diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/barcode.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/barcode.proto new file mode 100644 index 00000000000..28e588d6c6e --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/barcode.proto @@ -0,0 +1,67 @@ +// 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.v1; + +option csharp_namespace = "Google.Cloud.DocumentAI.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1;documentai"; +option java_multiple_files = true; +option java_outer_classname = "BarcodeProto"; +option java_package = "com.google.cloud.documentai.v1"; +option php_namespace = "Google\\Cloud\\DocumentAI\\V1"; +option ruby_package = "Google::Cloud::DocumentAI::V1"; + +// Encodes the detailed information of a barcode. +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. + 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. + string value_format = 2; + + // Raw value encoded in the barcode. + // 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/v1/document.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto index 4512affa5d2..d8bbf6b574d 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document.proto @@ -17,6 +17,7 @@ syntax = "proto3"; package google.cloud.documentai.v1; import "google/api/field_behavior.proto"; +import "google/cloud/documentai/v1/barcode.proto"; import "google/cloud/documentai/v1/geometry.proto"; import "google/protobuf/timestamp.proto"; import "google/rpc/status.proto"; @@ -34,11 +35,10 @@ option java_package = "com.google.cloud.documentai.v1"; option php_namespace = "Google\\Cloud\\DocumentAI\\V1"; option ruby_package = "Google::Cloud::DocumentAI::V1"; -// Document represents the canonical document resource in Document Understanding -// AI. -// It is an interchange format that provides insights into documents and allows -// for collaboration between users and Document Understanding AI to iterate and -// optimize for quality. +// Document represents the canonical document resource in Document AI. It is an +// interchange format that provides insights into documents and allows for +// collaboration between users and Document AI to iterate and optimize for +// quality. message Document { // For a large document, sharding may be performed to produce several // document shards. Each document shard contains this field to detail which @@ -50,8 +50,7 @@ message Document { // Total number of shards. int64 shard_count = 2; - // The index of the first character in - // [Document.text][google.cloud.documentai.v1.Document.text] in the overall + // The index of the first character in [Document.text][google.cloud.documentai.v1.Document.text] in the overall // document global text. int64 text_offset = 3; } @@ -68,8 +67,7 @@ message Document { string unit = 2; } - // Text anchor indexing into the - // [Document.text][google.cloud.documentai.v1.Document.text]. + // Text anchor indexing into the [Document.text][google.cloud.documentai.v1.Document.text]. TextAnchor text_anchor = 1; // Text color. @@ -166,31 +164,25 @@ message Document { PAGE_LEFT = 4; } - // Text anchor indexing into the - // [Document.text][google.cloud.documentai.v1.Document.text]. + // Text anchor indexing into the [Document.text][google.cloud.documentai.v1.Document.text]. TextAnchor text_anchor = 1; - // Confidence of the current - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] within - // context of the object this layout is for. e.g. confidence can be for a - // single token, a table, a visual element, etc. depending on context. - // Range [0, 1]. + // Confidence of the current [Layout][google.cloud.documentai.v1.Document.Page.Layout] within context of the object this + // layout is for. e.g. confidence can be for a single token, a table, + // a visual element, etc. depending on context. Range [0, 1]. float confidence = 2; - // The bounding polygon for the - // [Layout][google.cloud.documentai.v1.Document.Page.Layout]. + // The bounding polygon for the [Layout][google.cloud.documentai.v1.Document.Page.Layout]. BoundingPoly bounding_poly = 3; - // Detected orientation for the - // [Layout][google.cloud.documentai.v1.Document.Page.Layout]. + // Detected orientation for the [Layout][google.cloud.documentai.v1.Document.Page.Layout]. Orientation orientation = 4; } // A block has a set of lines (collected into paragraphs) that have a // common line-spacing and orientation. message Block { - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for - // [Block][google.cloud.documentai.v1.Document.Page.Block]. + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [Block][google.cloud.documentai.v1.Document.Page.Block]. Layout layout = 1; // A list of detected languages together with confidence. @@ -202,8 +194,7 @@ message Document { // A collection of lines that a human would perceive as a paragraph. message Paragraph { - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for - // [Paragraph][google.cloud.documentai.v1.Document.Page.Paragraph]. + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [Paragraph][google.cloud.documentai.v1.Document.Page.Paragraph]. Layout layout = 1; // A list of detected languages together with confidence. @@ -216,8 +207,7 @@ message Document { // A collection of tokens that a human would perceive as a line. // Does not cross column boundaries, can be horizontal, vertical, etc. message Line { - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for - // [Line][google.cloud.documentai.v1.Document.Page.Line]. + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [Line][google.cloud.documentai.v1.Document.Page.Line]. Layout layout = 1; // A list of detected languages together with confidence. @@ -229,8 +219,7 @@ message Document { // A detected token. message Token { - // Detected break at the end of a - // [Token][google.cloud.documentai.v1.Document.Page.Token]. + // Detected break at the end of a [Token][google.cloud.documentai.v1.Document.Page.Token]. message DetectedBreak { // Enum to denote the type of break found. enum Type { @@ -251,12 +240,10 @@ message Document { Type type = 1; } - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for - // [Token][google.cloud.documentai.v1.Document.Page.Token]. + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [Token][google.cloud.documentai.v1.Document.Page.Token]. Layout layout = 1; - // Detected break at the end of a - // [Token][google.cloud.documentai.v1.Document.Page.Token]. + // Detected break at the end of a [Token][google.cloud.documentai.v1.Document.Page.Token]. DetectedBreak detected_break = 2; // A list of detected languages together with confidence. @@ -268,8 +255,7 @@ message Document { // A detected symbol. message Symbol { - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for - // [Symbol][google.cloud.documentai.v1.Document.Page.Symbol]. + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [Symbol][google.cloud.documentai.v1.Document.Page.Symbol]. Layout layout = 1; // A list of detected languages together with confidence. @@ -279,12 +265,10 @@ message Document { // Detected non-text visual elements e.g. checkbox, signature etc. on the // page. message VisualElement { - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for - // [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement]. + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement]. Layout layout = 1; - // Type of the - // [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement]. + // Type of the [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement]. string type = 2; // A list of detected languages together with confidence. @@ -301,8 +285,7 @@ message Document { // A cell representation inside the table. message TableCell { - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for - // [TableCell][google.cloud.documentai.v1.Document.Page.Table.TableCell]. + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [TableCell][google.cloud.documentai.v1.Document.Page.Table.TableCell]. Layout layout = 1; // How many rows this cell spans. @@ -315,8 +298,7 @@ message Document { repeated DetectedLanguage detected_languages = 4; } - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for - // [Table][google.cloud.documentai.v1.Document.Page.Table]. + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [Table][google.cloud.documentai.v1.Document.Page.Table]. Layout layout = 1; // Header rows of the table. @@ -331,13 +313,11 @@ message Document { // A form field detected on the page. message FormField { - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the - // [FormField][google.cloud.documentai.v1.Document.Page.FormField] name. - // e.g. `Address`, `Email`, `Grand total`, `Phone number`, etc. + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the [FormField][google.cloud.documentai.v1.Document.Page.FormField] name. e.g. `Address`, `Email`, + // `Grand total`, `Phone number`, etc. Layout field_name = 1; - // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the - // [FormField][google.cloud.documentai.v1.Document.Page.FormField] value. + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the [FormField][google.cloud.documentai.v1.Document.Page.FormField] value. Layout field_value = 2; // A list of detected languages for name together with confidence. @@ -353,10 +333,29 @@ message Document { // - "filled_checkbox" string value_type = 5; + // Created for Labeling UI to export key text. + // If corrections were made to the text identified by the + // `field_name.text_anchor`, this field will contain the correction. + string corrected_key_text = 6; + + // Created for Labeling UI to export value text. + // If corrections were made to the text identified by the + // `field_value.text_anchor`, this field will contain the correction. + string corrected_value_text = 7; + // The history of this annotation. Provenance provenance = 8; } + // A detected barcode. + message DetectedBarcode { + // [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [DetectedBarcode][google.cloud.documentai.v1.Document.Page.DetectedBarcode]. + Layout layout = 1; + + // Detailed barcode information of the [DetectedBarcode][google.cloud.documentai.v1.Document.Page.DetectedBarcode]. + Barcode barcode = 2; + } + // Detected language for a structural component. message DetectedLanguage { // The BCP-47 language code, such as "en-US" or "sr-Latn". For more @@ -368,11 +367,9 @@ message Document { float confidence = 2; } - // 1-based index for current - // [Page][google.cloud.documentai.v1.Document.Page] in a parent - // [Document][google.cloud.documentai.v1.Document]. Useful when a page is - // taken out of a [Document][google.cloud.documentai.v1.Document] for - // individual processing. + // 1-based index for current [Page][google.cloud.documentai.v1.Document.Page] in a parent [Document][google.cloud.documentai.v1.Document]. + // Useful when a page is taken out of a [Document][google.cloud.documentai.v1.Document] for individual + // processing. int32 page_number = 1; // Rendered image for this page. This image is preprocessed to remove any @@ -422,6 +419,9 @@ message Document { // A list of visually detected symbols on the page. repeated Symbol symbols = 12; + // A list of detected barcodes. + repeated DetectedBarcode detected_barcodes = 15; + // The history of this page. Provenance provenance = 16; } @@ -456,6 +456,12 @@ message Document { // Boolean value. Can be used for entities with binary values, or for // checkboxes. bool boolean_value = 6; + + // Integer value. + int32 integer_value = 7; + + // Float value. + float float_value = 8; } // Optional. An optional field to store a normalized string. @@ -472,15 +478,14 @@ message Document { } // Optional. Provenance of the entity. - // Text anchor indexing into the - // [Document.text][google.cloud.documentai.v1.Document.text]. + // Text anchor indexing into the [Document.text][google.cloud.documentai.v1.Document.text]. TextAnchor text_anchor = 1 [(google.api.field_behavior) = OPTIONAL]; // 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 in the document e.g. `1600 Amphitheatre Pkwy`. If the entity + // is not present in the document, this field will be empty. string mention_text = 3 [(google.api.field_behavior) = OPTIONAL]; // Optional. Deprecated. Use `id` field instead. @@ -489,35 +494,32 @@ message Document { // 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 page where it was found. + // Optional. Represents the provenance of this entity wrt. the location on the + // page where it was found. PageAnchor page_anchor = 6 [(google.api.field_behavior) = OPTIONAL]; // Optional. Canonical id. This will be a unique value in the entity list // for this document. string id = 7 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Normalized entity value. Absent if the extracted value could - // not be converted or the type (e.g. address) is not supported for certain + // Optional. Normalized entity value. Absent if the extracted value could not be + // converted or the type (e.g. address) is not supported for certain // parsers. This field is also only populated for certain supported document // types. - NormalizedValue normalized_value = 9 - [(google.api.field_behavior) = OPTIONAL]; + NormalizedValue normalized_value = 9 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Entities can be nested to form a hierarchical data structure - // representing the content in the document. + // Optional. Entities can be nested to form a hierarchical data structure representing + // the content in the document. repeated Entity properties = 10 [(google.api.field_behavior) = OPTIONAL]; // Optional. The history of this annotation. Provenance provenance = 11 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Whether the entity will be redacted for de-identification - // purposes. + // Optional. Whether the entity will be redacted for de-identification purposes. bool redacted = 12 [(google.api.field_behavior) = OPTIONAL]; } - // Relationship between - // [Entities][google.cloud.documentai.v1.Document.Entity]. + // Relationship between [Entities][google.cloud.documentai.v1.Document.Entity]. message EntityRelation { // Subject entity id. string subject_id = 1; @@ -529,28 +531,21 @@ message Document { string relation = 3; } - // Text reference indexing into the - // [Document.text][google.cloud.documentai.v1.Document.text]. + // Text reference indexing into the [Document.text][google.cloud.documentai.v1.Document.text]. message TextAnchor { - // A text segment in the - // [Document.text][google.cloud.documentai.v1.Document.text]. The indices - // may be out of bounds which indicate that the text extends into another - // document shard for large sharded documents. See - // [ShardInfo.text_offset][google.cloud.documentai.v1.Document.ShardInfo.text_offset] + // A text segment in the [Document.text][google.cloud.documentai.v1.Document.text]. The indices may be out of bounds + // which indicate that the text extends into another document shard for + // large sharded documents. See [ShardInfo.text_offset][google.cloud.documentai.v1.Document.ShardInfo.text_offset] message TextSegment { - // [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment] - // start UTF-8 char index in the - // [Document.text][google.cloud.documentai.v1.Document.text]. + // [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment] start UTF-8 char index in the [Document.text][google.cloud.documentai.v1.Document.text]. int64 start_index = 1; - // [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment] - // half open end UTF-8 char index in the + // [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment] half open end UTF-8 char index in the // [Document.text][google.cloud.documentai.v1.Document.text]. int64 end_index = 2; } - // The text segments from the - // [Document.text][google.cloud.documentai.v1.Document.text]. + // The text segments from the [Document.text][google.cloud.documentai.v1.Document.text]. repeated TextSegment text_segments = 1; // Contains the content of the text span so that users do @@ -559,10 +554,9 @@ message Document { string content = 2; } - // Referencing the visual context of the entity in the - // [Document.pages][google.cloud.documentai.v1.Document.pages]. Page anchors - // can be cross-page, consist of multiple bounding polygons and optionally - // reference specific layout element types. + // Referencing the visual context of the entity in the [Document.pages][google.cloud.documentai.v1.Document.pages]. + // Page anchors can be cross-page, consist of multiple bounding polygons and + // optionally reference specific layout element types. message PageAnchor { // Represents a weak reference to a page element within a document. message PageRef { @@ -571,65 +565,47 @@ message Document { // Layout Unspecified. LAYOUT_TYPE_UNSPECIFIED = 0; - // References a - // [Page.blocks][google.cloud.documentai.v1.Document.Page.blocks] - // element. + // References a [Page.blocks][google.cloud.documentai.v1.Document.Page.blocks] element. BLOCK = 1; - // References a - // [Page.paragraphs][google.cloud.documentai.v1.Document.Page.paragraphs] - // element. + // References a [Page.paragraphs][google.cloud.documentai.v1.Document.Page.paragraphs] element. PARAGRAPH = 2; - // References a - // [Page.lines][google.cloud.documentai.v1.Document.Page.lines] element. + // References a [Page.lines][google.cloud.documentai.v1.Document.Page.lines] element. LINE = 3; - // References a - // [Page.tokens][google.cloud.documentai.v1.Document.Page.tokens] - // element. + // References a [Page.tokens][google.cloud.documentai.v1.Document.Page.tokens] element. TOKEN = 4; - // References a - // [Page.visual_elements][google.cloud.documentai.v1.Document.Page.visual_elements] - // element. + // References a [Page.visual_elements][google.cloud.documentai.v1.Document.Page.visual_elements] element. VISUAL_ELEMENT = 5; - // Refrrences a - // [Page.tables][google.cloud.documentai.v1.Document.Page.tables] - // element. + // Refrrences a [Page.tables][google.cloud.documentai.v1.Document.Page.tables] element. TABLE = 6; - // References a - // [Page.form_fields][google.cloud.documentai.v1.Document.Page.form_fields] - // element. + // References a [Page.form_fields][google.cloud.documentai.v1.Document.Page.form_fields] element. FORM_FIELD = 7; } - // Required. Index into the - // [Document.pages][google.cloud.documentai.v1.Document.pages] element, - // for example using [Document.pages][page_refs.page] to locate the - // related page element. This field is skipped when its value is the - // default 0. See + // Required. Index into the [Document.pages][google.cloud.documentai.v1.Document.pages] element, for example using + // [Document.pages][page_refs.page] to locate the related page element. + // This field is skipped when its value is the default 0. See // https://developers.google.com/protocol-buffers/docs/proto3#json. int64 page = 1 [(google.api.field_behavior) = REQUIRED]; - // Optional. The type of the layout element that is being referenced if - // any. + // Optional. The type of the layout element that is being referenced if any. LayoutType layout_type = 2 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Deprecated. Use - // [PageRef.bounding_poly][google.cloud.documentai.v1.Document.PageAnchor.PageRef.bounding_poly] - // instead. - string layout_id = 3 - [deprecated = true, (google.api.field_behavior) = OPTIONAL]; + // Optional. Deprecated. Use [PageRef.bounding_poly][google.cloud.documentai.v1.Document.PageAnchor.PageRef.bounding_poly] instead. + string layout_id = 3 [ + deprecated = true, + (google.api.field_behavior) = OPTIONAL + ]; - // Optional. Identifies the bounding polygon of a layout element on the - // page. + // 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]; } @@ -723,7 +699,12 @@ message Document { // The revisions that this revision is based on. This can include one or // more parent (when documents are merged.) This field represents the // index into the `revisions` field. - repeated int32 parent = 2; + repeated int32 parent = 2 [deprecated = true]; + + // The revisions that this revision is based on. Must include all the ids + // that have anything to do with this revision - eg. there are + // `provenance.parent.revision` fields that index into this field. + repeated string parent_ids = 7; // The time that the revision was created. google.protobuf.Timestamp create_time = 3; @@ -735,9 +716,8 @@ message Document { // This message is used for text changes aka. OCR corrections. message TextChange { // Provenance of the correction. - // Text anchor indexing into the - // [Document.text][google.cloud.documentai.v1.Document.text]. There can - // only be a single `TextAnchor.text_segments` element. If the start and + // Text anchor indexing into the [Document.text][google.cloud.documentai.v1.Document.text]. There can only be a + // single `TextAnchor.text_segments` element. If the start and // end index of the text segment are the same, the text change is inserted // before that index. TextAnchor text_anchor = 1; @@ -772,24 +752,22 @@ message Document { // Optional. UTF-8 encoded text in reading order from the document. string text = 4 [(google.api.field_behavior) = OPTIONAL]; - // Styles for the [Document.text][google.cloud.documentai.v1.Document.text]. + // Placeholder. Styles for the [Document.text][google.cloud.documentai.v1.Document.text]. repeated Style text_styles = 5; // Visual page layout for the [Document][google.cloud.documentai.v1.Document]. repeated Page pages = 6; - // A list of entities detected on - // [Document.text][google.cloud.documentai.v1.Document.text]. For document - // shards, entities in this list may cross shard boundaries. + // A list of entities detected on [Document.text][google.cloud.documentai.v1.Document.text]. For document shards, + // entities in this list may cross shard boundaries. repeated Entity entities = 7; - // Relationship among - // [Document.entities][google.cloud.documentai.v1.Document.entities]. + // Placeholder. Relationship among [Document.entities][google.cloud.documentai.v1.Document.entities]. repeated EntityRelation entity_relations = 8; - // 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]. 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 @@ -799,6 +777,6 @@ message Document { // Any error that occurred while processing this document. google.rpc.Status error = 10; - // Revision history of this document. + // Placeholder. Revision history of this document. repeated Revision revisions = 13; } diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_io.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_io.proto index 281a379fab6..17630a03592 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_io.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_io.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// 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. diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto index d0c21feb2a3..9c944f259a0 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_processor_service.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// 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. @@ -22,8 +22,12 @@ import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/cloud/documentai/v1/document.proto"; import "google/cloud/documentai/v1/document_io.proto"; +import "google/cloud/documentai/v1/document_schema.proto"; import "google/cloud/documentai/v1/operation_metadata.proto"; +import "google/cloud/documentai/v1/processor.proto"; +import "google/cloud/documentai/v1/processor_type.proto"; import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; import "google/rpc/status.proto"; @@ -34,18 +38,14 @@ option java_outer_classname = "DocumentAiProcessorService"; option java_package = "com.google.cloud.documentai.v1"; option php_namespace = "Google\\Cloud\\DocumentAI\\V1"; option ruby_package = "Google::Cloud::DocumentAI::V1"; -option (google.api.resource_definition) = { - type: "documentai.googleapis.com/Location" - pattern: "projects/{project}/locations/{location}" -}; -option (google.api.resource_definition) = { - type: "documentai.googleapis.com/Processor" - pattern: "projects/{project}/locations/{location}/processors/{processor}" -}; option (google.api.resource_definition) = { type: "documentai.googleapis.com/HumanReviewConfig" pattern: "projects/{project}/locations/{location}/processors/{processor}/humanReviewConfig" }; +option (google.api.resource_definition) = { + type: "documentai.googleapis.com/Location" + pattern: "projects/{project}/locations/{location}" +}; // Service to call Cloud DocumentAI to process documents according to the // processor's definition. Processors are built using state-of-the-art Google @@ -60,6 +60,10 @@ service DocumentProcessorService { option (google.api.http) = { post: "/v1/{name=projects/*/locations/*/processors/*}:process" body: "*" + additional_bindings { + post: "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:process" + body: "*" + } }; option (google.api.method_signature) = "name"; } @@ -70,6 +74,10 @@ service DocumentProcessorService { option (google.api.http) = { post: "/v1/{name=projects/*/locations/*/processors/*}:batchProcess" body: "*" + additional_bindings { + post: "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:batchProcess" + body: "*" + } }; option (google.api.method_signature) = "name"; option (google.longrunning.operation_info) = { @@ -78,6 +86,155 @@ service DocumentProcessorService { }; } + // Fetches processor types. Note that we do not use ListProcessorTypes here + // because it is not paginated. + rpc FetchProcessorTypes(FetchProcessorTypesRequest) returns (FetchProcessorTypesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}:fetchProcessorTypes" + }; + option (google.api.method_signature) = "parent"; + } + + // Lists the processor types that exist. + rpc ListProcessorTypes(ListProcessorTypesRequest) returns (ListProcessorTypesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/processorTypes" + }; + option (google.api.method_signature) = "parent"; + } + + // Lists all processors which belong to this project. + rpc ListProcessors(ListProcessorsRequest) returns (ListProcessorsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/processors" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a processor detail. + rpc GetProcessor(GetProcessorRequest) returns (Processor) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/processors/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Gets a processor version detail. + rpc GetProcessorVersion(GetProcessorVersionRequest) returns (ProcessorVersion) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all versions of a processor. + rpc ListProcessorVersions(ListProcessorVersionsRequest) returns (ListProcessorVersionsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/processors/*}/processorVersions" + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes the processor version, all artifacts under the processor version + // will be deleted. + rpc DeleteProcessorVersion(DeleteProcessorVersionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "DeleteProcessorVersionMetadata" + }; + } + + // Deploys the processor version. + rpc DeployProcessorVersion(DeployProcessorVersionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:deploy" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "DeployProcessorVersionResponse" + metadata_type: "DeployProcessorVersionMetadata" + }; + } + + // Undeploys the processor version. + rpc UndeployProcessorVersion(UndeployProcessorVersionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:undeploy" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "UndeployProcessorVersionResponse" + metadata_type: "UndeployProcessorVersionMetadata" + }; + } + + // Creates a processor from the type processor that the user chose. + // The processor will be at "ENABLED" state by default after its creation. + rpc CreateProcessor(CreateProcessorRequest) returns (Processor) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/processors" + body: "processor" + }; + option (google.api.method_signature) = "parent,processor"; + } + + // Deletes the processor, unloads all deployed model artifacts if it was + // enabled and then deletes all artifacts associated with this processor. + rpc DeleteProcessor(DeleteProcessorRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/processors/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "DeleteProcessorMetadata" + }; + } + + // Enables a processor + rpc EnableProcessor(EnableProcessorRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/processors/*}:enable" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "EnableProcessorResponse" + metadata_type: "EnableProcessorMetadata" + }; + } + + // Disables a processor + rpc DisableProcessor(DisableProcessorRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/processors/*}:disable" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "DisableProcessorResponse" + metadata_type: "DisableProcessorMetadata" + }; + } + + // Set the default (active) version of a [Processor][google.cloud.documentai.v1.Processor] that will be used in + // [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument] and + // [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]. + rpc SetDefaultProcessorVersion(SetDefaultProcessorVersionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{processor=projects/*/locations/*/processors/*}:setDefaultProcessorVersion" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "SetDefaultProcessorVersionResponse" + metadata_type: "SetDefaultProcessorVersionMetadata" + }; + } + // Send a document for Human Review. The input document should be processed by // the specified processor. rpc ReviewDocument(ReviewDocumentRequest) returns (google.longrunning.Operation) { @@ -104,17 +261,25 @@ message ProcessRequest { RawDocument raw_document = 5; } - // Required. The processor resource name. + // Required. The resource name of the [Processor][google.cloud.documentai.v1.Processor] or + // [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] + // to use for processing. If a [Processor][google.cloud.documentai.v1.Processor] is specified, the server will use + // its [default version][google.cloud.documentai.v1.Processor.default_processor_version]. Format: + // `projects/{project}/locations/{location}/processors/{processor}`, or + // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { - type: "documentai.googleapis.com/Processor" + type: "*" } ]; // Whether Human Review feature should be skipped for this request. Default to // false. bool skip_human_review = 3; + + // Specifies which fields to include in ProcessResponse's document. + google.protobuf.FieldMask field_mask = 6; } // The status of human review on a processed document. @@ -165,11 +330,15 @@ message ProcessResponse { // Request message for batch process document method. message BatchProcessRequest { - // Required. The processor resource name. + // Required. The resource name of [Processor][google.cloud.documentai.v1.Processor] or + // [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]. + // Format: `projects/{project}/locations/{location}/processors/{processor}`, + // or + // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { - type: "documentai.googleapis.com/Processor" + type: "*" } ]; @@ -199,10 +368,10 @@ message BatchProcessMetadata { // document during the process. string input_gcs_source = 1; - // The status of the processing of the document. + // The status processing the document. google.rpc.Status status = 2; - // The output_gcs_destination (in the request as 'output_gcs_destination') + // The output_gcs_destination (in the request as `output_gcs_destination`) // of the processed document if it was successful, otherwise empty. string output_gcs_destination = 3; @@ -251,10 +420,315 @@ message BatchProcessMetadata { repeated IndividualProcessStatus individual_process_statuses = 5; } +// Request message for fetch processor types. +message FetchProcessorTypesRequest { + // Required. The project of processor type to list. + // The available processor types may depend on the allow-listing on projects. + // Format: `projects/{project}/locations/{location}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "documentai.googleapis.com/ProcessorType" + } + ]; +} + +// Response message for fetch processor types. +message FetchProcessorTypesResponse { + // The list of processor types. + repeated ProcessorType processor_types = 1; +} + +// Request message for list processor types. +message ListProcessorTypesRequest { + // Required. The location of processor type to list. + // The available processor types may depend on the allow-listing on projects. + // Format: `projects/{project}/locations/{location}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "documentai.googleapis.com/ProcessorType" + } + ]; + + // The maximum number of processor types to return. + // If unspecified, at most 100 processor types will be returned. + // The maximum value is 500; values above 500 will be coerced to 500. + int32 page_size = 2; + + // Used to retrieve the next page of results, empty if at the end of the list. + string page_token = 3; +} + +// Response message for list processor types. +message ListProcessorTypesResponse { + // The processor types. + repeated ProcessorType processor_types = 1; + + // Points to the next page, otherwise empty. + string next_page_token = 2; +} + +// Request message for list all processors belongs to a project. +message ListProcessorsRequest { + // Required. The parent (project and location) which owns this collection of Processors. + // Format: `projects/{project}/locations/{location}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "documentai.googleapis.com/Processor" + } + ]; + + // The maximum number of processors to return. + // If unspecified, at most 50 processors will be returned. + // The maximum value is 100; values above 100 will be coerced to 100. + int32 page_size = 2; + + // We will return the processors sorted by creation time. The page token + // will point to the next processor. + string page_token = 3; +} + +// Response message for list processors. +message ListProcessorsResponse { + // The list of processors. + repeated Processor processors = 1; + + // Points to the next processor, otherwise empty. + string next_page_token = 2; +} + +// Request message for get processor. +message GetProcessorRequest { + // Required. The processor resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/Processor" + } + ]; +} + +// Request message for get processor version. +message GetProcessorVersionRequest { + // Required. The processor resource name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/ProcessorVersion" + } + ]; +} + +// Request message for list all processor versions belongs to a processor. +message ListProcessorVersionsRequest { + // Required. The parent (project, location and processor) to list all versions. + // 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" + } + ]; + + // The maximum number of processor versions to return. + // If unspecified, at most 10 processor versions will be returned. + // The maximum value is 20; values above 20 will be coerced to 20. + int32 page_size = 2; + + // We will return the processor versions sorted by creation time. The page + // token will point to the next processor version. + string page_token = 3; +} + +// Response message for list processors. +message ListProcessorVersionsResponse { + // The list of processors. + repeated ProcessorVersion processor_versions = 1; + + // Points to the next processor, otherwise empty. + string next_page_token = 2; +} + +// Request message for the delete processor version method. +message DeleteProcessorVersionRequest { + // Required. The processor version resource name to be deleted. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/ProcessorVersion" + } + ]; +} + +// The long running operation metadata for delete processor version method. +message DeleteProcessorVersionMetadata { + // The basic metadata of the long running operation. + CommonOperationMetadata common_metadata = 1; +} + +// Request message for the deploy processor version method. +message DeployProcessorVersionRequest { + // Required. The processor version resource name to be deployed. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/ProcessorVersion" + } + ]; +} + +// Response message for the deploy processor version method. +message DeployProcessorVersionResponse { + +} + +// The long running operation metadata for deploy processor version method. +message DeployProcessorVersionMetadata { + // The basic metadata of the long running operation. + CommonOperationMetadata common_metadata = 1; +} + +// Request message for the undeploy processor version method. +message UndeployProcessorVersionRequest { + // Required. The processor version resource name to be undeployed. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/ProcessorVersion" + } + ]; +} + +// Response message for the undeploy processor version method. +message UndeployProcessorVersionResponse { + +} + +// The long running operation metadata for the undeploy processor version +// method. +message UndeployProcessorVersionMetadata { + // The basic metadata of the long running operation. + CommonOperationMetadata common_metadata = 1; +} + +// Request message for create a processor. Notice this request is sent to +// a regionalized backend service, and if the processor type is not available +// on that region, the creation will fail. +message CreateProcessorRequest { + // Required. The parent (project and location) under which to create the processor. + // Format: `projects/{project}/locations/{location}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "documentai.googleapis.com/Processor" + } + ]; + + // Required. The processor to be created, requires [processor_type] and [display_name] + // to be set. Also, the processor is under CMEK if CMEK fields are set. + Processor processor = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for the delete processor method. +message DeleteProcessorRequest { + // Required. The processor resource name to be deleted. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/Processor" + } + ]; +} + +// The long running operation metadata for delete processor method. +message DeleteProcessorMetadata { + // The basic metadata of the long running operation. + CommonOperationMetadata common_metadata = 5; +} + +// Request message for the enable processor method. +message EnableProcessorRequest { + // Required. The processor resource name to be enabled. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/Processor" + } + ]; +} + +// Response message for the enable processor method. +// Intentionally empty proto for adding fields in future. +message EnableProcessorResponse { + +} + +// The long running operation metadata for enable processor method. +message EnableProcessorMetadata { + // The basic metadata of the long running operation. + CommonOperationMetadata common_metadata = 5; +} + +// Request message for the disable processor method. +message DisableProcessorRequest { + // Required. The processor resource name to be disabled. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/Processor" + } + ]; +} + +// Response message for the disable processor method. +// Intentionally empty proto for adding fields in future. +message DisableProcessorResponse { + +} + +// The long running operation metadata for disable processor method. +message DisableProcessorMetadata { + // The basic metadata of the long running operation. + CommonOperationMetadata common_metadata = 5; +} + +// Request message for the set default processor version method. +message SetDefaultProcessorVersionRequest { + // Required. The resource name of the [Processor][google.cloud.documentai.v1.Processor] to change default version. + string processor = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/Processor" + } + ]; + + // Required. The resource name of child [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to use as default. + // Format: + // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}` + string default_processor_version = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "documentai.googleapis.com/ProcessorVersion" + } + ]; +} + +// Response message for set default processor version method. +message SetDefaultProcessorVersionResponse { + +} + +// The long running operation metadata for set default processor version +// method. +message SetDefaultProcessorVersionMetadata { + // The basic metadata of the long running operation. + CommonOperationMetadata common_metadata = 1; +} + // Request message for review document method. message ReviewDocumentRequest { - reserved 2; - // The priority level of the human review task. enum Priority { // The default priority level. @@ -285,12 +759,34 @@ message ReviewDocumentRequest { // The priority of the human review task. Priority priority = 5; + + // The document schema of the human review task. + DocumentSchema document_schema = 6; } // Response message for review document method. message ReviewDocumentResponse { - // The Cloud Storage uri for the human reviewed document. + // Possible states of the review operation. + enum State { + // The default value. This value is used if the state is omitted. + STATE_UNSPECIFIED = 0; + + // The review operation is rejected by the reviewer. + REJECTED = 1; + + // The review operation is succeeded. + SUCCEEDED = 2; + } + + // The Cloud Storage uri for the human reviewed document if the review is + // succeeded. string gcs_destination = 1; + + // The state of the review operation. + State state = 2; + + // The reason why the review is rejected by reviewer. + string rejection_reason = 3; } // The long running operation metadata for review document method. @@ -298,6 +794,6 @@ message ReviewDocumentOperationMetadata { // The basic metadata of the long running operation. CommonOperationMetadata common_metadata = 5; - // The question ID. + // The Crowd Compute question ID. string question_id = 6; } diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_schema.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_schema.proto new file mode 100644 index 00000000000..24bd42285d9 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_schema.proto @@ -0,0 +1,140 @@ +// 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.v1; + +option csharp_namespace = "Google.Cloud.DocumentAI.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1;documentai"; +option java_multiple_files = true; +option java_outer_classname = "DocumentAiDocumentSchema"; +option java_package = "com.google.cloud.documentai.v1"; +option php_namespace = "Google\\Cloud\\DocumentAI\\V1"; +option ruby_package = "Google::Cloud::DocumentAI::V1"; + +// The schema defines the output of the processed document by a processor. +message DocumentSchema { + // EntityType is the wrapper of a label of the corresponding model with + // detailed attributes and limitations for entity-based processors. Multiple + // types can also compose a dependency tree to represent nested types. + message EntityType { + // Defines the a list of enum values. + message EnumValues { + // The individual values that this enum values type can include. + repeated string values = 1; + } + + // Defines properties that can be part of the entity type. + message Property { + // Types of occurrences of the entity type in the document. Note: this + // represents the number of instances of an entity types, not number of + // mentions of a given entity instance. + enum OccurrenceType { + // Unspecified occurrence type. + OCCURRENCE_TYPE_UNSPECIFIED = 0; + + // There will be zero or one instance of this entity type. + OPTIONAL_ONCE = 1; + + // The entity type will appear zero or multiple times. + OPTIONAL_MULTIPLE = 2; + + // The entity type will only appear exactly once. + REQUIRED_ONCE = 3; + + // The entity type will appear once or more times. + REQUIRED_MULTIPLE = 4; + } + + // The name of the property. Follows the same guidelines as the + // EntityType name. + string name = 1; + + // A reference to the value type of the property. This type is subject + // to the same conventions as the `Entity.base_types` field. + string value_type = 2; + + // Occurrence type limits the number of instances an entity type appears + // in the document. + OccurrenceType occurrence_type = 3; + } + + oneof value_source { + // If specified, lists all the possible values for this entity. This + // should not be more than a handful of values. If the number of values + // is >10 or could change frequently use the `EntityType.value_ontology` + // field and specify a list of all possible values in a value ontology + // file. + EnumValues enum_values = 14; + } + + // User defined name for the type. + string display_name = 13; + + // 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* + // - 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 + // honored for backward compatibility. + string name = 1; + + // The entity type that this type is derived from. For now, one and only + // one should be set. + repeated string base_types = 2; + + // Describing the nested structure, or composition of an entity. + repeated Property properties = 6; + } + + // Metadata for global schema behavior. + message Metadata { + // If true, a `document` entity type can be applied to subdocument ( + // splitting). Otherwise, it can only be applied to the entire document + // (classification). + bool document_splitter = 1; + + // If true, on a given page, there can be multiple `document` annotations + // covering it. + bool document_allow_multiple_labels = 2; + + // If set, all the nested entities must be prefixed with the parents. + bool prefixed_naming_on_properties = 6; + + // If set, we will skip the naming format validation in the schema. So the + // string values in `DocumentSchema.EntityType.name` and + // `DocumentSchema.EntityType.Property.name` will not be checked. + bool skip_naming_validation = 7; + } + + // Display name to show to users. + string display_name = 1; + + // Description of the schema. + string description = 2; + + // Entity types of the schema. + repeated EntityType entity_types = 3; + + // Metadata of the schema. + Metadata metadata = 4; +} diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/geometry.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/geometry.proto index 6f83ee7beb0..7471ef01247 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/geometry.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/geometry.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// 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. diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/operation_metadata.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/operation_metadata.proto index 773222439ed..5698b0a4f3c 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/operation_metadata.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/operation_metadata.proto @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// 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. @@ -55,6 +55,9 @@ message CommonOperationMetadata { // A message providing more details about the current state of processing. string state_message = 2; + // A related resource to this operation. + string resource = 5; + // The creation time of the operation. google.protobuf.Timestamp create_time = 3; diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/processor.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/processor.proto new file mode 100644 index 00000000000..b7eb95ef3f5 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/processor.proto @@ -0,0 +1,185 @@ +// 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.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.DocumentAI.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1;documentai"; +option java_multiple_files = true; +option java_outer_classname = "DocumentAiProcessor"; +option java_package = "com.google.cloud.documentai.v1"; +option php_namespace = "Google\\Cloud\\DocumentAI\\V1"; +option ruby_package = "Google::Cloud::DocumentAI::V1"; + +// A processor version is an implementation of a processor. Each processor +// can have multiple versions, pre-trained by Google internally or up-trained +// by the customer. At a time, a processor can only have one default version +// version. So the processor's behavior (when processing documents) is defined +// by a default version +message ProcessorVersion { + option (google.api.resource) = { + type: "documentai.googleapis.com/ProcessorVersion" + pattern: "projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}" + }; + + // Information about the upcoming deprecation of this processor version. + message DeprecationInfo { + // The time at which this processor version will be deprecated. + google.protobuf.Timestamp deprecation_time = 1; + + // If set, the processor version that will be used as a replacement. + string replacement_processor_version = 2 [(google.api.resource_reference) = { + type: "documentai.googleapis.com/ProcessorVersion" + }]; + } + + // The possible states of the processor version. + enum State { + // The processor version is in an unspecified state. + STATE_UNSPECIFIED = 0; + + // The processor version is deployed and can be used for processing. + DEPLOYED = 1; + + // The processor version is being deployed. + DEPLOYING = 2; + + // The processor version is not deployed and cannot be used for processing. + UNDEPLOYED = 3; + + // The processor version is being undeployed. + UNDEPLOYING = 4; + + // The processor version is being created. + CREATING = 5; + + // The processor version is being deleted. + DELETING = 6; + + // The processor version failed and is in an indeterminate state. + FAILED = 7; + } + + // The resource name of the processor version. + // Format: + // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}` + string name = 1; + + // The display name of the processor version. + string display_name = 2; + + // The state of the processor version. + State state = 6; + + // The time the processor version was created. + google.protobuf.Timestamp create_time = 7; + + // The KMS key name used for encryption. + string kms_key_name = 9; + + // The KMS key version with which data is encrypted. + string kms_key_version_name = 10; + + // Denotes that this ProcessorVersion is managed by google. + bool google_managed = 11; + + // If set, information about the eventual deprecation of this version. + DeprecationInfo deprecation_info = 13; +} + +// The first-class citizen for Document AI. Each processor defines how to +// extract structural information from a document. +message Processor { + option (google.api.resource) = { + type: "documentai.googleapis.com/Processor" + pattern: "projects/{project}/locations/{location}/processors/{processor}" + }; + + // The possible states of the processor. + enum State { + // The processor is in an unspecified state. + STATE_UNSPECIFIED = 0; + + // The processor is enabled, i.e., has an enabled version which can + // currently serve processing requests and all the feature dependencies have + // been successfully initialized. + ENABLED = 1; + + // The processor is disabled. + DISABLED = 2; + + // The processor is being enabled, will become ENABLED if successful. + ENABLING = 3; + + // 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). + // 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. + CREATING = 5; + + // The processor failed during creation or initialization of feature + // dependencies. The user should delete the processor and recreate one as + // all the functionalities of the processor are disabled. + FAILED = 6; + + // The processor is being deleted, will be removed if successful. + DELETING = 7; + } + + // Output only. Immutable. The resource name of the processor. + // Format: `projects/{project}/locations/{location}/processors/{processor}` + string name = 1 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = OUTPUT_ONLY + ]; + + // The processor type, e.g., OCR_PROCESSOR, INVOICE_PROCESSOR, etc. + // To get a list of processors types, see + // [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]. + string type = 2; + + // The display name of the processor. + string display_name = 3; + + // Output only. The state of the processor. + State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The default processor version. + string default_processor_version = 9 [(google.api.resource_reference) = { + type: "documentai.googleapis.com/ProcessorVersion" + }]; + + // Output only. Immutable. The http endpoint that can be called to invoke processing. + string process_endpoint = 6 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.field_behavior) = IMMUTABLE + ]; + + // The time the processor was created. + google.protobuf.Timestamp create_time = 7; + + // The KMS key used for encryption/decryption in CMEK scenarios. + // See https://cloud.google.com/security-key-management. + string kms_key_name = 8; +} diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/processor_type.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/processor_type.proto new file mode 100644 index 00000000000..dd5ef470011 --- /dev/null +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/processor_type.proto @@ -0,0 +1,63 @@ +// 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.v1; + +import "google/api/launch_stage.proto"; +import "google/api/resource.proto"; + +option csharp_namespace = "Google.Cloud.DocumentAI.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1;documentai"; +option java_multiple_files = true; +option java_outer_classname = "DocumentAiProcessorType"; +option java_package = "com.google.cloud.documentai.v1"; +option php_namespace = "Google\\Cloud\\DocumentAI\\V1"; +option ruby_package = "Google::Cloud::DocumentAI::V1"; + +// A processor type is responsible for performing a certain document +// understanding task on a certain type of document. +message ProcessorType { + option (google.api.resource) = { + type: "documentai.googleapis.com/ProcessorType" + pattern: "projects/{project}/locations/{location}/processorTypes/{processor_type}" + }; + + // The location information about where the processor is available. + message LocationInfo { + // The location id, currently must be one of [us, eu]. + string location_id = 1; + } + + // The resource name of the processor type. + // Format: projects/{project}/processorTypes/{processor_type} + string name = 1; + + // The type of the processor, e.g., "invoice_parsing". + string type = 2; + + // The processor category, used by UI to group processor types. + string category = 3; + + // The locations in which this processor is available. + repeated LocationInfo available_locations = 4; + + // Whether the processor type allows creation. If true, users can create a + // processor of this processor type. Otherwise, users need to request access. + bool allow_creation = 6; + + // Launch stage of the processor type + google.api.LaunchStage launch_stage = 8; +} diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index 52c11c025aa..7ecdc12c436 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -26,6 +26,108 @@ export namespace google { /** Namespace v1. */ namespace v1 { + /** Properties of a Barcode. */ + interface IBarcode { + + /** Barcode format */ + format?: (string|null); + + /** Barcode valueFormat */ + valueFormat?: (string|null); + + /** Barcode rawValue */ + rawValue?: (string|null); + } + + /** Represents a Barcode. */ + class Barcode implements IBarcode { + + /** + * Constructs a new Barcode. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IBarcode); + + /** Barcode format. */ + public format: string; + + /** Barcode valueFormat. */ + public valueFormat: string; + + /** Barcode rawValue. */ + public rawValue: string; + + /** + * Creates a new Barcode instance using the specified properties. + * @param [properties] Properties to set + * @returns Barcode instance + */ + public static create(properties?: google.cloud.documentai.v1.IBarcode): google.cloud.documentai.v1.Barcode; + + /** + * Encodes the specified Barcode message. Does not implicitly {@link google.cloud.documentai.v1.Barcode.verify|verify} messages. + * @param message Barcode message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IBarcode, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Barcode message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Barcode.verify|verify} messages. + * @param message Barcode message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IBarcode, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Barcode message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Barcode + * @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.v1.Barcode; + + /** + * Decodes a Barcode message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Barcode + * @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.v1.Barcode; + + /** + * Verifies a Barcode 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 Barcode message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Barcode + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Barcode; + + /** + * Creates a plain object from a Barcode message. Also converts values to other types if specified. + * @param message Barcode + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Barcode, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Barcode to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a Document. */ interface IDocument { @@ -559,6 +661,9 @@ export namespace google { /** Page symbols */ symbols?: (google.cloud.documentai.v1.Document.Page.ISymbol[]|null); + /** Page detectedBarcodes */ + detectedBarcodes?: (google.cloud.documentai.v1.Document.Page.IDetectedBarcode[]|null); + /** Page provenance */ provenance?: (google.cloud.documentai.v1.Document.IProvenance|null); } @@ -614,6 +719,9 @@ export namespace google { /** Page symbols. */ public symbols: google.cloud.documentai.v1.Document.Page.ISymbol[]; + /** Page detectedBarcodes. */ + public detectedBarcodes: google.cloud.documentai.v1.Document.Page.IDetectedBarcode[]; + /** Page provenance. */ public provenance?: (google.cloud.documentai.v1.Document.IProvenance|null); @@ -2171,6 +2279,12 @@ export namespace google { /** FormField valueType */ valueType?: (string|null); + /** FormField correctedKeyText */ + correctedKeyText?: (string|null); + + /** FormField correctedValueText */ + correctedValueText?: (string|null); + /** FormField provenance */ provenance?: (google.cloud.documentai.v1.Document.IProvenance|null); } @@ -2199,6 +2313,12 @@ export namespace google { /** FormField valueType. */ public valueType: string; + /** FormField correctedKeyText. */ + public correctedKeyText: string; + + /** FormField correctedValueText. */ + public correctedValueText: string; + /** FormField provenance. */ public provenance?: (google.cloud.documentai.v1.Document.IProvenance|null); @@ -2273,6 +2393,102 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** Properties of a DetectedBarcode. */ + interface IDetectedBarcode { + + /** DetectedBarcode layout */ + layout?: (google.cloud.documentai.v1.Document.Page.ILayout|null); + + /** DetectedBarcode barcode */ + barcode?: (google.cloud.documentai.v1.IBarcode|null); + } + + /** Represents a DetectedBarcode. */ + class DetectedBarcode implements IDetectedBarcode { + + /** + * Constructs a new DetectedBarcode. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.Page.IDetectedBarcode); + + /** DetectedBarcode layout. */ + public layout?: (google.cloud.documentai.v1.Document.Page.ILayout|null); + + /** DetectedBarcode barcode. */ + public barcode?: (google.cloud.documentai.v1.IBarcode|null); + + /** + * Creates a new DetectedBarcode instance using the specified properties. + * @param [properties] Properties to set + * @returns DetectedBarcode instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.Page.IDetectedBarcode): google.cloud.documentai.v1.Document.Page.DetectedBarcode; + + /** + * Encodes the specified DetectedBarcode message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.DetectedBarcode.verify|verify} messages. + * @param message DetectedBarcode message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.Page.IDetectedBarcode, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DetectedBarcode message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.DetectedBarcode.verify|verify} messages. + * @param message DetectedBarcode message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.Page.IDetectedBarcode, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DetectedBarcode message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DetectedBarcode + * @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.v1.Document.Page.DetectedBarcode; + + /** + * Decodes a DetectedBarcode message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DetectedBarcode + * @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.v1.Document.Page.DetectedBarcode; + + /** + * Verifies a DetectedBarcode 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 DetectedBarcode message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DetectedBarcode + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.Page.DetectedBarcode; + + /** + * Creates a plain object from a DetectedBarcode message. Also converts values to other types if specified. + * @param message DetectedBarcode + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.Page.DetectedBarcode, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DetectedBarcode to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a DetectedLanguage. */ interface IDetectedLanguage { @@ -2540,6 +2756,12 @@ export namespace google { /** NormalizedValue booleanValue */ booleanValue?: (boolean|null); + /** NormalizedValue integerValue */ + integerValue?: (number|null); + + /** NormalizedValue floatValue */ + floatValue?: (number|null); + /** NormalizedValue text */ text?: (string|null); } @@ -2568,11 +2790,17 @@ export namespace google { /** NormalizedValue booleanValue. */ public booleanValue?: (boolean|null); + /** NormalizedValue integerValue. */ + public integerValue?: (number|null); + + /** NormalizedValue floatValue. */ + public floatValue?: (number|null); + /** NormalizedValue text. */ public text: string; /** NormalizedValue structuredValue. */ - public structuredValue?: ("moneyValue"|"dateValue"|"datetimeValue"|"addressValue"|"booleanValue"); + public structuredValue?: ("moneyValue"|"dateValue"|"datetimeValue"|"addressValue"|"booleanValue"|"integerValue"|"floatValue"); /** * Creates a new NormalizedValue instance using the specified properties. @@ -3404,6 +3632,9 @@ export namespace google { /** Revision parent */ parent?: (number[]|null); + /** Revision parentIds */ + parentIds?: (string[]|null); + /** Revision createTime */ createTime?: (google.protobuf.ITimestamp|null); @@ -3432,6 +3663,9 @@ export namespace google { /** Revision parent. */ public parent: number[]; + /** Revision parentIds. */ + public parentIds: string[]; + /** Revision createTime. */ public createTime?: (google.protobuf.ITimestamp|null); @@ -4708,1217 +4942,5433 @@ export namespace google { public batchProcessDocuments(request: google.cloud.documentai.v1.IBatchProcessRequest): Promise; /** - * Calls ReviewDocument. - * @param request ReviewDocumentRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Calls FetchProcessorTypes. + * @param request FetchProcessorTypesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and FetchProcessorTypesResponse */ - public reviewDocument(request: google.cloud.documentai.v1.IReviewDocumentRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.ReviewDocumentCallback): void; + public fetchProcessorTypes(request: google.cloud.documentai.v1.IFetchProcessorTypesRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypesCallback): void; /** - * Calls ReviewDocument. - * @param request ReviewDocumentRequest message or plain object + * Calls FetchProcessorTypes. + * @param request FetchProcessorTypesRequest message or plain object * @returns Promise */ - public reviewDocument(request: google.cloud.documentai.v1.IReviewDocumentRequest): Promise; - } - - namespace DocumentProcessorService { + public fetchProcessorTypes(request: google.cloud.documentai.v1.IFetchProcessorTypesRequest): Promise; /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#processDocument}. - * @param error Error, if any - * @param [response] ProcessResponse + * Calls ListProcessorTypes. + * @param request ListProcessorTypesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListProcessorTypesResponse */ - type ProcessDocumentCallback = (error: (Error|null), response?: google.cloud.documentai.v1.ProcessResponse) => void; + public listProcessorTypes(request: google.cloud.documentai.v1.IListProcessorTypesRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypesCallback): void; /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#batchProcessDocuments}. - * @param error Error, if any - * @param [response] Operation + * Calls ListProcessorTypes. + * @param request ListProcessorTypesRequest message or plain object + * @returns Promise */ - type BatchProcessDocumentsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + public listProcessorTypes(request: google.cloud.documentai.v1.IListProcessorTypesRequest): Promise; /** - * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#reviewDocument}. - * @param error Error, if any - * @param [response] Operation + * Calls ListProcessors. + * @param request ListProcessorsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListProcessorsResponse */ - type ReviewDocumentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; - } - - /** Properties of a ProcessRequest. */ - interface IProcessRequest { - - /** ProcessRequest inlineDocument */ - inlineDocument?: (google.cloud.documentai.v1.IDocument|null); - - /** ProcessRequest rawDocument */ - rawDocument?: (google.cloud.documentai.v1.IRawDocument|null); - - /** ProcessRequest name */ - name?: (string|null); - - /** ProcessRequest skipHumanReview */ - skipHumanReview?: (boolean|null); - } - - /** Represents a ProcessRequest. */ - class ProcessRequest implements IProcessRequest { + public listProcessors(request: google.cloud.documentai.v1.IListProcessorsRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.ListProcessorsCallback): void; /** - * Constructs a new ProcessRequest. - * @param [properties] Properties to set + * Calls ListProcessors. + * @param request ListProcessorsRequest message or plain object + * @returns Promise */ - constructor(properties?: google.cloud.documentai.v1.IProcessRequest); - - /** ProcessRequest inlineDocument. */ - public inlineDocument?: (google.cloud.documentai.v1.IDocument|null); - - /** ProcessRequest rawDocument. */ - public rawDocument?: (google.cloud.documentai.v1.IRawDocument|null); - - /** ProcessRequest name. */ - public name: string; - - /** ProcessRequest skipHumanReview. */ - public skipHumanReview: boolean; - - /** ProcessRequest source. */ - public source?: ("inlineDocument"|"rawDocument"); + public listProcessors(request: google.cloud.documentai.v1.IListProcessorsRequest): Promise; /** - * Creates a new ProcessRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns ProcessRequest instance + * Calls GetProcessor. + * @param request GetProcessorRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Processor */ - public static create(properties?: google.cloud.documentai.v1.IProcessRequest): google.cloud.documentai.v1.ProcessRequest; + public getProcessor(request: google.cloud.documentai.v1.IGetProcessorRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.GetProcessorCallback): void; /** - * Encodes the specified ProcessRequest message. Does not implicitly {@link google.cloud.documentai.v1.ProcessRequest.verify|verify} messages. - * @param message ProcessRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Calls GetProcessor. + * @param request GetProcessorRequest message or plain object + * @returns Promise */ - public static encode(message: google.cloud.documentai.v1.IProcessRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public getProcessor(request: google.cloud.documentai.v1.IGetProcessorRequest): Promise; /** - * Encodes the specified ProcessRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ProcessRequest.verify|verify} messages. - * @param message ProcessRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Calls GetProcessorVersion. + * @param request GetProcessorVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ProcessorVersion */ - public static encodeDelimited(message: google.cloud.documentai.v1.IProcessRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public getProcessorVersion(request: google.cloud.documentai.v1.IGetProcessorVersionRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.GetProcessorVersionCallback): void; /** - * Decodes a ProcessRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ProcessRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls GetProcessorVersion. + * @param request GetProcessorVersionRequest message or plain object + * @returns Promise */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ProcessRequest; + public getProcessorVersion(request: google.cloud.documentai.v1.IGetProcessorVersionRequest): Promise; /** - * Decodes a ProcessRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ProcessRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls ListProcessorVersions. + * @param request ListProcessorVersionsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListProcessorVersionsResponse */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ProcessRequest; + public listProcessorVersions(request: google.cloud.documentai.v1.IListProcessorVersionsRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.ListProcessorVersionsCallback): void; /** - * Verifies a ProcessRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not + * Calls ListProcessorVersions. + * @param request ListProcessorVersionsRequest message or plain object + * @returns Promise */ - public static verify(message: { [k: string]: any }): (string|null); + public listProcessorVersions(request: google.cloud.documentai.v1.IListProcessorVersionsRequest): Promise; /** - * Creates a ProcessRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ProcessRequest + * Calls DeleteProcessorVersion. + * @param request DeleteProcessorVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ProcessRequest; + public deleteProcessorVersion(request: google.cloud.documentai.v1.IDeleteProcessorVersionRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersionCallback): void; /** - * Creates a plain object from a ProcessRequest message. Also converts values to other types if specified. + * Calls DeleteProcessorVersion. + * @param request DeleteProcessorVersionRequest message or plain object + * @returns Promise + */ + public deleteProcessorVersion(request: google.cloud.documentai.v1.IDeleteProcessorVersionRequest): Promise; + + /** + * Calls DeployProcessorVersion. + * @param request DeployProcessorVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deployProcessorVersion(request: google.cloud.documentai.v1.IDeployProcessorVersionRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersionCallback): void; + + /** + * Calls DeployProcessorVersion. + * @param request DeployProcessorVersionRequest message or plain object + * @returns Promise + */ + public deployProcessorVersion(request: google.cloud.documentai.v1.IDeployProcessorVersionRequest): Promise; + + /** + * Calls UndeployProcessorVersion. + * @param request UndeployProcessorVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public undeployProcessorVersion(request: google.cloud.documentai.v1.IUndeployProcessorVersionRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersionCallback): void; + + /** + * Calls UndeployProcessorVersion. + * @param request UndeployProcessorVersionRequest message or plain object + * @returns Promise + */ + public undeployProcessorVersion(request: google.cloud.documentai.v1.IUndeployProcessorVersionRequest): Promise; + + /** + * Calls CreateProcessor. + * @param request CreateProcessorRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Processor + */ + public createProcessor(request: google.cloud.documentai.v1.ICreateProcessorRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.CreateProcessorCallback): void; + + /** + * Calls CreateProcessor. + * @param request CreateProcessorRequest message or plain object + * @returns Promise + */ + public createProcessor(request: google.cloud.documentai.v1.ICreateProcessorRequest): Promise; + + /** + * Calls DeleteProcessor. + * @param request DeleteProcessorRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteProcessor(request: google.cloud.documentai.v1.IDeleteProcessorRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorCallback): void; + + /** + * Calls DeleteProcessor. + * @param request DeleteProcessorRequest message or plain object + * @returns Promise + */ + public deleteProcessor(request: google.cloud.documentai.v1.IDeleteProcessorRequest): Promise; + + /** + * Calls EnableProcessor. + * @param request EnableProcessorRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public enableProcessor(request: google.cloud.documentai.v1.IEnableProcessorRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.EnableProcessorCallback): void; + + /** + * Calls EnableProcessor. + * @param request EnableProcessorRequest message or plain object + * @returns Promise + */ + public enableProcessor(request: google.cloud.documentai.v1.IEnableProcessorRequest): Promise; + + /** + * Calls DisableProcessor. + * @param request DisableProcessorRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public disableProcessor(request: google.cloud.documentai.v1.IDisableProcessorRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.DisableProcessorCallback): void; + + /** + * Calls DisableProcessor. + * @param request DisableProcessorRequest message or plain object + * @returns Promise + */ + public disableProcessor(request: google.cloud.documentai.v1.IDisableProcessorRequest): Promise; + + /** + * Calls SetDefaultProcessorVersion. + * @param request SetDefaultProcessorVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public setDefaultProcessorVersion(request: google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersionCallback): void; + + /** + * Calls SetDefaultProcessorVersion. + * @param request SetDefaultProcessorVersionRequest message or plain object + * @returns Promise + */ + public setDefaultProcessorVersion(request: google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest): Promise; + + /** + * Calls ReviewDocument. + * @param request ReviewDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public reviewDocument(request: google.cloud.documentai.v1.IReviewDocumentRequest, callback: google.cloud.documentai.v1.DocumentProcessorService.ReviewDocumentCallback): void; + + /** + * Calls ReviewDocument. + * @param request ReviewDocumentRequest message or plain object + * @returns Promise + */ + public reviewDocument(request: google.cloud.documentai.v1.IReviewDocumentRequest): Promise; + } + + namespace DocumentProcessorService { + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#processDocument}. + * @param error Error, if any + * @param [response] ProcessResponse + */ + type ProcessDocumentCallback = (error: (Error|null), response?: google.cloud.documentai.v1.ProcessResponse) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#batchProcessDocuments}. + * @param error Error, if any + * @param [response] Operation + */ + type BatchProcessDocumentsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#fetchProcessorTypes}. + * @param error Error, if any + * @param [response] FetchProcessorTypesResponse + */ + type FetchProcessorTypesCallback = (error: (Error|null), response?: google.cloud.documentai.v1.FetchProcessorTypesResponse) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#listProcessorTypes}. + * @param error Error, if any + * @param [response] ListProcessorTypesResponse + */ + type ListProcessorTypesCallback = (error: (Error|null), response?: google.cloud.documentai.v1.ListProcessorTypesResponse) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#listProcessors}. + * @param error Error, if any + * @param [response] ListProcessorsResponse + */ + type ListProcessorsCallback = (error: (Error|null), response?: google.cloud.documentai.v1.ListProcessorsResponse) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#getProcessor}. + * @param error Error, if any + * @param [response] Processor + */ + type GetProcessorCallback = (error: (Error|null), response?: google.cloud.documentai.v1.Processor) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#getProcessorVersion}. + * @param error Error, if any + * @param [response] ProcessorVersion + */ + type GetProcessorVersionCallback = (error: (Error|null), response?: google.cloud.documentai.v1.ProcessorVersion) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#listProcessorVersions}. + * @param error Error, if any + * @param [response] ListProcessorVersionsResponse + */ + type ListProcessorVersionsCallback = (error: (Error|null), response?: google.cloud.documentai.v1.ListProcessorVersionsResponse) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#deleteProcessorVersion}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteProcessorVersionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#deployProcessorVersion}. + * @param error Error, if any + * @param [response] Operation + */ + type DeployProcessorVersionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#undeployProcessorVersion}. + * @param error Error, if any + * @param [response] Operation + */ + type UndeployProcessorVersionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#createProcessor}. + * @param error Error, if any + * @param [response] Processor + */ + type CreateProcessorCallback = (error: (Error|null), response?: google.cloud.documentai.v1.Processor) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#deleteProcessor}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteProcessorCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#enableProcessor}. + * @param error Error, if any + * @param [response] Operation + */ + type EnableProcessorCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#disableProcessor}. + * @param error Error, if any + * @param [response] Operation + */ + type DisableProcessorCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#setDefaultProcessorVersion}. + * @param error Error, if any + * @param [response] Operation + */ + type SetDefaultProcessorVersionCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#reviewDocument}. + * @param error Error, if any + * @param [response] Operation + */ + type ReviewDocumentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a ProcessRequest. */ + interface IProcessRequest { + + /** ProcessRequest inlineDocument */ + inlineDocument?: (google.cloud.documentai.v1.IDocument|null); + + /** ProcessRequest rawDocument */ + rawDocument?: (google.cloud.documentai.v1.IRawDocument|null); + + /** ProcessRequest name */ + name?: (string|null); + + /** ProcessRequest skipHumanReview */ + skipHumanReview?: (boolean|null); + + /** ProcessRequest fieldMask */ + fieldMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents a ProcessRequest. */ + class ProcessRequest implements IProcessRequest { + + /** + * Constructs a new ProcessRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IProcessRequest); + + /** ProcessRequest inlineDocument. */ + public inlineDocument?: (google.cloud.documentai.v1.IDocument|null); + + /** ProcessRequest rawDocument. */ + public rawDocument?: (google.cloud.documentai.v1.IRawDocument|null); + + /** ProcessRequest name. */ + public name: string; + + /** ProcessRequest skipHumanReview. */ + public skipHumanReview: boolean; + + /** ProcessRequest fieldMask. */ + public fieldMask?: (google.protobuf.IFieldMask|null); + + /** ProcessRequest source. */ + public source?: ("inlineDocument"|"rawDocument"); + + /** + * Creates a new ProcessRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ProcessRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IProcessRequest): google.cloud.documentai.v1.ProcessRequest; + + /** + * Encodes the specified ProcessRequest message. Does not implicitly {@link google.cloud.documentai.v1.ProcessRequest.verify|verify} messages. + * @param message ProcessRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IProcessRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProcessRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ProcessRequest.verify|verify} messages. + * @param message ProcessRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IProcessRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProcessRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProcessRequest + * @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.v1.ProcessRequest; + + /** + * Decodes a ProcessRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProcessRequest + * @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.v1.ProcessRequest; + + /** + * Verifies a ProcessRequest 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 ProcessRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProcessRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ProcessRequest; + + /** + * Creates a plain object from a ProcessRequest message. Also converts values to other types if specified. * @param message ProcessRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1.ProcessRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1.ProcessRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProcessRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a HumanReviewStatus. */ + interface IHumanReviewStatus { + + /** HumanReviewStatus state */ + state?: (google.cloud.documentai.v1.HumanReviewStatus.State|keyof typeof google.cloud.documentai.v1.HumanReviewStatus.State|null); + + /** HumanReviewStatus stateMessage */ + stateMessage?: (string|null); + + /** HumanReviewStatus humanReviewOperation */ + humanReviewOperation?: (string|null); + } + + /** Represents a HumanReviewStatus. */ + class HumanReviewStatus implements IHumanReviewStatus { + + /** + * Constructs a new HumanReviewStatus. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IHumanReviewStatus); + + /** HumanReviewStatus state. */ + public state: (google.cloud.documentai.v1.HumanReviewStatus.State|keyof typeof google.cloud.documentai.v1.HumanReviewStatus.State); + + /** HumanReviewStatus stateMessage. */ + public stateMessage: string; + + /** HumanReviewStatus humanReviewOperation. */ + public humanReviewOperation: string; + + /** + * Creates a new HumanReviewStatus instance using the specified properties. + * @param [properties] Properties to set + * @returns HumanReviewStatus instance + */ + public static create(properties?: google.cloud.documentai.v1.IHumanReviewStatus): google.cloud.documentai.v1.HumanReviewStatus; + + /** + * Encodes the specified HumanReviewStatus message. Does not implicitly {@link google.cloud.documentai.v1.HumanReviewStatus.verify|verify} messages. + * @param message HumanReviewStatus message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IHumanReviewStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HumanReviewStatus message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.HumanReviewStatus.verify|verify} messages. + * @param message HumanReviewStatus message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IHumanReviewStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HumanReviewStatus message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HumanReviewStatus + * @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.v1.HumanReviewStatus; + + /** + * Decodes a HumanReviewStatus message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HumanReviewStatus + * @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.v1.HumanReviewStatus; + + /** + * Verifies a HumanReviewStatus 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 HumanReviewStatus message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HumanReviewStatus + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.HumanReviewStatus; + + /** + * Creates a plain object from a HumanReviewStatus message. Also converts values to other types if specified. + * @param message HumanReviewStatus + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.HumanReviewStatus, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HumanReviewStatus to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace HumanReviewStatus { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + SKIPPED = 1, + VALIDATION_PASSED = 2, + IN_PROGRESS = 3, + ERROR = 4 + } + } + + /** Properties of a ProcessResponse. */ + interface IProcessResponse { + + /** ProcessResponse document */ + document?: (google.cloud.documentai.v1.IDocument|null); + + /** ProcessResponse humanReviewStatus */ + humanReviewStatus?: (google.cloud.documentai.v1.IHumanReviewStatus|null); + } + + /** Represents a ProcessResponse. */ + class ProcessResponse implements IProcessResponse { + + /** + * Constructs a new ProcessResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IProcessResponse); + + /** ProcessResponse document. */ + public document?: (google.cloud.documentai.v1.IDocument|null); + + /** ProcessResponse humanReviewStatus. */ + public humanReviewStatus?: (google.cloud.documentai.v1.IHumanReviewStatus|null); + + /** + * Creates a new ProcessResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ProcessResponse instance + */ + public static create(properties?: google.cloud.documentai.v1.IProcessResponse): google.cloud.documentai.v1.ProcessResponse; + + /** + * Encodes the specified ProcessResponse message. Does not implicitly {@link google.cloud.documentai.v1.ProcessResponse.verify|verify} messages. + * @param message ProcessResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IProcessResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ProcessResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ProcessResponse.verify|verify} messages. + * @param message ProcessResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IProcessResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ProcessResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ProcessResponse + * @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.v1.ProcessResponse; + + /** + * Decodes a ProcessResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ProcessResponse + * @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.v1.ProcessResponse; + + /** + * Verifies a ProcessResponse 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 ProcessResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ProcessResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ProcessResponse; + + /** + * Creates a plain object from a ProcessResponse message. Also converts values to other types if specified. + * @param message ProcessResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.ProcessResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ProcessResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BatchProcessRequest. */ + interface IBatchProcessRequest { + + /** BatchProcessRequest name */ + name?: (string|null); + + /** BatchProcessRequest inputDocuments */ + inputDocuments?: (google.cloud.documentai.v1.IBatchDocumentsInputConfig|null); + + /** BatchProcessRequest documentOutputConfig */ + documentOutputConfig?: (google.cloud.documentai.v1.IDocumentOutputConfig|null); + + /** BatchProcessRequest skipHumanReview */ + skipHumanReview?: (boolean|null); + } + + /** Represents a BatchProcessRequest. */ + class BatchProcessRequest implements IBatchProcessRequest { + + /** + * Constructs a new BatchProcessRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IBatchProcessRequest); + + /** BatchProcessRequest name. */ + public name: string; + + /** BatchProcessRequest inputDocuments. */ + public inputDocuments?: (google.cloud.documentai.v1.IBatchDocumentsInputConfig|null); + + /** BatchProcessRequest documentOutputConfig. */ + public documentOutputConfig?: (google.cloud.documentai.v1.IDocumentOutputConfig|null); + + /** BatchProcessRequest skipHumanReview. */ + public skipHumanReview: boolean; + + /** + * Creates a new BatchProcessRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchProcessRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IBatchProcessRequest): google.cloud.documentai.v1.BatchProcessRequest; + + /** + * Encodes the specified BatchProcessRequest message. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessRequest.verify|verify} messages. + * @param message BatchProcessRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IBatchProcessRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchProcessRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessRequest.verify|verify} messages. + * @param message BatchProcessRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IBatchProcessRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchProcessRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchProcessRequest + * @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.v1.BatchProcessRequest; + + /** + * Decodes a BatchProcessRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchProcessRequest + * @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.v1.BatchProcessRequest; + + /** + * Verifies a BatchProcessRequest 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 BatchProcessRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchProcessRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.BatchProcessRequest; + + /** + * Creates a plain object from a BatchProcessRequest message. Also converts values to other types if specified. + * @param message BatchProcessRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.BatchProcessRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchProcessRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BatchProcessResponse. */ + interface IBatchProcessResponse { + } + + /** Represents a BatchProcessResponse. */ + class BatchProcessResponse implements IBatchProcessResponse { + + /** + * Constructs a new BatchProcessResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IBatchProcessResponse); + + /** + * Creates a new BatchProcessResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchProcessResponse instance + */ + public static create(properties?: google.cloud.documentai.v1.IBatchProcessResponse): google.cloud.documentai.v1.BatchProcessResponse; + + /** + * Encodes the specified BatchProcessResponse message. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessResponse.verify|verify} messages. + * @param message BatchProcessResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IBatchProcessResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchProcessResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessResponse.verify|verify} messages. + * @param message BatchProcessResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IBatchProcessResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchProcessResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchProcessResponse + * @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.v1.BatchProcessResponse; + + /** + * Decodes a BatchProcessResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchProcessResponse + * @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.v1.BatchProcessResponse; + + /** + * Verifies a BatchProcessResponse 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 BatchProcessResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchProcessResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.BatchProcessResponse; + + /** + * Creates a plain object from a BatchProcessResponse message. Also converts values to other types if specified. + * @param message BatchProcessResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.BatchProcessResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchProcessResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BatchProcessMetadata. */ + interface IBatchProcessMetadata { + + /** BatchProcessMetadata state */ + state?: (google.cloud.documentai.v1.BatchProcessMetadata.State|keyof typeof google.cloud.documentai.v1.BatchProcessMetadata.State|null); + + /** BatchProcessMetadata stateMessage */ + stateMessage?: (string|null); + + /** BatchProcessMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** BatchProcessMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** BatchProcessMetadata individualProcessStatuses */ + individualProcessStatuses?: (google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus[]|null); + } + + /** Represents a BatchProcessMetadata. */ + class BatchProcessMetadata implements IBatchProcessMetadata { + + /** + * Constructs a new BatchProcessMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IBatchProcessMetadata); + + /** BatchProcessMetadata state. */ + public state: (google.cloud.documentai.v1.BatchProcessMetadata.State|keyof typeof google.cloud.documentai.v1.BatchProcessMetadata.State); + + /** BatchProcessMetadata stateMessage. */ + public stateMessage: string; + + /** BatchProcessMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** BatchProcessMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** BatchProcessMetadata individualProcessStatuses. */ + public individualProcessStatuses: google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus[]; + + /** + * Creates a new BatchProcessMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchProcessMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1.IBatchProcessMetadata): google.cloud.documentai.v1.BatchProcessMetadata; + + /** + * Encodes the specified BatchProcessMetadata message. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessMetadata.verify|verify} messages. + * @param message BatchProcessMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IBatchProcessMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchProcessMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessMetadata.verify|verify} messages. + * @param message BatchProcessMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IBatchProcessMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchProcessMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchProcessMetadata + * @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.v1.BatchProcessMetadata; + + /** + * Decodes a BatchProcessMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchProcessMetadata + * @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.v1.BatchProcessMetadata; + + /** + * Verifies a BatchProcessMetadata 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 BatchProcessMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchProcessMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.BatchProcessMetadata; + + /** + * Creates a plain object from a BatchProcessMetadata message. Also converts values to other types if specified. + * @param message BatchProcessMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.BatchProcessMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchProcessMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace BatchProcessMetadata { + + /** Properties of an IndividualProcessStatus. */ + interface IIndividualProcessStatus { + + /** IndividualProcessStatus inputGcsSource */ + inputGcsSource?: (string|null); + + /** IndividualProcessStatus status */ + status?: (google.rpc.IStatus|null); + + /** IndividualProcessStatus outputGcsDestination */ + outputGcsDestination?: (string|null); + + /** IndividualProcessStatus humanReviewStatus */ + humanReviewStatus?: (google.cloud.documentai.v1.IHumanReviewStatus|null); + } + + /** Represents an IndividualProcessStatus. */ + class IndividualProcessStatus implements IIndividualProcessStatus { + + /** + * Constructs a new IndividualProcessStatus. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus); + + /** IndividualProcessStatus inputGcsSource. */ + public inputGcsSource: string; + + /** IndividualProcessStatus status. */ + public status?: (google.rpc.IStatus|null); + + /** IndividualProcessStatus outputGcsDestination. */ + public outputGcsDestination: string; + + /** IndividualProcessStatus humanReviewStatus. */ + public humanReviewStatus?: (google.cloud.documentai.v1.IHumanReviewStatus|null); + + /** + * Creates a new IndividualProcessStatus instance using the specified properties. + * @param [properties] Properties to set + * @returns IndividualProcessStatus instance + */ + public static create(properties?: google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus): google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus; + + /** + * Encodes the specified IndividualProcessStatus message. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.verify|verify} messages. + * @param message IndividualProcessStatus message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified IndividualProcessStatus message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.verify|verify} messages. + * @param message IndividualProcessStatus message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an IndividualProcessStatus message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns IndividualProcessStatus + * @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.v1.BatchProcessMetadata.IndividualProcessStatus; + + /** + * Decodes an IndividualProcessStatus message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns IndividualProcessStatus + * @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.v1.BatchProcessMetadata.IndividualProcessStatus; + + /** + * Verifies an IndividualProcessStatus 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 IndividualProcessStatus message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns IndividualProcessStatus + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus; + + /** + * Creates a plain object from an IndividualProcessStatus message. Also converts values to other types if specified. + * @param message IndividualProcessStatus + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this IndividualProcessStatus to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + WAITING = 1, + RUNNING = 2, + SUCCEEDED = 3, + CANCELLING = 4, + CANCELLED = 5, + FAILED = 6 + } + } + + /** Properties of a FetchProcessorTypesRequest. */ + interface IFetchProcessorTypesRequest { + + /** FetchProcessorTypesRequest parent */ + parent?: (string|null); + } + + /** Represents a FetchProcessorTypesRequest. */ + class FetchProcessorTypesRequest implements IFetchProcessorTypesRequest { + + /** + * Constructs a new FetchProcessorTypesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IFetchProcessorTypesRequest); + + /** FetchProcessorTypesRequest parent. */ + public parent: string; + + /** + * Creates a new FetchProcessorTypesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns FetchProcessorTypesRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IFetchProcessorTypesRequest): google.cloud.documentai.v1.FetchProcessorTypesRequest; + + /** + * Encodes the specified FetchProcessorTypesRequest message. Does not implicitly {@link google.cloud.documentai.v1.FetchProcessorTypesRequest.verify|verify} messages. + * @param message FetchProcessorTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IFetchProcessorTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FetchProcessorTypesRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.FetchProcessorTypesRequest.verify|verify} messages. + * @param message FetchProcessorTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IFetchProcessorTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FetchProcessorTypesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FetchProcessorTypesRequest + * @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.v1.FetchProcessorTypesRequest; + + /** + * Decodes a FetchProcessorTypesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FetchProcessorTypesRequest + * @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.v1.FetchProcessorTypesRequest; + + /** + * Verifies a FetchProcessorTypesRequest 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 FetchProcessorTypesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FetchProcessorTypesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.FetchProcessorTypesRequest; + + /** + * Creates a plain object from a FetchProcessorTypesRequest message. Also converts values to other types if specified. + * @param message FetchProcessorTypesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.FetchProcessorTypesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FetchProcessorTypesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a FetchProcessorTypesResponse. */ + interface IFetchProcessorTypesResponse { + + /** FetchProcessorTypesResponse processorTypes */ + processorTypes?: (google.cloud.documentai.v1.IProcessorType[]|null); + } + + /** Represents a FetchProcessorTypesResponse. */ + class FetchProcessorTypesResponse implements IFetchProcessorTypesResponse { + + /** + * Constructs a new FetchProcessorTypesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IFetchProcessorTypesResponse); + + /** FetchProcessorTypesResponse processorTypes. */ + public processorTypes: google.cloud.documentai.v1.IProcessorType[]; + + /** + * Creates a new FetchProcessorTypesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns FetchProcessorTypesResponse instance + */ + public static create(properties?: google.cloud.documentai.v1.IFetchProcessorTypesResponse): google.cloud.documentai.v1.FetchProcessorTypesResponse; + + /** + * Encodes the specified FetchProcessorTypesResponse message. Does not implicitly {@link google.cloud.documentai.v1.FetchProcessorTypesResponse.verify|verify} messages. + * @param message FetchProcessorTypesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IFetchProcessorTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FetchProcessorTypesResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.FetchProcessorTypesResponse.verify|verify} messages. + * @param message FetchProcessorTypesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IFetchProcessorTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FetchProcessorTypesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FetchProcessorTypesResponse + * @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.v1.FetchProcessorTypesResponse; + + /** + * Decodes a FetchProcessorTypesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FetchProcessorTypesResponse + * @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.v1.FetchProcessorTypesResponse; + + /** + * Verifies a FetchProcessorTypesResponse 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 FetchProcessorTypesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FetchProcessorTypesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.FetchProcessorTypesResponse; + + /** + * Creates a plain object from a FetchProcessorTypesResponse message. Also converts values to other types if specified. + * @param message FetchProcessorTypesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.FetchProcessorTypesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FetchProcessorTypesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListProcessorTypesRequest. */ + interface IListProcessorTypesRequest { + + /** ListProcessorTypesRequest parent */ + parent?: (string|null); + + /** ListProcessorTypesRequest pageSize */ + pageSize?: (number|null); + + /** ListProcessorTypesRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListProcessorTypesRequest. */ + class ListProcessorTypesRequest implements IListProcessorTypesRequest { + + /** + * Constructs a new ListProcessorTypesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IListProcessorTypesRequest); + + /** ListProcessorTypesRequest parent. */ + public parent: string; + + /** ListProcessorTypesRequest pageSize. */ + public pageSize: number; + + /** ListProcessorTypesRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListProcessorTypesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListProcessorTypesRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IListProcessorTypesRequest): google.cloud.documentai.v1.ListProcessorTypesRequest; + + /** + * Encodes the specified ListProcessorTypesRequest message. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorTypesRequest.verify|verify} messages. + * @param message ListProcessorTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IListProcessorTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListProcessorTypesRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorTypesRequest.verify|verify} messages. + * @param message ListProcessorTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IListProcessorTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListProcessorTypesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListProcessorTypesRequest + * @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.v1.ListProcessorTypesRequest; + + /** + * Decodes a ListProcessorTypesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListProcessorTypesRequest + * @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.v1.ListProcessorTypesRequest; + + /** + * Verifies a ListProcessorTypesRequest 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 ListProcessorTypesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListProcessorTypesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ListProcessorTypesRequest; + + /** + * Creates a plain object from a ListProcessorTypesRequest message. Also converts values to other types if specified. + * @param message ListProcessorTypesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.ListProcessorTypesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListProcessorTypesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListProcessorTypesResponse. */ + interface IListProcessorTypesResponse { + + /** ListProcessorTypesResponse processorTypes */ + processorTypes?: (google.cloud.documentai.v1.IProcessorType[]|null); + + /** ListProcessorTypesResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListProcessorTypesResponse. */ + class ListProcessorTypesResponse implements IListProcessorTypesResponse { + + /** + * Constructs a new ListProcessorTypesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IListProcessorTypesResponse); + + /** ListProcessorTypesResponse processorTypes. */ + public processorTypes: google.cloud.documentai.v1.IProcessorType[]; + + /** ListProcessorTypesResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListProcessorTypesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListProcessorTypesResponse instance + */ + public static create(properties?: google.cloud.documentai.v1.IListProcessorTypesResponse): google.cloud.documentai.v1.ListProcessorTypesResponse; + + /** + * Encodes the specified ListProcessorTypesResponse message. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorTypesResponse.verify|verify} messages. + * @param message ListProcessorTypesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IListProcessorTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListProcessorTypesResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorTypesResponse.verify|verify} messages. + * @param message ListProcessorTypesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IListProcessorTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListProcessorTypesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListProcessorTypesResponse + * @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.v1.ListProcessorTypesResponse; + + /** + * Decodes a ListProcessorTypesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListProcessorTypesResponse + * @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.v1.ListProcessorTypesResponse; + + /** + * Verifies a ListProcessorTypesResponse 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 ListProcessorTypesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListProcessorTypesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ListProcessorTypesResponse; + + /** + * Creates a plain object from a ListProcessorTypesResponse message. Also converts values to other types if specified. + * @param message ListProcessorTypesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.ListProcessorTypesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListProcessorTypesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListProcessorsRequest. */ + interface IListProcessorsRequest { + + /** ListProcessorsRequest parent */ + parent?: (string|null); + + /** ListProcessorsRequest pageSize */ + pageSize?: (number|null); + + /** ListProcessorsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListProcessorsRequest. */ + class ListProcessorsRequest implements IListProcessorsRequest { + + /** + * Constructs a new ListProcessorsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IListProcessorsRequest); + + /** ListProcessorsRequest parent. */ + public parent: string; + + /** ListProcessorsRequest pageSize. */ + public pageSize: number; + + /** ListProcessorsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListProcessorsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListProcessorsRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IListProcessorsRequest): google.cloud.documentai.v1.ListProcessorsRequest; + + /** + * Encodes the specified ListProcessorsRequest message. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorsRequest.verify|verify} messages. + * @param message ListProcessorsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IListProcessorsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListProcessorsRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorsRequest.verify|verify} messages. + * @param message ListProcessorsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IListProcessorsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListProcessorsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListProcessorsRequest + * @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.v1.ListProcessorsRequest; + + /** + * Decodes a ListProcessorsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListProcessorsRequest + * @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.v1.ListProcessorsRequest; + + /** + * Verifies a ListProcessorsRequest 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 ListProcessorsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListProcessorsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ListProcessorsRequest; + + /** + * Creates a plain object from a ListProcessorsRequest message. Also converts values to other types if specified. + * @param message ListProcessorsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.ListProcessorsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListProcessorsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListProcessorsResponse. */ + interface IListProcessorsResponse { + + /** ListProcessorsResponse processors */ + processors?: (google.cloud.documentai.v1.IProcessor[]|null); + + /** ListProcessorsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListProcessorsResponse. */ + class ListProcessorsResponse implements IListProcessorsResponse { + + /** + * Constructs a new ListProcessorsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IListProcessorsResponse); + + /** ListProcessorsResponse processors. */ + public processors: google.cloud.documentai.v1.IProcessor[]; + + /** ListProcessorsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListProcessorsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListProcessorsResponse instance + */ + public static create(properties?: google.cloud.documentai.v1.IListProcessorsResponse): google.cloud.documentai.v1.ListProcessorsResponse; + + /** + * Encodes the specified ListProcessorsResponse message. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorsResponse.verify|verify} messages. + * @param message ListProcessorsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IListProcessorsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListProcessorsResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorsResponse.verify|verify} messages. + * @param message ListProcessorsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IListProcessorsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListProcessorsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListProcessorsResponse + * @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.v1.ListProcessorsResponse; + + /** + * Decodes a ListProcessorsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListProcessorsResponse + * @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.v1.ListProcessorsResponse; + + /** + * Verifies a ListProcessorsResponse 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 ListProcessorsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListProcessorsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ListProcessorsResponse; + + /** + * Creates a plain object from a ListProcessorsResponse message. Also converts values to other types if specified. + * @param message ListProcessorsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.ListProcessorsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListProcessorsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetProcessorRequest. */ + interface IGetProcessorRequest { + + /** GetProcessorRequest name */ + name?: (string|null); + } + + /** Represents a GetProcessorRequest. */ + class GetProcessorRequest implements IGetProcessorRequest { + + /** + * Constructs a new GetProcessorRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IGetProcessorRequest); + + /** GetProcessorRequest name. */ + public name: string; + + /** + * Creates a new GetProcessorRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetProcessorRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IGetProcessorRequest): google.cloud.documentai.v1.GetProcessorRequest; + + /** + * Encodes the specified GetProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1.GetProcessorRequest.verify|verify} messages. + * @param message GetProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IGetProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.GetProcessorRequest.verify|verify} messages. + * @param message GetProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IGetProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetProcessorRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetProcessorRequest + * @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.v1.GetProcessorRequest; + + /** + * Decodes a GetProcessorRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetProcessorRequest + * @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.v1.GetProcessorRequest; + + /** + * Verifies a GetProcessorRequest 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 GetProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetProcessorRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.GetProcessorRequest; + + /** + * Creates a plain object from a GetProcessorRequest message. Also converts values to other types if specified. + * @param message GetProcessorRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.GetProcessorRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetProcessorRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a GetProcessorVersionRequest. */ + interface IGetProcessorVersionRequest { + + /** GetProcessorVersionRequest name */ + name?: (string|null); + } + + /** Represents a GetProcessorVersionRequest. */ + class GetProcessorVersionRequest implements IGetProcessorVersionRequest { + + /** + * Constructs a new GetProcessorVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IGetProcessorVersionRequest); + + /** GetProcessorVersionRequest name. */ + public name: string; + + /** + * Creates a new GetProcessorVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetProcessorVersionRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IGetProcessorVersionRequest): google.cloud.documentai.v1.GetProcessorVersionRequest; + + /** + * Encodes the specified GetProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1.GetProcessorVersionRequest.verify|verify} messages. + * @param message GetProcessorVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IGetProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.GetProcessorVersionRequest.verify|verify} messages. + * @param message GetProcessorVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IGetProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetProcessorVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetProcessorVersionRequest + * @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.v1.GetProcessorVersionRequest; + + /** + * Decodes a GetProcessorVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetProcessorVersionRequest + * @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.v1.GetProcessorVersionRequest; + + /** + * Verifies a GetProcessorVersionRequest 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 GetProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetProcessorVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.GetProcessorVersionRequest; + + /** + * Creates a plain object from a GetProcessorVersionRequest message. Also converts values to other types if specified. + * @param message GetProcessorVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.GetProcessorVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetProcessorVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListProcessorVersionsRequest. */ + interface IListProcessorVersionsRequest { + + /** ListProcessorVersionsRequest parent */ + parent?: (string|null); + + /** ListProcessorVersionsRequest pageSize */ + pageSize?: (number|null); + + /** ListProcessorVersionsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListProcessorVersionsRequest. */ + class ListProcessorVersionsRequest implements IListProcessorVersionsRequest { + + /** + * Constructs a new ListProcessorVersionsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IListProcessorVersionsRequest); + + /** ListProcessorVersionsRequest parent. */ + public parent: string; + + /** ListProcessorVersionsRequest pageSize. */ + public pageSize: number; + + /** ListProcessorVersionsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListProcessorVersionsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListProcessorVersionsRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IListProcessorVersionsRequest): google.cloud.documentai.v1.ListProcessorVersionsRequest; + + /** + * Encodes the specified ListProcessorVersionsRequest message. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorVersionsRequest.verify|verify} messages. + * @param message ListProcessorVersionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IListProcessorVersionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListProcessorVersionsRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorVersionsRequest.verify|verify} messages. + * @param message ListProcessorVersionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IListProcessorVersionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListProcessorVersionsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListProcessorVersionsRequest + * @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.v1.ListProcessorVersionsRequest; + + /** + * Decodes a ListProcessorVersionsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListProcessorVersionsRequest + * @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.v1.ListProcessorVersionsRequest; + + /** + * Verifies a ListProcessorVersionsRequest 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 ListProcessorVersionsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListProcessorVersionsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ListProcessorVersionsRequest; + + /** + * Creates a plain object from a ListProcessorVersionsRequest message. Also converts values to other types if specified. + * @param message ListProcessorVersionsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.ListProcessorVersionsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListProcessorVersionsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a ListProcessorVersionsResponse. */ + interface IListProcessorVersionsResponse { + + /** ListProcessorVersionsResponse processorVersions */ + processorVersions?: (google.cloud.documentai.v1.IProcessorVersion[]|null); + + /** ListProcessorVersionsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListProcessorVersionsResponse. */ + class ListProcessorVersionsResponse implements IListProcessorVersionsResponse { + + /** + * Constructs a new ListProcessorVersionsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IListProcessorVersionsResponse); + + /** ListProcessorVersionsResponse processorVersions. */ + public processorVersions: google.cloud.documentai.v1.IProcessorVersion[]; + + /** ListProcessorVersionsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListProcessorVersionsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListProcessorVersionsResponse instance + */ + public static create(properties?: google.cloud.documentai.v1.IListProcessorVersionsResponse): google.cloud.documentai.v1.ListProcessorVersionsResponse; + + /** + * Encodes the specified ListProcessorVersionsResponse message. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorVersionsResponse.verify|verify} messages. + * @param message ListProcessorVersionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IListProcessorVersionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListProcessorVersionsResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorVersionsResponse.verify|verify} messages. + * @param message ListProcessorVersionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IListProcessorVersionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListProcessorVersionsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListProcessorVersionsResponse + * @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.v1.ListProcessorVersionsResponse; + + /** + * Decodes a ListProcessorVersionsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListProcessorVersionsResponse + * @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.v1.ListProcessorVersionsResponse; + + /** + * Verifies a ListProcessorVersionsResponse 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 ListProcessorVersionsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListProcessorVersionsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ListProcessorVersionsResponse; + + /** + * Creates a plain object from a ListProcessorVersionsResponse message. Also converts values to other types if specified. + * @param message ListProcessorVersionsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.ListProcessorVersionsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListProcessorVersionsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteProcessorVersionRequest. */ + interface IDeleteProcessorVersionRequest { + + /** DeleteProcessorVersionRequest name */ + name?: (string|null); + } + + /** Represents a DeleteProcessorVersionRequest. */ + class DeleteProcessorVersionRequest implements IDeleteProcessorVersionRequest { + + /** + * Constructs a new DeleteProcessorVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IDeleteProcessorVersionRequest); + + /** DeleteProcessorVersionRequest name. */ + public name: string; + + /** + * Creates a new DeleteProcessorVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteProcessorVersionRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IDeleteProcessorVersionRequest): google.cloud.documentai.v1.DeleteProcessorVersionRequest; + + /** + * Encodes the specified DeleteProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorVersionRequest.verify|verify} messages. + * @param message DeleteProcessorVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IDeleteProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorVersionRequest.verify|verify} messages. + * @param message DeleteProcessorVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IDeleteProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteProcessorVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteProcessorVersionRequest + * @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.v1.DeleteProcessorVersionRequest; + + /** + * Decodes a DeleteProcessorVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteProcessorVersionRequest + * @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.v1.DeleteProcessorVersionRequest; + + /** + * Verifies a DeleteProcessorVersionRequest 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 DeleteProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteProcessorVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.DeleteProcessorVersionRequest; + + /** + * Creates a plain object from a DeleteProcessorVersionRequest message. Also converts values to other types if specified. + * @param message DeleteProcessorVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.DeleteProcessorVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteProcessorVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteProcessorVersionMetadata. */ + interface IDeleteProcessorVersionMetadata { + + /** DeleteProcessorVersionMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + } + + /** Represents a DeleteProcessorVersionMetadata. */ + class DeleteProcessorVersionMetadata implements IDeleteProcessorVersionMetadata { + + /** + * Constructs a new DeleteProcessorVersionMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IDeleteProcessorVersionMetadata); + + /** DeleteProcessorVersionMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + + /** + * Creates a new DeleteProcessorVersionMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteProcessorVersionMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1.IDeleteProcessorVersionMetadata): google.cloud.documentai.v1.DeleteProcessorVersionMetadata; + + /** + * Encodes the specified DeleteProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorVersionMetadata.verify|verify} messages. + * @param message DeleteProcessorVersionMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IDeleteProcessorVersionMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorVersionMetadata.verify|verify} messages. + * @param message DeleteProcessorVersionMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IDeleteProcessorVersionMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteProcessorVersionMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteProcessorVersionMetadata + * @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.v1.DeleteProcessorVersionMetadata; + + /** + * Decodes a DeleteProcessorVersionMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteProcessorVersionMetadata + * @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.v1.DeleteProcessorVersionMetadata; + + /** + * Verifies a DeleteProcessorVersionMetadata 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 DeleteProcessorVersionMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteProcessorVersionMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.DeleteProcessorVersionMetadata; + + /** + * Creates a plain object from a DeleteProcessorVersionMetadata message. Also converts values to other types if specified. + * @param message DeleteProcessorVersionMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.DeleteProcessorVersionMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteProcessorVersionMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeployProcessorVersionRequest. */ + interface IDeployProcessorVersionRequest { + + /** DeployProcessorVersionRequest name */ + name?: (string|null); + } + + /** Represents a DeployProcessorVersionRequest. */ + class DeployProcessorVersionRequest implements IDeployProcessorVersionRequest { + + /** + * Constructs a new DeployProcessorVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IDeployProcessorVersionRequest); + + /** DeployProcessorVersionRequest name. */ + public name: string; + + /** + * Creates a new DeployProcessorVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeployProcessorVersionRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IDeployProcessorVersionRequest): google.cloud.documentai.v1.DeployProcessorVersionRequest; + + /** + * Encodes the specified DeployProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1.DeployProcessorVersionRequest.verify|verify} messages. + * @param message DeployProcessorVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IDeployProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeployProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DeployProcessorVersionRequest.verify|verify} messages. + * @param message DeployProcessorVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IDeployProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeployProcessorVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeployProcessorVersionRequest + * @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.v1.DeployProcessorVersionRequest; + + /** + * Decodes a DeployProcessorVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeployProcessorVersionRequest + * @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.v1.DeployProcessorVersionRequest; + + /** + * Verifies a DeployProcessorVersionRequest 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 DeployProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeployProcessorVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.DeployProcessorVersionRequest; + + /** + * Creates a plain object from a DeployProcessorVersionRequest message. Also converts values to other types if specified. + * @param message DeployProcessorVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.DeployProcessorVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeployProcessorVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeployProcessorVersionResponse. */ + interface IDeployProcessorVersionResponse { + } + + /** Represents a DeployProcessorVersionResponse. */ + class DeployProcessorVersionResponse implements IDeployProcessorVersionResponse { + + /** + * Constructs a new DeployProcessorVersionResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IDeployProcessorVersionResponse); + + /** + * Creates a new DeployProcessorVersionResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns DeployProcessorVersionResponse instance + */ + public static create(properties?: google.cloud.documentai.v1.IDeployProcessorVersionResponse): google.cloud.documentai.v1.DeployProcessorVersionResponse; + + /** + * Encodes the specified DeployProcessorVersionResponse message. Does not implicitly {@link google.cloud.documentai.v1.DeployProcessorVersionResponse.verify|verify} messages. + * @param message DeployProcessorVersionResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IDeployProcessorVersionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeployProcessorVersionResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DeployProcessorVersionResponse.verify|verify} messages. + * @param message DeployProcessorVersionResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IDeployProcessorVersionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeployProcessorVersionResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeployProcessorVersionResponse + * @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.v1.DeployProcessorVersionResponse; + + /** + * Decodes a DeployProcessorVersionResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeployProcessorVersionResponse + * @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.v1.DeployProcessorVersionResponse; + + /** + * Verifies a DeployProcessorVersionResponse 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 DeployProcessorVersionResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeployProcessorVersionResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.DeployProcessorVersionResponse; + + /** + * Creates a plain object from a DeployProcessorVersionResponse message. Also converts values to other types if specified. + * @param message DeployProcessorVersionResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.DeployProcessorVersionResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeployProcessorVersionResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeployProcessorVersionMetadata. */ + interface IDeployProcessorVersionMetadata { + + /** DeployProcessorVersionMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + } + + /** Represents a DeployProcessorVersionMetadata. */ + class DeployProcessorVersionMetadata implements IDeployProcessorVersionMetadata { + + /** + * Constructs a new DeployProcessorVersionMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IDeployProcessorVersionMetadata); + + /** DeployProcessorVersionMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + + /** + * Creates a new DeployProcessorVersionMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns DeployProcessorVersionMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1.IDeployProcessorVersionMetadata): google.cloud.documentai.v1.DeployProcessorVersionMetadata; + + /** + * Encodes the specified DeployProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1.DeployProcessorVersionMetadata.verify|verify} messages. + * @param message DeployProcessorVersionMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IDeployProcessorVersionMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeployProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DeployProcessorVersionMetadata.verify|verify} messages. + * @param message DeployProcessorVersionMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IDeployProcessorVersionMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeployProcessorVersionMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeployProcessorVersionMetadata + * @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.v1.DeployProcessorVersionMetadata; + + /** + * Decodes a DeployProcessorVersionMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeployProcessorVersionMetadata + * @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.v1.DeployProcessorVersionMetadata; + + /** + * Verifies a DeployProcessorVersionMetadata 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 DeployProcessorVersionMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeployProcessorVersionMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.DeployProcessorVersionMetadata; + + /** + * Creates a plain object from a DeployProcessorVersionMetadata message. Also converts values to other types if specified. + * @param message DeployProcessorVersionMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.DeployProcessorVersionMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeployProcessorVersionMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UndeployProcessorVersionRequest. */ + interface IUndeployProcessorVersionRequest { + + /** UndeployProcessorVersionRequest name */ + name?: (string|null); + } + + /** Represents an UndeployProcessorVersionRequest. */ + class UndeployProcessorVersionRequest implements IUndeployProcessorVersionRequest { + + /** + * Constructs a new UndeployProcessorVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IUndeployProcessorVersionRequest); + + /** UndeployProcessorVersionRequest name. */ + public name: string; + + /** + * Creates a new UndeployProcessorVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UndeployProcessorVersionRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IUndeployProcessorVersionRequest): google.cloud.documentai.v1.UndeployProcessorVersionRequest; + + /** + * Encodes the specified UndeployProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1.UndeployProcessorVersionRequest.verify|verify} messages. + * @param message UndeployProcessorVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IUndeployProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UndeployProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.UndeployProcessorVersionRequest.verify|verify} messages. + * @param message UndeployProcessorVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IUndeployProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UndeployProcessorVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UndeployProcessorVersionRequest + * @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.v1.UndeployProcessorVersionRequest; + + /** + * Decodes an UndeployProcessorVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UndeployProcessorVersionRequest + * @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.v1.UndeployProcessorVersionRequest; + + /** + * Verifies an UndeployProcessorVersionRequest 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 UndeployProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UndeployProcessorVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.UndeployProcessorVersionRequest; + + /** + * Creates a plain object from an UndeployProcessorVersionRequest message. Also converts values to other types if specified. + * @param message UndeployProcessorVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.UndeployProcessorVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UndeployProcessorVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UndeployProcessorVersionResponse. */ + interface IUndeployProcessorVersionResponse { + } + + /** Represents an UndeployProcessorVersionResponse. */ + class UndeployProcessorVersionResponse implements IUndeployProcessorVersionResponse { + + /** + * Constructs a new UndeployProcessorVersionResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IUndeployProcessorVersionResponse); + + /** + * Creates a new UndeployProcessorVersionResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns UndeployProcessorVersionResponse instance + */ + public static create(properties?: google.cloud.documentai.v1.IUndeployProcessorVersionResponse): google.cloud.documentai.v1.UndeployProcessorVersionResponse; + + /** + * Encodes the specified UndeployProcessorVersionResponse message. Does not implicitly {@link google.cloud.documentai.v1.UndeployProcessorVersionResponse.verify|verify} messages. + * @param message UndeployProcessorVersionResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IUndeployProcessorVersionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UndeployProcessorVersionResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.UndeployProcessorVersionResponse.verify|verify} messages. + * @param message UndeployProcessorVersionResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IUndeployProcessorVersionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UndeployProcessorVersionResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UndeployProcessorVersionResponse + * @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.v1.UndeployProcessorVersionResponse; + + /** + * Decodes an UndeployProcessorVersionResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UndeployProcessorVersionResponse + * @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.v1.UndeployProcessorVersionResponse; + + /** + * Verifies an UndeployProcessorVersionResponse 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 UndeployProcessorVersionResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UndeployProcessorVersionResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.UndeployProcessorVersionResponse; + + /** + * Creates a plain object from an UndeployProcessorVersionResponse message. Also converts values to other types if specified. + * @param message UndeployProcessorVersionResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.UndeployProcessorVersionResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UndeployProcessorVersionResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an UndeployProcessorVersionMetadata. */ + interface IUndeployProcessorVersionMetadata { + + /** UndeployProcessorVersionMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + } + + /** Represents an UndeployProcessorVersionMetadata. */ + class UndeployProcessorVersionMetadata implements IUndeployProcessorVersionMetadata { + + /** + * Constructs a new UndeployProcessorVersionMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IUndeployProcessorVersionMetadata); + + /** UndeployProcessorVersionMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + + /** + * Creates a new UndeployProcessorVersionMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns UndeployProcessorVersionMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1.IUndeployProcessorVersionMetadata): google.cloud.documentai.v1.UndeployProcessorVersionMetadata; + + /** + * Encodes the specified UndeployProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1.UndeployProcessorVersionMetadata.verify|verify} messages. + * @param message UndeployProcessorVersionMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IUndeployProcessorVersionMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UndeployProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.UndeployProcessorVersionMetadata.verify|verify} messages. + * @param message UndeployProcessorVersionMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IUndeployProcessorVersionMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UndeployProcessorVersionMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UndeployProcessorVersionMetadata + * @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.v1.UndeployProcessorVersionMetadata; + + /** + * Decodes an UndeployProcessorVersionMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UndeployProcessorVersionMetadata + * @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.v1.UndeployProcessorVersionMetadata; + + /** + * Verifies an UndeployProcessorVersionMetadata 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 UndeployProcessorVersionMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UndeployProcessorVersionMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.UndeployProcessorVersionMetadata; + + /** + * Creates a plain object from an UndeployProcessorVersionMetadata message. Also converts values to other types if specified. + * @param message UndeployProcessorVersionMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.UndeployProcessorVersionMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UndeployProcessorVersionMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a CreateProcessorRequest. */ + interface ICreateProcessorRequest { + + /** CreateProcessorRequest parent */ + parent?: (string|null); + + /** CreateProcessorRequest processor */ + processor?: (google.cloud.documentai.v1.IProcessor|null); + } + + /** Represents a CreateProcessorRequest. */ + class CreateProcessorRequest implements ICreateProcessorRequest { + + /** + * Constructs a new CreateProcessorRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.ICreateProcessorRequest); + + /** CreateProcessorRequest parent. */ + public parent: string; + + /** CreateProcessorRequest processor. */ + public processor?: (google.cloud.documentai.v1.IProcessor|null); + + /** + * Creates a new CreateProcessorRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateProcessorRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.ICreateProcessorRequest): google.cloud.documentai.v1.CreateProcessorRequest; + + /** + * Encodes the specified CreateProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1.CreateProcessorRequest.verify|verify} messages. + * @param message CreateProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.ICreateProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.CreateProcessorRequest.verify|verify} messages. + * @param message CreateProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.ICreateProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateProcessorRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateProcessorRequest + * @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.v1.CreateProcessorRequest; + + /** + * Decodes a CreateProcessorRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateProcessorRequest + * @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.v1.CreateProcessorRequest; + + /** + * Verifies a CreateProcessorRequest 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 CreateProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateProcessorRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.CreateProcessorRequest; + + /** + * Creates a plain object from a CreateProcessorRequest message. Also converts values to other types if specified. + * @param message CreateProcessorRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.CreateProcessorRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateProcessorRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteProcessorRequest. */ + interface IDeleteProcessorRequest { + + /** DeleteProcessorRequest name */ + name?: (string|null); + } + + /** Represents a DeleteProcessorRequest. */ + class DeleteProcessorRequest implements IDeleteProcessorRequest { + + /** + * Constructs a new DeleteProcessorRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IDeleteProcessorRequest); + + /** DeleteProcessorRequest name. */ + public name: string; + + /** + * Creates a new DeleteProcessorRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteProcessorRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IDeleteProcessorRequest): google.cloud.documentai.v1.DeleteProcessorRequest; + + /** + * Encodes the specified DeleteProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorRequest.verify|verify} messages. + * @param message DeleteProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IDeleteProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorRequest.verify|verify} messages. + * @param message DeleteProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IDeleteProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteProcessorRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteProcessorRequest + * @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.v1.DeleteProcessorRequest; + + /** + * Decodes a DeleteProcessorRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteProcessorRequest + * @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.v1.DeleteProcessorRequest; + + /** + * Verifies a DeleteProcessorRequest 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 DeleteProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteProcessorRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.DeleteProcessorRequest; + + /** + * Creates a plain object from a DeleteProcessorRequest message. Also converts values to other types if specified. + * @param message DeleteProcessorRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.DeleteProcessorRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteProcessorRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DeleteProcessorMetadata. */ + interface IDeleteProcessorMetadata { + + /** DeleteProcessorMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + } + + /** Represents a DeleteProcessorMetadata. */ + class DeleteProcessorMetadata implements IDeleteProcessorMetadata { + + /** + * Constructs a new DeleteProcessorMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IDeleteProcessorMetadata); + + /** DeleteProcessorMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + + /** + * Creates a new DeleteProcessorMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteProcessorMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1.IDeleteProcessorMetadata): google.cloud.documentai.v1.DeleteProcessorMetadata; + + /** + * Encodes the specified DeleteProcessorMetadata message. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorMetadata.verify|verify} messages. + * @param message DeleteProcessorMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IDeleteProcessorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteProcessorMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorMetadata.verify|verify} messages. + * @param message DeleteProcessorMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IDeleteProcessorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteProcessorMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteProcessorMetadata + * @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.v1.DeleteProcessorMetadata; + + /** + * Decodes a DeleteProcessorMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteProcessorMetadata + * @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.v1.DeleteProcessorMetadata; + + /** + * Verifies a DeleteProcessorMetadata 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 DeleteProcessorMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteProcessorMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.DeleteProcessorMetadata; + + /** + * Creates a plain object from a DeleteProcessorMetadata message. Also converts values to other types if specified. + * @param message DeleteProcessorMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.DeleteProcessorMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteProcessorMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EnableProcessorRequest. */ + interface IEnableProcessorRequest { + + /** EnableProcessorRequest name */ + name?: (string|null); + } + + /** Represents an EnableProcessorRequest. */ + class EnableProcessorRequest implements IEnableProcessorRequest { + + /** + * Constructs a new EnableProcessorRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IEnableProcessorRequest); + + /** EnableProcessorRequest name. */ + public name: string; + + /** + * Creates a new EnableProcessorRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns EnableProcessorRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IEnableProcessorRequest): google.cloud.documentai.v1.EnableProcessorRequest; + + /** + * Encodes the specified EnableProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1.EnableProcessorRequest.verify|verify} messages. + * @param message EnableProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IEnableProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnableProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.EnableProcessorRequest.verify|verify} messages. + * @param message EnableProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IEnableProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnableProcessorRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnableProcessorRequest + * @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.v1.EnableProcessorRequest; + + /** + * Decodes an EnableProcessorRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnableProcessorRequest + * @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.v1.EnableProcessorRequest; + + /** + * Verifies an EnableProcessorRequest 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 EnableProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnableProcessorRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.EnableProcessorRequest; + + /** + * Creates a plain object from an EnableProcessorRequest message. Also converts values to other types if specified. + * @param message EnableProcessorRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.EnableProcessorRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnableProcessorRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EnableProcessorResponse. */ + interface IEnableProcessorResponse { + } + + /** Represents an EnableProcessorResponse. */ + class EnableProcessorResponse implements IEnableProcessorResponse { + + /** + * Constructs a new EnableProcessorResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IEnableProcessorResponse); + + /** + * Creates a new EnableProcessorResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns EnableProcessorResponse instance + */ + public static create(properties?: google.cloud.documentai.v1.IEnableProcessorResponse): google.cloud.documentai.v1.EnableProcessorResponse; + + /** + * Encodes the specified EnableProcessorResponse message. Does not implicitly {@link google.cloud.documentai.v1.EnableProcessorResponse.verify|verify} messages. + * @param message EnableProcessorResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IEnableProcessorResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnableProcessorResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.EnableProcessorResponse.verify|verify} messages. + * @param message EnableProcessorResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IEnableProcessorResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnableProcessorResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnableProcessorResponse + * @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.v1.EnableProcessorResponse; + + /** + * Decodes an EnableProcessorResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnableProcessorResponse + * @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.v1.EnableProcessorResponse; + + /** + * Verifies an EnableProcessorResponse 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 EnableProcessorResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnableProcessorResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.EnableProcessorResponse; + + /** + * Creates a plain object from an EnableProcessorResponse message. Also converts values to other types if specified. + * @param message EnableProcessorResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.EnableProcessorResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnableProcessorResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of an EnableProcessorMetadata. */ + interface IEnableProcessorMetadata { + + /** EnableProcessorMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + } + + /** Represents an EnableProcessorMetadata. */ + class EnableProcessorMetadata implements IEnableProcessorMetadata { + + /** + * Constructs a new EnableProcessorMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IEnableProcessorMetadata); + + /** EnableProcessorMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + + /** + * Creates a new EnableProcessorMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns EnableProcessorMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1.IEnableProcessorMetadata): google.cloud.documentai.v1.EnableProcessorMetadata; + + /** + * Encodes the specified EnableProcessorMetadata message. Does not implicitly {@link google.cloud.documentai.v1.EnableProcessorMetadata.verify|verify} messages. + * @param message EnableProcessorMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IEnableProcessorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnableProcessorMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.EnableProcessorMetadata.verify|verify} messages. + * @param message EnableProcessorMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IEnableProcessorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnableProcessorMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnableProcessorMetadata + * @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.v1.EnableProcessorMetadata; + + /** + * Decodes an EnableProcessorMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnableProcessorMetadata + * @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.v1.EnableProcessorMetadata; + + /** + * Verifies an EnableProcessorMetadata 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 EnableProcessorMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnableProcessorMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.EnableProcessorMetadata; + + /** + * Creates a plain object from an EnableProcessorMetadata message. Also converts values to other types if specified. + * @param message EnableProcessorMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.EnableProcessorMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnableProcessorMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DisableProcessorRequest. */ + interface IDisableProcessorRequest { + + /** DisableProcessorRequest name */ + name?: (string|null); + } + + /** Represents a DisableProcessorRequest. */ + class DisableProcessorRequest implements IDisableProcessorRequest { + + /** + * Constructs a new DisableProcessorRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IDisableProcessorRequest); + + /** DisableProcessorRequest name. */ + public name: string; + + /** + * Creates a new DisableProcessorRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DisableProcessorRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.IDisableProcessorRequest): google.cloud.documentai.v1.DisableProcessorRequest; + + /** + * Encodes the specified DisableProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1.DisableProcessorRequest.verify|verify} messages. + * @param message DisableProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IDisableProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DisableProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DisableProcessorRequest.verify|verify} messages. + * @param message DisableProcessorRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IDisableProcessorRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DisableProcessorRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DisableProcessorRequest + * @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.v1.DisableProcessorRequest; + + /** + * Decodes a DisableProcessorRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DisableProcessorRequest + * @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.v1.DisableProcessorRequest; + + /** + * Verifies a DisableProcessorRequest 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 DisableProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DisableProcessorRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.DisableProcessorRequest; + + /** + * Creates a plain object from a DisableProcessorRequest message. Also converts values to other types if specified. + * @param message DisableProcessorRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.DisableProcessorRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DisableProcessorRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DisableProcessorResponse. */ + interface IDisableProcessorResponse { + } + + /** Represents a DisableProcessorResponse. */ + class DisableProcessorResponse implements IDisableProcessorResponse { + + /** + * Constructs a new DisableProcessorResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IDisableProcessorResponse); + + /** + * Creates a new DisableProcessorResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns DisableProcessorResponse instance + */ + public static create(properties?: google.cloud.documentai.v1.IDisableProcessorResponse): google.cloud.documentai.v1.DisableProcessorResponse; + + /** + * Encodes the specified DisableProcessorResponse message. Does not implicitly {@link google.cloud.documentai.v1.DisableProcessorResponse.verify|verify} messages. + * @param message DisableProcessorResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IDisableProcessorResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DisableProcessorResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DisableProcessorResponse.verify|verify} messages. + * @param message DisableProcessorResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IDisableProcessorResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DisableProcessorResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DisableProcessorResponse + * @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.v1.DisableProcessorResponse; + + /** + * Decodes a DisableProcessorResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DisableProcessorResponse + * @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.v1.DisableProcessorResponse; + + /** + * Verifies a DisableProcessorResponse 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 DisableProcessorResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DisableProcessorResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.DisableProcessorResponse; + + /** + * Creates a plain object from a DisableProcessorResponse message. Also converts values to other types if specified. + * @param message DisableProcessorResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.DisableProcessorResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DisableProcessorResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a DisableProcessorMetadata. */ + interface IDisableProcessorMetadata { + + /** DisableProcessorMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + } + + /** Represents a DisableProcessorMetadata. */ + class DisableProcessorMetadata implements IDisableProcessorMetadata { + + /** + * Constructs a new DisableProcessorMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.IDisableProcessorMetadata); + + /** DisableProcessorMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + + /** + * Creates a new DisableProcessorMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns DisableProcessorMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1.IDisableProcessorMetadata): google.cloud.documentai.v1.DisableProcessorMetadata; + + /** + * Encodes the specified DisableProcessorMetadata message. Does not implicitly {@link google.cloud.documentai.v1.DisableProcessorMetadata.verify|verify} messages. + * @param message DisableProcessorMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.IDisableProcessorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DisableProcessorMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DisableProcessorMetadata.verify|verify} messages. + * @param message DisableProcessorMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.IDisableProcessorMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DisableProcessorMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DisableProcessorMetadata + * @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.v1.DisableProcessorMetadata; + + /** + * Decodes a DisableProcessorMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DisableProcessorMetadata + * @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.v1.DisableProcessorMetadata; + + /** + * Verifies a DisableProcessorMetadata 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 DisableProcessorMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DisableProcessorMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.DisableProcessorMetadata; + + /** + * Creates a plain object from a DisableProcessorMetadata message. Also converts values to other types if specified. + * @param message DisableProcessorMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.DisableProcessorMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DisableProcessorMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SetDefaultProcessorVersionRequest. */ + interface ISetDefaultProcessorVersionRequest { + + /** SetDefaultProcessorVersionRequest processor */ + processor?: (string|null); + + /** SetDefaultProcessorVersionRequest defaultProcessorVersion */ + defaultProcessorVersion?: (string|null); + } + + /** Represents a SetDefaultProcessorVersionRequest. */ + class SetDefaultProcessorVersionRequest implements ISetDefaultProcessorVersionRequest { + + /** + * Constructs a new SetDefaultProcessorVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest); + + /** SetDefaultProcessorVersionRequest processor. */ + public processor: string; + + /** SetDefaultProcessorVersionRequest defaultProcessorVersion. */ + public defaultProcessorVersion: string; + + /** + * Creates a new SetDefaultProcessorVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SetDefaultProcessorVersionRequest instance + */ + public static create(properties?: google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest): google.cloud.documentai.v1.SetDefaultProcessorVersionRequest; + + /** + * Encodes the specified SetDefaultProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1.SetDefaultProcessorVersionRequest.verify|verify} messages. + * @param message SetDefaultProcessorVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SetDefaultProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.SetDefaultProcessorVersionRequest.verify|verify} messages. + * @param message SetDefaultProcessorVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SetDefaultProcessorVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SetDefaultProcessorVersionRequest + * @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.v1.SetDefaultProcessorVersionRequest; + + /** + * Decodes a SetDefaultProcessorVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SetDefaultProcessorVersionRequest + * @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.v1.SetDefaultProcessorVersionRequest; + + /** + * Verifies a SetDefaultProcessorVersionRequest 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 SetDefaultProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SetDefaultProcessorVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.SetDefaultProcessorVersionRequest; + + /** + * Creates a plain object from a SetDefaultProcessorVersionRequest message. Also converts values to other types if specified. + * @param message SetDefaultProcessorVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.SetDefaultProcessorVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SetDefaultProcessorVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a SetDefaultProcessorVersionResponse. */ + interface ISetDefaultProcessorVersionResponse { + } + + /** Represents a SetDefaultProcessorVersionResponse. */ + class SetDefaultProcessorVersionResponse implements ISetDefaultProcessorVersionResponse { + + /** + * Constructs a new SetDefaultProcessorVersionResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse); + + /** + * Creates a new SetDefaultProcessorVersionResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SetDefaultProcessorVersionResponse instance + */ + public static create(properties?: google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse): google.cloud.documentai.v1.SetDefaultProcessorVersionResponse; + + /** + * Encodes the specified SetDefaultProcessorVersionResponse message. Does not implicitly {@link google.cloud.documentai.v1.SetDefaultProcessorVersionResponse.verify|verify} messages. + * @param message SetDefaultProcessorVersionResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SetDefaultProcessorVersionResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.SetDefaultProcessorVersionResponse.verify|verify} messages. + * @param message SetDefaultProcessorVersionResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SetDefaultProcessorVersionResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SetDefaultProcessorVersionResponse + * @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.v1.SetDefaultProcessorVersionResponse; + + /** + * Decodes a SetDefaultProcessorVersionResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SetDefaultProcessorVersionResponse + * @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.v1.SetDefaultProcessorVersionResponse; + + /** + * Verifies a SetDefaultProcessorVersionResponse 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 SetDefaultProcessorVersionResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SetDefaultProcessorVersionResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.SetDefaultProcessorVersionResponse; + + /** + * Creates a plain object from a SetDefaultProcessorVersionResponse message. Also converts values to other types if specified. + * @param message SetDefaultProcessorVersionResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.SetDefaultProcessorVersionResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ProcessRequest to JSON. + * Converts this SetDefaultProcessorVersionResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a HumanReviewStatus. */ - interface IHumanReviewStatus { + /** Properties of a SetDefaultProcessorVersionMetadata. */ + interface ISetDefaultProcessorVersionMetadata { - /** HumanReviewStatus state */ - state?: (google.cloud.documentai.v1.HumanReviewStatus.State|keyof typeof google.cloud.documentai.v1.HumanReviewStatus.State|null); + /** SetDefaultProcessorVersionMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + } - /** HumanReviewStatus stateMessage */ - stateMessage?: (string|null); + /** Represents a SetDefaultProcessorVersionMetadata. */ + class SetDefaultProcessorVersionMetadata implements ISetDefaultProcessorVersionMetadata { - /** HumanReviewStatus humanReviewOperation */ - humanReviewOperation?: (string|null); + /** + * Constructs a new SetDefaultProcessorVersionMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata); + + /** SetDefaultProcessorVersionMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + + /** + * Creates a new SetDefaultProcessorVersionMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns SetDefaultProcessorVersionMetadata instance + */ + public static create(properties?: google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata): google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata; + + /** + * Encodes the specified SetDefaultProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata.verify|verify} messages. + * @param message SetDefaultProcessorVersionMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SetDefaultProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata.verify|verify} messages. + * @param message SetDefaultProcessorVersionMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SetDefaultProcessorVersionMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SetDefaultProcessorVersionMetadata + * @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.v1.SetDefaultProcessorVersionMetadata; + + /** + * Decodes a SetDefaultProcessorVersionMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SetDefaultProcessorVersionMetadata + * @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.v1.SetDefaultProcessorVersionMetadata; + + /** + * Verifies a SetDefaultProcessorVersionMetadata 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 SetDefaultProcessorVersionMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SetDefaultProcessorVersionMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata; + + /** + * Creates a plain object from a SetDefaultProcessorVersionMetadata message. Also converts values to other types if specified. + * @param message SetDefaultProcessorVersionMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SetDefaultProcessorVersionMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; } - /** Represents a HumanReviewStatus. */ - class HumanReviewStatus implements IHumanReviewStatus { + /** Properties of a ReviewDocumentRequest. */ + interface IReviewDocumentRequest { + + /** ReviewDocumentRequest inlineDocument */ + inlineDocument?: (google.cloud.documentai.v1.IDocument|null); + + /** ReviewDocumentRequest humanReviewConfig */ + humanReviewConfig?: (string|null); + + /** ReviewDocumentRequest enableSchemaValidation */ + enableSchemaValidation?: (boolean|null); + + /** ReviewDocumentRequest priority */ + priority?: (google.cloud.documentai.v1.ReviewDocumentRequest.Priority|keyof typeof google.cloud.documentai.v1.ReviewDocumentRequest.Priority|null); + + /** ReviewDocumentRequest documentSchema */ + documentSchema?: (google.cloud.documentai.v1.IDocumentSchema|null); + } + + /** Represents a ReviewDocumentRequest. */ + class ReviewDocumentRequest implements IReviewDocumentRequest { /** - * Constructs a new HumanReviewStatus. + * Constructs a new ReviewDocumentRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1.IHumanReviewStatus); + constructor(properties?: google.cloud.documentai.v1.IReviewDocumentRequest); - /** HumanReviewStatus state. */ - public state: (google.cloud.documentai.v1.HumanReviewStatus.State|keyof typeof google.cloud.documentai.v1.HumanReviewStatus.State); + /** ReviewDocumentRequest inlineDocument. */ + public inlineDocument?: (google.cloud.documentai.v1.IDocument|null); - /** HumanReviewStatus stateMessage. */ - public stateMessage: string; + /** ReviewDocumentRequest humanReviewConfig. */ + public humanReviewConfig: string; - /** HumanReviewStatus humanReviewOperation. */ - public humanReviewOperation: string; + /** ReviewDocumentRequest enableSchemaValidation. */ + public enableSchemaValidation: boolean; + + /** ReviewDocumentRequest priority. */ + public priority: (google.cloud.documentai.v1.ReviewDocumentRequest.Priority|keyof typeof google.cloud.documentai.v1.ReviewDocumentRequest.Priority); + + /** ReviewDocumentRequest documentSchema. */ + public documentSchema?: (google.cloud.documentai.v1.IDocumentSchema|null); + + /** ReviewDocumentRequest source. */ + public source?: "inlineDocument"; /** - * Creates a new HumanReviewStatus instance using the specified properties. + * Creates a new ReviewDocumentRequest instance using the specified properties. * @param [properties] Properties to set - * @returns HumanReviewStatus instance + * @returns ReviewDocumentRequest instance */ - public static create(properties?: google.cloud.documentai.v1.IHumanReviewStatus): google.cloud.documentai.v1.HumanReviewStatus; + public static create(properties?: google.cloud.documentai.v1.IReviewDocumentRequest): google.cloud.documentai.v1.ReviewDocumentRequest; /** - * Encodes the specified HumanReviewStatus message. Does not implicitly {@link google.cloud.documentai.v1.HumanReviewStatus.verify|verify} messages. - * @param message HumanReviewStatus message or plain object to encode + * Encodes the specified ReviewDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1.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.v1.IHumanReviewStatus, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1.IReviewDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified HumanReviewStatus message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.HumanReviewStatus.verify|verify} messages. - * @param message HumanReviewStatus message or plain object to encode + * Encodes the specified ReviewDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.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.v1.IHumanReviewStatus, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1.IReviewDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a HumanReviewStatus message from the specified reader or buffer. + * 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 HumanReviewStatus + * @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.v1.HumanReviewStatus; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ReviewDocumentRequest; /** - * Decodes a HumanReviewStatus message from the specified reader or buffer, length delimited. + * Decodes a ReviewDocumentRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns HumanReviewStatus + * @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.v1.HumanReviewStatus; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ReviewDocumentRequest; /** - * Verifies a HumanReviewStatus message. + * 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 HumanReviewStatus message from a plain object. Also converts values to their respective internal types. + * Creates a ReviewDocumentRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns HumanReviewStatus + * @returns ReviewDocumentRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.HumanReviewStatus; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ReviewDocumentRequest; /** - * Creates a plain object from a HumanReviewStatus message. Also converts values to other types if specified. - * @param message HumanReviewStatus + * 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.v1.HumanReviewStatus, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1.ReviewDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this HumanReviewStatus to JSON. + * Converts this ReviewDocumentRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace HumanReviewStatus { + namespace ReviewDocumentRequest { - /** State enum. */ - enum State { - STATE_UNSPECIFIED = 0, - SKIPPED = 1, - VALIDATION_PASSED = 2, - IN_PROGRESS = 3, - ERROR = 4 + /** Priority enum. */ + enum Priority { + DEFAULT = 0, + URGENT = 1 } } - /** Properties of a ProcessResponse. */ - interface IProcessResponse { + /** Properties of a ReviewDocumentResponse. */ + interface IReviewDocumentResponse { - /** ProcessResponse document */ - document?: (google.cloud.documentai.v1.IDocument|null); + /** ReviewDocumentResponse gcsDestination */ + gcsDestination?: (string|null); - /** ProcessResponse humanReviewStatus */ - humanReviewStatus?: (google.cloud.documentai.v1.IHumanReviewStatus|null); + /** ReviewDocumentResponse state */ + state?: (google.cloud.documentai.v1.ReviewDocumentResponse.State|keyof typeof google.cloud.documentai.v1.ReviewDocumentResponse.State|null); + + /** ReviewDocumentResponse rejectionReason */ + rejectionReason?: (string|null); } - /** Represents a ProcessResponse. */ - class ProcessResponse implements IProcessResponse { + /** Represents a ReviewDocumentResponse. */ + class ReviewDocumentResponse implements IReviewDocumentResponse { /** - * Constructs a new ProcessResponse. + * Constructs a new ReviewDocumentResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1.IProcessResponse); + constructor(properties?: google.cloud.documentai.v1.IReviewDocumentResponse); - /** ProcessResponse document. */ - public document?: (google.cloud.documentai.v1.IDocument|null); + /** ReviewDocumentResponse gcsDestination. */ + public gcsDestination: string; - /** ProcessResponse humanReviewStatus. */ - public humanReviewStatus?: (google.cloud.documentai.v1.IHumanReviewStatus|null); + /** ReviewDocumentResponse state. */ + public state: (google.cloud.documentai.v1.ReviewDocumentResponse.State|keyof typeof google.cloud.documentai.v1.ReviewDocumentResponse.State); + + /** ReviewDocumentResponse rejectionReason. */ + public rejectionReason: string; /** - * Creates a new ProcessResponse instance using the specified properties. + * Creates a new ReviewDocumentResponse instance using the specified properties. * @param [properties] Properties to set - * @returns ProcessResponse instance + * @returns ReviewDocumentResponse instance */ - public static create(properties?: google.cloud.documentai.v1.IProcessResponse): google.cloud.documentai.v1.ProcessResponse; + public static create(properties?: google.cloud.documentai.v1.IReviewDocumentResponse): google.cloud.documentai.v1.ReviewDocumentResponse; /** - * Encodes the specified ProcessResponse message. Does not implicitly {@link google.cloud.documentai.v1.ProcessResponse.verify|verify} messages. - * @param message ProcessResponse message or plain object to encode + * Encodes the specified ReviewDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1.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.v1.IProcessResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1.IReviewDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified ProcessResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ProcessResponse.verify|verify} messages. - * @param message ProcessResponse message or plain object to encode + /** + * Encodes the specified ReviewDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.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.v1.IProcessResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1.IReviewDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ProcessResponse message from the specified reader or buffer. + * 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 ProcessResponse + * @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.v1.ProcessResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ReviewDocumentResponse; /** - * Decodes a ProcessResponse message from the specified reader or buffer, length delimited. + * Decodes a ReviewDocumentResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ProcessResponse + * @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.v1.ProcessResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ReviewDocumentResponse; /** - * Verifies a ProcessResponse message. + * 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 ProcessResponse message from a plain object. Also converts values to their respective internal types. + * Creates a ReviewDocumentResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ProcessResponse + * @returns ReviewDocumentResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ProcessResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ReviewDocumentResponse; /** - * Creates a plain object from a ProcessResponse message. Also converts values to other types if specified. - * @param message ProcessResponse + * 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.v1.ProcessResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1.ReviewDocumentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ProcessResponse to JSON. + * Converts this ReviewDocumentResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a BatchProcessRequest. */ - interface IBatchProcessRequest { + namespace ReviewDocumentResponse { - /** BatchProcessRequest name */ - name?: (string|null); + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + REJECTED = 1, + SUCCEEDED = 2 + } + } - /** BatchProcessRequest inputDocuments */ - inputDocuments?: (google.cloud.documentai.v1.IBatchDocumentsInputConfig|null); + /** Properties of a ReviewDocumentOperationMetadata. */ + interface IReviewDocumentOperationMetadata { - /** BatchProcessRequest documentOutputConfig */ - documentOutputConfig?: (google.cloud.documentai.v1.IDocumentOutputConfig|null); + /** ReviewDocumentOperationMetadata commonMetadata */ + commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); - /** BatchProcessRequest skipHumanReview */ - skipHumanReview?: (boolean|null); + /** ReviewDocumentOperationMetadata questionId */ + questionId?: (string|null); } - /** Represents a BatchProcessRequest. */ - class BatchProcessRequest implements IBatchProcessRequest { + /** Represents a ReviewDocumentOperationMetadata. */ + class ReviewDocumentOperationMetadata implements IReviewDocumentOperationMetadata { /** - * Constructs a new BatchProcessRequest. + * Constructs a new ReviewDocumentOperationMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1.IBatchProcessRequest); - - /** BatchProcessRequest name. */ - public name: string; - - /** BatchProcessRequest inputDocuments. */ - public inputDocuments?: (google.cloud.documentai.v1.IBatchDocumentsInputConfig|null); + constructor(properties?: google.cloud.documentai.v1.IReviewDocumentOperationMetadata); - /** BatchProcessRequest documentOutputConfig. */ - public documentOutputConfig?: (google.cloud.documentai.v1.IDocumentOutputConfig|null); + /** ReviewDocumentOperationMetadata commonMetadata. */ + public commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); - /** BatchProcessRequest skipHumanReview. */ - public skipHumanReview: boolean; + /** ReviewDocumentOperationMetadata questionId. */ + public questionId: string; /** - * Creates a new BatchProcessRequest instance using the specified properties. + * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns BatchProcessRequest instance + * @returns ReviewDocumentOperationMetadata instance */ - public static create(properties?: google.cloud.documentai.v1.IBatchProcessRequest): google.cloud.documentai.v1.BatchProcessRequest; + public static create(properties?: google.cloud.documentai.v1.IReviewDocumentOperationMetadata): google.cloud.documentai.v1.ReviewDocumentOperationMetadata; /** - * Encodes the specified BatchProcessRequest message. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessRequest.verify|verify} messages. - * @param message BatchProcessRequest message or plain object to encode + * Encodes the specified ReviewDocumentOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1.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.v1.IBatchProcessRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1.IReviewDocumentOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified BatchProcessRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessRequest.verify|verify} messages. - * @param message BatchProcessRequest message or plain object to encode + * Encodes the specified ReviewDocumentOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.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.v1.IBatchProcessRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1.IReviewDocumentOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a BatchProcessRequest message from the specified reader or buffer. + * 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 BatchProcessRequest + * @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.v1.BatchProcessRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ReviewDocumentOperationMetadata; /** - * Decodes a BatchProcessRequest message from the specified reader or buffer, length delimited. + * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns BatchProcessRequest + * @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.v1.BatchProcessRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ReviewDocumentOperationMetadata; /** - * Verifies a BatchProcessRequest message. + * 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 BatchProcessRequest message from a plain object. Also converts values to their respective internal types. + * Creates a ReviewDocumentOperationMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns BatchProcessRequest + * @returns ReviewDocumentOperationMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.BatchProcessRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ReviewDocumentOperationMetadata; /** - * Creates a plain object from a BatchProcessRequest message. Also converts values to other types if specified. - * @param message BatchProcessRequest + * 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.v1.BatchProcessRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1.ReviewDocumentOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this BatchProcessRequest to JSON. + * Converts this ReviewDocumentOperationMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a BatchProcessResponse. */ - interface IBatchProcessResponse { + /** Properties of a DocumentSchema. */ + interface IDocumentSchema { + + /** DocumentSchema displayName */ + displayName?: (string|null); + + /** DocumentSchema description */ + description?: (string|null); + + /** DocumentSchema entityTypes */ + entityTypes?: (google.cloud.documentai.v1.DocumentSchema.IEntityType[]|null); + + /** DocumentSchema metadata */ + metadata?: (google.cloud.documentai.v1.DocumentSchema.IMetadata|null); } - /** Represents a BatchProcessResponse. */ - class BatchProcessResponse implements IBatchProcessResponse { + /** Represents a DocumentSchema. */ + class DocumentSchema implements IDocumentSchema { /** - * Constructs a new BatchProcessResponse. + * Constructs a new DocumentSchema. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1.IBatchProcessResponse); + constructor(properties?: google.cloud.documentai.v1.IDocumentSchema); + + /** DocumentSchema displayName. */ + public displayName: string; + + /** DocumentSchema description. */ + public description: string; + + /** DocumentSchema entityTypes. */ + public entityTypes: google.cloud.documentai.v1.DocumentSchema.IEntityType[]; + + /** DocumentSchema metadata. */ + public metadata?: (google.cloud.documentai.v1.DocumentSchema.IMetadata|null); /** - * Creates a new BatchProcessResponse instance using the specified properties. + * Creates a new DocumentSchema instance using the specified properties. * @param [properties] Properties to set - * @returns BatchProcessResponse instance + * @returns DocumentSchema instance */ - public static create(properties?: google.cloud.documentai.v1.IBatchProcessResponse): google.cloud.documentai.v1.BatchProcessResponse; + public static create(properties?: google.cloud.documentai.v1.IDocumentSchema): google.cloud.documentai.v1.DocumentSchema; /** - * Encodes the specified BatchProcessResponse message. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessResponse.verify|verify} messages. - * @param message BatchProcessResponse message or plain object to encode + * Encodes the specified DocumentSchema message. Does not implicitly {@link google.cloud.documentai.v1.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.v1.IBatchProcessResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1.IDocumentSchema, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified BatchProcessResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessResponse.verify|verify} messages. - * @param message BatchProcessResponse message or plain object to encode + * Encodes the specified DocumentSchema message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.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.v1.IBatchProcessResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1.IDocumentSchema, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a BatchProcessResponse message from the specified reader or buffer. + * 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 BatchProcessResponse + * @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.v1.BatchProcessResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.DocumentSchema; /** - * Decodes a BatchProcessResponse message from the specified reader or buffer, length delimited. + * Decodes a DocumentSchema message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns BatchProcessResponse + * @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.v1.BatchProcessResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.DocumentSchema; /** - * Verifies a BatchProcessResponse message. + * 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 BatchProcessResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BatchProcessResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.BatchProcessResponse; + /** + * 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.v1.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.v1.DocumentSchema, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DocumentSchema to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace DocumentSchema { + + /** Properties of an EntityType. */ + interface IEntityType { + + /** EntityType enumValues */ + enumValues?: (google.cloud.documentai.v1.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.v1.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.v1.DocumentSchema.IEntityType); + + /** EntityType enumValues. */ + public enumValues?: (google.cloud.documentai.v1.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.v1.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.v1.DocumentSchema.IEntityType): google.cloud.documentai.v1.DocumentSchema.EntityType; + + /** + * Encodes the specified EntityType message. Does not implicitly {@link google.cloud.documentai.v1.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.v1.DocumentSchema.IEntityType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EntityType message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.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.v1.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.v1.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.v1.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.v1.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.v1.DocumentSchema.EntityType, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EntityType to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + 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.v1.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.v1.DocumentSchema.EntityType.IEnumValues): google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues; + + /** + * Encodes the specified EnumValues message. Does not implicitly {@link google.cloud.documentai.v1.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.v1.DocumentSchema.EntityType.IEnumValues, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumValues message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.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.v1.DocumentSchema.EntityType.IEnumValues, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Creates a plain object from a BatchProcessResponse message. Also converts values to other types if specified. - * @param message BatchProcessResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.documentai.v1.BatchProcessResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * 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.v1.DocumentSchema.EntityType.EnumValues; - /** - * Converts this BatchProcessResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * 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.v1.DocumentSchema.EntityType.EnumValues; - /** Properties of a BatchProcessMetadata. */ - interface IBatchProcessMetadata { + /** + * 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); - /** BatchProcessMetadata state */ - state?: (google.cloud.documentai.v1.BatchProcessMetadata.State|keyof typeof google.cloud.documentai.v1.BatchProcessMetadata.State|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.v1.DocumentSchema.EntityType.EnumValues; - /** BatchProcessMetadata stateMessage */ - stateMessage?: (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.v1.DocumentSchema.EntityType.EnumValues, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** BatchProcessMetadata createTime */ - createTime?: (google.protobuf.ITimestamp|null); + /** + * Converts this EnumValues to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** BatchProcessMetadata updateTime */ - updateTime?: (google.protobuf.ITimestamp|null); + /** Properties of a Property. */ + interface IProperty { - /** BatchProcessMetadata individualProcessStatuses */ - individualProcessStatuses?: (google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus[]|null); - } + /** Property name */ + name?: (string|null); - /** Represents a BatchProcessMetadata. */ - class BatchProcessMetadata implements IBatchProcessMetadata { + /** Property valueType */ + valueType?: (string|null); - /** - * Constructs a new BatchProcessMetadata. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.documentai.v1.IBatchProcessMetadata); + /** Property occurrenceType */ + occurrenceType?: (google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType|keyof typeof google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType|null); + } - /** BatchProcessMetadata state. */ - public state: (google.cloud.documentai.v1.BatchProcessMetadata.State|keyof typeof google.cloud.documentai.v1.BatchProcessMetadata.State); + /** Represents a Property. */ + class Property implements IProperty { - /** BatchProcessMetadata stateMessage. */ - public stateMessage: string; + /** + * Constructs a new Property. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.DocumentSchema.EntityType.IProperty); - /** BatchProcessMetadata createTime. */ - public createTime?: (google.protobuf.ITimestamp|null); + /** Property name. */ + public name: string; - /** BatchProcessMetadata updateTime. */ - public updateTime?: (google.protobuf.ITimestamp|null); + /** Property valueType. */ + public valueType: string; - /** BatchProcessMetadata individualProcessStatuses. */ - public individualProcessStatuses: google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus[]; + /** Property occurrenceType. */ + public occurrenceType: (google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType|keyof typeof google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType); - /** - * Creates a new BatchProcessMetadata instance using the specified properties. - * @param [properties] Properties to set - * @returns BatchProcessMetadata instance - */ - public static create(properties?: google.cloud.documentai.v1.IBatchProcessMetadata): google.cloud.documentai.v1.BatchProcessMetadata; + /** + * Creates a new Property instance using the specified properties. + * @param [properties] Properties to set + * @returns Property instance + */ + public static create(properties?: google.cloud.documentai.v1.DocumentSchema.EntityType.IProperty): google.cloud.documentai.v1.DocumentSchema.EntityType.Property; - /** - * Encodes the specified BatchProcessMetadata message. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessMetadata.verify|verify} messages. - * @param message BatchProcessMetadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.documentai.v1.IBatchProcessMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified Property message. Does not implicitly {@link google.cloud.documentai.v1.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.v1.DocumentSchema.EntityType.IProperty, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Encodes the specified BatchProcessMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessMetadata.verify|verify} messages. - * @param message BatchProcessMetadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.documentai.v1.IBatchProcessMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + /** + * Encodes the specified Property message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.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.v1.DocumentSchema.EntityType.IProperty, writer?: $protobuf.Writer): $protobuf.Writer; - /** - * Decodes a BatchProcessMetadata message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BatchProcessMetadata - * @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.v1.BatchProcessMetadata; + /** + * 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.v1.DocumentSchema.EntityType.Property; - /** - * Decodes a BatchProcessMetadata message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BatchProcessMetadata - * @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.v1.BatchProcessMetadata; + /** + * 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.v1.DocumentSchema.EntityType.Property; - /** - * Verifies a BatchProcessMetadata 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 BatchProcessMetadata message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BatchProcessMetadata - */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.BatchProcessMetadata; + /** + * 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.v1.DocumentSchema.EntityType.Property; - /** - * Creates a plain object from a BatchProcessMetadata message. Also converts values to other types if specified. - * @param message BatchProcessMetadata - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.documentai.v1.BatchProcessMetadata, 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.v1.DocumentSchema.EntityType.Property, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Converts this BatchProcessMetadata to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } + /** + * Converts this Property to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - namespace BatchProcessMetadata { + namespace Property { - /** Properties of an IndividualProcessStatus. */ - interface IIndividualProcessStatus { + /** OccurrenceType enum. */ + enum OccurrenceType { + OCCURRENCE_TYPE_UNSPECIFIED = 0, + OPTIONAL_ONCE = 1, + OPTIONAL_MULTIPLE = 2, + REQUIRED_ONCE = 3, + REQUIRED_MULTIPLE = 4 + } + } + } - /** IndividualProcessStatus inputGcsSource */ - inputGcsSource?: (string|null); + /** Properties of a Metadata. */ + interface IMetadata { - /** IndividualProcessStatus status */ - status?: (google.rpc.IStatus|null); + /** Metadata documentSplitter */ + documentSplitter?: (boolean|null); - /** IndividualProcessStatus outputGcsDestination */ - outputGcsDestination?: (string|null); + /** Metadata documentAllowMultipleLabels */ + documentAllowMultipleLabels?: (boolean|null); - /** IndividualProcessStatus humanReviewStatus */ - humanReviewStatus?: (google.cloud.documentai.v1.IHumanReviewStatus|null); + /** Metadata prefixedNamingOnProperties */ + prefixedNamingOnProperties?: (boolean|null); + + /** Metadata skipNamingValidation */ + skipNamingValidation?: (boolean|null); } - /** Represents an IndividualProcessStatus. */ - class IndividualProcessStatus implements IIndividualProcessStatus { + /** Represents a Metadata. */ + class Metadata implements IMetadata { /** - * Constructs a new IndividualProcessStatus. + * Constructs a new Metadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus); + constructor(properties?: google.cloud.documentai.v1.DocumentSchema.IMetadata); - /** IndividualProcessStatus inputGcsSource. */ - public inputGcsSource: string; + /** Metadata documentSplitter. */ + public documentSplitter: boolean; - /** IndividualProcessStatus status. */ - public status?: (google.rpc.IStatus|null); + /** Metadata documentAllowMultipleLabels. */ + public documentAllowMultipleLabels: boolean; - /** IndividualProcessStatus outputGcsDestination. */ - public outputGcsDestination: string; + /** Metadata prefixedNamingOnProperties. */ + public prefixedNamingOnProperties: boolean; - /** IndividualProcessStatus humanReviewStatus. */ - public humanReviewStatus?: (google.cloud.documentai.v1.IHumanReviewStatus|null); + /** Metadata skipNamingValidation. */ + public skipNamingValidation: boolean; /** - * Creates a new IndividualProcessStatus instance using the specified properties. + * Creates a new Metadata instance using the specified properties. * @param [properties] Properties to set - * @returns IndividualProcessStatus instance + * @returns Metadata instance */ - public static create(properties?: google.cloud.documentai.v1.BatchProcessMetadata.IIndividualProcessStatus): google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus; + public static create(properties?: google.cloud.documentai.v1.DocumentSchema.IMetadata): google.cloud.documentai.v1.DocumentSchema.Metadata; /** - * Encodes the specified IndividualProcessStatus message. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.verify|verify} messages. - * @param message IndividualProcessStatus message or plain object to encode + * Encodes the specified Metadata message. Does not implicitly {@link google.cloud.documentai.v1.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.v1.BatchProcessMetadata.IIndividualProcessStatus, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1.DocumentSchema.IMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified IndividualProcessStatus message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.verify|verify} messages. - * @param message IndividualProcessStatus message or plain object to encode + * Encodes the specified Metadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.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.v1.BatchProcessMetadata.IIndividualProcessStatus, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1.DocumentSchema.IMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an IndividualProcessStatus message from the specified reader or buffer. + * 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 IndividualProcessStatus + * @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.v1.BatchProcessMetadata.IndividualProcessStatus; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.DocumentSchema.Metadata; /** - * Decodes an IndividualProcessStatus message from the specified reader or buffer, length delimited. + * Decodes a Metadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns IndividualProcessStatus + * @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.v1.BatchProcessMetadata.IndividualProcessStatus; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.DocumentSchema.Metadata; /** - * Verifies an IndividualProcessStatus message. + * 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 an IndividualProcessStatus message from a plain object. Also converts values to their respective internal types. + * Creates a Metadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns IndividualProcessStatus + * @returns Metadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.DocumentSchema.Metadata; /** - * Creates a plain object from an IndividualProcessStatus message. Also converts values to other types if specified. - * @param message IndividualProcessStatus + * 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.v1.BatchProcessMetadata.IndividualProcessStatus, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1.DocumentSchema.Metadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this IndividualProcessStatus to JSON. + * Converts this Metadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - - /** State enum. */ - enum State { - STATE_UNSPECIFIED = 0, - WAITING = 1, - RUNNING = 2, - SUCCEEDED = 3, - CANCELLING = 4, - CANCELLED = 5, - FAILED = 6 - } } - /** Properties of a ReviewDocumentRequest. */ - interface IReviewDocumentRequest { + /** Properties of a CommonOperationMetadata. */ + interface ICommonOperationMetadata { + + /** CommonOperationMetadata state */ + state?: (google.cloud.documentai.v1.CommonOperationMetadata.State|keyof typeof google.cloud.documentai.v1.CommonOperationMetadata.State|null); - /** ReviewDocumentRequest inlineDocument */ - inlineDocument?: (google.cloud.documentai.v1.IDocument|null); + /** CommonOperationMetadata stateMessage */ + stateMessage?: (string|null); - /** ReviewDocumentRequest humanReviewConfig */ - humanReviewConfig?: (string|null); + /** CommonOperationMetadata resource */ + resource?: (string|null); - /** ReviewDocumentRequest enableSchemaValidation */ - enableSchemaValidation?: (boolean|null); + /** CommonOperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); - /** ReviewDocumentRequest priority */ - priority?: (google.cloud.documentai.v1.ReviewDocumentRequest.Priority|keyof typeof google.cloud.documentai.v1.ReviewDocumentRequest.Priority|null); + /** CommonOperationMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); } - /** Represents a ReviewDocumentRequest. */ - class ReviewDocumentRequest implements IReviewDocumentRequest { + /** Represents a CommonOperationMetadata. */ + class CommonOperationMetadata implements ICommonOperationMetadata { /** - * Constructs a new ReviewDocumentRequest. + * Constructs a new CommonOperationMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1.IReviewDocumentRequest); + constructor(properties?: google.cloud.documentai.v1.ICommonOperationMetadata); - /** ReviewDocumentRequest inlineDocument. */ - public inlineDocument?: (google.cloud.documentai.v1.IDocument|null); + /** CommonOperationMetadata state. */ + public state: (google.cloud.documentai.v1.CommonOperationMetadata.State|keyof typeof google.cloud.documentai.v1.CommonOperationMetadata.State); - /** ReviewDocumentRequest humanReviewConfig. */ - public humanReviewConfig: string; + /** CommonOperationMetadata stateMessage. */ + public stateMessage: string; - /** ReviewDocumentRequest enableSchemaValidation. */ - public enableSchemaValidation: boolean; + /** CommonOperationMetadata resource. */ + public resource: string; - /** ReviewDocumentRequest priority. */ - public priority: (google.cloud.documentai.v1.ReviewDocumentRequest.Priority|keyof typeof google.cloud.documentai.v1.ReviewDocumentRequest.Priority); + /** CommonOperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); - /** ReviewDocumentRequest source. */ - public source?: "inlineDocument"; + /** CommonOperationMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); /** - * Creates a new ReviewDocumentRequest instance using the specified properties. + * Creates a new CommonOperationMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns ReviewDocumentRequest instance + * @returns CommonOperationMetadata instance */ - public static create(properties?: google.cloud.documentai.v1.IReviewDocumentRequest): google.cloud.documentai.v1.ReviewDocumentRequest; + public static create(properties?: google.cloud.documentai.v1.ICommonOperationMetadata): google.cloud.documentai.v1.CommonOperationMetadata; /** - * Encodes the specified ReviewDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentRequest.verify|verify} messages. - * @param message ReviewDocumentRequest message or plain object to encode + * Encodes the specified CommonOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1.CommonOperationMetadata.verify|verify} messages. + * @param message CommonOperationMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1.IReviewDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1.ICommonOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ReviewDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentRequest.verify|verify} messages. - * @param message ReviewDocumentRequest message or plain object to encode + * Encodes the specified CommonOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.CommonOperationMetadata.verify|verify} messages. + * @param message CommonOperationMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1.IReviewDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1.ICommonOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ReviewDocumentRequest message from the specified reader or buffer. + * Decodes a CommonOperationMetadata 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 CommonOperationMetadata * @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.v1.ReviewDocumentRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.CommonOperationMetadata; /** - * Decodes a ReviewDocumentRequest message from the specified reader or buffer, length delimited. + * Decodes a CommonOperationMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ReviewDocumentRequest + * @returns CommonOperationMetadata * @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.v1.ReviewDocumentRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.CommonOperationMetadata; /** - * Verifies a ReviewDocumentRequest message. + * Verifies a CommonOperationMetadata 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 CommonOperationMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ReviewDocumentRequest + * @returns CommonOperationMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ReviewDocumentRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.CommonOperationMetadata; /** - * 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 CommonOperationMetadata message. Also converts values to other types if specified. + * @param message CommonOperationMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1.ReviewDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1.CommonOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ReviewDocumentRequest to JSON. + * Converts this CommonOperationMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace ReviewDocumentRequest { + namespace CommonOperationMetadata { - /** Priority enum. */ - enum Priority { - DEFAULT = 0, - URGENT = 1 + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + RUNNING = 1, + CANCELLING = 2, + SUCCEEDED = 3, + FAILED = 4, + CANCELLED = 5 } } - /** Properties of a ReviewDocumentResponse. */ - interface IReviewDocumentResponse { + /** Properties of a ProcessorVersion. */ + interface IProcessorVersion { - /** ReviewDocumentResponse gcsDestination */ - gcsDestination?: (string|null); + /** ProcessorVersion name */ + name?: (string|null); + + /** ProcessorVersion displayName */ + displayName?: (string|null); + + /** ProcessorVersion state */ + state?: (google.cloud.documentai.v1.ProcessorVersion.State|keyof typeof google.cloud.documentai.v1.ProcessorVersion.State|null); + + /** ProcessorVersion createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** ProcessorVersion kmsKeyName */ + kmsKeyName?: (string|null); + + /** ProcessorVersion kmsKeyVersionName */ + kmsKeyVersionName?: (string|null); + + /** ProcessorVersion googleManaged */ + googleManaged?: (boolean|null); + + /** ProcessorVersion deprecationInfo */ + deprecationInfo?: (google.cloud.documentai.v1.ProcessorVersion.IDeprecationInfo|null); } - /** Represents a ReviewDocumentResponse. */ - class ReviewDocumentResponse implements IReviewDocumentResponse { + /** Represents a ProcessorVersion. */ + class ProcessorVersion implements IProcessorVersion { /** - * Constructs a new ReviewDocumentResponse. + * Constructs a new ProcessorVersion. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1.IReviewDocumentResponse); + constructor(properties?: google.cloud.documentai.v1.IProcessorVersion); - /** ReviewDocumentResponse gcsDestination. */ - public gcsDestination: string; + /** ProcessorVersion name. */ + public name: string; + + /** ProcessorVersion displayName. */ + public displayName: string; + + /** ProcessorVersion state. */ + public state: (google.cloud.documentai.v1.ProcessorVersion.State|keyof typeof google.cloud.documentai.v1.ProcessorVersion.State); + + /** ProcessorVersion createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** ProcessorVersion kmsKeyName. */ + public kmsKeyName: string; + + /** ProcessorVersion kmsKeyVersionName. */ + public kmsKeyVersionName: string; + + /** ProcessorVersion googleManaged. */ + public googleManaged: boolean; + + /** ProcessorVersion deprecationInfo. */ + public deprecationInfo?: (google.cloud.documentai.v1.ProcessorVersion.IDeprecationInfo|null); /** - * Creates a new ReviewDocumentResponse instance using the specified properties. + * Creates a new ProcessorVersion instance using the specified properties. * @param [properties] Properties to set - * @returns ReviewDocumentResponse instance + * @returns ProcessorVersion instance */ - public static create(properties?: google.cloud.documentai.v1.IReviewDocumentResponse): google.cloud.documentai.v1.ReviewDocumentResponse; + public static create(properties?: google.cloud.documentai.v1.IProcessorVersion): google.cloud.documentai.v1.ProcessorVersion; /** - * Encodes the specified ReviewDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentResponse.verify|verify} messages. - * @param message ReviewDocumentResponse message or plain object to encode + * Encodes the specified ProcessorVersion message. Does not implicitly {@link google.cloud.documentai.v1.ProcessorVersion.verify|verify} messages. + * @param message ProcessorVersion message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1.IReviewDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1.IProcessorVersion, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ReviewDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentResponse.verify|verify} messages. - * @param message ReviewDocumentResponse message or plain object to encode + * Encodes the specified ProcessorVersion message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ProcessorVersion.verify|verify} messages. + * @param message ProcessorVersion message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1.IReviewDocumentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1.IProcessorVersion, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ReviewDocumentResponse message from the specified reader or buffer. + * Decodes a ProcessorVersion 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 ProcessorVersion * @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.v1.ReviewDocumentResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ProcessorVersion; /** - * Decodes a ReviewDocumentResponse message from the specified reader or buffer, length delimited. + * Decodes a ProcessorVersion message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ReviewDocumentResponse + * @returns ProcessorVersion * @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.v1.ReviewDocumentResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ProcessorVersion; /** - * Verifies a ReviewDocumentResponse message. + * Verifies a ProcessorVersion 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 ProcessorVersion message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ReviewDocumentResponse + * @returns ProcessorVersion */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ReviewDocumentResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ProcessorVersion; /** - * 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 ProcessorVersion message. Also converts values to other types if specified. + * @param message ProcessorVersion * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1.ReviewDocumentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1.ProcessorVersion, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ReviewDocumentResponse to JSON. + * Converts this ProcessorVersion to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ReviewDocumentOperationMetadata. */ - interface IReviewDocumentOperationMetadata { + namespace ProcessorVersion { - /** ReviewDocumentOperationMetadata commonMetadata */ - commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + /** Properties of a DeprecationInfo. */ + interface IDeprecationInfo { - /** ReviewDocumentOperationMetadata questionId */ - questionId?: (string|null); + /** DeprecationInfo deprecationTime */ + deprecationTime?: (google.protobuf.ITimestamp|null); + + /** DeprecationInfo replacementProcessorVersion */ + replacementProcessorVersion?: (string|null); + } + + /** Represents a DeprecationInfo. */ + class DeprecationInfo implements IDeprecationInfo { + + /** + * Constructs a new DeprecationInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.ProcessorVersion.IDeprecationInfo); + + /** DeprecationInfo deprecationTime. */ + public deprecationTime?: (google.protobuf.ITimestamp|null); + + /** DeprecationInfo replacementProcessorVersion. */ + public replacementProcessorVersion: string; + + /** + * Creates a new DeprecationInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns DeprecationInfo instance + */ + public static create(properties?: google.cloud.documentai.v1.ProcessorVersion.IDeprecationInfo): google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo; + + /** + * Encodes the specified DeprecationInfo message. Does not implicitly {@link google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo.verify|verify} messages. + * @param message DeprecationInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.ProcessorVersion.IDeprecationInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeprecationInfo message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo.verify|verify} messages. + * @param message DeprecationInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.ProcessorVersion.IDeprecationInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeprecationInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeprecationInfo + * @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.v1.ProcessorVersion.DeprecationInfo; + + /** + * Decodes a DeprecationInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeprecationInfo + * @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.v1.ProcessorVersion.DeprecationInfo; + + /** + * Verifies a DeprecationInfo 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 DeprecationInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeprecationInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo; + + /** + * Creates a plain object from a DeprecationInfo message. Also converts values to other types if specified. + * @param message DeprecationInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeprecationInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + DEPLOYED = 1, + DEPLOYING = 2, + UNDEPLOYED = 3, + UNDEPLOYING = 4, + CREATING = 5, + DELETING = 6, + FAILED = 7 + } } - /** Represents a ReviewDocumentOperationMetadata. */ - class ReviewDocumentOperationMetadata implements IReviewDocumentOperationMetadata { + /** Properties of a Processor. */ + interface IProcessor { + + /** Processor name */ + name?: (string|null); + + /** Processor type */ + type?: (string|null); + + /** Processor displayName */ + displayName?: (string|null); + + /** Processor state */ + state?: (google.cloud.documentai.v1.Processor.State|keyof typeof google.cloud.documentai.v1.Processor.State|null); + + /** Processor defaultProcessorVersion */ + defaultProcessorVersion?: (string|null); + + /** Processor processEndpoint */ + processEndpoint?: (string|null); + + /** Processor createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** Processor kmsKeyName */ + kmsKeyName?: (string|null); + } + + /** Represents a Processor. */ + class Processor implements IProcessor { /** - * Constructs a new ReviewDocumentOperationMetadata. + * Constructs a new Processor. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1.IReviewDocumentOperationMetadata); + constructor(properties?: google.cloud.documentai.v1.IProcessor); - /** ReviewDocumentOperationMetadata commonMetadata. */ - public commonMetadata?: (google.cloud.documentai.v1.ICommonOperationMetadata|null); + /** Processor name. */ + public name: string; - /** ReviewDocumentOperationMetadata questionId. */ - public questionId: string; + /** Processor type. */ + public type: string; + + /** Processor displayName. */ + public displayName: string; + + /** Processor state. */ + public state: (google.cloud.documentai.v1.Processor.State|keyof typeof google.cloud.documentai.v1.Processor.State); + + /** Processor defaultProcessorVersion. */ + public defaultProcessorVersion: string; + + /** Processor processEndpoint. */ + public processEndpoint: string; + + /** Processor createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** Processor kmsKeyName. */ + public kmsKeyName: string; /** - * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. + * Creates a new Processor instance using the specified properties. * @param [properties] Properties to set - * @returns ReviewDocumentOperationMetadata instance + * @returns Processor instance */ - public static create(properties?: google.cloud.documentai.v1.IReviewDocumentOperationMetadata): google.cloud.documentai.v1.ReviewDocumentOperationMetadata; + public static create(properties?: google.cloud.documentai.v1.IProcessor): google.cloud.documentai.v1.Processor; /** - * Encodes the specified ReviewDocumentOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentOperationMetadata.verify|verify} messages. - * @param message ReviewDocumentOperationMetadata message or plain object to encode + * Encodes the specified Processor message. Does not implicitly {@link google.cloud.documentai.v1.Processor.verify|verify} messages. + * @param message Processor message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1.IReviewDocumentOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1.IProcessor, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ReviewDocumentOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentOperationMetadata.verify|verify} messages. - * @param message ReviewDocumentOperationMetadata message or plain object to encode + * Encodes the specified Processor message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Processor.verify|verify} messages. + * @param message Processor message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1.IReviewDocumentOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1.IProcessor, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer. + * Decodes a Processor 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 Processor * @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.v1.ReviewDocumentOperationMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.Processor; /** - * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer, length delimited. + * Decodes a Processor message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ReviewDocumentOperationMetadata + * @returns Processor * @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.v1.ReviewDocumentOperationMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.Processor; /** - * Verifies a ReviewDocumentOperationMetadata message. + * Verifies a Processor 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 Processor message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ReviewDocumentOperationMetadata + * @returns Processor */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ReviewDocumentOperationMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Processor; /** - * 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 Processor message. Also converts values to other types if specified. + * @param message Processor * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1.ReviewDocumentOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1.Processor, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ReviewDocumentOperationMetadata to JSON. + * Converts this Processor to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a CommonOperationMetadata. */ - interface ICommonOperationMetadata { + namespace Processor { - /** CommonOperationMetadata state */ - state?: (google.cloud.documentai.v1.CommonOperationMetadata.State|keyof typeof google.cloud.documentai.v1.CommonOperationMetadata.State|null); + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + ENABLED = 1, + DISABLED = 2, + ENABLING = 3, + DISABLING = 4, + CREATING = 5, + FAILED = 6, + DELETING = 7 + } + } - /** CommonOperationMetadata stateMessage */ - stateMessage?: (string|null); + /** Properties of a ProcessorType. */ + interface IProcessorType { - /** CommonOperationMetadata createTime */ - createTime?: (google.protobuf.ITimestamp|null); + /** ProcessorType name */ + name?: (string|null); - /** CommonOperationMetadata updateTime */ - updateTime?: (google.protobuf.ITimestamp|null); + /** ProcessorType type */ + type?: (string|null); + + /** ProcessorType category */ + category?: (string|null); + + /** ProcessorType availableLocations */ + availableLocations?: (google.cloud.documentai.v1.ProcessorType.ILocationInfo[]|null); + + /** ProcessorType allowCreation */ + allowCreation?: (boolean|null); + + /** ProcessorType launchStage */ + launchStage?: (google.api.LaunchStage|keyof typeof google.api.LaunchStage|null); } - /** Represents a CommonOperationMetadata. */ - class CommonOperationMetadata implements ICommonOperationMetadata { + /** Represents a ProcessorType. */ + class ProcessorType implements IProcessorType { /** - * Constructs a new CommonOperationMetadata. + * Constructs a new ProcessorType. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.documentai.v1.ICommonOperationMetadata); + constructor(properties?: google.cloud.documentai.v1.IProcessorType); - /** CommonOperationMetadata state. */ - public state: (google.cloud.documentai.v1.CommonOperationMetadata.State|keyof typeof google.cloud.documentai.v1.CommonOperationMetadata.State); + /** ProcessorType name. */ + public name: string; - /** CommonOperationMetadata stateMessage. */ - public stateMessage: string; + /** ProcessorType type. */ + public type: string; - /** CommonOperationMetadata createTime. */ - public createTime?: (google.protobuf.ITimestamp|null); + /** ProcessorType category. */ + public category: string; - /** CommonOperationMetadata updateTime. */ - public updateTime?: (google.protobuf.ITimestamp|null); + /** ProcessorType availableLocations. */ + public availableLocations: google.cloud.documentai.v1.ProcessorType.ILocationInfo[]; + + /** ProcessorType allowCreation. */ + public allowCreation: boolean; + + /** ProcessorType launchStage. */ + public launchStage: (google.api.LaunchStage|keyof typeof google.api.LaunchStage); /** - * Creates a new CommonOperationMetadata instance using the specified properties. + * Creates a new ProcessorType instance using the specified properties. * @param [properties] Properties to set - * @returns CommonOperationMetadata instance + * @returns ProcessorType instance */ - public static create(properties?: google.cloud.documentai.v1.ICommonOperationMetadata): google.cloud.documentai.v1.CommonOperationMetadata; + public static create(properties?: google.cloud.documentai.v1.IProcessorType): google.cloud.documentai.v1.ProcessorType; /** - * Encodes the specified CommonOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1.CommonOperationMetadata.verify|verify} messages. - * @param message CommonOperationMetadata message or plain object to encode + * Encodes the specified ProcessorType message. Does not implicitly {@link google.cloud.documentai.v1.ProcessorType.verify|verify} messages. + * @param message ProcessorType message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.documentai.v1.ICommonOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.documentai.v1.IProcessorType, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CommonOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.CommonOperationMetadata.verify|verify} messages. - * @param message CommonOperationMetadata message or plain object to encode + * Encodes the specified ProcessorType message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ProcessorType.verify|verify} messages. + * @param message ProcessorType message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.documentai.v1.ICommonOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.documentai.v1.IProcessorType, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CommonOperationMetadata message from the specified reader or buffer. + * Decodes a ProcessorType message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CommonOperationMetadata + * @returns ProcessorType * @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.v1.CommonOperationMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1.ProcessorType; /** - * Decodes a CommonOperationMetadata message from the specified reader or buffer, length delimited. + * Decodes a ProcessorType message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CommonOperationMetadata + * @returns ProcessorType * @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.v1.CommonOperationMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1.ProcessorType; /** - * Verifies a CommonOperationMetadata message. + * Verifies a ProcessorType 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 CommonOperationMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a ProcessorType message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CommonOperationMetadata + * @returns ProcessorType */ - public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.CommonOperationMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ProcessorType; /** - * Creates a plain object from a CommonOperationMetadata message. Also converts values to other types if specified. - * @param message CommonOperationMetadata + * Creates a plain object from a ProcessorType message. Also converts values to other types if specified. + * @param message ProcessorType * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.documentai.v1.CommonOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.documentai.v1.ProcessorType, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CommonOperationMetadata to JSON. + * Converts this ProcessorType to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace CommonOperationMetadata { + namespace ProcessorType { - /** State enum. */ - enum State { - STATE_UNSPECIFIED = 0, - RUNNING = 1, - CANCELLING = 2, - SUCCEEDED = 3, - FAILED = 4, - CANCELLED = 5 + /** Properties of a LocationInfo. */ + interface ILocationInfo { + + /** LocationInfo locationId */ + locationId?: (string|null); + } + + /** Represents a LocationInfo. */ + class LocationInfo implements ILocationInfo { + + /** + * Constructs a new LocationInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.ProcessorType.ILocationInfo); + + /** LocationInfo locationId. */ + public locationId: string; + + /** + * Creates a new LocationInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns LocationInfo instance + */ + public static create(properties?: google.cloud.documentai.v1.ProcessorType.ILocationInfo): google.cloud.documentai.v1.ProcessorType.LocationInfo; + + /** + * Encodes the specified LocationInfo message. Does not implicitly {@link google.cloud.documentai.v1.ProcessorType.LocationInfo.verify|verify} messages. + * @param message LocationInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.ProcessorType.ILocationInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LocationInfo message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ProcessorType.LocationInfo.verify|verify} messages. + * @param message LocationInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.ProcessorType.ILocationInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LocationInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LocationInfo + * @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.v1.ProcessorType.LocationInfo; + + /** + * Decodes a LocationInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LocationInfo + * @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.v1.ProcessorType.LocationInfo; + + /** + * Verifies a LocationInfo 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 LocationInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LocationInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.ProcessorType.LocationInfo; + + /** + * Creates a plain object from a LocationInfo message. Also converts values to other types if specified. + * @param message LocationInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.ProcessorType.LocationInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LocationInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; } } } @@ -23224,6 +27674,18 @@ export namespace google { */ public toJSON(): { [k: string]: any }; } + + /** LaunchStage enum. */ + enum LaunchStage { + LAUNCH_STAGE_UNSPECIFIED = 0, + UNIMPLEMENTED = 6, + PRELAUNCH = 7, + EARLY_ACCESS = 1, + ALPHA = 2, + BETA = 3, + GA = 4, + DEPRECATED = 5 + } } /** Namespace protobuf. */ diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index 7f75f503cba..0b85aec5689 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -66,6 +66,238 @@ */ var v1 = {}; + v1.Barcode = (function() { + + /** + * Properties of a Barcode. + * @memberof google.cloud.documentai.v1 + * @interface IBarcode + * @property {string|null} [format] Barcode format + * @property {string|null} [valueFormat] Barcode valueFormat + * @property {string|null} [rawValue] Barcode rawValue + */ + + /** + * Constructs a new Barcode. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a Barcode. + * @implements IBarcode + * @constructor + * @param {google.cloud.documentai.v1.IBarcode=} [properties] Properties to set + */ + function Barcode(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]]; + } + + /** + * Barcode format. + * @member {string} format + * @memberof google.cloud.documentai.v1.Barcode + * @instance + */ + Barcode.prototype.format = ""; + + /** + * Barcode valueFormat. + * @member {string} valueFormat + * @memberof google.cloud.documentai.v1.Barcode + * @instance + */ + Barcode.prototype.valueFormat = ""; + + /** + * Barcode rawValue. + * @member {string} rawValue + * @memberof google.cloud.documentai.v1.Barcode + * @instance + */ + Barcode.prototype.rawValue = ""; + + /** + * Creates a new Barcode instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Barcode + * @static + * @param {google.cloud.documentai.v1.IBarcode=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Barcode} Barcode instance + */ + Barcode.create = function create(properties) { + return new Barcode(properties); + }; + + /** + * Encodes the specified Barcode message. Does not implicitly {@link google.cloud.documentai.v1.Barcode.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Barcode + * @static + * @param {google.cloud.documentai.v1.IBarcode} message Barcode message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Barcode.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.format != null && Object.hasOwnProperty.call(message, "format")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.format); + if (message.valueFormat != null && Object.hasOwnProperty.call(message, "valueFormat")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.valueFormat); + if (message.rawValue != null && Object.hasOwnProperty.call(message, "rawValue")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.rawValue); + return writer; + }; + + /** + * Encodes the specified Barcode message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Barcode.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Barcode + * @static + * @param {google.cloud.documentai.v1.IBarcode} message Barcode message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Barcode.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Barcode message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Barcode + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Barcode} Barcode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Barcode.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.v1.Barcode(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.format = reader.string(); + break; + case 2: + message.valueFormat = reader.string(); + break; + case 3: + message.rawValue = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Barcode message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Barcode + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Barcode} Barcode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Barcode.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Barcode message. + * @function verify + * @memberof google.cloud.documentai.v1.Barcode + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Barcode.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.format != null && message.hasOwnProperty("format")) + if (!$util.isString(message.format)) + return "format: string expected"; + if (message.valueFormat != null && message.hasOwnProperty("valueFormat")) + if (!$util.isString(message.valueFormat)) + return "valueFormat: string expected"; + if (message.rawValue != null && message.hasOwnProperty("rawValue")) + if (!$util.isString(message.rawValue)) + return "rawValue: string expected"; + return null; + }; + + /** + * Creates a Barcode message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Barcode + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Barcode} Barcode + */ + Barcode.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Barcode) + return object; + var message = new $root.google.cloud.documentai.v1.Barcode(); + if (object.format != null) + message.format = String(object.format); + if (object.valueFormat != null) + message.valueFormat = String(object.valueFormat); + if (object.rawValue != null) + message.rawValue = String(object.rawValue); + return message; + }; + + /** + * Creates a plain object from a Barcode message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Barcode + * @static + * @param {google.cloud.documentai.v1.Barcode} message Barcode + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Barcode.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.format = ""; + object.valueFormat = ""; + object.rawValue = ""; + } + if (message.format != null && message.hasOwnProperty("format")) + object.format = message.format; + if (message.valueFormat != null && message.hasOwnProperty("valueFormat")) + object.valueFormat = message.valueFormat; + if (message.rawValue != null && message.hasOwnProperty("rawValue")) + object.rawValue = message.rawValue; + return object; + }; + + /** + * Converts this Barcode to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Barcode + * @instance + * @returns {Object.} JSON object + */ + Barcode.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Barcode; + })(); + v1.Document = (function() { /** @@ -1503,6 +1735,7 @@ * @property {Array.|null} [tables] Page tables * @property {Array.|null} [formFields] Page formFields * @property {Array.|null} [symbols] Page symbols + * @property {Array.|null} [detectedBarcodes] Page detectedBarcodes * @property {google.cloud.documentai.v1.Document.IProvenance|null} [provenance] Page provenance */ @@ -1525,6 +1758,7 @@ this.tables = []; this.formFields = []; this.symbols = []; + this.detectedBarcodes = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -1643,6 +1877,14 @@ */ Page.prototype.symbols = $util.emptyArray; + /** + * Page detectedBarcodes. + * @member {Array.} detectedBarcodes + * @memberof google.cloud.documentai.v1.Document.Page + * @instance + */ + Page.prototype.detectedBarcodes = $util.emptyArray; + /** * Page provenance. * @member {google.cloud.documentai.v1.Document.IProvenance|null|undefined} provenance @@ -1713,6 +1955,9 @@ if (message.transforms != null && message.transforms.length) for (var i = 0; i < message.transforms.length; ++i) $root.google.cloud.documentai.v1.Document.Page.Matrix.encode(message.transforms[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.detectedBarcodes != null && message.detectedBarcodes.length) + for (var i = 0; i < message.detectedBarcodes.length; ++i) + $root.google.cloud.documentai.v1.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.v1.Document.Provenance.encode(message.provenance, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); return writer; @@ -1811,6 +2056,11 @@ message.symbols = []; message.symbols.push($root.google.cloud.documentai.v1.Document.Page.Symbol.decode(reader, reader.uint32())); break; + case 15: + if (!(message.detectedBarcodes && message.detectedBarcodes.length)) + message.detectedBarcodes = []; + message.detectedBarcodes.push($root.google.cloud.documentai.v1.Document.Page.DetectedBarcode.decode(reader, reader.uint32())); + break; case 16: message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32()); break; @@ -1957,6 +2207,15 @@ return "symbols." + error; } } + if (message.detectedBarcodes != null && message.hasOwnProperty("detectedBarcodes")) { + if (!Array.isArray(message.detectedBarcodes)) + return "detectedBarcodes: array expected"; + for (var i = 0; i < message.detectedBarcodes.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Page.DetectedBarcode.verify(message.detectedBarcodes[i]); + if (error) + return "detectedBarcodes." + error; + } + } if (message.provenance != null && message.hasOwnProperty("provenance")) { var error = $root.google.cloud.documentai.v1.Document.Provenance.verify(message.provenance); if (error) @@ -2094,6 +2353,16 @@ message.symbols[i] = $root.google.cloud.documentai.v1.Document.Page.Symbol.fromObject(object.symbols[i]); } } + if (object.detectedBarcodes) { + if (!Array.isArray(object.detectedBarcodes)) + throw TypeError(".google.cloud.documentai.v1.Document.Page.detectedBarcodes: array expected"); + message.detectedBarcodes = []; + for (var i = 0; i < object.detectedBarcodes.length; ++i) { + if (typeof object.detectedBarcodes[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.detectedBarcodes: object expected"); + message.detectedBarcodes[i] = $root.google.cloud.documentai.v1.Document.Page.DetectedBarcode.fromObject(object.detectedBarcodes[i]); + } + } if (object.provenance != null) { if (typeof object.provenance !== "object") throw TypeError(".google.cloud.documentai.v1.Document.Page.provenance: object expected"); @@ -2126,6 +2395,7 @@ object.formFields = []; object.symbols = []; object.transforms = []; + object.detectedBarcodes = []; } if (options.defaults) { object.pageNumber = 0; @@ -2192,6 +2462,11 @@ for (var j = 0; j < message.transforms.length; ++j) object.transforms[j] = $root.google.cloud.documentai.v1.Document.Page.Matrix.toObject(message.transforms[j], options); } + if (message.detectedBarcodes && message.detectedBarcodes.length) { + object.detectedBarcodes = []; + for (var j = 0; j < message.detectedBarcodes.length; ++j) + object.detectedBarcodes[j] = $root.google.cloud.documentai.v1.Document.Page.DetectedBarcode.toObject(message.detectedBarcodes[j], options); + } if (message.provenance != null && message.hasOwnProperty("provenance")) object.provenance = $root.google.cloud.documentai.v1.Document.Provenance.toObject(message.provenance, options); return object; @@ -5907,6 +6182,8 @@ * @property {Array.|null} [nameDetectedLanguages] FormField nameDetectedLanguages * @property {Array.|null} [valueDetectedLanguages] FormField valueDetectedLanguages * @property {string|null} [valueType] FormField valueType + * @property {string|null} [correctedKeyText] FormField correctedKeyText + * @property {string|null} [correctedValueText] FormField correctedValueText * @property {google.cloud.documentai.v1.Document.IProvenance|null} [provenance] FormField provenance */ @@ -5967,6 +6244,22 @@ */ FormField.prototype.valueType = ""; + /** + * FormField correctedKeyText. + * @member {string} correctedKeyText + * @memberof google.cloud.documentai.v1.Document.Page.FormField + * @instance + */ + FormField.prototype.correctedKeyText = ""; + + /** + * FormField correctedValueText. + * @member {string} correctedValueText + * @memberof google.cloud.documentai.v1.Document.Page.FormField + * @instance + */ + FormField.prototype.correctedValueText = ""; + /** * FormField provenance. * @member {google.cloud.documentai.v1.Document.IProvenance|null|undefined} provenance @@ -6011,6 +6304,10 @@ $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.encode(message.valueDetectedLanguages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.valueType != null && Object.hasOwnProperty.call(message, "valueType")) writer.uint32(/* id 5, wireType 2 =*/42).string(message.valueType); + if (message.correctedKeyText != null && Object.hasOwnProperty.call(message, "correctedKeyText")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.correctedKeyText); + if (message.correctedValueText != null && Object.hasOwnProperty.call(message, "correctedValueText")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.correctedValueText); if (message.provenance != null && Object.hasOwnProperty.call(message, "provenance")) $root.google.cloud.documentai.v1.Document.Provenance.encode(message.provenance, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); return writer; @@ -6066,6 +6363,12 @@ case 5: message.valueType = reader.string(); break; + case 6: + message.correctedKeyText = reader.string(); + break; + case 7: + message.correctedValueText = reader.string(); + break; case 8: message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32()); break; @@ -6135,6 +6438,12 @@ if (message.valueType != null && message.hasOwnProperty("valueType")) if (!$util.isString(message.valueType)) return "valueType: string expected"; + if (message.correctedKeyText != null && message.hasOwnProperty("correctedKeyText")) + if (!$util.isString(message.correctedKeyText)) + return "correctedKeyText: string expected"; + if (message.correctedValueText != null && message.hasOwnProperty("correctedValueText")) + if (!$util.isString(message.correctedValueText)) + return "correctedValueText: string expected"; if (message.provenance != null && message.hasOwnProperty("provenance")) { var error = $root.google.cloud.documentai.v1.Document.Provenance.verify(message.provenance); if (error) @@ -6187,6 +6496,10 @@ } if (object.valueType != null) message.valueType = String(object.valueType); + if (object.correctedKeyText != null) + message.correctedKeyText = String(object.correctedKeyText); + if (object.correctedValueText != null) + message.correctedValueText = String(object.correctedValueText); if (object.provenance != null) { if (typeof object.provenance !== "object") throw TypeError(".google.cloud.documentai.v1.Document.Page.FormField.provenance: object expected"); @@ -6216,6 +6529,8 @@ object.fieldName = null; object.fieldValue = null; object.valueType = ""; + object.correctedKeyText = ""; + object.correctedValueText = ""; object.provenance = null; } if (message.fieldName != null && message.hasOwnProperty("fieldName")) @@ -6234,6 +6549,10 @@ } if (message.valueType != null && message.hasOwnProperty("valueType")) object.valueType = message.valueType; + if (message.correctedKeyText != null && message.hasOwnProperty("correctedKeyText")) + object.correctedKeyText = message.correctedKeyText; + if (message.correctedValueText != null && message.hasOwnProperty("correctedValueText")) + object.correctedValueText = message.correctedValueText; if (message.provenance != null && message.hasOwnProperty("provenance")) object.provenance = $root.google.cloud.documentai.v1.Document.Provenance.toObject(message.provenance, options); return object; @@ -6253,6 +6572,226 @@ return FormField; })(); + Page.DetectedBarcode = (function() { + + /** + * Properties of a DetectedBarcode. + * @memberof google.cloud.documentai.v1.Document.Page + * @interface IDetectedBarcode + * @property {google.cloud.documentai.v1.Document.Page.ILayout|null} [layout] DetectedBarcode layout + * @property {google.cloud.documentai.v1.IBarcode|null} [barcode] DetectedBarcode barcode + */ + + /** + * Constructs a new DetectedBarcode. + * @memberof google.cloud.documentai.v1.Document.Page + * @classdesc Represents a DetectedBarcode. + * @implements IDetectedBarcode + * @constructor + * @param {google.cloud.documentai.v1.Document.Page.IDetectedBarcode=} [properties] Properties to set + */ + function DetectedBarcode(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]]; + } + + /** + * DetectedBarcode layout. + * @member {google.cloud.documentai.v1.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1.Document.Page.DetectedBarcode + * @instance + */ + DetectedBarcode.prototype.layout = null; + + /** + * DetectedBarcode barcode. + * @member {google.cloud.documentai.v1.IBarcode|null|undefined} barcode + * @memberof google.cloud.documentai.v1.Document.Page.DetectedBarcode + * @instance + */ + DetectedBarcode.prototype.barcode = null; + + /** + * Creates a new DetectedBarcode instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.Page.DetectedBarcode + * @static + * @param {google.cloud.documentai.v1.Document.Page.IDetectedBarcode=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.Page.DetectedBarcode} DetectedBarcode instance + */ + DetectedBarcode.create = function create(properties) { + return new DetectedBarcode(properties); + }; + + /** + * Encodes the specified DetectedBarcode message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.DetectedBarcode.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.Page.DetectedBarcode + * @static + * @param {google.cloud.documentai.v1.Document.Page.IDetectedBarcode} message DetectedBarcode message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectedBarcode.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) + $root.google.cloud.documentai.v1.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.barcode != null && Object.hasOwnProperty.call(message, "barcode")) + $root.google.cloud.documentai.v1.Barcode.encode(message.barcode, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DetectedBarcode message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.DetectedBarcode.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.DetectedBarcode + * @static + * @param {google.cloud.documentai.v1.Document.Page.IDetectedBarcode} message DetectedBarcode message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectedBarcode.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DetectedBarcode message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.Page.DetectedBarcode + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Document.Page.DetectedBarcode} DetectedBarcode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectedBarcode.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.v1.Document.Page.DetectedBarcode(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + message.barcode = $root.google.cloud.documentai.v1.Barcode.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DetectedBarcode message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.DetectedBarcode + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.Page.DetectedBarcode} DetectedBarcode + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectedBarcode.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DetectedBarcode message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.Page.DetectedBarcode + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DetectedBarcode.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.layout != null && message.hasOwnProperty("layout")) { + var error = $root.google.cloud.documentai.v1.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.barcode != null && message.hasOwnProperty("barcode")) { + var error = $root.google.cloud.documentai.v1.Barcode.verify(message.barcode); + if (error) + return "barcode." + error; + } + return null; + }; + + /** + * Creates a DetectedBarcode message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.Page.DetectedBarcode + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.Page.DetectedBarcode} DetectedBarcode + */ + DetectedBarcode.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.Page.DetectedBarcode) + return object; + var message = new $root.google.cloud.documentai.v1.Document.Page.DetectedBarcode(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.DetectedBarcode.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.fromObject(object.layout); + } + if (object.barcode != null) { + if (typeof object.barcode !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.DetectedBarcode.barcode: object expected"); + message.barcode = $root.google.cloud.documentai.v1.Barcode.fromObject(object.barcode); + } + return message; + }; + + /** + * Creates a plain object from a DetectedBarcode message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.Page.DetectedBarcode + * @static + * @param {google.cloud.documentai.v1.Document.Page.DetectedBarcode} message DetectedBarcode + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DetectedBarcode.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.layout = null; + object.barcode = null; + } + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.toObject(message.layout, options); + if (message.barcode != null && message.hasOwnProperty("barcode")) + object.barcode = $root.google.cloud.documentai.v1.Barcode.toObject(message.barcode, options); + return object; + }; + + /** + * Converts this DetectedBarcode to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.Page.DetectedBarcode + * @instance + * @returns {Object.} JSON object + */ + DetectedBarcode.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DetectedBarcode; + })(); + Page.DetectedLanguage = (function() { /** @@ -6924,6 +7463,8 @@ * @property {google.type.IDateTime|null} [datetimeValue] NormalizedValue datetimeValue * @property {google.type.IPostalAddress|null} [addressValue] NormalizedValue addressValue * @property {boolean|null} [booleanValue] NormalizedValue booleanValue + * @property {number|null} [integerValue] NormalizedValue integerValue + * @property {number|null} [floatValue] NormalizedValue floatValue * @property {string|null} [text] NormalizedValue text */ @@ -6982,6 +7523,22 @@ */ NormalizedValue.prototype.booleanValue = null; + /** + * NormalizedValue integerValue. + * @member {number|null|undefined} integerValue + * @memberof google.cloud.documentai.v1.Document.Entity.NormalizedValue + * @instance + */ + NormalizedValue.prototype.integerValue = null; + + /** + * NormalizedValue floatValue. + * @member {number|null|undefined} floatValue + * @memberof google.cloud.documentai.v1.Document.Entity.NormalizedValue + * @instance + */ + NormalizedValue.prototype.floatValue = null; + /** * NormalizedValue text. * @member {string} text @@ -6995,12 +7552,12 @@ /** * NormalizedValue structuredValue. - * @member {"moneyValue"|"dateValue"|"datetimeValue"|"addressValue"|"booleanValue"|undefined} structuredValue + * @member {"moneyValue"|"dateValue"|"datetimeValue"|"addressValue"|"booleanValue"|"integerValue"|"floatValue"|undefined} structuredValue * @memberof google.cloud.documentai.v1.Document.Entity.NormalizedValue * @instance */ Object.defineProperty(NormalizedValue.prototype, "structuredValue", { - get: $util.oneOfGetter($oneOfFields = ["moneyValue", "dateValue", "datetimeValue", "addressValue", "booleanValue"]), + get: $util.oneOfGetter($oneOfFields = ["moneyValue", "dateValue", "datetimeValue", "addressValue", "booleanValue", "integerValue", "floatValue"]), set: $util.oneOfSetter($oneOfFields) }); @@ -7040,6 +7597,10 @@ $root.google.type.PostalAddress.encode(message.addressValue, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); if (message.booleanValue != null && Object.hasOwnProperty.call(message, "booleanValue")) writer.uint32(/* id 6, wireType 0 =*/48).bool(message.booleanValue); + if (message.integerValue != null && Object.hasOwnProperty.call(message, "integerValue")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.integerValue); + if (message.floatValue != null && Object.hasOwnProperty.call(message, "floatValue")) + writer.uint32(/* id 8, wireType 5 =*/69).float(message.floatValue); return writer; }; @@ -7089,6 +7650,12 @@ case 6: message.booleanValue = reader.bool(); break; + case 7: + message.integerValue = reader.int32(); + break; + case 8: + message.floatValue = reader.float(); + break; case 1: message.text = reader.string(); break; @@ -7173,6 +7740,20 @@ if (typeof message.booleanValue !== "boolean") return "booleanValue: boolean expected"; } + if (message.integerValue != null && message.hasOwnProperty("integerValue")) { + if (properties.structuredValue === 1) + return "structuredValue: multiple values"; + properties.structuredValue = 1; + if (!$util.isInteger(message.integerValue)) + return "integerValue: integer expected"; + } + if (message.floatValue != null && message.hasOwnProperty("floatValue")) { + if (properties.structuredValue === 1) + return "structuredValue: multiple values"; + properties.structuredValue = 1; + if (typeof message.floatValue !== "number") + return "floatValue: number expected"; + } if (message.text != null && message.hasOwnProperty("text")) if (!$util.isString(message.text)) return "text: string expected"; @@ -7213,6 +7794,10 @@ } if (object.booleanValue != null) message.booleanValue = Boolean(object.booleanValue); + if (object.integerValue != null) + message.integerValue = object.integerValue | 0; + if (object.floatValue != null) + message.floatValue = Number(object.floatValue); if (object.text != null) message.text = String(object.text); return message; @@ -7260,6 +7845,16 @@ if (options.oneofs) object.structuredValue = "booleanValue"; } + if (message.integerValue != null && message.hasOwnProperty("integerValue")) { + object.integerValue = message.integerValue; + if (options.oneofs) + object.structuredValue = "integerValue"; + } + if (message.floatValue != null && message.hasOwnProperty("floatValue")) { + object.floatValue = options.json && !isFinite(message.floatValue) ? String(message.floatValue) : message.floatValue; + if (options.oneofs) + object.structuredValue = "floatValue"; + } return object; }; @@ -9133,6 +9728,7 @@ * @property {string|null} [processor] Revision processor * @property {string|null} [id] Revision id * @property {Array.|null} [parent] Revision parent + * @property {Array.|null} [parentIds] Revision parentIds * @property {google.protobuf.ITimestamp|null} [createTime] Revision createTime * @property {google.cloud.documentai.v1.Document.Revision.IHumanReview|null} [humanReview] Revision humanReview */ @@ -9147,6 +9743,7 @@ */ function Revision(properties) { this.parent = []; + this.parentIds = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -9185,6 +9782,14 @@ */ Revision.prototype.parent = $util.emptyArray; + /** + * Revision parentIds. + * @member {Array.} parentIds + * @memberof google.cloud.documentai.v1.Document.Revision + * @instance + */ + Revision.prototype.parentIds = $util.emptyArray; + /** * Revision createTime. * @member {google.protobuf.ITimestamp|null|undefined} createTime @@ -9255,6 +9860,9 @@ writer.uint32(/* id 5, wireType 2 =*/42).string(message.processor); if (message.humanReview != null && Object.hasOwnProperty.call(message, "humanReview")) $root.google.cloud.documentai.v1.Document.Revision.HumanReview.encode(message.humanReview, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.parentIds != null && message.parentIds.length) + for (var i = 0; i < message.parentIds.length; ++i) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.parentIds[i]); return writer; }; @@ -9308,6 +9916,11 @@ } else message.parent.push(reader.int32()); break; + case 7: + if (!(message.parentIds && message.parentIds.length)) + message.parentIds = []; + message.parentIds.push(reader.string()); + break; case 3: message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; @@ -9372,6 +9985,13 @@ if (!$util.isInteger(message.parent[i])) return "parent: integer[] expected"; } + if (message.parentIds != null && message.hasOwnProperty("parentIds")) { + if (!Array.isArray(message.parentIds)) + return "parentIds: array expected"; + for (var i = 0; i < message.parentIds.length; ++i) + if (!$util.isString(message.parentIds[i])) + return "parentIds: string[] expected"; + } if (message.createTime != null && message.hasOwnProperty("createTime")) { var error = $root.google.protobuf.Timestamp.verify(message.createTime); if (error) @@ -9410,6 +10030,13 @@ for (var i = 0; i < object.parent.length; ++i) message.parent[i] = object.parent[i] | 0; } + if (object.parentIds) { + if (!Array.isArray(object.parentIds)) + throw TypeError(".google.cloud.documentai.v1.Document.Revision.parentIds: array expected"); + message.parentIds = []; + for (var i = 0; i < object.parentIds.length; ++i) + message.parentIds[i] = String(object.parentIds[i]); + } if (object.createTime != null) { if (typeof object.createTime !== "object") throw TypeError(".google.cloud.documentai.v1.Document.Revision.createTime: object expected"); @@ -9436,8 +10063,10 @@ if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) + if (options.arrays || options.defaults) { object.parent = []; + object.parentIds = []; + } if (options.defaults) { object.id = ""; object.createTime = null; @@ -9464,6 +10093,11 @@ } if (message.humanReview != null && message.hasOwnProperty("humanReview")) object.humanReview = $root.google.cloud.documentai.v1.Document.Revision.HumanReview.toObject(message.humanReview, options); + if (message.parentIds && message.parentIds.length) { + object.parentIds = []; + for (var j = 0; j < message.parentIds.length; ++j) + object.parentIds[j] = message.parentIds[j]; + } return object; }; @@ -12190,6 +12824,468 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#fetchProcessorTypes}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef FetchProcessorTypesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.documentai.v1.FetchProcessorTypesResponse} [response] FetchProcessorTypesResponse + */ + + /** + * Calls FetchProcessorTypes. + * @function fetchProcessorTypes + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IFetchProcessorTypesRequest} request FetchProcessorTypesRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypesCallback} callback Node-style callback called with the error, if any, and FetchProcessorTypesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.fetchProcessorTypes = function fetchProcessorTypes(request, callback) { + return this.rpcCall(fetchProcessorTypes, $root.google.cloud.documentai.v1.FetchProcessorTypesRequest, $root.google.cloud.documentai.v1.FetchProcessorTypesResponse, request, callback); + }, "name", { value: "FetchProcessorTypes" }); + + /** + * Calls FetchProcessorTypes. + * @function fetchProcessorTypes + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IFetchProcessorTypesRequest} request FetchProcessorTypesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#listProcessorTypes}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef ListProcessorTypesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.documentai.v1.ListProcessorTypesResponse} [response] ListProcessorTypesResponse + */ + + /** + * Calls ListProcessorTypes. + * @function listProcessorTypes + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IListProcessorTypesRequest} request ListProcessorTypesRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypesCallback} callback Node-style callback called with the error, if any, and ListProcessorTypesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.listProcessorTypes = function listProcessorTypes(request, callback) { + return this.rpcCall(listProcessorTypes, $root.google.cloud.documentai.v1.ListProcessorTypesRequest, $root.google.cloud.documentai.v1.ListProcessorTypesResponse, request, callback); + }, "name", { value: "ListProcessorTypes" }); + + /** + * Calls ListProcessorTypes. + * @function listProcessorTypes + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IListProcessorTypesRequest} request ListProcessorTypesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#listProcessors}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef ListProcessorsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.documentai.v1.ListProcessorsResponse} [response] ListProcessorsResponse + */ + + /** + * Calls ListProcessors. + * @function listProcessors + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IListProcessorsRequest} request ListProcessorsRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.ListProcessorsCallback} callback Node-style callback called with the error, if any, and ListProcessorsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.listProcessors = function listProcessors(request, callback) { + return this.rpcCall(listProcessors, $root.google.cloud.documentai.v1.ListProcessorsRequest, $root.google.cloud.documentai.v1.ListProcessorsResponse, request, callback); + }, "name", { value: "ListProcessors" }); + + /** + * Calls ListProcessors. + * @function listProcessors + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IListProcessorsRequest} request ListProcessorsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#getProcessor}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef GetProcessorCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.documentai.v1.Processor} [response] Processor + */ + + /** + * Calls GetProcessor. + * @function getProcessor + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IGetProcessorRequest} request GetProcessorRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.GetProcessorCallback} callback Node-style callback called with the error, if any, and Processor + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.getProcessor = function getProcessor(request, callback) { + return this.rpcCall(getProcessor, $root.google.cloud.documentai.v1.GetProcessorRequest, $root.google.cloud.documentai.v1.Processor, request, callback); + }, "name", { value: "GetProcessor" }); + + /** + * Calls GetProcessor. + * @function getProcessor + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IGetProcessorRequest} request GetProcessorRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#getProcessorVersion}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef GetProcessorVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.documentai.v1.ProcessorVersion} [response] ProcessorVersion + */ + + /** + * Calls GetProcessorVersion. + * @function getProcessorVersion + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IGetProcessorVersionRequest} request GetProcessorVersionRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.GetProcessorVersionCallback} callback Node-style callback called with the error, if any, and ProcessorVersion + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.getProcessorVersion = function getProcessorVersion(request, callback) { + return this.rpcCall(getProcessorVersion, $root.google.cloud.documentai.v1.GetProcessorVersionRequest, $root.google.cloud.documentai.v1.ProcessorVersion, request, callback); + }, "name", { value: "GetProcessorVersion" }); + + /** + * Calls GetProcessorVersion. + * @function getProcessorVersion + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IGetProcessorVersionRequest} request GetProcessorVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#listProcessorVersions}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef ListProcessorVersionsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.documentai.v1.ListProcessorVersionsResponse} [response] ListProcessorVersionsResponse + */ + + /** + * Calls ListProcessorVersions. + * @function listProcessorVersions + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IListProcessorVersionsRequest} request ListProcessorVersionsRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.ListProcessorVersionsCallback} callback Node-style callback called with the error, if any, and ListProcessorVersionsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.listProcessorVersions = function listProcessorVersions(request, callback) { + return this.rpcCall(listProcessorVersions, $root.google.cloud.documentai.v1.ListProcessorVersionsRequest, $root.google.cloud.documentai.v1.ListProcessorVersionsResponse, request, callback); + }, "name", { value: "ListProcessorVersions" }); + + /** + * Calls ListProcessorVersions. + * @function listProcessorVersions + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IListProcessorVersionsRequest} request ListProcessorVersionsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#deleteProcessorVersion}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef DeleteProcessorVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteProcessorVersion. + * @function deleteProcessorVersion + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IDeleteProcessorVersionRequest} request DeleteProcessorVersionRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.deleteProcessorVersion = function deleteProcessorVersion(request, callback) { + return this.rpcCall(deleteProcessorVersion, $root.google.cloud.documentai.v1.DeleteProcessorVersionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteProcessorVersion" }); + + /** + * Calls DeleteProcessorVersion. + * @function deleteProcessorVersion + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IDeleteProcessorVersionRequest} request DeleteProcessorVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#deployProcessorVersion}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef DeployProcessorVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeployProcessorVersion. + * @function deployProcessorVersion + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IDeployProcessorVersionRequest} request DeployProcessorVersionRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.deployProcessorVersion = function deployProcessorVersion(request, callback) { + return this.rpcCall(deployProcessorVersion, $root.google.cloud.documentai.v1.DeployProcessorVersionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeployProcessorVersion" }); + + /** + * Calls DeployProcessorVersion. + * @function deployProcessorVersion + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IDeployProcessorVersionRequest} request DeployProcessorVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#undeployProcessorVersion}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef UndeployProcessorVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls UndeployProcessorVersion. + * @function undeployProcessorVersion + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IUndeployProcessorVersionRequest} request UndeployProcessorVersionRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.undeployProcessorVersion = function undeployProcessorVersion(request, callback) { + return this.rpcCall(undeployProcessorVersion, $root.google.cloud.documentai.v1.UndeployProcessorVersionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UndeployProcessorVersion" }); + + /** + * Calls UndeployProcessorVersion. + * @function undeployProcessorVersion + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IUndeployProcessorVersionRequest} request UndeployProcessorVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#createProcessor}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef CreateProcessorCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.documentai.v1.Processor} [response] Processor + */ + + /** + * Calls CreateProcessor. + * @function createProcessor + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.ICreateProcessorRequest} request CreateProcessorRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.CreateProcessorCallback} callback Node-style callback called with the error, if any, and Processor + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.createProcessor = function createProcessor(request, callback) { + return this.rpcCall(createProcessor, $root.google.cloud.documentai.v1.CreateProcessorRequest, $root.google.cloud.documentai.v1.Processor, request, callback); + }, "name", { value: "CreateProcessor" }); + + /** + * Calls CreateProcessor. + * @function createProcessor + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.ICreateProcessorRequest} request CreateProcessorRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#deleteProcessor}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef DeleteProcessorCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteProcessor. + * @function deleteProcessor + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IDeleteProcessorRequest} request DeleteProcessorRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.deleteProcessor = function deleteProcessor(request, callback) { + return this.rpcCall(deleteProcessor, $root.google.cloud.documentai.v1.DeleteProcessorRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteProcessor" }); + + /** + * Calls DeleteProcessor. + * @function deleteProcessor + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IDeleteProcessorRequest} request DeleteProcessorRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#enableProcessor}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef EnableProcessorCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls EnableProcessor. + * @function enableProcessor + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IEnableProcessorRequest} request EnableProcessorRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.EnableProcessorCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.enableProcessor = function enableProcessor(request, callback) { + return this.rpcCall(enableProcessor, $root.google.cloud.documentai.v1.EnableProcessorRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "EnableProcessor" }); + + /** + * Calls EnableProcessor. + * @function enableProcessor + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IEnableProcessorRequest} request EnableProcessorRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#disableProcessor}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef DisableProcessorCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DisableProcessor. + * @function disableProcessor + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IDisableProcessorRequest} request DisableProcessorRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.DisableProcessorCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.disableProcessor = function disableProcessor(request, callback) { + return this.rpcCall(disableProcessor, $root.google.cloud.documentai.v1.DisableProcessorRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DisableProcessor" }); + + /** + * Calls DisableProcessor. + * @function disableProcessor + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.IDisableProcessorRequest} request DisableProcessorRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#setDefaultProcessorVersion}. + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @typedef SetDefaultProcessorVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls SetDefaultProcessorVersion. + * @function setDefaultProcessorVersion + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest} request SetDefaultProcessorVersionRequest message or plain object + * @param {google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersionCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(DocumentProcessorService.prototype.setDefaultProcessorVersion = function setDefaultProcessorVersion(request, callback) { + return this.rpcCall(setDefaultProcessorVersion, $root.google.cloud.documentai.v1.SetDefaultProcessorVersionRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "SetDefaultProcessorVersion" }); + + /** + * Calls SetDefaultProcessorVersion. + * @function setDefaultProcessorVersion + * @memberof google.cloud.documentai.v1.DocumentProcessorService + * @instance + * @param {google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest} request SetDefaultProcessorVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.cloud.documentai.v1.DocumentProcessorService#reviewDocument}. * @memberof google.cloud.documentai.v1.DocumentProcessorService @@ -12236,6 +13332,7 @@ * @property {google.cloud.documentai.v1.IRawDocument|null} [rawDocument] ProcessRequest rawDocument * @property {string|null} [name] ProcessRequest name * @property {boolean|null} [skipHumanReview] ProcessRequest skipHumanReview + * @property {google.protobuf.IFieldMask|null} [fieldMask] ProcessRequest fieldMask */ /** @@ -12285,6 +13382,14 @@ */ ProcessRequest.prototype.skipHumanReview = false; + /** + * ProcessRequest fieldMask. + * @member {google.protobuf.IFieldMask|null|undefined} fieldMask + * @memberof google.cloud.documentai.v1.ProcessRequest + * @instance + */ + ProcessRequest.prototype.fieldMask = null; + // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -12331,6 +13436,8 @@ $root.google.cloud.documentai.v1.Document.encode(message.inlineDocument, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.rawDocument != null && Object.hasOwnProperty.call(message, "rawDocument")) $root.google.cloud.documentai.v1.RawDocument.encode(message.rawDocument, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.fieldMask != null && Object.hasOwnProperty.call(message, "fieldMask")) + $root.google.protobuf.FieldMask.encode(message.fieldMask, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); return writer; }; @@ -12377,6 +13484,9 @@ case 3: message.skipHumanReview = reader.bool(); break; + case 6: + message.fieldMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -12437,6 +13547,11 @@ if (message.skipHumanReview != null && message.hasOwnProperty("skipHumanReview")) if (typeof message.skipHumanReview !== "boolean") return "skipHumanReview: boolean expected"; + if (message.fieldMask != null && message.hasOwnProperty("fieldMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.fieldMask); + if (error) + return "fieldMask." + error; + } return null; }; @@ -12466,6 +13581,11 @@ message.name = String(object.name); if (object.skipHumanReview != null) message.skipHumanReview = Boolean(object.skipHumanReview); + if (object.fieldMask != null) { + if (typeof object.fieldMask !== "object") + throw TypeError(".google.cloud.documentai.v1.ProcessRequest.fieldMask: object expected"); + message.fieldMask = $root.google.protobuf.FieldMask.fromObject(object.fieldMask); + } return message; }; @@ -12485,6 +13605,7 @@ if (options.defaults) { object.name = ""; object.skipHumanReview = false; + object.fieldMask = null; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -12500,6 +13621,8 @@ if (options.oneofs) object.source = "rawDocument"; } + if (message.fieldMask != null && message.hasOwnProperty("fieldMask")) + object.fieldMask = $root.google.protobuf.FieldMask.toObject(message.fieldMask, options); return object; }; @@ -14075,27 +15198,24 @@ return BatchProcessMetadata; })(); - v1.ReviewDocumentRequest = (function() { + v1.FetchProcessorTypesRequest = (function() { /** - * Properties of a ReviewDocumentRequest. + * Properties of a FetchProcessorTypesRequest. * @memberof google.cloud.documentai.v1 - * @interface IReviewDocumentRequest - * @property {google.cloud.documentai.v1.IDocument|null} [inlineDocument] ReviewDocumentRequest inlineDocument - * @property {string|null} [humanReviewConfig] ReviewDocumentRequest humanReviewConfig - * @property {boolean|null} [enableSchemaValidation] ReviewDocumentRequest enableSchemaValidation - * @property {google.cloud.documentai.v1.ReviewDocumentRequest.Priority|null} [priority] ReviewDocumentRequest priority + * @interface IFetchProcessorTypesRequest + * @property {string|null} [parent] FetchProcessorTypesRequest parent */ /** - * Constructs a new ReviewDocumentRequest. + * Constructs a new FetchProcessorTypesRequest. * @memberof google.cloud.documentai.v1 - * @classdesc Represents a ReviewDocumentRequest. - * @implements IReviewDocumentRequest + * @classdesc Represents a FetchProcessorTypesRequest. + * @implements IFetchProcessorTypesRequest * @constructor - * @param {google.cloud.documentai.v1.IReviewDocumentRequest=} [properties] Properties to set + * @param {google.cloud.documentai.v1.IFetchProcessorTypesRequest=} [properties] Properties to set */ - function ReviewDocumentRequest(properties) { + function FetchProcessorTypesRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -14103,128 +15223,75 @@ } /** - * ReviewDocumentRequest inlineDocument. - * @member {google.cloud.documentai.v1.IDocument|null|undefined} inlineDocument - * @memberof google.cloud.documentai.v1.ReviewDocumentRequest - * @instance - */ - ReviewDocumentRequest.prototype.inlineDocument = null; - - /** - * ReviewDocumentRequest humanReviewConfig. - * @member {string} humanReviewConfig - * @memberof google.cloud.documentai.v1.ReviewDocumentRequest - * @instance - */ - ReviewDocumentRequest.prototype.humanReviewConfig = ""; - - /** - * ReviewDocumentRequest enableSchemaValidation. - * @member {boolean} enableSchemaValidation - * @memberof google.cloud.documentai.v1.ReviewDocumentRequest - * @instance - */ - ReviewDocumentRequest.prototype.enableSchemaValidation = false; - - /** - * ReviewDocumentRequest priority. - * @member {google.cloud.documentai.v1.ReviewDocumentRequest.Priority} priority - * @memberof google.cloud.documentai.v1.ReviewDocumentRequest - * @instance - */ - ReviewDocumentRequest.prototype.priority = 0; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * ReviewDocumentRequest source. - * @member {"inlineDocument"|undefined} source - * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * FetchProcessorTypesRequest parent. + * @member {string} parent + * @memberof google.cloud.documentai.v1.FetchProcessorTypesRequest * @instance */ - Object.defineProperty(ReviewDocumentRequest.prototype, "source", { - get: $util.oneOfGetter($oneOfFields = ["inlineDocument"]), - set: $util.oneOfSetter($oneOfFields) - }); + FetchProcessorTypesRequest.prototype.parent = ""; /** - * Creates a new ReviewDocumentRequest instance using the specified properties. + * Creates a new FetchProcessorTypesRequest instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1.FetchProcessorTypesRequest * @static - * @param {google.cloud.documentai.v1.IReviewDocumentRequest=} [properties] Properties to set - * @returns {google.cloud.documentai.v1.ReviewDocumentRequest} ReviewDocumentRequest instance + * @param {google.cloud.documentai.v1.IFetchProcessorTypesRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.FetchProcessorTypesRequest} FetchProcessorTypesRequest instance */ - ReviewDocumentRequest.create = function create(properties) { - return new ReviewDocumentRequest(properties); + FetchProcessorTypesRequest.create = function create(properties) { + return new FetchProcessorTypesRequest(properties); }; /** - * Encodes the specified ReviewDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentRequest.verify|verify} messages. + * Encodes the specified FetchProcessorTypesRequest message. Does not implicitly {@link google.cloud.documentai.v1.FetchProcessorTypesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1.FetchProcessorTypesRequest * @static - * @param {google.cloud.documentai.v1.IReviewDocumentRequest} message ReviewDocumentRequest message or plain object to encode + * @param {google.cloud.documentai.v1.IFetchProcessorTypesRequest} message FetchProcessorTypesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentRequest.encode = function encode(message, writer) { + FetchProcessorTypesRequest.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.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.v1.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); return writer; }; /** - * Encodes the specified ReviewDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentRequest.verify|verify} messages. + * Encodes the specified FetchProcessorTypesRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.FetchProcessorTypesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1.FetchProcessorTypesRequest * @static - * @param {google.cloud.documentai.v1.IReviewDocumentRequest} message ReviewDocumentRequest message or plain object to encode + * @param {google.cloud.documentai.v1.IFetchProcessorTypesRequest} message FetchProcessorTypesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + FetchProcessorTypesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ReviewDocumentRequest message from the specified reader or buffer. + * Decodes a FetchProcessorTypesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1.FetchProcessorTypesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1.ReviewDocumentRequest} ReviewDocumentRequest + * @returns {google.cloud.documentai.v1.FetchProcessorTypesRequest} FetchProcessorTypesRequest * @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) { + FetchProcessorTypesRequest.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.v1.ReviewDocumentRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.FetchProcessorTypesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 4: - message.inlineDocument = $root.google.cloud.documentai.v1.Document.decode(reader, reader.uint32()); - break; case 1: - message.humanReviewConfig = reader.string(); - break; - case 3: - message.enableSchemaValidation = reader.bool(); - break; - case 5: - message.priority = reader.int32(); + message.parent = reader.string(); break; default: reader.skipType(tag & 7); @@ -14235,170 +15302,108 @@ }; /** - * Decodes a ReviewDocumentRequest message from the specified reader or buffer, length delimited. + * Decodes a FetchProcessorTypesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1.FetchProcessorTypesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1.ReviewDocumentRequest} ReviewDocumentRequest + * @returns {google.cloud.documentai.v1.FetchProcessorTypesRequest} FetchProcessorTypesRequest * @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) { + FetchProcessorTypesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ReviewDocumentRequest message. + * Verifies a FetchProcessorTypesRequest message. * @function verify - * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1.FetchProcessorTypesRequest * @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) { + FetchProcessorTypesRequest.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.v1.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.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.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; return null; }; /** - * Creates a ReviewDocumentRequest message from a plain object. Also converts values to their respective internal types. + * Creates a FetchProcessorTypesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1.FetchProcessorTypesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1.ReviewDocumentRequest} ReviewDocumentRequest + * @returns {google.cloud.documentai.v1.FetchProcessorTypesRequest} FetchProcessorTypesRequest */ - ReviewDocumentRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1.ReviewDocumentRequest) + FetchProcessorTypesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.FetchProcessorTypesRequest) return object; - var message = new $root.google.cloud.documentai.v1.ReviewDocumentRequest(); - if (object.inlineDocument != null) { - if (typeof object.inlineDocument !== "object") - throw TypeError(".google.cloud.documentai.v1.ReviewDocumentRequest.inlineDocument: object expected"); - message.inlineDocument = $root.google.cloud.documentai.v1.Document.fromObject(object.inlineDocument); - } - if (object.humanReviewConfig != null) - message.humanReviewConfig = String(object.humanReviewConfig); - if (object.enableSchemaValidation != null) - message.enableSchemaValidation = Boolean(object.enableSchemaValidation); - switch (object.priority) { - case "DEFAULT": - case 0: - message.priority = 0; - break; - case "URGENT": - case 1: - message.priority = 1; - break; - } + var message = new $root.google.cloud.documentai.v1.FetchProcessorTypesRequest(); + if (object.parent != null) + message.parent = String(object.parent); return message; }; /** - * Creates a plain object from a ReviewDocumentRequest message. Also converts values to other types if specified. + * Creates a plain object from a FetchProcessorTypesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1.FetchProcessorTypesRequest * @static - * @param {google.cloud.documentai.v1.ReviewDocumentRequest} message ReviewDocumentRequest + * @param {google.cloud.documentai.v1.FetchProcessorTypesRequest} message FetchProcessorTypesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ReviewDocumentRequest.toObject = function toObject(message, options) { + FetchProcessorTypesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.humanReviewConfig = ""; - object.enableSchemaValidation = false; - object.priority = options.enums === String ? "DEFAULT" : 0; - } - if (message.humanReviewConfig != null && message.hasOwnProperty("humanReviewConfig")) - object.humanReviewConfig = message.humanReviewConfig; - if (message.enableSchemaValidation != null && message.hasOwnProperty("enableSchemaValidation")) - object.enableSchemaValidation = message.enableSchemaValidation; - if (message.inlineDocument != null && message.hasOwnProperty("inlineDocument")) { - object.inlineDocument = $root.google.cloud.documentai.v1.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.v1.ReviewDocumentRequest.Priority[message.priority] : message.priority; + if (options.defaults) + object.parent = ""; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; return object; }; /** - * Converts this ReviewDocumentRequest to JSON. + * Converts this FetchProcessorTypesRequest to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @memberof google.cloud.documentai.v1.FetchProcessorTypesRequest * @instance * @returns {Object.} JSON object */ - ReviewDocumentRequest.prototype.toJSON = function toJSON() { + FetchProcessorTypesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * Priority enum. - * @name google.cloud.documentai.v1.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; + return FetchProcessorTypesRequest; })(); - v1.ReviewDocumentResponse = (function() { + v1.FetchProcessorTypesResponse = (function() { /** - * Properties of a ReviewDocumentResponse. + * Properties of a FetchProcessorTypesResponse. * @memberof google.cloud.documentai.v1 - * @interface IReviewDocumentResponse - * @property {string|null} [gcsDestination] ReviewDocumentResponse gcsDestination + * @interface IFetchProcessorTypesResponse + * @property {Array.|null} [processorTypes] FetchProcessorTypesResponse processorTypes */ /** - * Constructs a new ReviewDocumentResponse. + * Constructs a new FetchProcessorTypesResponse. * @memberof google.cloud.documentai.v1 - * @classdesc Represents a ReviewDocumentResponse. - * @implements IReviewDocumentResponse + * @classdesc Represents a FetchProcessorTypesResponse. + * @implements IFetchProcessorTypesResponse * @constructor - * @param {google.cloud.documentai.v1.IReviewDocumentResponse=} [properties] Properties to set + * @param {google.cloud.documentai.v1.IFetchProcessorTypesResponse=} [properties] Properties to set */ - function ReviewDocumentResponse(properties) { + function FetchProcessorTypesResponse(properties) { + this.processorTypes = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -14406,75 +15411,78 @@ } /** - * ReviewDocumentResponse gcsDestination. - * @member {string} gcsDestination - * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * FetchProcessorTypesResponse processorTypes. + * @member {Array.} processorTypes + * @memberof google.cloud.documentai.v1.FetchProcessorTypesResponse * @instance */ - ReviewDocumentResponse.prototype.gcsDestination = ""; + FetchProcessorTypesResponse.prototype.processorTypes = $util.emptyArray; /** - * Creates a new ReviewDocumentResponse instance using the specified properties. + * Creates a new FetchProcessorTypesResponse instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1.FetchProcessorTypesResponse * @static - * @param {google.cloud.documentai.v1.IReviewDocumentResponse=} [properties] Properties to set - * @returns {google.cloud.documentai.v1.ReviewDocumentResponse} ReviewDocumentResponse instance + * @param {google.cloud.documentai.v1.IFetchProcessorTypesResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.FetchProcessorTypesResponse} FetchProcessorTypesResponse instance */ - ReviewDocumentResponse.create = function create(properties) { - return new ReviewDocumentResponse(properties); + FetchProcessorTypesResponse.create = function create(properties) { + return new FetchProcessorTypesResponse(properties); }; /** - * Encodes the specified ReviewDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentResponse.verify|verify} messages. + * Encodes the specified FetchProcessorTypesResponse message. Does not implicitly {@link google.cloud.documentai.v1.FetchProcessorTypesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1.FetchProcessorTypesResponse * @static - * @param {google.cloud.documentai.v1.IReviewDocumentResponse} message ReviewDocumentResponse message or plain object to encode + * @param {google.cloud.documentai.v1.IFetchProcessorTypesResponse} message FetchProcessorTypesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentResponse.encode = function encode(message, writer) { + FetchProcessorTypesResponse.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.processorTypes != null && message.processorTypes.length) + for (var i = 0; i < message.processorTypes.length; ++i) + $root.google.cloud.documentai.v1.ProcessorType.encode(message.processorTypes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified ReviewDocumentResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentResponse.verify|verify} messages. + * Encodes the specified FetchProcessorTypesResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.FetchProcessorTypesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1.FetchProcessorTypesResponse * @static - * @param {google.cloud.documentai.v1.IReviewDocumentResponse} message ReviewDocumentResponse message or plain object to encode + * @param {google.cloud.documentai.v1.IFetchProcessorTypesResponse} message FetchProcessorTypesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentResponse.encodeDelimited = function encodeDelimited(message, writer) { + FetchProcessorTypesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ReviewDocumentResponse message from the specified reader or buffer. + * Decodes a FetchProcessorTypesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1.FetchProcessorTypesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1.ReviewDocumentResponse} ReviewDocumentResponse + * @returns {google.cloud.documentai.v1.FetchProcessorTypesResponse} FetchProcessorTypesResponse * @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) { + FetchProcessorTypesResponse.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.v1.ReviewDocumentResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.FetchProcessorTypesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.gcsDestination = reader.string(); + if (!(message.processorTypes && message.processorTypes.length)) + message.processorTypes = []; + message.processorTypes.push($root.google.cloud.documentai.v1.ProcessorType.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -14485,108 +15493,126 @@ }; /** - * Decodes a ReviewDocumentResponse message from the specified reader or buffer, length delimited. + * Decodes a FetchProcessorTypesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1.FetchProcessorTypesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1.ReviewDocumentResponse} ReviewDocumentResponse + * @returns {google.cloud.documentai.v1.FetchProcessorTypesResponse} FetchProcessorTypesResponse * @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) { + FetchProcessorTypesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ReviewDocumentResponse message. + * Verifies a FetchProcessorTypesResponse message. * @function verify - * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1.FetchProcessorTypesResponse * @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) { + FetchProcessorTypesResponse.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.processorTypes != null && message.hasOwnProperty("processorTypes")) { + if (!Array.isArray(message.processorTypes)) + return "processorTypes: array expected"; + for (var i = 0; i < message.processorTypes.length; ++i) { + var error = $root.google.cloud.documentai.v1.ProcessorType.verify(message.processorTypes[i]); + if (error) + return "processorTypes." + error; + } + } return null; }; /** - * Creates a ReviewDocumentResponse message from a plain object. Also converts values to their respective internal types. + * Creates a FetchProcessorTypesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1.FetchProcessorTypesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1.ReviewDocumentResponse} ReviewDocumentResponse + * @returns {google.cloud.documentai.v1.FetchProcessorTypesResponse} FetchProcessorTypesResponse */ - ReviewDocumentResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1.ReviewDocumentResponse) + FetchProcessorTypesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.FetchProcessorTypesResponse) return object; - var message = new $root.google.cloud.documentai.v1.ReviewDocumentResponse(); - if (object.gcsDestination != null) - message.gcsDestination = String(object.gcsDestination); + var message = new $root.google.cloud.documentai.v1.FetchProcessorTypesResponse(); + if (object.processorTypes) { + if (!Array.isArray(object.processorTypes)) + throw TypeError(".google.cloud.documentai.v1.FetchProcessorTypesResponse.processorTypes: array expected"); + message.processorTypes = []; + for (var i = 0; i < object.processorTypes.length; ++i) { + if (typeof object.processorTypes[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.FetchProcessorTypesResponse.processorTypes: object expected"); + message.processorTypes[i] = $root.google.cloud.documentai.v1.ProcessorType.fromObject(object.processorTypes[i]); + } + } return message; }; /** - * Creates a plain object from a ReviewDocumentResponse message. Also converts values to other types if specified. + * Creates a plain object from a FetchProcessorTypesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1.FetchProcessorTypesResponse * @static - * @param {google.cloud.documentai.v1.ReviewDocumentResponse} message ReviewDocumentResponse + * @param {google.cloud.documentai.v1.FetchProcessorTypesResponse} message FetchProcessorTypesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ReviewDocumentResponse.toObject = function toObject(message, options) { + FetchProcessorTypesResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.gcsDestination = ""; - if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) - object.gcsDestination = message.gcsDestination; + if (options.arrays || options.defaults) + object.processorTypes = []; + if (message.processorTypes && message.processorTypes.length) { + object.processorTypes = []; + for (var j = 0; j < message.processorTypes.length; ++j) + object.processorTypes[j] = $root.google.cloud.documentai.v1.ProcessorType.toObject(message.processorTypes[j], options); + } return object; }; /** - * Converts this ReviewDocumentResponse to JSON. + * Converts this FetchProcessorTypesResponse to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @memberof google.cloud.documentai.v1.FetchProcessorTypesResponse * @instance * @returns {Object.} JSON object */ - ReviewDocumentResponse.prototype.toJSON = function toJSON() { + FetchProcessorTypesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ReviewDocumentResponse; + return FetchProcessorTypesResponse; })(); - v1.ReviewDocumentOperationMetadata = (function() { + v1.ListProcessorTypesRequest = (function() { /** - * Properties of a ReviewDocumentOperationMetadata. + * Properties of a ListProcessorTypesRequest. * @memberof google.cloud.documentai.v1 - * @interface IReviewDocumentOperationMetadata - * @property {google.cloud.documentai.v1.ICommonOperationMetadata|null} [commonMetadata] ReviewDocumentOperationMetadata commonMetadata - * @property {string|null} [questionId] ReviewDocumentOperationMetadata questionId + * @interface IListProcessorTypesRequest + * @property {string|null} [parent] ListProcessorTypesRequest parent + * @property {number|null} [pageSize] ListProcessorTypesRequest pageSize + * @property {string|null} [pageToken] ListProcessorTypesRequest pageToken */ /** - * Constructs a new ReviewDocumentOperationMetadata. + * Constructs a new ListProcessorTypesRequest. * @memberof google.cloud.documentai.v1 - * @classdesc Represents a ReviewDocumentOperationMetadata. - * @implements IReviewDocumentOperationMetadata + * @classdesc Represents a ListProcessorTypesRequest. + * @implements IListProcessorTypesRequest * @constructor - * @param {google.cloud.documentai.v1.IReviewDocumentOperationMetadata=} [properties] Properties to set + * @param {google.cloud.documentai.v1.IListProcessorTypesRequest=} [properties] Properties to set */ - function ReviewDocumentOperationMetadata(properties) { + function ListProcessorTypesRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -14594,88 +15620,101 @@ } /** - * ReviewDocumentOperationMetadata commonMetadata. - * @member {google.cloud.documentai.v1.ICommonOperationMetadata|null|undefined} commonMetadata - * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * ListProcessorTypesRequest parent. + * @member {string} parent + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest * @instance */ - ReviewDocumentOperationMetadata.prototype.commonMetadata = null; + ListProcessorTypesRequest.prototype.parent = ""; /** - * ReviewDocumentOperationMetadata questionId. - * @member {string} questionId - * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * ListProcessorTypesRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest * @instance */ - ReviewDocumentOperationMetadata.prototype.questionId = ""; + ListProcessorTypesRequest.prototype.pageSize = 0; /** - * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. + * ListProcessorTypesRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest + * @instance + */ + ListProcessorTypesRequest.prototype.pageToken = ""; + + /** + * Creates a new ListProcessorTypesRequest instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest * @static - * @param {google.cloud.documentai.v1.IReviewDocumentOperationMetadata=} [properties] Properties to set - * @returns {google.cloud.documentai.v1.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata instance + * @param {google.cloud.documentai.v1.IListProcessorTypesRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ListProcessorTypesRequest} ListProcessorTypesRequest instance */ - ReviewDocumentOperationMetadata.create = function create(properties) { - return new ReviewDocumentOperationMetadata(properties); + ListProcessorTypesRequest.create = function create(properties) { + return new ListProcessorTypesRequest(properties); }; /** - * Encodes the specified ReviewDocumentOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentOperationMetadata.verify|verify} messages. + * Encodes the specified ListProcessorTypesRequest message. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorTypesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest * @static - * @param {google.cloud.documentai.v1.IReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata message or plain object to encode + * @param {google.cloud.documentai.v1.IListProcessorTypesRequest} message ListProcessorTypesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentOperationMetadata.encode = function encode(message, writer) { + ListProcessorTypesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) - $root.google.cloud.documentai.v1.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); + 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 ReviewDocumentOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentOperationMetadata.verify|verify} messages. + * Encodes the specified ListProcessorTypesRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorTypesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest * @static - * @param {google.cloud.documentai.v1.IReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata message or plain object to encode + * @param {google.cloud.documentai.v1.IListProcessorTypesRequest} message ListProcessorTypesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ReviewDocumentOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + ListProcessorTypesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer. + * Decodes a ListProcessorTypesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + * @returns {google.cloud.documentai.v1.ListProcessorTypesRequest} ListProcessorTypesRequest * @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) { + ListProcessorTypesRequest.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.v1.ReviewDocumentOperationMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.ListProcessorTypesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 5: - message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); + case 1: + message.parent = reader.string(); break; - case 6: - message.questionId = reader.string(); + case 2: + message.pageSize = reader.int32(); + break; + case 3: + message.pageToken = reader.string(); break; default: reader.skipType(tag & 7); @@ -14686,124 +15725,8917 @@ }; /** - * Decodes a ReviewDocumentOperationMetadata message from the specified reader or buffer, length delimited. + * Decodes a ListProcessorTypesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + * @returns {google.cloud.documentai.v1.ListProcessorTypesRequest} ListProcessorTypesRequest * @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) { + ListProcessorTypesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ReviewDocumentOperationMetadata message. + * Verifies a ListProcessorTypesRequest message. * @function verify - * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest * @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) { + ListProcessorTypesRequest.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.v1.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"; + 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 ReviewDocumentOperationMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a ListProcessorTypesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + * @returns {google.cloud.documentai.v1.ListProcessorTypesRequest} ListProcessorTypesRequest */ - ReviewDocumentOperationMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1.ReviewDocumentOperationMetadata) + ListProcessorTypesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ListProcessorTypesRequest) return object; - var message = new $root.google.cloud.documentai.v1.ReviewDocumentOperationMetadata(); - if (object.commonMetadata != null) { - if (typeof object.commonMetadata !== "object") - throw TypeError(".google.cloud.documentai.v1.ReviewDocumentOperationMetadata.commonMetadata: object expected"); - message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.fromObject(object.commonMetadata); - } - if (object.questionId != null) - message.questionId = String(object.questionId); + var message = new $root.google.cloud.documentai.v1.ListProcessorTypesRequest(); + 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 ReviewDocumentOperationMetadata message. Also converts values to other types if specified. + * Creates a plain object from a ListProcessorTypesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest * @static - * @param {google.cloud.documentai.v1.ReviewDocumentOperationMetadata} message ReviewDocumentOperationMetadata + * @param {google.cloud.documentai.v1.ListProcessorTypesRequest} message ListProcessorTypesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListProcessorTypesRequest.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 ListProcessorTypesRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.ListProcessorTypesRequest + * @instance + * @returns {Object.} JSON object + */ + ListProcessorTypesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListProcessorTypesRequest; + })(); + + v1.ListProcessorTypesResponse = (function() { + + /** + * Properties of a ListProcessorTypesResponse. + * @memberof google.cloud.documentai.v1 + * @interface IListProcessorTypesResponse + * @property {Array.|null} [processorTypes] ListProcessorTypesResponse processorTypes + * @property {string|null} [nextPageToken] ListProcessorTypesResponse nextPageToken + */ + + /** + * Constructs a new ListProcessorTypesResponse. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a ListProcessorTypesResponse. + * @implements IListProcessorTypesResponse + * @constructor + * @param {google.cloud.documentai.v1.IListProcessorTypesResponse=} [properties] Properties to set + */ + function ListProcessorTypesResponse(properties) { + this.processorTypes = []; + 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]]; + } + + /** + * ListProcessorTypesResponse processorTypes. + * @member {Array.} processorTypes + * @memberof google.cloud.documentai.v1.ListProcessorTypesResponse + * @instance + */ + ListProcessorTypesResponse.prototype.processorTypes = $util.emptyArray; + + /** + * ListProcessorTypesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.documentai.v1.ListProcessorTypesResponse + * @instance + */ + ListProcessorTypesResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListProcessorTypesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.ListProcessorTypesResponse + * @static + * @param {google.cloud.documentai.v1.IListProcessorTypesResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ListProcessorTypesResponse} ListProcessorTypesResponse instance + */ + ListProcessorTypesResponse.create = function create(properties) { + return new ListProcessorTypesResponse(properties); + }; + + /** + * Encodes the specified ListProcessorTypesResponse message. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorTypesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.ListProcessorTypesResponse + * @static + * @param {google.cloud.documentai.v1.IListProcessorTypesResponse} message ListProcessorTypesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProcessorTypesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.processorTypes != null && message.processorTypes.length) + for (var i = 0; i < message.processorTypes.length; ++i) + $root.google.cloud.documentai.v1.ProcessorType.encode(message.processorTypes[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 ListProcessorTypesResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorTypesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.ListProcessorTypesResponse + * @static + * @param {google.cloud.documentai.v1.IListProcessorTypesResponse} message ListProcessorTypesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProcessorTypesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListProcessorTypesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.ListProcessorTypesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.ListProcessorTypesResponse} ListProcessorTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProcessorTypesResponse.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.v1.ListProcessorTypesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.processorTypes && message.processorTypes.length)) + message.processorTypes = []; + message.processorTypes.push($root.google.cloud.documentai.v1.ProcessorType.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListProcessorTypesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.ListProcessorTypesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.ListProcessorTypesResponse} ListProcessorTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProcessorTypesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListProcessorTypesResponse message. + * @function verify + * @memberof google.cloud.documentai.v1.ListProcessorTypesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListProcessorTypesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.processorTypes != null && message.hasOwnProperty("processorTypes")) { + if (!Array.isArray(message.processorTypes)) + return "processorTypes: array expected"; + for (var i = 0; i < message.processorTypes.length; ++i) { + var error = $root.google.cloud.documentai.v1.ProcessorType.verify(message.processorTypes[i]); + if (error) + return "processorTypes." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListProcessorTypesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.ListProcessorTypesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.ListProcessorTypesResponse} ListProcessorTypesResponse + */ + ListProcessorTypesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ListProcessorTypesResponse) + return object; + var message = new $root.google.cloud.documentai.v1.ListProcessorTypesResponse(); + if (object.processorTypes) { + if (!Array.isArray(object.processorTypes)) + throw TypeError(".google.cloud.documentai.v1.ListProcessorTypesResponse.processorTypes: array expected"); + message.processorTypes = []; + for (var i = 0; i < object.processorTypes.length; ++i) { + if (typeof object.processorTypes[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.ListProcessorTypesResponse.processorTypes: object expected"); + message.processorTypes[i] = $root.google.cloud.documentai.v1.ProcessorType.fromObject(object.processorTypes[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListProcessorTypesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.ListProcessorTypesResponse + * @static + * @param {google.cloud.documentai.v1.ListProcessorTypesResponse} message ListProcessorTypesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListProcessorTypesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.processorTypes = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.processorTypes && message.processorTypes.length) { + object.processorTypes = []; + for (var j = 0; j < message.processorTypes.length; ++j) + object.processorTypes[j] = $root.google.cloud.documentai.v1.ProcessorType.toObject(message.processorTypes[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListProcessorTypesResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.ListProcessorTypesResponse + * @instance + * @returns {Object.} JSON object + */ + ListProcessorTypesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListProcessorTypesResponse; + })(); + + v1.ListProcessorsRequest = (function() { + + /** + * Properties of a ListProcessorsRequest. + * @memberof google.cloud.documentai.v1 + * @interface IListProcessorsRequest + * @property {string|null} [parent] ListProcessorsRequest parent + * @property {number|null} [pageSize] ListProcessorsRequest pageSize + * @property {string|null} [pageToken] ListProcessorsRequest pageToken + */ + + /** + * Constructs a new ListProcessorsRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a ListProcessorsRequest. + * @implements IListProcessorsRequest + * @constructor + * @param {google.cloud.documentai.v1.IListProcessorsRequest=} [properties] Properties to set + */ + function ListProcessorsRequest(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]]; + } + + /** + * ListProcessorsRequest parent. + * @member {string} parent + * @memberof google.cloud.documentai.v1.ListProcessorsRequest + * @instance + */ + ListProcessorsRequest.prototype.parent = ""; + + /** + * ListProcessorsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.documentai.v1.ListProcessorsRequest + * @instance + */ + ListProcessorsRequest.prototype.pageSize = 0; + + /** + * ListProcessorsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.documentai.v1.ListProcessorsRequest + * @instance + */ + ListProcessorsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListProcessorsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.ListProcessorsRequest + * @static + * @param {google.cloud.documentai.v1.IListProcessorsRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ListProcessorsRequest} ListProcessorsRequest instance + */ + ListProcessorsRequest.create = function create(properties) { + return new ListProcessorsRequest(properties); + }; + + /** + * Encodes the specified ListProcessorsRequest message. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.ListProcessorsRequest + * @static + * @param {google.cloud.documentai.v1.IListProcessorsRequest} message ListProcessorsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProcessorsRequest.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 ListProcessorsRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.ListProcessorsRequest + * @static + * @param {google.cloud.documentai.v1.IListProcessorsRequest} message ListProcessorsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProcessorsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListProcessorsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.ListProcessorsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.ListProcessorsRequest} ListProcessorsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProcessorsRequest.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.v1.ListProcessorsRequest(); + 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 ListProcessorsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.ListProcessorsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.ListProcessorsRequest} ListProcessorsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProcessorsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListProcessorsRequest message. + * @function verify + * @memberof google.cloud.documentai.v1.ListProcessorsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListProcessorsRequest.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 ListProcessorsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.ListProcessorsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.ListProcessorsRequest} ListProcessorsRequest + */ + ListProcessorsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ListProcessorsRequest) + return object; + var message = new $root.google.cloud.documentai.v1.ListProcessorsRequest(); + 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 ListProcessorsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.ListProcessorsRequest + * @static + * @param {google.cloud.documentai.v1.ListProcessorsRequest} message ListProcessorsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListProcessorsRequest.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 ListProcessorsRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.ListProcessorsRequest + * @instance + * @returns {Object.} JSON object + */ + ListProcessorsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListProcessorsRequest; + })(); + + v1.ListProcessorsResponse = (function() { + + /** + * Properties of a ListProcessorsResponse. + * @memberof google.cloud.documentai.v1 + * @interface IListProcessorsResponse + * @property {Array.|null} [processors] ListProcessorsResponse processors + * @property {string|null} [nextPageToken] ListProcessorsResponse nextPageToken + */ + + /** + * Constructs a new ListProcessorsResponse. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a ListProcessorsResponse. + * @implements IListProcessorsResponse + * @constructor + * @param {google.cloud.documentai.v1.IListProcessorsResponse=} [properties] Properties to set + */ + function ListProcessorsResponse(properties) { + this.processors = []; + 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]]; + } + + /** + * ListProcessorsResponse processors. + * @member {Array.} processors + * @memberof google.cloud.documentai.v1.ListProcessorsResponse + * @instance + */ + ListProcessorsResponse.prototype.processors = $util.emptyArray; + + /** + * ListProcessorsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.documentai.v1.ListProcessorsResponse + * @instance + */ + ListProcessorsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListProcessorsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.ListProcessorsResponse + * @static + * @param {google.cloud.documentai.v1.IListProcessorsResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ListProcessorsResponse} ListProcessorsResponse instance + */ + ListProcessorsResponse.create = function create(properties) { + return new ListProcessorsResponse(properties); + }; + + /** + * Encodes the specified ListProcessorsResponse message. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.ListProcessorsResponse + * @static + * @param {google.cloud.documentai.v1.IListProcessorsResponse} message ListProcessorsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProcessorsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.processors != null && message.processors.length) + for (var i = 0; i < message.processors.length; ++i) + $root.google.cloud.documentai.v1.Processor.encode(message.processors[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 ListProcessorsResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.ListProcessorsResponse + * @static + * @param {google.cloud.documentai.v1.IListProcessorsResponse} message ListProcessorsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProcessorsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListProcessorsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.ListProcessorsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.ListProcessorsResponse} ListProcessorsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProcessorsResponse.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.v1.ListProcessorsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.processors && message.processors.length)) + message.processors = []; + message.processors.push($root.google.cloud.documentai.v1.Processor.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListProcessorsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.ListProcessorsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.ListProcessorsResponse} ListProcessorsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProcessorsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListProcessorsResponse message. + * @function verify + * @memberof google.cloud.documentai.v1.ListProcessorsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListProcessorsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.processors != null && message.hasOwnProperty("processors")) { + if (!Array.isArray(message.processors)) + return "processors: array expected"; + for (var i = 0; i < message.processors.length; ++i) { + var error = $root.google.cloud.documentai.v1.Processor.verify(message.processors[i]); + if (error) + return "processors." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListProcessorsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.ListProcessorsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.ListProcessorsResponse} ListProcessorsResponse + */ + ListProcessorsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ListProcessorsResponse) + return object; + var message = new $root.google.cloud.documentai.v1.ListProcessorsResponse(); + if (object.processors) { + if (!Array.isArray(object.processors)) + throw TypeError(".google.cloud.documentai.v1.ListProcessorsResponse.processors: array expected"); + message.processors = []; + for (var i = 0; i < object.processors.length; ++i) { + if (typeof object.processors[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.ListProcessorsResponse.processors: object expected"); + message.processors[i] = $root.google.cloud.documentai.v1.Processor.fromObject(object.processors[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListProcessorsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.ListProcessorsResponse + * @static + * @param {google.cloud.documentai.v1.ListProcessorsResponse} message ListProcessorsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListProcessorsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.processors = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.processors && message.processors.length) { + object.processors = []; + for (var j = 0; j < message.processors.length; ++j) + object.processors[j] = $root.google.cloud.documentai.v1.Processor.toObject(message.processors[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListProcessorsResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.ListProcessorsResponse + * @instance + * @returns {Object.} JSON object + */ + ListProcessorsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListProcessorsResponse; + })(); + + v1.GetProcessorRequest = (function() { + + /** + * Properties of a GetProcessorRequest. + * @memberof google.cloud.documentai.v1 + * @interface IGetProcessorRequest + * @property {string|null} [name] GetProcessorRequest name + */ + + /** + * Constructs a new GetProcessorRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a GetProcessorRequest. + * @implements IGetProcessorRequest + * @constructor + * @param {google.cloud.documentai.v1.IGetProcessorRequest=} [properties] Properties to set + */ + function GetProcessorRequest(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]]; + } + + /** + * GetProcessorRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1.GetProcessorRequest + * @instance + */ + GetProcessorRequest.prototype.name = ""; + + /** + * Creates a new GetProcessorRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.GetProcessorRequest + * @static + * @param {google.cloud.documentai.v1.IGetProcessorRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.GetProcessorRequest} GetProcessorRequest instance + */ + GetProcessorRequest.create = function create(properties) { + return new GetProcessorRequest(properties); + }; + + /** + * Encodes the specified GetProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1.GetProcessorRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.GetProcessorRequest + * @static + * @param {google.cloud.documentai.v1.IGetProcessorRequest} message GetProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProcessorRequest.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 GetProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.GetProcessorRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.GetProcessorRequest + * @static + * @param {google.cloud.documentai.v1.IGetProcessorRequest} message GetProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProcessorRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetProcessorRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.GetProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.GetProcessorRequest} GetProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProcessorRequest.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.v1.GetProcessorRequest(); + 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 GetProcessorRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.GetProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.GetProcessorRequest} GetProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProcessorRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetProcessorRequest message. + * @function verify + * @memberof google.cloud.documentai.v1.GetProcessorRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetProcessorRequest.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 GetProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.GetProcessorRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.GetProcessorRequest} GetProcessorRequest + */ + GetProcessorRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.GetProcessorRequest) + return object; + var message = new $root.google.cloud.documentai.v1.GetProcessorRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetProcessorRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.GetProcessorRequest + * @static + * @param {google.cloud.documentai.v1.GetProcessorRequest} message GetProcessorRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetProcessorRequest.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 GetProcessorRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.GetProcessorRequest + * @instance + * @returns {Object.} JSON object + */ + GetProcessorRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetProcessorRequest; + })(); + + v1.GetProcessorVersionRequest = (function() { + + /** + * Properties of a GetProcessorVersionRequest. + * @memberof google.cloud.documentai.v1 + * @interface IGetProcessorVersionRequest + * @property {string|null} [name] GetProcessorVersionRequest name + */ + + /** + * Constructs a new GetProcessorVersionRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a GetProcessorVersionRequest. + * @implements IGetProcessorVersionRequest + * @constructor + * @param {google.cloud.documentai.v1.IGetProcessorVersionRequest=} [properties] Properties to set + */ + function GetProcessorVersionRequest(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]]; + } + + /** + * GetProcessorVersionRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1.GetProcessorVersionRequest + * @instance + */ + GetProcessorVersionRequest.prototype.name = ""; + + /** + * Creates a new GetProcessorVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.GetProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.IGetProcessorVersionRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.GetProcessorVersionRequest} GetProcessorVersionRequest instance + */ + GetProcessorVersionRequest.create = function create(properties) { + return new GetProcessorVersionRequest(properties); + }; + + /** + * Encodes the specified GetProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1.GetProcessorVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.GetProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.IGetProcessorVersionRequest} message GetProcessorVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProcessorVersionRequest.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 GetProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.GetProcessorVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.GetProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.IGetProcessorVersionRequest} message GetProcessorVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetProcessorVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetProcessorVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.GetProcessorVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.GetProcessorVersionRequest} GetProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProcessorVersionRequest.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.v1.GetProcessorVersionRequest(); + 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 GetProcessorVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.GetProcessorVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.GetProcessorVersionRequest} GetProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetProcessorVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetProcessorVersionRequest message. + * @function verify + * @memberof google.cloud.documentai.v1.GetProcessorVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetProcessorVersionRequest.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 GetProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.GetProcessorVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.GetProcessorVersionRequest} GetProcessorVersionRequest + */ + GetProcessorVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.GetProcessorVersionRequest) + return object; + var message = new $root.google.cloud.documentai.v1.GetProcessorVersionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetProcessorVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.GetProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.GetProcessorVersionRequest} message GetProcessorVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetProcessorVersionRequest.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 GetProcessorVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.GetProcessorVersionRequest + * @instance + * @returns {Object.} JSON object + */ + GetProcessorVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return GetProcessorVersionRequest; + })(); + + v1.ListProcessorVersionsRequest = (function() { + + /** + * Properties of a ListProcessorVersionsRequest. + * @memberof google.cloud.documentai.v1 + * @interface IListProcessorVersionsRequest + * @property {string|null} [parent] ListProcessorVersionsRequest parent + * @property {number|null} [pageSize] ListProcessorVersionsRequest pageSize + * @property {string|null} [pageToken] ListProcessorVersionsRequest pageToken + */ + + /** + * Constructs a new ListProcessorVersionsRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a ListProcessorVersionsRequest. + * @implements IListProcessorVersionsRequest + * @constructor + * @param {google.cloud.documentai.v1.IListProcessorVersionsRequest=} [properties] Properties to set + */ + function ListProcessorVersionsRequest(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]]; + } + + /** + * ListProcessorVersionsRequest parent. + * @member {string} parent + * @memberof google.cloud.documentai.v1.ListProcessorVersionsRequest + * @instance + */ + ListProcessorVersionsRequest.prototype.parent = ""; + + /** + * ListProcessorVersionsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.documentai.v1.ListProcessorVersionsRequest + * @instance + */ + ListProcessorVersionsRequest.prototype.pageSize = 0; + + /** + * ListProcessorVersionsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.documentai.v1.ListProcessorVersionsRequest + * @instance + */ + ListProcessorVersionsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListProcessorVersionsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.ListProcessorVersionsRequest + * @static + * @param {google.cloud.documentai.v1.IListProcessorVersionsRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ListProcessorVersionsRequest} ListProcessorVersionsRequest instance + */ + ListProcessorVersionsRequest.create = function create(properties) { + return new ListProcessorVersionsRequest(properties); + }; + + /** + * Encodes the specified ListProcessorVersionsRequest message. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorVersionsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.ListProcessorVersionsRequest + * @static + * @param {google.cloud.documentai.v1.IListProcessorVersionsRequest} message ListProcessorVersionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProcessorVersionsRequest.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 ListProcessorVersionsRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorVersionsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.ListProcessorVersionsRequest + * @static + * @param {google.cloud.documentai.v1.IListProcessorVersionsRequest} message ListProcessorVersionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProcessorVersionsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListProcessorVersionsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.ListProcessorVersionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.ListProcessorVersionsRequest} ListProcessorVersionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProcessorVersionsRequest.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.v1.ListProcessorVersionsRequest(); + 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 ListProcessorVersionsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.ListProcessorVersionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.ListProcessorVersionsRequest} ListProcessorVersionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProcessorVersionsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListProcessorVersionsRequest message. + * @function verify + * @memberof google.cloud.documentai.v1.ListProcessorVersionsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListProcessorVersionsRequest.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 ListProcessorVersionsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.ListProcessorVersionsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.ListProcessorVersionsRequest} ListProcessorVersionsRequest + */ + ListProcessorVersionsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ListProcessorVersionsRequest) + return object; + var message = new $root.google.cloud.documentai.v1.ListProcessorVersionsRequest(); + 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 ListProcessorVersionsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.ListProcessorVersionsRequest + * @static + * @param {google.cloud.documentai.v1.ListProcessorVersionsRequest} message ListProcessorVersionsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListProcessorVersionsRequest.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 ListProcessorVersionsRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.ListProcessorVersionsRequest + * @instance + * @returns {Object.} JSON object + */ + ListProcessorVersionsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListProcessorVersionsRequest; + })(); + + v1.ListProcessorVersionsResponse = (function() { + + /** + * Properties of a ListProcessorVersionsResponse. + * @memberof google.cloud.documentai.v1 + * @interface IListProcessorVersionsResponse + * @property {Array.|null} [processorVersions] ListProcessorVersionsResponse processorVersions + * @property {string|null} [nextPageToken] ListProcessorVersionsResponse nextPageToken + */ + + /** + * Constructs a new ListProcessorVersionsResponse. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a ListProcessorVersionsResponse. + * @implements IListProcessorVersionsResponse + * @constructor + * @param {google.cloud.documentai.v1.IListProcessorVersionsResponse=} [properties] Properties to set + */ + function ListProcessorVersionsResponse(properties) { + this.processorVersions = []; + 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]]; + } + + /** + * ListProcessorVersionsResponse processorVersions. + * @member {Array.} processorVersions + * @memberof google.cloud.documentai.v1.ListProcessorVersionsResponse + * @instance + */ + ListProcessorVersionsResponse.prototype.processorVersions = $util.emptyArray; + + /** + * ListProcessorVersionsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.documentai.v1.ListProcessorVersionsResponse + * @instance + */ + ListProcessorVersionsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListProcessorVersionsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.ListProcessorVersionsResponse + * @static + * @param {google.cloud.documentai.v1.IListProcessorVersionsResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ListProcessorVersionsResponse} ListProcessorVersionsResponse instance + */ + ListProcessorVersionsResponse.create = function create(properties) { + return new ListProcessorVersionsResponse(properties); + }; + + /** + * Encodes the specified ListProcessorVersionsResponse message. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorVersionsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.ListProcessorVersionsResponse + * @static + * @param {google.cloud.documentai.v1.IListProcessorVersionsResponse} message ListProcessorVersionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProcessorVersionsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.processorVersions != null && message.processorVersions.length) + for (var i = 0; i < message.processorVersions.length; ++i) + $root.google.cloud.documentai.v1.ProcessorVersion.encode(message.processorVersions[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 ListProcessorVersionsResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ListProcessorVersionsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.ListProcessorVersionsResponse + * @static + * @param {google.cloud.documentai.v1.IListProcessorVersionsResponse} message ListProcessorVersionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListProcessorVersionsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListProcessorVersionsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.ListProcessorVersionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.ListProcessorVersionsResponse} ListProcessorVersionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProcessorVersionsResponse.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.v1.ListProcessorVersionsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.processorVersions && message.processorVersions.length)) + message.processorVersions = []; + message.processorVersions.push($root.google.cloud.documentai.v1.ProcessorVersion.decode(reader, reader.uint32())); + break; + case 2: + message.nextPageToken = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListProcessorVersionsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.ListProcessorVersionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.ListProcessorVersionsResponse} ListProcessorVersionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListProcessorVersionsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListProcessorVersionsResponse message. + * @function verify + * @memberof google.cloud.documentai.v1.ListProcessorVersionsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListProcessorVersionsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.processorVersions != null && message.hasOwnProperty("processorVersions")) { + if (!Array.isArray(message.processorVersions)) + return "processorVersions: array expected"; + for (var i = 0; i < message.processorVersions.length; ++i) { + var error = $root.google.cloud.documentai.v1.ProcessorVersion.verify(message.processorVersions[i]); + if (error) + return "processorVersions." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListProcessorVersionsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.ListProcessorVersionsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.ListProcessorVersionsResponse} ListProcessorVersionsResponse + */ + ListProcessorVersionsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ListProcessorVersionsResponse) + return object; + var message = new $root.google.cloud.documentai.v1.ListProcessorVersionsResponse(); + if (object.processorVersions) { + if (!Array.isArray(object.processorVersions)) + throw TypeError(".google.cloud.documentai.v1.ListProcessorVersionsResponse.processorVersions: array expected"); + message.processorVersions = []; + for (var i = 0; i < object.processorVersions.length; ++i) { + if (typeof object.processorVersions[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.ListProcessorVersionsResponse.processorVersions: object expected"); + message.processorVersions[i] = $root.google.cloud.documentai.v1.ProcessorVersion.fromObject(object.processorVersions[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListProcessorVersionsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.ListProcessorVersionsResponse + * @static + * @param {google.cloud.documentai.v1.ListProcessorVersionsResponse} message ListProcessorVersionsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListProcessorVersionsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.processorVersions = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.processorVersions && message.processorVersions.length) { + object.processorVersions = []; + for (var j = 0; j < message.processorVersions.length; ++j) + object.processorVersions[j] = $root.google.cloud.documentai.v1.ProcessorVersion.toObject(message.processorVersions[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListProcessorVersionsResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.ListProcessorVersionsResponse + * @instance + * @returns {Object.} JSON object + */ + ListProcessorVersionsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ListProcessorVersionsResponse; + })(); + + v1.DeleteProcessorVersionRequest = (function() { + + /** + * Properties of a DeleteProcessorVersionRequest. + * @memberof google.cloud.documentai.v1 + * @interface IDeleteProcessorVersionRequest + * @property {string|null} [name] DeleteProcessorVersionRequest name + */ + + /** + * Constructs a new DeleteProcessorVersionRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a DeleteProcessorVersionRequest. + * @implements IDeleteProcessorVersionRequest + * @constructor + * @param {google.cloud.documentai.v1.IDeleteProcessorVersionRequest=} [properties] Properties to set + */ + function DeleteProcessorVersionRequest(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]]; + } + + /** + * DeleteProcessorVersionRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionRequest + * @instance + */ + DeleteProcessorVersionRequest.prototype.name = ""; + + /** + * Creates a new DeleteProcessorVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.IDeleteProcessorVersionRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.DeleteProcessorVersionRequest} DeleteProcessorVersionRequest instance + */ + DeleteProcessorVersionRequest.create = function create(properties) { + return new DeleteProcessorVersionRequest(properties); + }; + + /** + * Encodes the specified DeleteProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.IDeleteProcessorVersionRequest} message DeleteProcessorVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProcessorVersionRequest.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 DeleteProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.IDeleteProcessorVersionRequest} message DeleteProcessorVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProcessorVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteProcessorVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.DeleteProcessorVersionRequest} DeleteProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProcessorVersionRequest.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.v1.DeleteProcessorVersionRequest(); + 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 DeleteProcessorVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.DeleteProcessorVersionRequest} DeleteProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProcessorVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteProcessorVersionRequest message. + * @function verify + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteProcessorVersionRequest.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 DeleteProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DeleteProcessorVersionRequest} DeleteProcessorVersionRequest + */ + DeleteProcessorVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DeleteProcessorVersionRequest) + return object; + var message = new $root.google.cloud.documentai.v1.DeleteProcessorVersionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteProcessorVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.DeleteProcessorVersionRequest} message DeleteProcessorVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteProcessorVersionRequest.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 DeleteProcessorVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteProcessorVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteProcessorVersionRequest; + })(); + + v1.DeleteProcessorVersionMetadata = (function() { + + /** + * Properties of a DeleteProcessorVersionMetadata. + * @memberof google.cloud.documentai.v1 + * @interface IDeleteProcessorVersionMetadata + * @property {google.cloud.documentai.v1.ICommonOperationMetadata|null} [commonMetadata] DeleteProcessorVersionMetadata commonMetadata + */ + + /** + * Constructs a new DeleteProcessorVersionMetadata. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a DeleteProcessorVersionMetadata. + * @implements IDeleteProcessorVersionMetadata + * @constructor + * @param {google.cloud.documentai.v1.IDeleteProcessorVersionMetadata=} [properties] Properties to set + */ + function DeleteProcessorVersionMetadata(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]]; + } + + /** + * DeleteProcessorVersionMetadata commonMetadata. + * @member {google.cloud.documentai.v1.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionMetadata + * @instance + */ + DeleteProcessorVersionMetadata.prototype.commonMetadata = null; + + /** + * Creates a new DeleteProcessorVersionMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.IDeleteProcessorVersionMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.DeleteProcessorVersionMetadata} DeleteProcessorVersionMetadata instance + */ + DeleteProcessorVersionMetadata.create = function create(properties) { + return new DeleteProcessorVersionMetadata(properties); + }; + + /** + * Encodes the specified DeleteProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorVersionMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.IDeleteProcessorVersionMetadata} message DeleteProcessorVersionMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProcessorVersionMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DeleteProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorVersionMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.IDeleteProcessorVersionMetadata} message DeleteProcessorVersionMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProcessorVersionMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteProcessorVersionMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.DeleteProcessorVersionMetadata} DeleteProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProcessorVersionMetadata.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.v1.DeleteProcessorVersionMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteProcessorVersionMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.DeleteProcessorVersionMetadata} DeleteProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProcessorVersionMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteProcessorVersionMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteProcessorVersionMetadata.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.v1.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } + return null; + }; + + /** + * Creates a DeleteProcessorVersionMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DeleteProcessorVersionMetadata} DeleteProcessorVersionMetadata + */ + DeleteProcessorVersionMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DeleteProcessorVersionMetadata) + return object; + var message = new $root.google.cloud.documentai.v1.DeleteProcessorVersionMetadata(); + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1.DeleteProcessorVersionMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.fromObject(object.commonMetadata); + } + return message; + }; + + /** + * Creates a plain object from a DeleteProcessorVersionMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.DeleteProcessorVersionMetadata} message DeleteProcessorVersionMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteProcessorVersionMetadata.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.v1.CommonOperationMetadata.toObject(message.commonMetadata, options); + return object; + }; + + /** + * Converts this DeleteProcessorVersionMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DeleteProcessorVersionMetadata + * @instance + * @returns {Object.} JSON object + */ + DeleteProcessorVersionMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteProcessorVersionMetadata; + })(); + + v1.DeployProcessorVersionRequest = (function() { + + /** + * Properties of a DeployProcessorVersionRequest. + * @memberof google.cloud.documentai.v1 + * @interface IDeployProcessorVersionRequest + * @property {string|null} [name] DeployProcessorVersionRequest name + */ + + /** + * Constructs a new DeployProcessorVersionRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a DeployProcessorVersionRequest. + * @implements IDeployProcessorVersionRequest + * @constructor + * @param {google.cloud.documentai.v1.IDeployProcessorVersionRequest=} [properties] Properties to set + */ + function DeployProcessorVersionRequest(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]]; + } + + /** + * DeployProcessorVersionRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1.DeployProcessorVersionRequest + * @instance + */ + DeployProcessorVersionRequest.prototype.name = ""; + + /** + * Creates a new DeployProcessorVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DeployProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.IDeployProcessorVersionRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.DeployProcessorVersionRequest} DeployProcessorVersionRequest instance + */ + DeployProcessorVersionRequest.create = function create(properties) { + return new DeployProcessorVersionRequest(properties); + }; + + /** + * Encodes the specified DeployProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1.DeployProcessorVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DeployProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.IDeployProcessorVersionRequest} message DeployProcessorVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeployProcessorVersionRequest.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 DeployProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DeployProcessorVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DeployProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.IDeployProcessorVersionRequest} message DeployProcessorVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeployProcessorVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeployProcessorVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.DeployProcessorVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.DeployProcessorVersionRequest} DeployProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeployProcessorVersionRequest.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.v1.DeployProcessorVersionRequest(); + 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 DeployProcessorVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.DeployProcessorVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.DeployProcessorVersionRequest} DeployProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeployProcessorVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeployProcessorVersionRequest message. + * @function verify + * @memberof google.cloud.documentai.v1.DeployProcessorVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeployProcessorVersionRequest.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 DeployProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.DeployProcessorVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DeployProcessorVersionRequest} DeployProcessorVersionRequest + */ + DeployProcessorVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DeployProcessorVersionRequest) + return object; + var message = new $root.google.cloud.documentai.v1.DeployProcessorVersionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeployProcessorVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.DeployProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.DeployProcessorVersionRequest} message DeployProcessorVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeployProcessorVersionRequest.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 DeployProcessorVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DeployProcessorVersionRequest + * @instance + * @returns {Object.} JSON object + */ + DeployProcessorVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeployProcessorVersionRequest; + })(); + + v1.DeployProcessorVersionResponse = (function() { + + /** + * Properties of a DeployProcessorVersionResponse. + * @memberof google.cloud.documentai.v1 + * @interface IDeployProcessorVersionResponse + */ + + /** + * Constructs a new DeployProcessorVersionResponse. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a DeployProcessorVersionResponse. + * @implements IDeployProcessorVersionResponse + * @constructor + * @param {google.cloud.documentai.v1.IDeployProcessorVersionResponse=} [properties] Properties to set + */ + function DeployProcessorVersionResponse(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 DeployProcessorVersionResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DeployProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1.IDeployProcessorVersionResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.DeployProcessorVersionResponse} DeployProcessorVersionResponse instance + */ + DeployProcessorVersionResponse.create = function create(properties) { + return new DeployProcessorVersionResponse(properties); + }; + + /** + * Encodes the specified DeployProcessorVersionResponse message. Does not implicitly {@link google.cloud.documentai.v1.DeployProcessorVersionResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DeployProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1.IDeployProcessorVersionResponse} message DeployProcessorVersionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeployProcessorVersionResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified DeployProcessorVersionResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DeployProcessorVersionResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DeployProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1.IDeployProcessorVersionResponse} message DeployProcessorVersionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeployProcessorVersionResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeployProcessorVersionResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.DeployProcessorVersionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.DeployProcessorVersionResponse} DeployProcessorVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeployProcessorVersionResponse.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.v1.DeployProcessorVersionResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeployProcessorVersionResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.DeployProcessorVersionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.DeployProcessorVersionResponse} DeployProcessorVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeployProcessorVersionResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeployProcessorVersionResponse message. + * @function verify + * @memberof google.cloud.documentai.v1.DeployProcessorVersionResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeployProcessorVersionResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a DeployProcessorVersionResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.DeployProcessorVersionResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DeployProcessorVersionResponse} DeployProcessorVersionResponse + */ + DeployProcessorVersionResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DeployProcessorVersionResponse) + return object; + return new $root.google.cloud.documentai.v1.DeployProcessorVersionResponse(); + }; + + /** + * Creates a plain object from a DeployProcessorVersionResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.DeployProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1.DeployProcessorVersionResponse} message DeployProcessorVersionResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeployProcessorVersionResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this DeployProcessorVersionResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DeployProcessorVersionResponse + * @instance + * @returns {Object.} JSON object + */ + DeployProcessorVersionResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeployProcessorVersionResponse; + })(); + + v1.DeployProcessorVersionMetadata = (function() { + + /** + * Properties of a DeployProcessorVersionMetadata. + * @memberof google.cloud.documentai.v1 + * @interface IDeployProcessorVersionMetadata + * @property {google.cloud.documentai.v1.ICommonOperationMetadata|null} [commonMetadata] DeployProcessorVersionMetadata commonMetadata + */ + + /** + * Constructs a new DeployProcessorVersionMetadata. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a DeployProcessorVersionMetadata. + * @implements IDeployProcessorVersionMetadata + * @constructor + * @param {google.cloud.documentai.v1.IDeployProcessorVersionMetadata=} [properties] Properties to set + */ + function DeployProcessorVersionMetadata(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]]; + } + + /** + * DeployProcessorVersionMetadata commonMetadata. + * @member {google.cloud.documentai.v1.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1.DeployProcessorVersionMetadata + * @instance + */ + DeployProcessorVersionMetadata.prototype.commonMetadata = null; + + /** + * Creates a new DeployProcessorVersionMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DeployProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.IDeployProcessorVersionMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.DeployProcessorVersionMetadata} DeployProcessorVersionMetadata instance + */ + DeployProcessorVersionMetadata.create = function create(properties) { + return new DeployProcessorVersionMetadata(properties); + }; + + /** + * Encodes the specified DeployProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1.DeployProcessorVersionMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DeployProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.IDeployProcessorVersionMetadata} message DeployProcessorVersionMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeployProcessorVersionMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DeployProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DeployProcessorVersionMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DeployProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.IDeployProcessorVersionMetadata} message DeployProcessorVersionMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeployProcessorVersionMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeployProcessorVersionMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.DeployProcessorVersionMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.DeployProcessorVersionMetadata} DeployProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeployProcessorVersionMetadata.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.v1.DeployProcessorVersionMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeployProcessorVersionMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.DeployProcessorVersionMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.DeployProcessorVersionMetadata} DeployProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeployProcessorVersionMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeployProcessorVersionMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1.DeployProcessorVersionMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeployProcessorVersionMetadata.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.v1.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } + return null; + }; + + /** + * Creates a DeployProcessorVersionMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.DeployProcessorVersionMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DeployProcessorVersionMetadata} DeployProcessorVersionMetadata + */ + DeployProcessorVersionMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DeployProcessorVersionMetadata) + return object; + var message = new $root.google.cloud.documentai.v1.DeployProcessorVersionMetadata(); + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1.DeployProcessorVersionMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.fromObject(object.commonMetadata); + } + return message; + }; + + /** + * Creates a plain object from a DeployProcessorVersionMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.DeployProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.DeployProcessorVersionMetadata} message DeployProcessorVersionMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeployProcessorVersionMetadata.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.v1.CommonOperationMetadata.toObject(message.commonMetadata, options); + return object; + }; + + /** + * Converts this DeployProcessorVersionMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DeployProcessorVersionMetadata + * @instance + * @returns {Object.} JSON object + */ + DeployProcessorVersionMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeployProcessorVersionMetadata; + })(); + + v1.UndeployProcessorVersionRequest = (function() { + + /** + * Properties of an UndeployProcessorVersionRequest. + * @memberof google.cloud.documentai.v1 + * @interface IUndeployProcessorVersionRequest + * @property {string|null} [name] UndeployProcessorVersionRequest name + */ + + /** + * Constructs a new UndeployProcessorVersionRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents an UndeployProcessorVersionRequest. + * @implements IUndeployProcessorVersionRequest + * @constructor + * @param {google.cloud.documentai.v1.IUndeployProcessorVersionRequest=} [properties] Properties to set + */ + function UndeployProcessorVersionRequest(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]]; + } + + /** + * UndeployProcessorVersionRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionRequest + * @instance + */ + UndeployProcessorVersionRequest.prototype.name = ""; + + /** + * Creates a new UndeployProcessorVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.IUndeployProcessorVersionRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.UndeployProcessorVersionRequest} UndeployProcessorVersionRequest instance + */ + UndeployProcessorVersionRequest.create = function create(properties) { + return new UndeployProcessorVersionRequest(properties); + }; + + /** + * Encodes the specified UndeployProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1.UndeployProcessorVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.IUndeployProcessorVersionRequest} message UndeployProcessorVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UndeployProcessorVersionRequest.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 UndeployProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.UndeployProcessorVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.IUndeployProcessorVersionRequest} message UndeployProcessorVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UndeployProcessorVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UndeployProcessorVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.UndeployProcessorVersionRequest} UndeployProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UndeployProcessorVersionRequest.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.v1.UndeployProcessorVersionRequest(); + 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 an UndeployProcessorVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.UndeployProcessorVersionRequest} UndeployProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UndeployProcessorVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UndeployProcessorVersionRequest message. + * @function verify + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UndeployProcessorVersionRequest.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 an UndeployProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.UndeployProcessorVersionRequest} UndeployProcessorVersionRequest + */ + UndeployProcessorVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.UndeployProcessorVersionRequest) + return object; + var message = new $root.google.cloud.documentai.v1.UndeployProcessorVersionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from an UndeployProcessorVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.UndeployProcessorVersionRequest} message UndeployProcessorVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UndeployProcessorVersionRequest.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 UndeployProcessorVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionRequest + * @instance + * @returns {Object.} JSON object + */ + UndeployProcessorVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UndeployProcessorVersionRequest; + })(); + + v1.UndeployProcessorVersionResponse = (function() { + + /** + * Properties of an UndeployProcessorVersionResponse. + * @memberof google.cloud.documentai.v1 + * @interface IUndeployProcessorVersionResponse + */ + + /** + * Constructs a new UndeployProcessorVersionResponse. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents an UndeployProcessorVersionResponse. + * @implements IUndeployProcessorVersionResponse + * @constructor + * @param {google.cloud.documentai.v1.IUndeployProcessorVersionResponse=} [properties] Properties to set + */ + function UndeployProcessorVersionResponse(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 UndeployProcessorVersionResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1.IUndeployProcessorVersionResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.UndeployProcessorVersionResponse} UndeployProcessorVersionResponse instance + */ + UndeployProcessorVersionResponse.create = function create(properties) { + return new UndeployProcessorVersionResponse(properties); + }; + + /** + * Encodes the specified UndeployProcessorVersionResponse message. Does not implicitly {@link google.cloud.documentai.v1.UndeployProcessorVersionResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1.IUndeployProcessorVersionResponse} message UndeployProcessorVersionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UndeployProcessorVersionResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified UndeployProcessorVersionResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.UndeployProcessorVersionResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1.IUndeployProcessorVersionResponse} message UndeployProcessorVersionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UndeployProcessorVersionResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UndeployProcessorVersionResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.UndeployProcessorVersionResponse} UndeployProcessorVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UndeployProcessorVersionResponse.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.v1.UndeployProcessorVersionResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UndeployProcessorVersionResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.UndeployProcessorVersionResponse} UndeployProcessorVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UndeployProcessorVersionResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UndeployProcessorVersionResponse message. + * @function verify + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UndeployProcessorVersionResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an UndeployProcessorVersionResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.UndeployProcessorVersionResponse} UndeployProcessorVersionResponse + */ + UndeployProcessorVersionResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.UndeployProcessorVersionResponse) + return object; + return new $root.google.cloud.documentai.v1.UndeployProcessorVersionResponse(); + }; + + /** + * Creates a plain object from an UndeployProcessorVersionResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1.UndeployProcessorVersionResponse} message UndeployProcessorVersionResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UndeployProcessorVersionResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this UndeployProcessorVersionResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionResponse + * @instance + * @returns {Object.} JSON object + */ + UndeployProcessorVersionResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UndeployProcessorVersionResponse; + })(); + + v1.UndeployProcessorVersionMetadata = (function() { + + /** + * Properties of an UndeployProcessorVersionMetadata. + * @memberof google.cloud.documentai.v1 + * @interface IUndeployProcessorVersionMetadata + * @property {google.cloud.documentai.v1.ICommonOperationMetadata|null} [commonMetadata] UndeployProcessorVersionMetadata commonMetadata + */ + + /** + * Constructs a new UndeployProcessorVersionMetadata. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents an UndeployProcessorVersionMetadata. + * @implements IUndeployProcessorVersionMetadata + * @constructor + * @param {google.cloud.documentai.v1.IUndeployProcessorVersionMetadata=} [properties] Properties to set + */ + function UndeployProcessorVersionMetadata(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]]; + } + + /** + * UndeployProcessorVersionMetadata commonMetadata. + * @member {google.cloud.documentai.v1.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionMetadata + * @instance + */ + UndeployProcessorVersionMetadata.prototype.commonMetadata = null; + + /** + * Creates a new UndeployProcessorVersionMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.IUndeployProcessorVersionMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.UndeployProcessorVersionMetadata} UndeployProcessorVersionMetadata instance + */ + UndeployProcessorVersionMetadata.create = function create(properties) { + return new UndeployProcessorVersionMetadata(properties); + }; + + /** + * Encodes the specified UndeployProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1.UndeployProcessorVersionMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.IUndeployProcessorVersionMetadata} message UndeployProcessorVersionMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UndeployProcessorVersionMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UndeployProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.UndeployProcessorVersionMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.IUndeployProcessorVersionMetadata} message UndeployProcessorVersionMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UndeployProcessorVersionMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UndeployProcessorVersionMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.UndeployProcessorVersionMetadata} UndeployProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UndeployProcessorVersionMetadata.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.v1.UndeployProcessorVersionMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UndeployProcessorVersionMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.UndeployProcessorVersionMetadata} UndeployProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UndeployProcessorVersionMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UndeployProcessorVersionMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UndeployProcessorVersionMetadata.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.v1.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } + return null; + }; + + /** + * Creates an UndeployProcessorVersionMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.UndeployProcessorVersionMetadata} UndeployProcessorVersionMetadata + */ + UndeployProcessorVersionMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.UndeployProcessorVersionMetadata) + return object; + var message = new $root.google.cloud.documentai.v1.UndeployProcessorVersionMetadata(); + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1.UndeployProcessorVersionMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.fromObject(object.commonMetadata); + } + return message; + }; + + /** + * Creates a plain object from an UndeployProcessorVersionMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.UndeployProcessorVersionMetadata} message UndeployProcessorVersionMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UndeployProcessorVersionMetadata.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.v1.CommonOperationMetadata.toObject(message.commonMetadata, options); + return object; + }; + + /** + * Converts this UndeployProcessorVersionMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.UndeployProcessorVersionMetadata + * @instance + * @returns {Object.} JSON object + */ + UndeployProcessorVersionMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return UndeployProcessorVersionMetadata; + })(); + + v1.CreateProcessorRequest = (function() { + + /** + * Properties of a CreateProcessorRequest. + * @memberof google.cloud.documentai.v1 + * @interface ICreateProcessorRequest + * @property {string|null} [parent] CreateProcessorRequest parent + * @property {google.cloud.documentai.v1.IProcessor|null} [processor] CreateProcessorRequest processor + */ + + /** + * Constructs a new CreateProcessorRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a CreateProcessorRequest. + * @implements ICreateProcessorRequest + * @constructor + * @param {google.cloud.documentai.v1.ICreateProcessorRequest=} [properties] Properties to set + */ + function CreateProcessorRequest(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]]; + } + + /** + * CreateProcessorRequest parent. + * @member {string} parent + * @memberof google.cloud.documentai.v1.CreateProcessorRequest + * @instance + */ + CreateProcessorRequest.prototype.parent = ""; + + /** + * CreateProcessorRequest processor. + * @member {google.cloud.documentai.v1.IProcessor|null|undefined} processor + * @memberof google.cloud.documentai.v1.CreateProcessorRequest + * @instance + */ + CreateProcessorRequest.prototype.processor = null; + + /** + * Creates a new CreateProcessorRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.CreateProcessorRequest + * @static + * @param {google.cloud.documentai.v1.ICreateProcessorRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.CreateProcessorRequest} CreateProcessorRequest instance + */ + CreateProcessorRequest.create = function create(properties) { + return new CreateProcessorRequest(properties); + }; + + /** + * Encodes the specified CreateProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1.CreateProcessorRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.CreateProcessorRequest + * @static + * @param {google.cloud.documentai.v1.ICreateProcessorRequest} message CreateProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateProcessorRequest.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.processor != null && Object.hasOwnProperty.call(message, "processor")) + $root.google.cloud.documentai.v1.Processor.encode(message.processor, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.CreateProcessorRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.CreateProcessorRequest + * @static + * @param {google.cloud.documentai.v1.ICreateProcessorRequest} message CreateProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateProcessorRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateProcessorRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.CreateProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.CreateProcessorRequest} CreateProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateProcessorRequest.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.v1.CreateProcessorRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.parent = reader.string(); + break; + case 2: + message.processor = $root.google.cloud.documentai.v1.Processor.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateProcessorRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.CreateProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.CreateProcessorRequest} CreateProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateProcessorRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateProcessorRequest message. + * @function verify + * @memberof google.cloud.documentai.v1.CreateProcessorRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateProcessorRequest.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.processor != null && message.hasOwnProperty("processor")) { + var error = $root.google.cloud.documentai.v1.Processor.verify(message.processor); + if (error) + return "processor." + error; + } + return null; + }; + + /** + * Creates a CreateProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.CreateProcessorRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.CreateProcessorRequest} CreateProcessorRequest + */ + CreateProcessorRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.CreateProcessorRequest) + return object; + var message = new $root.google.cloud.documentai.v1.CreateProcessorRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.processor != null) { + if (typeof object.processor !== "object") + throw TypeError(".google.cloud.documentai.v1.CreateProcessorRequest.processor: object expected"); + message.processor = $root.google.cloud.documentai.v1.Processor.fromObject(object.processor); + } + return message; + }; + + /** + * Creates a plain object from a CreateProcessorRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.CreateProcessorRequest + * @static + * @param {google.cloud.documentai.v1.CreateProcessorRequest} message CreateProcessorRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateProcessorRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.processor = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.processor != null && message.hasOwnProperty("processor")) + object.processor = $root.google.cloud.documentai.v1.Processor.toObject(message.processor, options); + return object; + }; + + /** + * Converts this CreateProcessorRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.CreateProcessorRequest + * @instance + * @returns {Object.} JSON object + */ + CreateProcessorRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return CreateProcessorRequest; + })(); + + v1.DeleteProcessorRequest = (function() { + + /** + * Properties of a DeleteProcessorRequest. + * @memberof google.cloud.documentai.v1 + * @interface IDeleteProcessorRequest + * @property {string|null} [name] DeleteProcessorRequest name + */ + + /** + * Constructs a new DeleteProcessorRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a DeleteProcessorRequest. + * @implements IDeleteProcessorRequest + * @constructor + * @param {google.cloud.documentai.v1.IDeleteProcessorRequest=} [properties] Properties to set + */ + function DeleteProcessorRequest(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]]; + } + + /** + * DeleteProcessorRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1.DeleteProcessorRequest + * @instance + */ + DeleteProcessorRequest.prototype.name = ""; + + /** + * Creates a new DeleteProcessorRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DeleteProcessorRequest + * @static + * @param {google.cloud.documentai.v1.IDeleteProcessorRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.DeleteProcessorRequest} DeleteProcessorRequest instance + */ + DeleteProcessorRequest.create = function create(properties) { + return new DeleteProcessorRequest(properties); + }; + + /** + * Encodes the specified DeleteProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DeleteProcessorRequest + * @static + * @param {google.cloud.documentai.v1.IDeleteProcessorRequest} message DeleteProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProcessorRequest.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 DeleteProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DeleteProcessorRequest + * @static + * @param {google.cloud.documentai.v1.IDeleteProcessorRequest} message DeleteProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProcessorRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteProcessorRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.DeleteProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.DeleteProcessorRequest} DeleteProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProcessorRequest.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.v1.DeleteProcessorRequest(); + 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 DeleteProcessorRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.DeleteProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.DeleteProcessorRequest} DeleteProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProcessorRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteProcessorRequest message. + * @function verify + * @memberof google.cloud.documentai.v1.DeleteProcessorRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteProcessorRequest.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 DeleteProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.DeleteProcessorRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DeleteProcessorRequest} DeleteProcessorRequest + */ + DeleteProcessorRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DeleteProcessorRequest) + return object; + var message = new $root.google.cloud.documentai.v1.DeleteProcessorRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteProcessorRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.DeleteProcessorRequest + * @static + * @param {google.cloud.documentai.v1.DeleteProcessorRequest} message DeleteProcessorRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteProcessorRequest.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 DeleteProcessorRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DeleteProcessorRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteProcessorRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteProcessorRequest; + })(); + + v1.DeleteProcessorMetadata = (function() { + + /** + * Properties of a DeleteProcessorMetadata. + * @memberof google.cloud.documentai.v1 + * @interface IDeleteProcessorMetadata + * @property {google.cloud.documentai.v1.ICommonOperationMetadata|null} [commonMetadata] DeleteProcessorMetadata commonMetadata + */ + + /** + * Constructs a new DeleteProcessorMetadata. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a DeleteProcessorMetadata. + * @implements IDeleteProcessorMetadata + * @constructor + * @param {google.cloud.documentai.v1.IDeleteProcessorMetadata=} [properties] Properties to set + */ + function DeleteProcessorMetadata(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]]; + } + + /** + * DeleteProcessorMetadata commonMetadata. + * @member {google.cloud.documentai.v1.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1.DeleteProcessorMetadata + * @instance + */ + DeleteProcessorMetadata.prototype.commonMetadata = null; + + /** + * Creates a new DeleteProcessorMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DeleteProcessorMetadata + * @static + * @param {google.cloud.documentai.v1.IDeleteProcessorMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.DeleteProcessorMetadata} DeleteProcessorMetadata instance + */ + DeleteProcessorMetadata.create = function create(properties) { + return new DeleteProcessorMetadata(properties); + }; + + /** + * Encodes the specified DeleteProcessorMetadata message. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DeleteProcessorMetadata + * @static + * @param {google.cloud.documentai.v1.IDeleteProcessorMetadata} message DeleteProcessorMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProcessorMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DeleteProcessorMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DeleteProcessorMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DeleteProcessorMetadata + * @static + * @param {google.cloud.documentai.v1.IDeleteProcessorMetadata} message DeleteProcessorMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteProcessorMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteProcessorMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.DeleteProcessorMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.DeleteProcessorMetadata} DeleteProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProcessorMetadata.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.v1.DeleteProcessorMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 5: + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteProcessorMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.DeleteProcessorMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.DeleteProcessorMetadata} DeleteProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteProcessorMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteProcessorMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1.DeleteProcessorMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteProcessorMetadata.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.v1.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } + return null; + }; + + /** + * Creates a DeleteProcessorMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.DeleteProcessorMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DeleteProcessorMetadata} DeleteProcessorMetadata + */ + DeleteProcessorMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DeleteProcessorMetadata) + return object; + var message = new $root.google.cloud.documentai.v1.DeleteProcessorMetadata(); + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1.DeleteProcessorMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.fromObject(object.commonMetadata); + } + return message; + }; + + /** + * Creates a plain object from a DeleteProcessorMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.DeleteProcessorMetadata + * @static + * @param {google.cloud.documentai.v1.DeleteProcessorMetadata} message DeleteProcessorMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteProcessorMetadata.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.v1.CommonOperationMetadata.toObject(message.commonMetadata, options); + return object; + }; + + /** + * Converts this DeleteProcessorMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DeleteProcessorMetadata + * @instance + * @returns {Object.} JSON object + */ + DeleteProcessorMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeleteProcessorMetadata; + })(); + + v1.EnableProcessorRequest = (function() { + + /** + * Properties of an EnableProcessorRequest. + * @memberof google.cloud.documentai.v1 + * @interface IEnableProcessorRequest + * @property {string|null} [name] EnableProcessorRequest name + */ + + /** + * Constructs a new EnableProcessorRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents an EnableProcessorRequest. + * @implements IEnableProcessorRequest + * @constructor + * @param {google.cloud.documentai.v1.IEnableProcessorRequest=} [properties] Properties to set + */ + function EnableProcessorRequest(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]]; + } + + /** + * EnableProcessorRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1.EnableProcessorRequest + * @instance + */ + EnableProcessorRequest.prototype.name = ""; + + /** + * Creates a new EnableProcessorRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.EnableProcessorRequest + * @static + * @param {google.cloud.documentai.v1.IEnableProcessorRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.EnableProcessorRequest} EnableProcessorRequest instance + */ + EnableProcessorRequest.create = function create(properties) { + return new EnableProcessorRequest(properties); + }; + + /** + * Encodes the specified EnableProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1.EnableProcessorRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.EnableProcessorRequest + * @static + * @param {google.cloud.documentai.v1.IEnableProcessorRequest} message EnableProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnableProcessorRequest.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 EnableProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.EnableProcessorRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.EnableProcessorRequest + * @static + * @param {google.cloud.documentai.v1.IEnableProcessorRequest} message EnableProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnableProcessorRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnableProcessorRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.EnableProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.EnableProcessorRequest} EnableProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnableProcessorRequest.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.v1.EnableProcessorRequest(); + 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 an EnableProcessorRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.EnableProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.EnableProcessorRequest} EnableProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnableProcessorRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnableProcessorRequest message. + * @function verify + * @memberof google.cloud.documentai.v1.EnableProcessorRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnableProcessorRequest.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 an EnableProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.EnableProcessorRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.EnableProcessorRequest} EnableProcessorRequest + */ + EnableProcessorRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.EnableProcessorRequest) + return object; + var message = new $root.google.cloud.documentai.v1.EnableProcessorRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from an EnableProcessorRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.EnableProcessorRequest + * @static + * @param {google.cloud.documentai.v1.EnableProcessorRequest} message EnableProcessorRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnableProcessorRequest.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 EnableProcessorRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.EnableProcessorRequest + * @instance + * @returns {Object.} JSON object + */ + EnableProcessorRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnableProcessorRequest; + })(); + + v1.EnableProcessorResponse = (function() { + + /** + * Properties of an EnableProcessorResponse. + * @memberof google.cloud.documentai.v1 + * @interface IEnableProcessorResponse + */ + + /** + * Constructs a new EnableProcessorResponse. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents an EnableProcessorResponse. + * @implements IEnableProcessorResponse + * @constructor + * @param {google.cloud.documentai.v1.IEnableProcessorResponse=} [properties] Properties to set + */ + function EnableProcessorResponse(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 EnableProcessorResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.EnableProcessorResponse + * @static + * @param {google.cloud.documentai.v1.IEnableProcessorResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.EnableProcessorResponse} EnableProcessorResponse instance + */ + EnableProcessorResponse.create = function create(properties) { + return new EnableProcessorResponse(properties); + }; + + /** + * Encodes the specified EnableProcessorResponse message. Does not implicitly {@link google.cloud.documentai.v1.EnableProcessorResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.EnableProcessorResponse + * @static + * @param {google.cloud.documentai.v1.IEnableProcessorResponse} message EnableProcessorResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnableProcessorResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified EnableProcessorResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.EnableProcessorResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.EnableProcessorResponse + * @static + * @param {google.cloud.documentai.v1.IEnableProcessorResponse} message EnableProcessorResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnableProcessorResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnableProcessorResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.EnableProcessorResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.EnableProcessorResponse} EnableProcessorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnableProcessorResponse.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.v1.EnableProcessorResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnableProcessorResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.EnableProcessorResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.EnableProcessorResponse} EnableProcessorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnableProcessorResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnableProcessorResponse message. + * @function verify + * @memberof google.cloud.documentai.v1.EnableProcessorResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnableProcessorResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an EnableProcessorResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.EnableProcessorResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.EnableProcessorResponse} EnableProcessorResponse + */ + EnableProcessorResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.EnableProcessorResponse) + return object; + return new $root.google.cloud.documentai.v1.EnableProcessorResponse(); + }; + + /** + * Creates a plain object from an EnableProcessorResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.EnableProcessorResponse + * @static + * @param {google.cloud.documentai.v1.EnableProcessorResponse} message EnableProcessorResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnableProcessorResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this EnableProcessorResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.EnableProcessorResponse + * @instance + * @returns {Object.} JSON object + */ + EnableProcessorResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnableProcessorResponse; + })(); + + v1.EnableProcessorMetadata = (function() { + + /** + * Properties of an EnableProcessorMetadata. + * @memberof google.cloud.documentai.v1 + * @interface IEnableProcessorMetadata + * @property {google.cloud.documentai.v1.ICommonOperationMetadata|null} [commonMetadata] EnableProcessorMetadata commonMetadata + */ + + /** + * Constructs a new EnableProcessorMetadata. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents an EnableProcessorMetadata. + * @implements IEnableProcessorMetadata + * @constructor + * @param {google.cloud.documentai.v1.IEnableProcessorMetadata=} [properties] Properties to set + */ + function EnableProcessorMetadata(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]]; + } + + /** + * EnableProcessorMetadata commonMetadata. + * @member {google.cloud.documentai.v1.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1.EnableProcessorMetadata + * @instance + */ + EnableProcessorMetadata.prototype.commonMetadata = null; + + /** + * Creates a new EnableProcessorMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.EnableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1.IEnableProcessorMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.EnableProcessorMetadata} EnableProcessorMetadata instance + */ + EnableProcessorMetadata.create = function create(properties) { + return new EnableProcessorMetadata(properties); + }; + + /** + * Encodes the specified EnableProcessorMetadata message. Does not implicitly {@link google.cloud.documentai.v1.EnableProcessorMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.EnableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1.IEnableProcessorMetadata} message EnableProcessorMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnableProcessorMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnableProcessorMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.EnableProcessorMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.EnableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1.IEnableProcessorMetadata} message EnableProcessorMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnableProcessorMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnableProcessorMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.EnableProcessorMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.EnableProcessorMetadata} EnableProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnableProcessorMetadata.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.v1.EnableProcessorMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 5: + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnableProcessorMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.EnableProcessorMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.EnableProcessorMetadata} EnableProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnableProcessorMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnableProcessorMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1.EnableProcessorMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnableProcessorMetadata.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.v1.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } + return null; + }; + + /** + * Creates an EnableProcessorMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.EnableProcessorMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.EnableProcessorMetadata} EnableProcessorMetadata + */ + EnableProcessorMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.EnableProcessorMetadata) + return object; + var message = new $root.google.cloud.documentai.v1.EnableProcessorMetadata(); + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1.EnableProcessorMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.fromObject(object.commonMetadata); + } + return message; + }; + + /** + * Creates a plain object from an EnableProcessorMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.EnableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1.EnableProcessorMetadata} message EnableProcessorMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnableProcessorMetadata.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.v1.CommonOperationMetadata.toObject(message.commonMetadata, options); + return object; + }; + + /** + * Converts this EnableProcessorMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.EnableProcessorMetadata + * @instance + * @returns {Object.} JSON object + */ + EnableProcessorMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnableProcessorMetadata; + })(); + + v1.DisableProcessorRequest = (function() { + + /** + * Properties of a DisableProcessorRequest. + * @memberof google.cloud.documentai.v1 + * @interface IDisableProcessorRequest + * @property {string|null} [name] DisableProcessorRequest name + */ + + /** + * Constructs a new DisableProcessorRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a DisableProcessorRequest. + * @implements IDisableProcessorRequest + * @constructor + * @param {google.cloud.documentai.v1.IDisableProcessorRequest=} [properties] Properties to set + */ + function DisableProcessorRequest(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]]; + } + + /** + * DisableProcessorRequest name. + * @member {string} name + * @memberof google.cloud.documentai.v1.DisableProcessorRequest + * @instance + */ + DisableProcessorRequest.prototype.name = ""; + + /** + * Creates a new DisableProcessorRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DisableProcessorRequest + * @static + * @param {google.cloud.documentai.v1.IDisableProcessorRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.DisableProcessorRequest} DisableProcessorRequest instance + */ + DisableProcessorRequest.create = function create(properties) { + return new DisableProcessorRequest(properties); + }; + + /** + * Encodes the specified DisableProcessorRequest message. Does not implicitly {@link google.cloud.documentai.v1.DisableProcessorRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DisableProcessorRequest + * @static + * @param {google.cloud.documentai.v1.IDisableProcessorRequest} message DisableProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DisableProcessorRequest.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 DisableProcessorRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DisableProcessorRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DisableProcessorRequest + * @static + * @param {google.cloud.documentai.v1.IDisableProcessorRequest} message DisableProcessorRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DisableProcessorRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DisableProcessorRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.DisableProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.DisableProcessorRequest} DisableProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DisableProcessorRequest.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.v1.DisableProcessorRequest(); + 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 DisableProcessorRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.DisableProcessorRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.DisableProcessorRequest} DisableProcessorRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DisableProcessorRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DisableProcessorRequest message. + * @function verify + * @memberof google.cloud.documentai.v1.DisableProcessorRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DisableProcessorRequest.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 DisableProcessorRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.DisableProcessorRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DisableProcessorRequest} DisableProcessorRequest + */ + DisableProcessorRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DisableProcessorRequest) + return object; + var message = new $root.google.cloud.documentai.v1.DisableProcessorRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DisableProcessorRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.DisableProcessorRequest + * @static + * @param {google.cloud.documentai.v1.DisableProcessorRequest} message DisableProcessorRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DisableProcessorRequest.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 DisableProcessorRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DisableProcessorRequest + * @instance + * @returns {Object.} JSON object + */ + DisableProcessorRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DisableProcessorRequest; + })(); + + v1.DisableProcessorResponse = (function() { + + /** + * Properties of a DisableProcessorResponse. + * @memberof google.cloud.documentai.v1 + * @interface IDisableProcessorResponse + */ + + /** + * Constructs a new DisableProcessorResponse. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a DisableProcessorResponse. + * @implements IDisableProcessorResponse + * @constructor + * @param {google.cloud.documentai.v1.IDisableProcessorResponse=} [properties] Properties to set + */ + function DisableProcessorResponse(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 DisableProcessorResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DisableProcessorResponse + * @static + * @param {google.cloud.documentai.v1.IDisableProcessorResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.DisableProcessorResponse} DisableProcessorResponse instance + */ + DisableProcessorResponse.create = function create(properties) { + return new DisableProcessorResponse(properties); + }; + + /** + * Encodes the specified DisableProcessorResponse message. Does not implicitly {@link google.cloud.documentai.v1.DisableProcessorResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DisableProcessorResponse + * @static + * @param {google.cloud.documentai.v1.IDisableProcessorResponse} message DisableProcessorResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DisableProcessorResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified DisableProcessorResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DisableProcessorResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DisableProcessorResponse + * @static + * @param {google.cloud.documentai.v1.IDisableProcessorResponse} message DisableProcessorResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DisableProcessorResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DisableProcessorResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.DisableProcessorResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.DisableProcessorResponse} DisableProcessorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DisableProcessorResponse.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.v1.DisableProcessorResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DisableProcessorResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.DisableProcessorResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.DisableProcessorResponse} DisableProcessorResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DisableProcessorResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DisableProcessorResponse message. + * @function verify + * @memberof google.cloud.documentai.v1.DisableProcessorResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DisableProcessorResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a DisableProcessorResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.DisableProcessorResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DisableProcessorResponse} DisableProcessorResponse + */ + DisableProcessorResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DisableProcessorResponse) + return object; + return new $root.google.cloud.documentai.v1.DisableProcessorResponse(); + }; + + /** + * Creates a plain object from a DisableProcessorResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.DisableProcessorResponse + * @static + * @param {google.cloud.documentai.v1.DisableProcessorResponse} message DisableProcessorResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DisableProcessorResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this DisableProcessorResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DisableProcessorResponse + * @instance + * @returns {Object.} JSON object + */ + DisableProcessorResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DisableProcessorResponse; + })(); + + v1.DisableProcessorMetadata = (function() { + + /** + * Properties of a DisableProcessorMetadata. + * @memberof google.cloud.documentai.v1 + * @interface IDisableProcessorMetadata + * @property {google.cloud.documentai.v1.ICommonOperationMetadata|null} [commonMetadata] DisableProcessorMetadata commonMetadata + */ + + /** + * Constructs a new DisableProcessorMetadata. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a DisableProcessorMetadata. + * @implements IDisableProcessorMetadata + * @constructor + * @param {google.cloud.documentai.v1.IDisableProcessorMetadata=} [properties] Properties to set + */ + function DisableProcessorMetadata(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]]; + } + + /** + * DisableProcessorMetadata commonMetadata. + * @member {google.cloud.documentai.v1.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1.DisableProcessorMetadata + * @instance + */ + DisableProcessorMetadata.prototype.commonMetadata = null; + + /** + * Creates a new DisableProcessorMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DisableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1.IDisableProcessorMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.DisableProcessorMetadata} DisableProcessorMetadata instance + */ + DisableProcessorMetadata.create = function create(properties) { + return new DisableProcessorMetadata(properties); + }; + + /** + * Encodes the specified DisableProcessorMetadata message. Does not implicitly {@link google.cloud.documentai.v1.DisableProcessorMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DisableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1.IDisableProcessorMetadata} message DisableProcessorMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DisableProcessorMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DisableProcessorMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DisableProcessorMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DisableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1.IDisableProcessorMetadata} message DisableProcessorMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DisableProcessorMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DisableProcessorMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.DisableProcessorMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.DisableProcessorMetadata} DisableProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DisableProcessorMetadata.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.v1.DisableProcessorMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 5: + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DisableProcessorMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.DisableProcessorMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.DisableProcessorMetadata} DisableProcessorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DisableProcessorMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DisableProcessorMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1.DisableProcessorMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DisableProcessorMetadata.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.v1.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } + return null; + }; + + /** + * Creates a DisableProcessorMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.DisableProcessorMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DisableProcessorMetadata} DisableProcessorMetadata + */ + DisableProcessorMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DisableProcessorMetadata) + return object; + var message = new $root.google.cloud.documentai.v1.DisableProcessorMetadata(); + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1.DisableProcessorMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.fromObject(object.commonMetadata); + } + return message; + }; + + /** + * Creates a plain object from a DisableProcessorMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.DisableProcessorMetadata + * @static + * @param {google.cloud.documentai.v1.DisableProcessorMetadata} message DisableProcessorMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DisableProcessorMetadata.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.v1.CommonOperationMetadata.toObject(message.commonMetadata, options); + return object; + }; + + /** + * Converts this DisableProcessorMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DisableProcessorMetadata + * @instance + * @returns {Object.} JSON object + */ + DisableProcessorMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DisableProcessorMetadata; + })(); + + v1.SetDefaultProcessorVersionRequest = (function() { + + /** + * Properties of a SetDefaultProcessorVersionRequest. + * @memberof google.cloud.documentai.v1 + * @interface ISetDefaultProcessorVersionRequest + * @property {string|null} [processor] SetDefaultProcessorVersionRequest processor + * @property {string|null} [defaultProcessorVersion] SetDefaultProcessorVersionRequest defaultProcessorVersion + */ + + /** + * Constructs a new SetDefaultProcessorVersionRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a SetDefaultProcessorVersionRequest. + * @implements ISetDefaultProcessorVersionRequest + * @constructor + * @param {google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest=} [properties] Properties to set + */ + function SetDefaultProcessorVersionRequest(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]]; + } + + /** + * SetDefaultProcessorVersionRequest processor. + * @member {string} processor + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionRequest + * @instance + */ + SetDefaultProcessorVersionRequest.prototype.processor = ""; + + /** + * SetDefaultProcessorVersionRequest defaultProcessorVersion. + * @member {string} defaultProcessorVersion + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionRequest + * @instance + */ + SetDefaultProcessorVersionRequest.prototype.defaultProcessorVersion = ""; + + /** + * Creates a new SetDefaultProcessorVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.SetDefaultProcessorVersionRequest} SetDefaultProcessorVersionRequest instance + */ + SetDefaultProcessorVersionRequest.create = function create(properties) { + return new SetDefaultProcessorVersionRequest(properties); + }; + + /** + * Encodes the specified SetDefaultProcessorVersionRequest message. Does not implicitly {@link google.cloud.documentai.v1.SetDefaultProcessorVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest} message SetDefaultProcessorVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetDefaultProcessorVersionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.processor != null && Object.hasOwnProperty.call(message, "processor")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.processor); + if (message.defaultProcessorVersion != null && Object.hasOwnProperty.call(message, "defaultProcessorVersion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.defaultProcessorVersion); + return writer; + }; + + /** + * Encodes the specified SetDefaultProcessorVersionRequest message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.SetDefaultProcessorVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest} message SetDefaultProcessorVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetDefaultProcessorVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SetDefaultProcessorVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.SetDefaultProcessorVersionRequest} SetDefaultProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetDefaultProcessorVersionRequest.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.v1.SetDefaultProcessorVersionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.processor = reader.string(); + break; + case 2: + message.defaultProcessorVersion = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SetDefaultProcessorVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.SetDefaultProcessorVersionRequest} SetDefaultProcessorVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetDefaultProcessorVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SetDefaultProcessorVersionRequest message. + * @function verify + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SetDefaultProcessorVersionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.processor != null && message.hasOwnProperty("processor")) + if (!$util.isString(message.processor)) + return "processor: string expected"; + if (message.defaultProcessorVersion != null && message.hasOwnProperty("defaultProcessorVersion")) + if (!$util.isString(message.defaultProcessorVersion)) + return "defaultProcessorVersion: string expected"; + return null; + }; + + /** + * Creates a SetDefaultProcessorVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.SetDefaultProcessorVersionRequest} SetDefaultProcessorVersionRequest + */ + SetDefaultProcessorVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.SetDefaultProcessorVersionRequest) + return object; + var message = new $root.google.cloud.documentai.v1.SetDefaultProcessorVersionRequest(); + if (object.processor != null) + message.processor = String(object.processor); + if (object.defaultProcessorVersion != null) + message.defaultProcessorVersion = String(object.defaultProcessorVersion); + return message; + }; + + /** + * Creates a plain object from a SetDefaultProcessorVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionRequest + * @static + * @param {google.cloud.documentai.v1.SetDefaultProcessorVersionRequest} message SetDefaultProcessorVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SetDefaultProcessorVersionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.processor = ""; + object.defaultProcessorVersion = ""; + } + if (message.processor != null && message.hasOwnProperty("processor")) + object.processor = message.processor; + if (message.defaultProcessorVersion != null && message.hasOwnProperty("defaultProcessorVersion")) + object.defaultProcessorVersion = message.defaultProcessorVersion; + return object; + }; + + /** + * Converts this SetDefaultProcessorVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionRequest + * @instance + * @returns {Object.} JSON object + */ + SetDefaultProcessorVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SetDefaultProcessorVersionRequest; + })(); + + v1.SetDefaultProcessorVersionResponse = (function() { + + /** + * Properties of a SetDefaultProcessorVersionResponse. + * @memberof google.cloud.documentai.v1 + * @interface ISetDefaultProcessorVersionResponse + */ + + /** + * Constructs a new SetDefaultProcessorVersionResponse. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a SetDefaultProcessorVersionResponse. + * @implements ISetDefaultProcessorVersionResponse + * @constructor + * @param {google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse=} [properties] Properties to set + */ + function SetDefaultProcessorVersionResponse(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 SetDefaultProcessorVersionResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.SetDefaultProcessorVersionResponse} SetDefaultProcessorVersionResponse instance + */ + SetDefaultProcessorVersionResponse.create = function create(properties) { + return new SetDefaultProcessorVersionResponse(properties); + }; + + /** + * Encodes the specified SetDefaultProcessorVersionResponse message. Does not implicitly {@link google.cloud.documentai.v1.SetDefaultProcessorVersionResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse} message SetDefaultProcessorVersionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetDefaultProcessorVersionResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified SetDefaultProcessorVersionResponse message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.SetDefaultProcessorVersionResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse} message SetDefaultProcessorVersionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetDefaultProcessorVersionResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SetDefaultProcessorVersionResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.SetDefaultProcessorVersionResponse} SetDefaultProcessorVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetDefaultProcessorVersionResponse.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.v1.SetDefaultProcessorVersionResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SetDefaultProcessorVersionResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.SetDefaultProcessorVersionResponse} SetDefaultProcessorVersionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetDefaultProcessorVersionResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SetDefaultProcessorVersionResponse message. + * @function verify + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SetDefaultProcessorVersionResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a SetDefaultProcessorVersionResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.SetDefaultProcessorVersionResponse} SetDefaultProcessorVersionResponse + */ + SetDefaultProcessorVersionResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.SetDefaultProcessorVersionResponse) + return object; + return new $root.google.cloud.documentai.v1.SetDefaultProcessorVersionResponse(); + }; + + /** + * Creates a plain object from a SetDefaultProcessorVersionResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionResponse + * @static + * @param {google.cloud.documentai.v1.SetDefaultProcessorVersionResponse} message SetDefaultProcessorVersionResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SetDefaultProcessorVersionResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this SetDefaultProcessorVersionResponse to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionResponse + * @instance + * @returns {Object.} JSON object + */ + SetDefaultProcessorVersionResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SetDefaultProcessorVersionResponse; + })(); + + v1.SetDefaultProcessorVersionMetadata = (function() { + + /** + * Properties of a SetDefaultProcessorVersionMetadata. + * @memberof google.cloud.documentai.v1 + * @interface ISetDefaultProcessorVersionMetadata + * @property {google.cloud.documentai.v1.ICommonOperationMetadata|null} [commonMetadata] SetDefaultProcessorVersionMetadata commonMetadata + */ + + /** + * Constructs a new SetDefaultProcessorVersionMetadata. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a SetDefaultProcessorVersionMetadata. + * @implements ISetDefaultProcessorVersionMetadata + * @constructor + * @param {google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata=} [properties] Properties to set + */ + function SetDefaultProcessorVersionMetadata(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]]; + } + + /** + * SetDefaultProcessorVersionMetadata commonMetadata. + * @member {google.cloud.documentai.v1.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata + * @instance + */ + SetDefaultProcessorVersionMetadata.prototype.commonMetadata = null; + + /** + * Creates a new SetDefaultProcessorVersionMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata} SetDefaultProcessorVersionMetadata instance + */ + SetDefaultProcessorVersionMetadata.create = function create(properties) { + return new SetDefaultProcessorVersionMetadata(properties); + }; + + /** + * Encodes the specified SetDefaultProcessorVersionMetadata message. Does not implicitly {@link google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata} message SetDefaultProcessorVersionMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetDefaultProcessorVersionMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1.CommonOperationMetadata.encode(message.commonMetadata, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SetDefaultProcessorVersionMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata} message SetDefaultProcessorVersionMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetDefaultProcessorVersionMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SetDefaultProcessorVersionMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata} SetDefaultProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetDefaultProcessorVersionMetadata.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.v1.SetDefaultProcessorVersionMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SetDefaultProcessorVersionMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata} SetDefaultProcessorVersionMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetDefaultProcessorVersionMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SetDefaultProcessorVersionMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SetDefaultProcessorVersionMetadata.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.v1.CommonOperationMetadata.verify(message.commonMetadata); + if (error) + return "commonMetadata." + error; + } + return null; + }; + + /** + * Creates a SetDefaultProcessorVersionMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata} SetDefaultProcessorVersionMetadata + */ + SetDefaultProcessorVersionMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata) + return object; + var message = new $root.google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata(); + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.fromObject(object.commonMetadata); + } + return message; + }; + + /** + * Creates a plain object from a SetDefaultProcessorVersionMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata + * @static + * @param {google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata} message SetDefaultProcessorVersionMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SetDefaultProcessorVersionMetadata.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.v1.CommonOperationMetadata.toObject(message.commonMetadata, options); + return object; + }; + + /** + * Converts this SetDefaultProcessorVersionMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata + * @instance + * @returns {Object.} JSON object + */ + SetDefaultProcessorVersionMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return SetDefaultProcessorVersionMetadata; + })(); + + v1.ReviewDocumentRequest = (function() { + + /** + * Properties of a ReviewDocumentRequest. + * @memberof google.cloud.documentai.v1 + * @interface IReviewDocumentRequest + * @property {google.cloud.documentai.v1.IDocument|null} [inlineDocument] ReviewDocumentRequest inlineDocument + * @property {string|null} [humanReviewConfig] ReviewDocumentRequest humanReviewConfig + * @property {boolean|null} [enableSchemaValidation] ReviewDocumentRequest enableSchemaValidation + * @property {google.cloud.documentai.v1.ReviewDocumentRequest.Priority|null} [priority] ReviewDocumentRequest priority + * @property {google.cloud.documentai.v1.IDocumentSchema|null} [documentSchema] ReviewDocumentRequest documentSchema + */ + + /** + * Constructs a new ReviewDocumentRequest. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a ReviewDocumentRequest. + * @implements IReviewDocumentRequest + * @constructor + * @param {google.cloud.documentai.v1.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.v1.IDocument|null|undefined} inlineDocument + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.inlineDocument = null; + + /** + * ReviewDocumentRequest humanReviewConfig. + * @member {string} humanReviewConfig + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.humanReviewConfig = ""; + + /** + * ReviewDocumentRequest enableSchemaValidation. + * @member {boolean} enableSchemaValidation + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.enableSchemaValidation = false; + + /** + * ReviewDocumentRequest priority. + * @member {google.cloud.documentai.v1.ReviewDocumentRequest.Priority} priority + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @instance + */ + ReviewDocumentRequest.prototype.priority = 0; + + /** + * ReviewDocumentRequest documentSchema. + * @member {google.cloud.documentai.v1.IDocumentSchema|null|undefined} documentSchema + * @memberof google.cloud.documentai.v1.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.v1.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.v1.ReviewDocumentRequest + * @static + * @param {google.cloud.documentai.v1.IReviewDocumentRequest=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ReviewDocumentRequest} ReviewDocumentRequest instance + */ + ReviewDocumentRequest.create = function create(properties) { + return new ReviewDocumentRequest(properties); + }; + + /** + * Encodes the specified ReviewDocumentRequest message. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @static + * @param {google.cloud.documentai.v1.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.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.v1.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.v1.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.v1.ReviewDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @static + * @param {google.cloud.documentai.v1.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.v1.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.v1.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.v1.ReviewDocumentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 4: + message.inlineDocument = $root.google.cloud.documentai.v1.Document.decode(reader, reader.uint32()); + break; + case 1: + message.humanReviewConfig = reader.string(); + break; + case 3: + message.enableSchemaValidation = reader.bool(); + break; + case 5: + message.priority = reader.int32(); + break; + case 6: + message.documentSchema = $root.google.cloud.documentai.v1.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.v1.ReviewDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.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.v1.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.v1.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.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.v1.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.v1.ReviewDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.ReviewDocumentRequest} ReviewDocumentRequest + */ + ReviewDocumentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ReviewDocumentRequest) + return object; + var message = new $root.google.cloud.documentai.v1.ReviewDocumentRequest(); + if (object.inlineDocument != null) { + if (typeof object.inlineDocument !== "object") + throw TypeError(".google.cloud.documentai.v1.ReviewDocumentRequest.inlineDocument: object expected"); + message.inlineDocument = $root.google.cloud.documentai.v1.Document.fromObject(object.inlineDocument); + } + if (object.humanReviewConfig != null) + message.humanReviewConfig = String(object.humanReviewConfig); + if (object.enableSchemaValidation != null) + message.enableSchemaValidation = Boolean(object.enableSchemaValidation); + switch (object.priority) { + 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.v1.ReviewDocumentRequest.documentSchema: object expected"); + message.documentSchema = $root.google.cloud.documentai.v1.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.v1.ReviewDocumentRequest + * @static + * @param {google.cloud.documentai.v1.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.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.enableSchemaValidation != null && message.hasOwnProperty("enableSchemaValidation")) + object.enableSchemaValidation = message.enableSchemaValidation; + if (message.inlineDocument != null && message.hasOwnProperty("inlineDocument")) { + object.inlineDocument = $root.google.cloud.documentai.v1.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.v1.ReviewDocumentRequest.Priority[message.priority] : message.priority; + if (message.documentSchema != null && message.hasOwnProperty("documentSchema")) + object.documentSchema = $root.google.cloud.documentai.v1.DocumentSchema.toObject(message.documentSchema, options); + return object; + }; + + /** + * Converts this ReviewDocumentRequest to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.ReviewDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + ReviewDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Priority enum. + * @name google.cloud.documentai.v1.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; + })(); + + v1.ReviewDocumentResponse = (function() { + + /** + * Properties of a ReviewDocumentResponse. + * @memberof google.cloud.documentai.v1 + * @interface IReviewDocumentResponse + * @property {string|null} [gcsDestination] ReviewDocumentResponse gcsDestination + * @property {google.cloud.documentai.v1.ReviewDocumentResponse.State|null} [state] ReviewDocumentResponse state + * @property {string|null} [rejectionReason] ReviewDocumentResponse rejectionReason + */ + + /** + * Constructs a new ReviewDocumentResponse. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a ReviewDocumentResponse. + * @implements IReviewDocumentResponse + * @constructor + * @param {google.cloud.documentai.v1.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.v1.ReviewDocumentResponse + * @instance + */ + ReviewDocumentResponse.prototype.gcsDestination = ""; + + /** + * ReviewDocumentResponse state. + * @member {google.cloud.documentai.v1.ReviewDocumentResponse.State} state + * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @instance + */ + ReviewDocumentResponse.prototype.state = 0; + + /** + * ReviewDocumentResponse rejectionReason. + * @member {string} rejectionReason + * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @instance + */ + ReviewDocumentResponse.prototype.rejectionReason = ""; + + /** + * Creates a new ReviewDocumentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @static + * @param {google.cloud.documentai.v1.IReviewDocumentResponse=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ReviewDocumentResponse} ReviewDocumentResponse instance + */ + ReviewDocumentResponse.create = function create(properties) { + return new ReviewDocumentResponse(properties); + }; + + /** + * Encodes the specified ReviewDocumentResponse message. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @static + * @param {google.cloud.documentai.v1.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.v1.ReviewDocumentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.ReviewDocumentResponse + * @static + * @param {google.cloud.documentai.v1.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.v1.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.v1.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.v1.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.v1.ReviewDocumentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.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.v1.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.v1.ReviewDocumentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.ReviewDocumentResponse} ReviewDocumentResponse + */ + ReviewDocumentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ReviewDocumentResponse) + return object; + var message = new $root.google.cloud.documentai.v1.ReviewDocumentResponse(); + if (object.gcsDestination != null) + message.gcsDestination = String(object.gcsDestination); + switch (object.state) { + 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.v1.ReviewDocumentResponse + * @static + * @param {google.cloud.documentai.v1.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.v1.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.v1.ReviewDocumentResponse + * @instance + * @returns {Object.} JSON object + */ + ReviewDocumentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * State enum. + * @name google.cloud.documentai.v1.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; + })(); + + v1.ReviewDocumentOperationMetadata = (function() { + + /** + * Properties of a ReviewDocumentOperationMetadata. + * @memberof google.cloud.documentai.v1 + * @interface IReviewDocumentOperationMetadata + * @property {google.cloud.documentai.v1.ICommonOperationMetadata|null} [commonMetadata] ReviewDocumentOperationMetadata commonMetadata + * @property {string|null} [questionId] ReviewDocumentOperationMetadata questionId + */ + + /** + * Constructs a new ReviewDocumentOperationMetadata. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a ReviewDocumentOperationMetadata. + * @implements IReviewDocumentOperationMetadata + * @constructor + * @param {google.cloud.documentai.v1.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 commonMetadata. + * @member {google.cloud.documentai.v1.ICommonOperationMetadata|null|undefined} commonMetadata + * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.commonMetadata = null; + + /** + * ReviewDocumentOperationMetadata questionId. + * @member {string} questionId + * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @instance + */ + ReviewDocumentOperationMetadata.prototype.questionId = ""; + + /** + * Creates a new ReviewDocumentOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @static + * @param {google.cloud.documentai.v1.IReviewDocumentOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata instance + */ + ReviewDocumentOperationMetadata.create = function create(properties) { + return new ReviewDocumentOperationMetadata(properties); + }; + + /** + * Encodes the specified ReviewDocumentOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1.ReviewDocumentOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @static + * @param {google.cloud.documentai.v1.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.commonMetadata != null && Object.hasOwnProperty.call(message, "commonMetadata")) + $root.google.cloud.documentai.v1.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.v1.ReviewDocumentOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @static + * @param {google.cloud.documentai.v1.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.v1.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.v1.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.v1.ReviewDocumentOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 5: + message.commonMetadata = $root.google.cloud.documentai.v1.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.v1.ReviewDocumentOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.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.v1.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.commonMetadata != null && message.hasOwnProperty("commonMetadata")) { + var error = $root.google.cloud.documentai.v1.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.v1.ReviewDocumentOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.ReviewDocumentOperationMetadata} ReviewDocumentOperationMetadata + */ + ReviewDocumentOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ReviewDocumentOperationMetadata) + return object; + var message = new $root.google.cloud.documentai.v1.ReviewDocumentOperationMetadata(); + if (object.commonMetadata != null) { + if (typeof object.commonMetadata !== "object") + throw TypeError(".google.cloud.documentai.v1.ReviewDocumentOperationMetadata.commonMetadata: object expected"); + message.commonMetadata = $root.google.cloud.documentai.v1.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.v1.ReviewDocumentOperationMetadata + * @static + * @param {google.cloud.documentai.v1.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.commonMetadata = null; + object.questionId = ""; + } + if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) + object.commonMetadata = $root.google.cloud.documentai.v1.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.v1.ReviewDocumentOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + ReviewDocumentOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return ReviewDocumentOperationMetadata; + })(); + + v1.DocumentSchema = (function() { + + /** + * Properties of a DocumentSchema. + * @memberof google.cloud.documentai.v1 + * @interface IDocumentSchema + * @property {string|null} [displayName] DocumentSchema displayName + * @property {string|null} [description] DocumentSchema description + * @property {Array.|null} [entityTypes] DocumentSchema entityTypes + * @property {google.cloud.documentai.v1.DocumentSchema.IMetadata|null} [metadata] DocumentSchema metadata + */ + + /** + * Constructs a new DocumentSchema. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a DocumentSchema. + * @implements IDocumentSchema + * @constructor + * @param {google.cloud.documentai.v1.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.v1.DocumentSchema + * @instance + */ + DocumentSchema.prototype.displayName = ""; + + /** + * DocumentSchema description. + * @member {string} description + * @memberof google.cloud.documentai.v1.DocumentSchema + * @instance + */ + DocumentSchema.prototype.description = ""; + + /** + * DocumentSchema entityTypes. + * @member {Array.} entityTypes + * @memberof google.cloud.documentai.v1.DocumentSchema + * @instance + */ + DocumentSchema.prototype.entityTypes = $util.emptyArray; + + /** + * DocumentSchema metadata. + * @member {google.cloud.documentai.v1.DocumentSchema.IMetadata|null|undefined} metadata + * @memberof google.cloud.documentai.v1.DocumentSchema + * @instance + */ + DocumentSchema.prototype.metadata = null; + + /** + * Creates a new DocumentSchema instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DocumentSchema + * @static + * @param {google.cloud.documentai.v1.IDocumentSchema=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.DocumentSchema} DocumentSchema instance + */ + DocumentSchema.create = function create(properties) { + return new DocumentSchema(properties); + }; + + /** + * Encodes the specified DocumentSchema message. Does not implicitly {@link google.cloud.documentai.v1.DocumentSchema.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DocumentSchema + * @static + * @param {google.cloud.documentai.v1.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.v1.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.v1.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.v1.DocumentSchema.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DocumentSchema + * @static + * @param {google.cloud.documentai.v1.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.v1.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.v1.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.v1.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.v1.DocumentSchema.EntityType.decode(reader, reader.uint32())); + break; + case 4: + message.metadata = $root.google.cloud.documentai.v1.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.v1.DocumentSchema + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.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.v1.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.v1.DocumentSchema.EntityType.verify(message.entityTypes[i]); + if (error) + return "entityTypes." + error; + } + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.google.cloud.documentai.v1.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.v1.DocumentSchema + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DocumentSchema} DocumentSchema + */ + DocumentSchema.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DocumentSchema) + return object; + var message = new $root.google.cloud.documentai.v1.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.v1.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.v1.DocumentSchema.entityTypes: object expected"); + message.entityTypes[i] = $root.google.cloud.documentai.v1.DocumentSchema.EntityType.fromObject(object.entityTypes[i]); + } + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.documentai.v1.DocumentSchema.metadata: object expected"); + message.metadata = $root.google.cloud.documentai.v1.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.v1.DocumentSchema + * @static + * @param {google.cloud.documentai.v1.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.v1.DocumentSchema.EntityType.toObject(message.entityTypes[j], options); + } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.google.cloud.documentai.v1.DocumentSchema.Metadata.toObject(message.metadata, options); + return object; + }; + + /** + * Converts this DocumentSchema to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DocumentSchema + * @instance + * @returns {Object.} JSON object + */ + DocumentSchema.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + DocumentSchema.EntityType = (function() { + + /** + * Properties of an EntityType. + * @memberof google.cloud.documentai.v1.DocumentSchema + * @interface IEntityType + * @property {google.cloud.documentai.v1.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.v1.DocumentSchema + * @classdesc Represents an EntityType. + * @implements IEntityType + * @constructor + * @param {google.cloud.documentai.v1.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.v1.DocumentSchema.EntityType.IEnumValues|null|undefined} enumValues + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType + * @instance + */ + EntityType.prototype.enumValues = null; + + /** + * EntityType displayName. + * @member {string} displayName + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType + * @instance + */ + EntityType.prototype.displayName = ""; + + /** + * EntityType name. + * @member {string} name + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType + * @instance + */ + EntityType.prototype.name = ""; + + /** + * EntityType baseTypes. + * @member {Array.} baseTypes + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType + * @instance + */ + EntityType.prototype.baseTypes = $util.emptyArray; + + /** + * EntityType properties. + * @member {Array.} properties + * @memberof google.cloud.documentai.v1.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.v1.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.v1.DocumentSchema.EntityType + * @static + * @param {google.cloud.documentai.v1.DocumentSchema.IEntityType=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.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.v1.DocumentSchema.EntityType.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType + * @static + * @param {google.cloud.documentai.v1.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.v1.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.v1.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.v1.DocumentSchema.EntityType.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType + * @static + * @param {google.cloud.documentai.v1.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.v1.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.v1.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.v1.DocumentSchema.EntityType(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 14: + message.enumValues = $root.google.cloud.documentai.v1.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.v1.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.v1.DocumentSchema.EntityType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.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.v1.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.v1.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.v1.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.v1.DocumentSchema.EntityType + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DocumentSchema.EntityType} EntityType + */ + EntityType.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DocumentSchema.EntityType) + return object; + var message = new $root.google.cloud.documentai.v1.DocumentSchema.EntityType(); + if (object.enumValues != null) { + if (typeof object.enumValues !== "object") + throw TypeError(".google.cloud.documentai.v1.DocumentSchema.EntityType.enumValues: object expected"); + message.enumValues = $root.google.cloud.documentai.v1.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.v1.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.v1.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.v1.DocumentSchema.EntityType.properties: object expected"); + message.properties[i] = $root.google.cloud.documentai.v1.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.v1.DocumentSchema.EntityType + * @static + * @param {google.cloud.documentai.v1.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.v1.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.v1.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.v1.DocumentSchema.EntityType + * @instance + * @returns {Object.} JSON object + */ + EntityType.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + EntityType.EnumValues = (function() { + + /** + * Properties of an EnumValues. + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType + * @interface IEnumValues + * @property {Array.|null} [values] EnumValues values + */ + + /** + * Constructs a new EnumValues. + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType + * @classdesc Represents an EnumValues. + * @implements IEnumValues + * @constructor + * @param {google.cloud.documentai.v1.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.v1.DocumentSchema.EntityType.EnumValues + * @instance + */ + EnumValues.prototype.values = $util.emptyArray; + + /** + * Creates a new EnumValues instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues + * @static + * @param {google.cloud.documentai.v1.DocumentSchema.EntityType.IEnumValues=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.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.v1.DocumentSchema.EntityType.EnumValues.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues + * @static + * @param {google.cloud.documentai.v1.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.v1.DocumentSchema.EntityType.EnumValues.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues + * @static + * @param {google.cloud.documentai.v1.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.v1.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.v1.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.v1.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.v1.DocumentSchema.EntityType.EnumValues + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.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.v1.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.v1.DocumentSchema.EntityType.EnumValues + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues} EnumValues + */ + EnumValues.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues) + return object; + var message = new $root.google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues(); + if (object.values) { + if (!Array.isArray(object.values)) + throw TypeError(".google.cloud.documentai.v1.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.v1.DocumentSchema.EntityType.EnumValues + * @static + * @param {google.cloud.documentai.v1.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.v1.DocumentSchema.EntityType.EnumValues + * @instance + * @returns {Object.} JSON object + */ + EnumValues.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return EnumValues; + })(); + + EntityType.Property = (function() { + + /** + * Properties of a Property. + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType + * @interface IProperty + * @property {string|null} [name] Property name + * @property {string|null} [valueType] Property valueType + * @property {google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType|null} [occurrenceType] Property occurrenceType + */ + + /** + * Constructs a new Property. + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType + * @classdesc Represents a Property. + * @implements IProperty + * @constructor + * @param {google.cloud.documentai.v1.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.v1.DocumentSchema.EntityType.Property + * @instance + */ + Property.prototype.name = ""; + + /** + * Property valueType. + * @member {string} valueType + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.Property + * @instance + */ + Property.prototype.valueType = ""; + + /** + * Property occurrenceType. + * @member {google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType} occurrenceType + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.Property + * @instance + */ + Property.prototype.occurrenceType = 0; + + /** + * Creates a new Property instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.Property + * @static + * @param {google.cloud.documentai.v1.DocumentSchema.EntityType.IProperty=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.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.v1.DocumentSchema.EntityType.Property.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.Property + * @static + * @param {google.cloud.documentai.v1.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.v1.DocumentSchema.EntityType.Property.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.Property + * @static + * @param {google.cloud.documentai.v1.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.v1.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.v1.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.v1.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.v1.DocumentSchema.EntityType.Property + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.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.v1.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.v1.DocumentSchema.EntityType.Property + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DocumentSchema.EntityType.Property} Property + */ + Property.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DocumentSchema.EntityType.Property) + return object; + var message = new $root.google.cloud.documentai.v1.DocumentSchema.EntityType.Property(); + if (object.name != null) + message.name = String(object.name); + if (object.valueType != null) + message.valueType = String(object.valueType); + switch (object.occurrenceType) { + 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.v1.DocumentSchema.EntityType.Property + * @static + * @param {google.cloud.documentai.v1.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.v1.DocumentSchema.EntityType.Property.OccurrenceType[message.occurrenceType] : message.occurrenceType; + return object; + }; + + /** + * Converts this Property to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DocumentSchema.EntityType.Property + * @instance + * @returns {Object.} JSON object + */ + Property.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * OccurrenceType enum. + * @name google.cloud.documentai.v1.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.v1.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.v1.DocumentSchema + * @classdesc Represents a Metadata. + * @implements IMetadata + * @constructor + * @param {google.cloud.documentai.v1.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.v1.DocumentSchema.Metadata + * @instance + */ + Metadata.prototype.documentSplitter = false; + + /** + * Metadata documentAllowMultipleLabels. + * @member {boolean} documentAllowMultipleLabels + * @memberof google.cloud.documentai.v1.DocumentSchema.Metadata + * @instance + */ + Metadata.prototype.documentAllowMultipleLabels = false; + + /** + * Metadata prefixedNamingOnProperties. + * @member {boolean} prefixedNamingOnProperties + * @memberof google.cloud.documentai.v1.DocumentSchema.Metadata + * @instance + */ + Metadata.prototype.prefixedNamingOnProperties = false; + + /** + * Metadata skipNamingValidation. + * @member {boolean} skipNamingValidation + * @memberof google.cloud.documentai.v1.DocumentSchema.Metadata + * @instance + */ + Metadata.prototype.skipNamingValidation = false; + + /** + * Creates a new Metadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DocumentSchema.Metadata + * @static + * @param {google.cloud.documentai.v1.DocumentSchema.IMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.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.v1.DocumentSchema.Metadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DocumentSchema.Metadata + * @static + * @param {google.cloud.documentai.v1.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.v1.DocumentSchema.Metadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DocumentSchema.Metadata + * @static + * @param {google.cloud.documentai.v1.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.v1.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.v1.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.v1.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.v1.DocumentSchema.Metadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.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.v1.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.v1.DocumentSchema.Metadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DocumentSchema.Metadata} Metadata + */ + Metadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DocumentSchema.Metadata) + return object; + var message = new $root.google.cloud.documentai.v1.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.v1.DocumentSchema.Metadata + * @static + * @param {google.cloud.documentai.v1.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; + }; + + /** + * Converts this Metadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DocumentSchema.Metadata + * @instance + * @returns {Object.} JSON object + */ + Metadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Metadata; + })(); + + return DocumentSchema; + })(); + + v1.CommonOperationMetadata = (function() { + + /** + * Properties of a CommonOperationMetadata. + * @memberof google.cloud.documentai.v1 + * @interface ICommonOperationMetadata + * @property {google.cloud.documentai.v1.CommonOperationMetadata.State|null} [state] CommonOperationMetadata state + * @property {string|null} [stateMessage] CommonOperationMetadata stateMessage + * @property {string|null} [resource] CommonOperationMetadata resource + * @property {google.protobuf.ITimestamp|null} [createTime] CommonOperationMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] CommonOperationMetadata updateTime + */ + + /** + * Constructs a new CommonOperationMetadata. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a CommonOperationMetadata. + * @implements ICommonOperationMetadata + * @constructor + * @param {google.cloud.documentai.v1.ICommonOperationMetadata=} [properties] Properties to set + */ + function CommonOperationMetadata(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]]; + } + + /** + * CommonOperationMetadata state. + * @member {google.cloud.documentai.v1.CommonOperationMetadata.State} state + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @instance + */ + CommonOperationMetadata.prototype.state = 0; + + /** + * CommonOperationMetadata stateMessage. + * @member {string} stateMessage + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @instance + */ + CommonOperationMetadata.prototype.stateMessage = ""; + + /** + * CommonOperationMetadata resource. + * @member {string} resource + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @instance + */ + CommonOperationMetadata.prototype.resource = ""; + + /** + * CommonOperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @instance + */ + CommonOperationMetadata.prototype.createTime = null; + + /** + * CommonOperationMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @instance + */ + CommonOperationMetadata.prototype.updateTime = null; + + /** + * Creates a new CommonOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @static + * @param {google.cloud.documentai.v1.ICommonOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.CommonOperationMetadata} CommonOperationMetadata instance + */ + CommonOperationMetadata.create = function create(properties) { + return new CommonOperationMetadata(properties); + }; + + /** + * Encodes the specified CommonOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1.CommonOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @static + * @param {google.cloud.documentai.v1.ICommonOperationMetadata} message CommonOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommonOperationMetadata.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.resource != null && Object.hasOwnProperty.call(message, "resource")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.resource); + return writer; + }; + + /** + * Encodes the specified CommonOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.CommonOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @static + * @param {google.cloud.documentai.v1.ICommonOperationMetadata} message CommonOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommonOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CommonOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.CommonOperationMetadata} CommonOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommonOperationMetadata.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.v1.CommonOperationMetadata(); + 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 5: + message.resource = 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; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CommonOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.CommonOperationMetadata} CommonOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommonOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CommonOperationMetadata message. + * @function verify + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CommonOperationMetadata.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.resource != null && message.hasOwnProperty("resource")) + if (!$util.isString(message.resource)) + return "resource: 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; + } + return null; + }; + + /** + * Creates a CommonOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.CommonOperationMetadata} CommonOperationMetadata + */ + CommonOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.CommonOperationMetadata) + return object; + var message = new $root.google.cloud.documentai.v1.CommonOperationMetadata(); + switch (object.state) { + 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.resource != null) + message.resource = String(object.resource); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.documentai.v1.CommonOperationMetadata.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.v1.CommonOperationMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + return message; + }; + + /** + * Creates a plain object from a CommonOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @static + * @param {google.cloud.documentai.v1.CommonOperationMetadata} message CommonOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CommonOperationMetadata.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.resource = ""; + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.documentai.v1.CommonOperationMetadata.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.resource != null && message.hasOwnProperty("resource")) + object.resource = message.resource; + return object; + }; + + /** + * Converts this CommonOperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + CommonOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * State enum. + * @name google.cloud.documentai.v1.CommonOperationMetadata.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 + */ + CommonOperationMetadata.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 CommonOperationMetadata; + })(); + + v1.ProcessorVersion = (function() { + + /** + * Properties of a ProcessorVersion. + * @memberof google.cloud.documentai.v1 + * @interface IProcessorVersion + * @property {string|null} [name] ProcessorVersion name + * @property {string|null} [displayName] ProcessorVersion displayName + * @property {google.cloud.documentai.v1.ProcessorVersion.State|null} [state] ProcessorVersion state + * @property {google.protobuf.ITimestamp|null} [createTime] ProcessorVersion createTime + * @property {string|null} [kmsKeyName] ProcessorVersion kmsKeyName + * @property {string|null} [kmsKeyVersionName] ProcessorVersion kmsKeyVersionName + * @property {boolean|null} [googleManaged] ProcessorVersion googleManaged + * @property {google.cloud.documentai.v1.ProcessorVersion.IDeprecationInfo|null} [deprecationInfo] ProcessorVersion deprecationInfo + */ + + /** + * Constructs a new ProcessorVersion. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a ProcessorVersion. + * @implements IProcessorVersion + * @constructor + * @param {google.cloud.documentai.v1.IProcessorVersion=} [properties] Properties to set + */ + function ProcessorVersion(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]]; + } + + /** + * ProcessorVersion name. + * @member {string} name + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @instance + */ + ProcessorVersion.prototype.name = ""; + + /** + * ProcessorVersion displayName. + * @member {string} displayName + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @instance + */ + ProcessorVersion.prototype.displayName = ""; + + /** + * ProcessorVersion state. + * @member {google.cloud.documentai.v1.ProcessorVersion.State} state + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @instance + */ + ProcessorVersion.prototype.state = 0; + + /** + * ProcessorVersion createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @instance + */ + ProcessorVersion.prototype.createTime = null; + + /** + * ProcessorVersion kmsKeyName. + * @member {string} kmsKeyName + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @instance + */ + ProcessorVersion.prototype.kmsKeyName = ""; + + /** + * ProcessorVersion kmsKeyVersionName. + * @member {string} kmsKeyVersionName + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @instance + */ + ProcessorVersion.prototype.kmsKeyVersionName = ""; + + /** + * ProcessorVersion googleManaged. + * @member {boolean} googleManaged + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @instance + */ + ProcessorVersion.prototype.googleManaged = false; + + /** + * ProcessorVersion deprecationInfo. + * @member {google.cloud.documentai.v1.ProcessorVersion.IDeprecationInfo|null|undefined} deprecationInfo + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @instance + */ + ProcessorVersion.prototype.deprecationInfo = null; + + /** + * Creates a new ProcessorVersion instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @static + * @param {google.cloud.documentai.v1.IProcessorVersion=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ProcessorVersion} ProcessorVersion instance + */ + ProcessorVersion.create = function create(properties) { + return new ProcessorVersion(properties); + }; + + /** + * Encodes the specified ProcessorVersion message. Does not implicitly {@link google.cloud.documentai.v1.ProcessorVersion.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @static + * @param {google.cloud.documentai.v1.IProcessorVersion} message ProcessorVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProcessorVersion.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.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.state); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.kmsKeyName != null && Object.hasOwnProperty.call(message, "kmsKeyName")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.kmsKeyName); + if (message.kmsKeyVersionName != null && Object.hasOwnProperty.call(message, "kmsKeyVersionName")) + 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.deprecationInfo != null && Object.hasOwnProperty.call(message, "deprecationInfo")) + $root.google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo.encode(message.deprecationInfo, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ProcessorVersion message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ProcessorVersion.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @static + * @param {google.cloud.documentai.v1.IProcessorVersion} message ProcessorVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ProcessorVersion.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ProcessorVersion message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.ProcessorVersion} ProcessorVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProcessorVersion.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.v1.ProcessorVersion(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.displayName = reader.string(); + break; + case 6: + message.state = reader.int32(); + break; + case 7: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 9: + message.kmsKeyName = reader.string(); + break; + case 10: + message.kmsKeyVersionName = reader.string(); + break; + case 11: + message.googleManaged = reader.bool(); + break; + case 13: + message.deprecationInfo = $root.google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ProcessorVersion message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.ProcessorVersion} ProcessorVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ProcessorVersion.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ProcessorVersion message. + * @function verify + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ProcessorVersion.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.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string 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: + case 6: + case 7: + break; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + 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"; + if (message.googleManaged != null && message.hasOwnProperty("googleManaged")) + if (typeof message.googleManaged !== "boolean") + return "googleManaged: boolean expected"; + if (message.deprecationInfo != null && message.hasOwnProperty("deprecationInfo")) { + var error = $root.google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo.verify(message.deprecationInfo); + if (error) + return "deprecationInfo." + error; + } + return null; + }; + + /** + * Creates a ProcessorVersion message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.ProcessorVersion} ProcessorVersion + */ + ProcessorVersion.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ProcessorVersion) + return object; + var message = new $root.google.cloud.documentai.v1.ProcessorVersion(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "DEPLOYED": + case 1: + message.state = 1; + break; + case "DEPLOYING": + case 2: + message.state = 2; + break; + case "UNDEPLOYED": + case 3: + message.state = 3; + break; + case "UNDEPLOYING": + case 4: + message.state = 4; + break; + case "CREATING": + case 5: + message.state = 5; + break; + case "DELETING": + case 6: + message.state = 6; + break; + case "FAILED": + case 7: + message.state = 7; + break; + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.documentai.v1.ProcessorVersion.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.kmsKeyName != null) + message.kmsKeyName = String(object.kmsKeyName); + if (object.kmsKeyVersionName != null) + message.kmsKeyVersionName = String(object.kmsKeyVersionName); + if (object.googleManaged != null) + message.googleManaged = Boolean(object.googleManaged); + if (object.deprecationInfo != null) { + if (typeof object.deprecationInfo !== "object") + throw TypeError(".google.cloud.documentai.v1.ProcessorVersion.deprecationInfo: object expected"); + message.deprecationInfo = $root.google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo.fromObject(object.deprecationInfo); + } + return message; + }; + + /** + * Creates a plain object from a ProcessorVersion message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @static + * @param {google.cloud.documentai.v1.ProcessorVersion} message ProcessorVersion + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ProcessorVersion.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.createTime = null; + object.kmsKeyName = ""; + object.kmsKeyVersionName = ""; + object.googleManaged = false; + object.deprecationInfo = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.documentai.v1.ProcessorVersion.State[message.state] : message.state; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) + object.kmsKeyName = message.kmsKeyName; + if (message.kmsKeyVersionName != null && message.hasOwnProperty("kmsKeyVersionName")) + object.kmsKeyVersionName = message.kmsKeyVersionName; + if (message.googleManaged != null && message.hasOwnProperty("googleManaged")) + object.googleManaged = message.googleManaged; + if (message.deprecationInfo != null && message.hasOwnProperty("deprecationInfo")) + object.deprecationInfo = $root.google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo.toObject(message.deprecationInfo, options); + return object; + }; + + /** + * Converts this ProcessorVersion to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @instance + * @returns {Object.} JSON object + */ + ProcessorVersion.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + ProcessorVersion.DeprecationInfo = (function() { + + /** + * Properties of a DeprecationInfo. + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @interface IDeprecationInfo + * @property {google.protobuf.ITimestamp|null} [deprecationTime] DeprecationInfo deprecationTime + * @property {string|null} [replacementProcessorVersion] DeprecationInfo replacementProcessorVersion + */ + + /** + * Constructs a new DeprecationInfo. + * @memberof google.cloud.documentai.v1.ProcessorVersion + * @classdesc Represents a DeprecationInfo. + * @implements IDeprecationInfo + * @constructor + * @param {google.cloud.documentai.v1.ProcessorVersion.IDeprecationInfo=} [properties] Properties to set + */ + function DeprecationInfo(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]]; + } + + /** + * DeprecationInfo deprecationTime. + * @member {google.protobuf.ITimestamp|null|undefined} deprecationTime + * @memberof google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo + * @instance + */ + DeprecationInfo.prototype.deprecationTime = null; + + /** + * DeprecationInfo replacementProcessorVersion. + * @member {string} replacementProcessorVersion + * @memberof google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo + * @instance + */ + DeprecationInfo.prototype.replacementProcessorVersion = ""; + + /** + * Creates a new DeprecationInfo instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo + * @static + * @param {google.cloud.documentai.v1.ProcessorVersion.IDeprecationInfo=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo} DeprecationInfo instance + */ + DeprecationInfo.create = function create(properties) { + return new DeprecationInfo(properties); + }; + + /** + * Encodes the specified DeprecationInfo message. Does not implicitly {@link google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo + * @static + * @param {google.cloud.documentai.v1.ProcessorVersion.IDeprecationInfo} message DeprecationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeprecationInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecationTime != null && Object.hasOwnProperty.call(message, "deprecationTime")) + $root.google.protobuf.Timestamp.encode(message.deprecationTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.replacementProcessorVersion != null && Object.hasOwnProperty.call(message, "replacementProcessorVersion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.replacementProcessorVersion); + return writer; + }; + + /** + * Encodes the specified DeprecationInfo message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo + * @static + * @param {google.cloud.documentai.v1.ProcessorVersion.IDeprecationInfo} message DeprecationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeprecationInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeprecationInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo} DeprecationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeprecationInfo.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.v1.ProcessorVersion.DeprecationInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deprecationTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 2: + message.replacementProcessorVersion = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeprecationInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo} DeprecationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeprecationInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeprecationInfo message. + * @function verify + * @memberof google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeprecationInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deprecationTime != null && message.hasOwnProperty("deprecationTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.deprecationTime); + if (error) + return "deprecationTime." + error; + } + if (message.replacementProcessorVersion != null && message.hasOwnProperty("replacementProcessorVersion")) + if (!$util.isString(message.replacementProcessorVersion)) + return "replacementProcessorVersion: string expected"; + return null; + }; + + /** + * Creates a DeprecationInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo} DeprecationInfo + */ + DeprecationInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo) + return object; + var message = new $root.google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo(); + if (object.deprecationTime != null) { + if (typeof object.deprecationTime !== "object") + throw TypeError(".google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo.deprecationTime: object expected"); + message.deprecationTime = $root.google.protobuf.Timestamp.fromObject(object.deprecationTime); + } + if (object.replacementProcessorVersion != null) + message.replacementProcessorVersion = String(object.replacementProcessorVersion); + return message; + }; + + /** + * Creates a plain object from a DeprecationInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo + * @static + * @param {google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo} message DeprecationInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeprecationInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.deprecationTime = null; + object.replacementProcessorVersion = ""; + } + if (message.deprecationTime != null && message.hasOwnProperty("deprecationTime")) + object.deprecationTime = $root.google.protobuf.Timestamp.toObject(message.deprecationTime, options); + if (message.replacementProcessorVersion != null && message.hasOwnProperty("replacementProcessorVersion")) + object.replacementProcessorVersion = message.replacementProcessorVersion; + return object; + }; + + /** + * Converts this DeprecationInfo to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo + * @instance + * @returns {Object.} JSON object + */ + DeprecationInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return DeprecationInfo; + })(); + + /** + * State enum. + * @name google.cloud.documentai.v1.ProcessorVersion.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} DEPLOYED=1 DEPLOYED value + * @property {number} DEPLOYING=2 DEPLOYING value + * @property {number} UNDEPLOYED=3 UNDEPLOYED value + * @property {number} UNDEPLOYING=4 UNDEPLOYING value + * @property {number} CREATING=5 CREATING value + * @property {number} DELETING=6 DELETING value + * @property {number} FAILED=7 FAILED value + */ + ProcessorVersion.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DEPLOYED"] = 1; + values[valuesById[2] = "DEPLOYING"] = 2; + values[valuesById[3] = "UNDEPLOYED"] = 3; + values[valuesById[4] = "UNDEPLOYING"] = 4; + values[valuesById[5] = "CREATING"] = 5; + values[valuesById[6] = "DELETING"] = 6; + values[valuesById[7] = "FAILED"] = 7; + return values; + })(); + + return ProcessorVersion; + })(); + + v1.Processor = (function() { + + /** + * Properties of a Processor. + * @memberof google.cloud.documentai.v1 + * @interface IProcessor + * @property {string|null} [name] Processor name + * @property {string|null} [type] Processor type + * @property {string|null} [displayName] Processor displayName + * @property {google.cloud.documentai.v1.Processor.State|null} [state] Processor state + * @property {string|null} [defaultProcessorVersion] Processor defaultProcessorVersion + * @property {string|null} [processEndpoint] Processor processEndpoint + * @property {google.protobuf.ITimestamp|null} [createTime] Processor createTime + * @property {string|null} [kmsKeyName] Processor kmsKeyName + */ + + /** + * Constructs a new Processor. + * @memberof google.cloud.documentai.v1 + * @classdesc Represents a Processor. + * @implements IProcessor + * @constructor + * @param {google.cloud.documentai.v1.IProcessor=} [properties] Properties to set + */ + function Processor(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]]; + } + + /** + * Processor name. + * @member {string} name + * @memberof google.cloud.documentai.v1.Processor + * @instance + */ + Processor.prototype.name = ""; + + /** + * Processor type. + * @member {string} type + * @memberof google.cloud.documentai.v1.Processor + * @instance + */ + Processor.prototype.type = ""; + + /** + * Processor displayName. + * @member {string} displayName + * @memberof google.cloud.documentai.v1.Processor + * @instance + */ + Processor.prototype.displayName = ""; + + /** + * Processor state. + * @member {google.cloud.documentai.v1.Processor.State} state + * @memberof google.cloud.documentai.v1.Processor + * @instance + */ + Processor.prototype.state = 0; + + /** + * Processor defaultProcessorVersion. + * @member {string} defaultProcessorVersion + * @memberof google.cloud.documentai.v1.Processor + * @instance + */ + Processor.prototype.defaultProcessorVersion = ""; + + /** + * Processor processEndpoint. + * @member {string} processEndpoint + * @memberof google.cloud.documentai.v1.Processor + * @instance + */ + Processor.prototype.processEndpoint = ""; + + /** + * Processor createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.documentai.v1.Processor + * @instance + */ + Processor.prototype.createTime = null; + + /** + * Processor kmsKeyName. + * @member {string} kmsKeyName + * @memberof google.cloud.documentai.v1.Processor + * @instance + */ + Processor.prototype.kmsKeyName = ""; + + /** + * Creates a new Processor instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Processor + * @static + * @param {google.cloud.documentai.v1.IProcessor=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Processor} Processor instance + */ + Processor.create = function create(properties) { + return new Processor(properties); + }; + + /** + * Encodes the specified Processor message. Does not implicitly {@link google.cloud.documentai.v1.Processor.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Processor + * @static + * @param {google.cloud.documentai.v1.IProcessor} message Processor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Processor.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.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.displayName); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.state); + if (message.processEndpoint != null && Object.hasOwnProperty.call(message, "processEndpoint")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.processEndpoint); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.kmsKeyName != null && Object.hasOwnProperty.call(message, "kmsKeyName")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.kmsKeyName); + if (message.defaultProcessorVersion != null && Object.hasOwnProperty.call(message, "defaultProcessorVersion")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.defaultProcessorVersion); + return writer; + }; + + /** + * Encodes the specified Processor message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Processor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Processor + * @static + * @param {google.cloud.documentai.v1.IProcessor} message Processor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Processor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Processor message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Processor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.Processor} Processor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Processor.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.v1.Processor(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.type = reader.string(); + break; + case 3: + message.displayName = reader.string(); + break; + case 4: + message.state = reader.int32(); + break; + case 9: + message.defaultProcessorVersion = reader.string(); + break; + case 6: + message.processEndpoint = reader.string(); + break; + case 7: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 8: + message.kmsKeyName = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Processor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Processor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Processor} Processor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Processor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Processor message. + * @function verify + * @memberof google.cloud.documentai.v1.Processor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Processor.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.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string 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: + case 6: + case 7: + break; + } + if (message.defaultProcessorVersion != null && message.hasOwnProperty("defaultProcessorVersion")) + if (!$util.isString(message.defaultProcessorVersion)) + return "defaultProcessorVersion: string expected"; + if (message.processEndpoint != null && message.hasOwnProperty("processEndpoint")) + if (!$util.isString(message.processEndpoint)) + return "processEndpoint: 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.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) + if (!$util.isString(message.kmsKeyName)) + return "kmsKeyName: string expected"; + return null; + }; + + /** + * Creates a Processor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Processor + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Processor} Processor + */ + Processor.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Processor) + return object; + var message = new $root.google.cloud.documentai.v1.Processor(); + if (object.name != null) + message.name = String(object.name); + if (object.type != null) + message.type = String(object.type); + if (object.displayName != null) + message.displayName = String(object.displayName); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "ENABLED": + case 1: + message.state = 1; + break; + case "DISABLED": + case 2: + message.state = 2; + break; + case "ENABLING": + case 3: + message.state = 3; + break; + case "DISABLING": + case 4: + message.state = 4; + break; + case "CREATING": + case 5: + message.state = 5; + break; + case "FAILED": + case 6: + message.state = 6; + break; + case "DELETING": + case 7: + message.state = 7; + break; + } + if (object.defaultProcessorVersion != null) + message.defaultProcessorVersion = String(object.defaultProcessorVersion); + if (object.processEndpoint != null) + message.processEndpoint = String(object.processEndpoint); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.documentai.v1.Processor.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.kmsKeyName != null) + message.kmsKeyName = String(object.kmsKeyName); + return message; + }; + + /** + * Creates a plain object from a Processor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Processor + * @static + * @param {google.cloud.documentai.v1.Processor} message Processor * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ReviewDocumentOperationMetadata.toObject = function toObject(message, options) { + Processor.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.commonMetadata = null; - object.questionId = ""; + object.name = ""; + object.type = ""; + object.displayName = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.processEndpoint = ""; + object.createTime = null; + object.kmsKeyName = ""; + object.defaultProcessorVersion = ""; } - if (message.commonMetadata != null && message.hasOwnProperty("commonMetadata")) - object.commonMetadata = $root.google.cloud.documentai.v1.CommonOperationMetadata.toObject(message.commonMetadata, options); - if (message.questionId != null && message.hasOwnProperty("questionId")) - object.questionId = message.questionId; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.documentai.v1.Processor.State[message.state] : message.state; + if (message.processEndpoint != null && message.hasOwnProperty("processEndpoint")) + object.processEndpoint = message.processEndpoint; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) + object.kmsKeyName = message.kmsKeyName; + if (message.defaultProcessorVersion != null && message.hasOwnProperty("defaultProcessorVersion")) + object.defaultProcessorVersion = message.defaultProcessorVersion; return object; }; /** - * Converts this ReviewDocumentOperationMetadata to JSON. + * Converts this Processor to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1.ReviewDocumentOperationMetadata + * @memberof google.cloud.documentai.v1.Processor * @instance * @returns {Object.} JSON object */ - ReviewDocumentOperationMetadata.prototype.toJSON = function toJSON() { + Processor.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ReviewDocumentOperationMetadata; + /** + * State enum. + * @name google.cloud.documentai.v1.Processor.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} ENABLED=1 ENABLED value + * @property {number} DISABLED=2 DISABLED value + * @property {number} ENABLING=3 ENABLING value + * @property {number} DISABLING=4 DISABLING value + * @property {number} CREATING=5 CREATING value + * @property {number} FAILED=6 FAILED value + * @property {number} DELETING=7 DELETING value + */ + Processor.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ENABLED"] = 1; + values[valuesById[2] = "DISABLED"] = 2; + values[valuesById[3] = "ENABLING"] = 3; + values[valuesById[4] = "DISABLING"] = 4; + values[valuesById[5] = "CREATING"] = 5; + values[valuesById[6] = "FAILED"] = 6; + values[valuesById[7] = "DELETING"] = 7; + return values; + })(); + + return Processor; })(); - v1.CommonOperationMetadata = (function() { + v1.ProcessorType = (function() { /** - * Properties of a CommonOperationMetadata. + * Properties of a ProcessorType. * @memberof google.cloud.documentai.v1 - * @interface ICommonOperationMetadata - * @property {google.cloud.documentai.v1.CommonOperationMetadata.State|null} [state] CommonOperationMetadata state - * @property {string|null} [stateMessage] CommonOperationMetadata stateMessage - * @property {google.protobuf.ITimestamp|null} [createTime] CommonOperationMetadata createTime - * @property {google.protobuf.ITimestamp|null} [updateTime] CommonOperationMetadata updateTime + * @interface IProcessorType + * @property {string|null} [name] ProcessorType name + * @property {string|null} [type] ProcessorType type + * @property {string|null} [category] ProcessorType category + * @property {Array.|null} [availableLocations] ProcessorType availableLocations + * @property {boolean|null} [allowCreation] ProcessorType allowCreation + * @property {google.api.LaunchStage|null} [launchStage] ProcessorType launchStage */ /** - * Constructs a new CommonOperationMetadata. + * Constructs a new ProcessorType. * @memberof google.cloud.documentai.v1 - * @classdesc Represents a CommonOperationMetadata. - * @implements ICommonOperationMetadata + * @classdesc Represents a ProcessorType. + * @implements IProcessorType * @constructor - * @param {google.cloud.documentai.v1.ICommonOperationMetadata=} [properties] Properties to set + * @param {google.cloud.documentai.v1.IProcessorType=} [properties] Properties to set */ - function CommonOperationMetadata(properties) { + function ProcessorType(properties) { + this.availableLocations = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -14811,114 +24643,143 @@ } /** - * CommonOperationMetadata state. - * @member {google.cloud.documentai.v1.CommonOperationMetadata.State} state - * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * ProcessorType name. + * @member {string} name + * @memberof google.cloud.documentai.v1.ProcessorType * @instance */ - CommonOperationMetadata.prototype.state = 0; + ProcessorType.prototype.name = ""; /** - * CommonOperationMetadata stateMessage. - * @member {string} stateMessage - * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * ProcessorType type. + * @member {string} type + * @memberof google.cloud.documentai.v1.ProcessorType * @instance */ - CommonOperationMetadata.prototype.stateMessage = ""; + ProcessorType.prototype.type = ""; /** - * CommonOperationMetadata createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * ProcessorType category. + * @member {string} category + * @memberof google.cloud.documentai.v1.ProcessorType * @instance */ - CommonOperationMetadata.prototype.createTime = null; + ProcessorType.prototype.category = ""; /** - * CommonOperationMetadata updateTime. - * @member {google.protobuf.ITimestamp|null|undefined} updateTime - * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * ProcessorType availableLocations. + * @member {Array.} availableLocations + * @memberof google.cloud.documentai.v1.ProcessorType * @instance */ - CommonOperationMetadata.prototype.updateTime = null; + ProcessorType.prototype.availableLocations = $util.emptyArray; /** - * Creates a new CommonOperationMetadata instance using the specified properties. + * ProcessorType allowCreation. + * @member {boolean} allowCreation + * @memberof google.cloud.documentai.v1.ProcessorType + * @instance + */ + ProcessorType.prototype.allowCreation = false; + + /** + * ProcessorType launchStage. + * @member {google.api.LaunchStage} launchStage + * @memberof google.cloud.documentai.v1.ProcessorType + * @instance + */ + ProcessorType.prototype.launchStage = 0; + + /** + * Creates a new ProcessorType instance using the specified properties. * @function create - * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @memberof google.cloud.documentai.v1.ProcessorType * @static - * @param {google.cloud.documentai.v1.ICommonOperationMetadata=} [properties] Properties to set - * @returns {google.cloud.documentai.v1.CommonOperationMetadata} CommonOperationMetadata instance + * @param {google.cloud.documentai.v1.IProcessorType=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ProcessorType} ProcessorType instance */ - CommonOperationMetadata.create = function create(properties) { - return new CommonOperationMetadata(properties); + ProcessorType.create = function create(properties) { + return new ProcessorType(properties); }; /** - * Encodes the specified CommonOperationMetadata message. Does not implicitly {@link google.cloud.documentai.v1.CommonOperationMetadata.verify|verify} messages. + * Encodes the specified ProcessorType message. Does not implicitly {@link google.cloud.documentai.v1.ProcessorType.verify|verify} messages. * @function encode - * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @memberof google.cloud.documentai.v1.ProcessorType * @static - * @param {google.cloud.documentai.v1.ICommonOperationMetadata} message CommonOperationMetadata message or plain object to encode + * @param {google.cloud.documentai.v1.IProcessorType} message ProcessorType message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CommonOperationMetadata.encode = function encode(message, writer) { + ProcessorType.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.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.category != null && Object.hasOwnProperty.call(message, "category")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.category); + if (message.availableLocations != null && message.availableLocations.length) + for (var i = 0; i < message.availableLocations.length; ++i) + $root.google.cloud.documentai.v1.ProcessorType.LocationInfo.encode(message.availableLocations[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.allowCreation != null && Object.hasOwnProperty.call(message, "allowCreation")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.allowCreation); + if (message.launchStage != null && Object.hasOwnProperty.call(message, "launchStage")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.launchStage); return writer; }; /** - * Encodes the specified CommonOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.CommonOperationMetadata.verify|verify} messages. + * Encodes the specified ProcessorType message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ProcessorType.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @memberof google.cloud.documentai.v1.ProcessorType * @static - * @param {google.cloud.documentai.v1.ICommonOperationMetadata} message CommonOperationMetadata message or plain object to encode + * @param {google.cloud.documentai.v1.IProcessorType} message ProcessorType message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CommonOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + ProcessorType.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CommonOperationMetadata message from the specified reader or buffer. + * Decodes a ProcessorType message from the specified reader or buffer. * @function decode - * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @memberof google.cloud.documentai.v1.ProcessorType * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.documentai.v1.CommonOperationMetadata} CommonOperationMetadata + * @returns {google.cloud.documentai.v1.ProcessorType} ProcessorType * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CommonOperationMetadata.decode = function decode(reader, length) { + ProcessorType.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.v1.CommonOperationMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1.ProcessorType(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.state = reader.int32(); + message.name = reader.string(); break; case 2: - message.stateMessage = reader.string(); + message.type = reader.string(); break; case 3: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.category = reader.string(); break; case 4: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + if (!(message.availableLocations && message.availableLocations.length)) + message.availableLocations = []; + message.availableLocations.push($root.google.cloud.documentai.v1.ProcessorType.LocationInfo.decode(reader, reader.uint32())); + break; + case 6: + message.allowCreation = reader.bool(); + break; + case 8: + message.launchStage = reader.int32(); break; default: reader.skipType(tag & 7); @@ -14929,37 +24790,60 @@ }; /** - * Decodes a CommonOperationMetadata message from the specified reader or buffer, length delimited. + * Decodes a ProcessorType message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @memberof google.cloud.documentai.v1.ProcessorType * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.documentai.v1.CommonOperationMetadata} CommonOperationMetadata + * @returns {google.cloud.documentai.v1.ProcessorType} ProcessorType * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CommonOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + ProcessorType.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CommonOperationMetadata message. + * Verifies a ProcessorType message. * @function verify - * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @memberof google.cloud.documentai.v1.ProcessorType * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CommonOperationMetadata.verify = function verify(message) { + ProcessorType.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.state != null && message.hasOwnProperty("state")) - switch (message.state) { + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.category != null && message.hasOwnProperty("category")) + if (!$util.isString(message.category)) + return "category: string expected"; + if (message.availableLocations != null && message.hasOwnProperty("availableLocations")) { + if (!Array.isArray(message.availableLocations)) + return "availableLocations: array expected"; + for (var i = 0; i < message.availableLocations.length; ++i) { + var error = $root.google.cloud.documentai.v1.ProcessorType.LocationInfo.verify(message.availableLocations[i]); + if (error) + return "availableLocations." + error; + } + } + if (message.allowCreation != null && message.hasOwnProperty("allowCreation")) + if (typeof message.allowCreation !== "boolean") + return "allowCreation: boolean expected"; + if (message.launchStage != null && message.hasOwnProperty("launchStage")) + switch (message.launchStage) { default: - return "state: enum value expected"; + return "launchStage: enum value expected"; case 0: + case 6: + case 7: case 1: case 2: case 3: @@ -14967,139 +24851,315 @@ 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; - } return null; }; /** - * Creates a CommonOperationMetadata message from a plain object. Also converts values to their respective internal types. + * Creates a ProcessorType message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @memberof google.cloud.documentai.v1.ProcessorType * @static * @param {Object.} object Plain object - * @returns {google.cloud.documentai.v1.CommonOperationMetadata} CommonOperationMetadata + * @returns {google.cloud.documentai.v1.ProcessorType} ProcessorType */ - CommonOperationMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.documentai.v1.CommonOperationMetadata) + ProcessorType.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ProcessorType) return object; - var message = new $root.google.cloud.documentai.v1.CommonOperationMetadata(); - switch (object.state) { - case "STATE_UNSPECIFIED": + var message = new $root.google.cloud.documentai.v1.ProcessorType(); + if (object.name != null) + message.name = String(object.name); + if (object.type != null) + message.type = String(object.type); + if (object.category != null) + message.category = String(object.category); + if (object.availableLocations) { + if (!Array.isArray(object.availableLocations)) + throw TypeError(".google.cloud.documentai.v1.ProcessorType.availableLocations: array expected"); + message.availableLocations = []; + for (var i = 0; i < object.availableLocations.length; ++i) { + if (typeof object.availableLocations[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.ProcessorType.availableLocations: object expected"); + message.availableLocations[i] = $root.google.cloud.documentai.v1.ProcessorType.LocationInfo.fromObject(object.availableLocations[i]); + } + } + if (object.allowCreation != null) + message.allowCreation = Boolean(object.allowCreation); + switch (object.launchStage) { + case "LAUNCH_STAGE_UNSPECIFIED": case 0: - message.state = 0; + message.launchStage = 0; break; - case "RUNNING": + case "UNIMPLEMENTED": + case 6: + message.launchStage = 6; + break; + case "PRELAUNCH": + case 7: + message.launchStage = 7; + break; + case "EARLY_ACCESS": case 1: - message.state = 1; + message.launchStage = 1; break; - case "CANCELLING": + case "ALPHA": case 2: - message.state = 2; + message.launchStage = 2; break; - case "SUCCEEDED": + case "BETA": case 3: - message.state = 3; + message.launchStage = 3; break; - case "FAILED": + case "GA": case 4: - message.state = 4; + message.launchStage = 4; break; - case "CANCELLED": + case "DEPRECATED": case 5: - message.state = 5; + message.launchStage = 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.v1.CommonOperationMetadata.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.v1.CommonOperationMetadata.updateTime: object expected"); - message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); - } return message; }; /** - * Creates a plain object from a CommonOperationMetadata message. Also converts values to other types if specified. + * Creates a plain object from a ProcessorType message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @memberof google.cloud.documentai.v1.ProcessorType * @static - * @param {google.cloud.documentai.v1.CommonOperationMetadata} message CommonOperationMetadata + * @param {google.cloud.documentai.v1.ProcessorType} message ProcessorType * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CommonOperationMetadata.toObject = function toObject(message, options) { + ProcessorType.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.availableLocations = []; if (options.defaults) { - object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; - object.stateMessage = ""; - object.createTime = null; - object.updateTime = null; + object.name = ""; + object.type = ""; + object.category = ""; + object.allowCreation = false; + object.launchStage = options.enums === String ? "LAUNCH_STAGE_UNSPECIFIED" : 0; } - if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.documentai.v1.CommonOperationMetadata.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.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.category != null && message.hasOwnProperty("category")) + object.category = message.category; + if (message.availableLocations && message.availableLocations.length) { + object.availableLocations = []; + for (var j = 0; j < message.availableLocations.length; ++j) + object.availableLocations[j] = $root.google.cloud.documentai.v1.ProcessorType.LocationInfo.toObject(message.availableLocations[j], options); + } + if (message.allowCreation != null && message.hasOwnProperty("allowCreation")) + object.allowCreation = message.allowCreation; + if (message.launchStage != null && message.hasOwnProperty("launchStage")) + object.launchStage = options.enums === String ? $root.google.api.LaunchStage[message.launchStage] : message.launchStage; return object; }; /** - * Converts this CommonOperationMetadata to JSON. + * Converts this ProcessorType to JSON. * @function toJSON - * @memberof google.cloud.documentai.v1.CommonOperationMetadata + * @memberof google.cloud.documentai.v1.ProcessorType * @instance * @returns {Object.} JSON object */ - CommonOperationMetadata.prototype.toJSON = function toJSON() { + ProcessorType.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * State enum. - * @name google.cloud.documentai.v1.CommonOperationMetadata.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 - */ - CommonOperationMetadata.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; + ProcessorType.LocationInfo = (function() { + + /** + * Properties of a LocationInfo. + * @memberof google.cloud.documentai.v1.ProcessorType + * @interface ILocationInfo + * @property {string|null} [locationId] LocationInfo locationId + */ + + /** + * Constructs a new LocationInfo. + * @memberof google.cloud.documentai.v1.ProcessorType + * @classdesc Represents a LocationInfo. + * @implements ILocationInfo + * @constructor + * @param {google.cloud.documentai.v1.ProcessorType.ILocationInfo=} [properties] Properties to set + */ + function LocationInfo(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]]; + } + + /** + * LocationInfo locationId. + * @member {string} locationId + * @memberof google.cloud.documentai.v1.ProcessorType.LocationInfo + * @instance + */ + LocationInfo.prototype.locationId = ""; + + /** + * Creates a new LocationInfo instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.ProcessorType.LocationInfo + * @static + * @param {google.cloud.documentai.v1.ProcessorType.ILocationInfo=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.ProcessorType.LocationInfo} LocationInfo instance + */ + LocationInfo.create = function create(properties) { + return new LocationInfo(properties); + }; + + /** + * Encodes the specified LocationInfo message. Does not implicitly {@link google.cloud.documentai.v1.ProcessorType.LocationInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.ProcessorType.LocationInfo + * @static + * @param {google.cloud.documentai.v1.ProcessorType.ILocationInfo} message LocationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LocationInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.locationId != null && Object.hasOwnProperty.call(message, "locationId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.locationId); + return writer; + }; + + /** + * Encodes the specified LocationInfo message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.ProcessorType.LocationInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.ProcessorType.LocationInfo + * @static + * @param {google.cloud.documentai.v1.ProcessorType.ILocationInfo} message LocationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LocationInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LocationInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.ProcessorType.LocationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1.ProcessorType.LocationInfo} LocationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LocationInfo.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.v1.ProcessorType.LocationInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.locationId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LocationInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.ProcessorType.LocationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.ProcessorType.LocationInfo} LocationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LocationInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LocationInfo message. + * @function verify + * @memberof google.cloud.documentai.v1.ProcessorType.LocationInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LocationInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.locationId != null && message.hasOwnProperty("locationId")) + if (!$util.isString(message.locationId)) + return "locationId: string expected"; + return null; + }; + + /** + * Creates a LocationInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.ProcessorType.LocationInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.ProcessorType.LocationInfo} LocationInfo + */ + LocationInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.ProcessorType.LocationInfo) + return object; + var message = new $root.google.cloud.documentai.v1.ProcessorType.LocationInfo(); + if (object.locationId != null) + message.locationId = String(object.locationId); + return message; + }; + + /** + * Creates a plain object from a LocationInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.ProcessorType.LocationInfo + * @static + * @param {google.cloud.documentai.v1.ProcessorType.LocationInfo} message LocationInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LocationInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.locationId = ""; + if (message.locationId != null && message.hasOwnProperty("locationId")) + object.locationId = message.locationId; + return object; + }; + + /** + * Converts this LocationInfo to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.ProcessorType.LocationInfo + * @instance + * @returns {Object.} JSON object + */ + LocationInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return LocationInfo; })(); - return CommonOperationMetadata; + return ProcessorType; })(); return v1; @@ -58424,6 +68484,32 @@ return ResourceReference; })(); + /** + * LaunchStage enum. + * @name google.api.LaunchStage + * @enum {number} + * @property {number} LAUNCH_STAGE_UNSPECIFIED=0 LAUNCH_STAGE_UNSPECIFIED value + * @property {number} UNIMPLEMENTED=6 UNIMPLEMENTED value + * @property {number} PRELAUNCH=7 PRELAUNCH value + * @property {number} EARLY_ACCESS=1 EARLY_ACCESS value + * @property {number} ALPHA=2 ALPHA value + * @property {number} BETA=3 BETA value + * @property {number} GA=4 GA value + * @property {number} DEPRECATED=5 DEPRECATED value + */ + api.LaunchStage = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "LAUNCH_STAGE_UNSPECIFIED"] = 0; + values[valuesById[6] = "UNIMPLEMENTED"] = 6; + values[valuesById[7] = "PRELAUNCH"] = 7; + values[valuesById[1] = "EARLY_ACCESS"] = 1; + values[valuesById[2] = "ALPHA"] = 2; + values[valuesById[3] = "BETA"] = 3; + values[valuesById[4] = "GA"] = 4; + values[valuesById[5] = "DEPRECATED"] = 5; + return values; + })(); + return api; })(); diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index 7773f8661b9..10ece4e69df 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -11,14 +11,30 @@ "csharp_namespace": "Google.Cloud.DocumentAI.V1", "go_package": "google.golang.org/genproto/googleapis/cloud/documentai/v1;documentai", "java_multiple_files": true, - "java_outer_classname": "OperationMetadataProto", + "java_outer_classname": "DocumentAiProcessorType", "java_package": "com.google.cloud.documentai.v1", "php_namespace": "Google\\Cloud\\DocumentAI\\V1", "ruby_package": "Google::Cloud::DocumentAI::V1", - "(google.api.resource_definition).type": "documentai.googleapis.com/HumanReviewConfig", - "(google.api.resource_definition).pattern": "projects/{project}/locations/{location}/processors/{processor}/humanReviewConfig" + "(google.api.resource_definition).type": "documentai.googleapis.com/Location", + "(google.api.resource_definition).pattern": "projects/{project}/locations/{location}" }, "nested": { + "Barcode": { + "fields": { + "format": { + "type": "string", + "id": 1 + }, + "valueFormat": { + "type": "string", + "id": 2 + }, + "rawValue": { + "type": "string", + "id": 3 + } + } + }, "Document": { "oneofs": { "source": { @@ -224,6 +240,11 @@ "type": "Symbol", "id": 12 }, + "detectedBarcodes": { + "rule": "repeated", + "type": "DetectedBarcode", + "id": 15 + }, "provenance": { "type": "Provenance", "id": 16 @@ -518,12 +539,32 @@ "type": "string", "id": 5 }, + "correctedKeyText": { + "type": "string", + "id": 6 + }, + "correctedValueText": { + "type": "string", + "id": 7 + }, "provenance": { "type": "Provenance", "id": 8 } } }, + "DetectedBarcode": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "barcode": { + "type": "Barcode", + "id": 2 + } + } + }, "DetectedLanguage": { "fields": { "languageCode": { @@ -628,7 +669,9 @@ "dateValue", "datetimeValue", "addressValue", - "booleanValue" + "booleanValue", + "integerValue", + "floatValue" ] } }, @@ -653,6 +696,14 @@ "type": "bool", "id": 6 }, + "integerValue": { + "type": "int32", + "id": 7 + }, + "floatValue": { + "type": "float", + "id": 8 + }, "text": { "type": "string", "id": 1, @@ -853,7 +904,15 @@ "parent": { "rule": "repeated", "type": "int32", - "id": 2 + "id": 2, + "options": { + "deprecated": true + } + }, + "parentIds": { + "rule": "repeated", + "type": "string", + "id": 7 }, "createTime": { "type": "google.protobuf.Timestamp", @@ -1034,13 +1093,19 @@ "options": { "(google.api.http).post": "/v1/{name=projects/*/locations/*/processors/*}:process", "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:process", + "(google.api.http).additional_bindings.body": "*", "(google.api.method_signature)": "name" }, "parsedOptions": [ { "(google.api.http)": { "post": "/v1/{name=projects/*/locations/*/processors/*}:process", - "body": "*" + "body": "*", + "additional_bindings": { + "post": "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:process", + "body": "*" + } } }, { @@ -1054,6 +1119,8 @@ "options": { "(google.api.http).post": "/v1/{name=projects/*/locations/*/processors/*}:batchProcess", "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:batchProcess", + "(google.api.http).additional_bindings.body": "*", "(google.api.method_signature)": "name", "(google.longrunning.operation_info).response_type": "BatchProcessResponse", "(google.longrunning.operation_info).metadata_type": "BatchProcessMetadata" @@ -1062,7 +1129,11 @@ { "(google.api.http)": { "post": "/v1/{name=projects/*/locations/*/processors/*}:batchProcess", - "body": "*" + "body": "*", + "additional_bindings": { + "post": "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:batchProcess", + "body": "*" + } } }, { @@ -1076,69 +1147,1025 @@ } ] }, - "ReviewDocument": { - "requestType": "ReviewDocumentRequest", + "FetchProcessorTypes": { + "requestType": "FetchProcessorTypesRequest", + "responseType": "FetchProcessorTypesResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/locations/*}:fetchProcessorTypes", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/locations/*}:fetchProcessorTypes" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "ListProcessorTypes": { + "requestType": "ListProcessorTypesRequest", + "responseType": "ListProcessorTypesResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/locations/*}/processorTypes", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/locations/*}/processorTypes" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "ListProcessors": { + "requestType": "ListProcessorsRequest", + "responseType": "ListProcessorsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/locations/*}/processors", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/locations/*}/processors" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetProcessor": { + "requestType": "GetProcessorRequest", + "responseType": "Processor", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/locations/*/processors/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/locations/*/processors/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "GetProcessorVersion": { + "requestType": "GetProcessorVersionRequest", + "responseType": "ProcessorVersion", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListProcessorVersions": { + "requestType": "ListProcessorVersionsRequest", + "responseType": "ListProcessorVersionsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/locations/*/processors/*}/processorVersions", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/locations/*/processors/*}/processorVersions" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "DeleteProcessorVersion": { + "requestType": "DeleteProcessorVersionRequest", "responseType": "google.longrunning.Operation", "options": { - "(google.api.http).post": "/v1/{human_review_config=projects/*/locations/*/processors/*/humanReviewConfig}:reviewDocument", + "(google.api.http).delete": "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "DeleteProcessorVersionMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "DeleteProcessorVersionMetadata" + } + } + ] + }, + "DeployProcessorVersion": { + "requestType": "DeployProcessorVersionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:deploy", "(google.api.http).body": "*", - "(google.api.method_signature)": "human_review_config", - "(google.longrunning.operation_info).response_type": "ReviewDocumentResponse", - "(google.longrunning.operation_info).metadata_type": "ReviewDocumentOperationMetadata" + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "DeployProcessorVersionResponse", + "(google.longrunning.operation_info).metadata_type": "DeployProcessorVersionMetadata" }, "parsedOptions": [ { "(google.api.http)": { - "post": "/v1/{human_review_config=projects/*/locations/*/processors/*/humanReviewConfig}:reviewDocument", + "post": "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:deploy", "body": "*" } }, { - "(google.api.method_signature)": "human_review_config" + "(google.api.method_signature)": "name" }, { "(google.longrunning.operation_info)": { - "response_type": "ReviewDocumentResponse", - "metadata_type": "ReviewDocumentOperationMetadata" + "response_type": "DeployProcessorVersionResponse", + "metadata_type": "DeployProcessorVersionMetadata" } } ] - } - } - }, - "ProcessRequest": { - "oneofs": { - "source": { - "oneof": [ - "inlineDocument", - "rawDocument" + }, + "UndeployProcessorVersion": { + "requestType": "UndeployProcessorVersionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:undeploy", + "(google.api.http).body": "*", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "UndeployProcessorVersionResponse", + "(google.longrunning.operation_info).metadata_type": "UndeployProcessorVersionMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:undeploy", + "body": "*" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "UndeployProcessorVersionResponse", + "metadata_type": "UndeployProcessorVersionMetadata" + } + } ] - } - }, - "fields": { - "inlineDocument": { - "type": "Document", - "id": 4 }, - "rawDocument": { - "type": "RawDocument", - "id": 5 + "CreateProcessor": { + "requestType": "CreateProcessorRequest", + "responseType": "Processor", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*/locations/*}/processors", + "(google.api.http).body": "processor", + "(google.api.method_signature)": "parent,processor" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*/locations/*}/processors", + "body": "processor" + } + }, + { + "(google.api.method_signature)": "parent,processor" + } + ] }, - "name": { - "type": "string", - "id": 1, + "DeleteProcessor": { + "requestType": "DeleteProcessorRequest", + "responseType": "google.longrunning.Operation", "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "documentai.googleapis.com/Processor" + "(google.api.http).delete": "/v1/{name=projects/*/locations/*/processors/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "DeleteProcessorMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=projects/*/locations/*/processors/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "DeleteProcessorMetadata" + } + } + ] + }, + "EnableProcessor": { + "requestType": "EnableProcessorRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/locations/*/processors/*}:enable", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "EnableProcessorResponse", + "(google.longrunning.operation_info).metadata_type": "EnableProcessorMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/locations/*/processors/*}:enable", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "EnableProcessorResponse", + "metadata_type": "EnableProcessorMetadata" + } + } + ] + }, + "DisableProcessor": { + "requestType": "DisableProcessorRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{name=projects/*/locations/*/processors/*}:disable", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "DisableProcessorResponse", + "(google.longrunning.operation_info).metadata_type": "DisableProcessorMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{name=projects/*/locations/*/processors/*}:disable", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "DisableProcessorResponse", + "metadata_type": "DisableProcessorMetadata" + } + } + ] + }, + "SetDefaultProcessorVersion": { + "requestType": "SetDefaultProcessorVersionRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{processor=projects/*/locations/*/processors/*}:setDefaultProcessorVersion", + "(google.api.http).body": "*", + "(google.longrunning.operation_info).response_type": "SetDefaultProcessorVersionResponse", + "(google.longrunning.operation_info).metadata_type": "SetDefaultProcessorVersionMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{processor=projects/*/locations/*/processors/*}:setDefaultProcessorVersion", + "body": "*" + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "SetDefaultProcessorVersionResponse", + "metadata_type": "SetDefaultProcessorVersionMetadata" + } + } + ] + }, + "ReviewDocument": { + "requestType": "ReviewDocumentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v1/{human_review_config=projects/*/locations/*/processors/*/humanReviewConfig}:reviewDocument", + "(google.api.http).body": "*", + "(google.api.method_signature)": "human_review_config", + "(google.longrunning.operation_info).response_type": "ReviewDocumentResponse", + "(google.longrunning.operation_info).metadata_type": "ReviewDocumentOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{human_review_config=projects/*/locations/*/processors/*/humanReviewConfig}:reviewDocument", + "body": "*" + } + }, + { + "(google.api.method_signature)": "human_review_config" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "ReviewDocumentResponse", + "metadata_type": "ReviewDocumentOperationMetadata" + } + } + ] + } + } + }, + "ProcessRequest": { + "oneofs": { + "source": { + "oneof": [ + "inlineDocument", + "rawDocument" + ] + } + }, + "fields": { + "inlineDocument": { + "type": "Document", + "id": 4 + }, + "rawDocument": { + "type": "RawDocument", + "id": 5 + }, + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "*" + } + }, + "skipHumanReview": { + "type": "bool", + "id": 3 + }, + "fieldMask": { + "type": "google.protobuf.FieldMask", + "id": 6 + } + } + }, + "HumanReviewStatus": { + "fields": { + "state": { + "type": "State", + "id": 1 + }, + "stateMessage": { + "type": "string", + "id": 2 + }, + "humanReviewOperation": { + "type": "string", + "id": 3 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "SKIPPED": 1, + "VALIDATION_PASSED": 2, + "IN_PROGRESS": 3, + "ERROR": 4 + } + } + } + }, + "ProcessResponse": { + "fields": { + "document": { + "type": "Document", + "id": 1 + }, + "humanReviewStatus": { + "type": "HumanReviewStatus", + "id": 3 + } + } + }, + "BatchProcessRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "*" + } + }, + "inputDocuments": { + "type": "BatchDocumentsInputConfig", + "id": 5 + }, + "documentOutputConfig": { + "type": "DocumentOutputConfig", + "id": 6 + }, + "skipHumanReview": { + "type": "bool", + "id": 4 + } + } + }, + "BatchProcessResponse": { + "fields": {} + }, + "BatchProcessMetadata": { + "fields": { + "state": { + "type": "State", + "id": 1 + }, + "stateMessage": { + "type": "string", + "id": 2 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + }, + "individualProcessStatuses": { + "rule": "repeated", + "type": "IndividualProcessStatus", + "id": 5 + } + }, + "nested": { + "IndividualProcessStatus": { + "fields": { + "inputGcsSource": { + "type": "string", + "id": 1 + }, + "status": { + "type": "google.rpc.Status", + "id": 2 + }, + "outputGcsDestination": { + "type": "string", + "id": 3 + }, + "humanReviewStatus": { + "type": "HumanReviewStatus", + "id": 5 + } + } + }, + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "WAITING": 1, + "RUNNING": 2, + "SUCCEEDED": 3, + "CANCELLING": 4, + "CANCELLED": 5, + "FAILED": 6 + } + } + } + }, + "FetchProcessorTypesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "documentai.googleapis.com/ProcessorType" + } + } + } + }, + "FetchProcessorTypesResponse": { + "fields": { + "processorTypes": { + "rule": "repeated", + "type": "ProcessorType", + "id": 1 + } + } + }, + "ListProcessorTypesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "documentai.googleapis.com/ProcessorType" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListProcessorTypesResponse": { + "fields": { + "processorTypes": { + "rule": "repeated", + "type": "ProcessorType", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "ListProcessorsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "documentai.googleapis.com/Processor" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListProcessorsResponse": { + "fields": { + "processors": { + "rule": "repeated", + "type": "Processor", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetProcessorRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/Processor" + } + } + } + }, + "GetProcessorVersionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/ProcessorVersion" + } + } + } + }, + "ListProcessorVersionsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "documentai.googleapis.com/ProcessorVersion" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListProcessorVersionsResponse": { + "fields": { + "processorVersions": { + "rule": "repeated", + "type": "ProcessorVersion", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "DeleteProcessorVersionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/ProcessorVersion" + } + } + } + }, + "DeleteProcessorVersionMetadata": { + "fields": { + "commonMetadata": { + "type": "CommonOperationMetadata", + "id": 1 + } + } + }, + "DeployProcessorVersionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/ProcessorVersion" + } + } + } + }, + "DeployProcessorVersionResponse": { + "fields": {} + }, + "DeployProcessorVersionMetadata": { + "fields": { + "commonMetadata": { + "type": "CommonOperationMetadata", + "id": 1 + } + } + }, + "UndeployProcessorVersionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/ProcessorVersion" + } + } + } + }, + "UndeployProcessorVersionResponse": { + "fields": {} + }, + "UndeployProcessorVersionMetadata": { + "fields": { + "commonMetadata": { + "type": "CommonOperationMetadata", + "id": 1 + } + } + }, + "CreateProcessorRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "documentai.googleapis.com/Processor" + } + }, + "processor": { + "type": "Processor", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "DeleteProcessorRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/Processor" + } + } + } + }, + "DeleteProcessorMetadata": { + "fields": { + "commonMetadata": { + "type": "CommonOperationMetadata", + "id": 5 + } + } + }, + "EnableProcessorRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/Processor" + } + } + } + }, + "EnableProcessorResponse": { + "fields": {} + }, + "EnableProcessorMetadata": { + "fields": { + "commonMetadata": { + "type": "CommonOperationMetadata", + "id": 5 + } + } + }, + "DisableProcessorRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/Processor" + } + } + } + }, + "DisableProcessorResponse": { + "fields": {} + }, + "DisableProcessorMetadata": { + "fields": { + "commonMetadata": { + "type": "CommonOperationMetadata", + "id": 5 + } + } + }, + "SetDefaultProcessorVersionRequest": { + "fields": { + "processor": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/Processor" + } + }, + "defaultProcessorVersion": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/ProcessorVersion" + } + } + } + }, + "SetDefaultProcessorVersionResponse": { + "fields": {} + }, + "SetDefaultProcessorVersionMetadata": { + "fields": { + "commonMetadata": { + "type": "CommonOperationMetadata", + "id": 1 + } + } + }, + "ReviewDocumentRequest": { + "oneofs": { + "source": { + "oneof": [ + "inlineDocument" + ] + } + }, + "fields": { + "inlineDocument": { + "type": "Document", + "id": 4 + }, + "humanReviewConfig": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "documentai.googleapis.com/HumanReviewConfig" + } + }, + "enableSchemaValidation": { + "type": "bool", + "id": 3 + }, + "priority": { + "type": "Priority", + "id": 5 + }, + "documentSchema": { + "type": "DocumentSchema", + "id": 6 + } + }, + "nested": { + "Priority": { + "values": { + "DEFAULT": 0, + "URGENT": 1 + } + } + } + }, + "ReviewDocumentResponse": { + "fields": { + "gcsDestination": { + "type": "string", + "id": 1 + }, + "state": { + "type": "State", + "id": 2 + }, + "rejectionReason": { + "type": "string", + "id": 3 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "REJECTED": 1, + "SUCCEEDED": 2 + } + } + } + }, + "ReviewDocumentOperationMetadata": { + "fields": { + "commonMetadata": { + "type": "CommonOperationMetadata", + "id": 5 + }, + "questionId": { + "type": "string", + "id": 6 + } + } + }, + "DocumentSchema": { + "fields": { + "displayName": { + "type": "string", + "id": 1 + }, + "description": { + "type": "string", + "id": 2 + }, + "entityTypes": { + "rule": "repeated", + "type": "EntityType", + "id": 3 + }, + "metadata": { + "type": "Metadata", + "id": 4 + } + }, + "nested": { + "EntityType": { + "oneofs": { + "valueSource": { + "oneof": [ + "enumValues" + ] + } + }, + "fields": { + "enumValues": { + "type": "EnumValues", + "id": 14 + }, + "displayName": { + "type": "string", + "id": 13 + }, + "name": { + "type": "string", + "id": 1 + }, + "baseTypes": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "properties": { + "rule": "repeated", + "type": "Property", + "id": 6 + } + }, + "nested": { + "EnumValues": { + "fields": { + "values": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "Property": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "valueType": { + "type": "string", + "id": 2 + }, + "occurrenceType": { + "type": "OccurrenceType", + "id": 3 + } + }, + "nested": { + "OccurrenceType": { + "values": { + "OCCURRENCE_TYPE_UNSPECIFIED": 0, + "OPTIONAL_ONCE": 1, + "OPTIONAL_MULTIPLE": 2, + "REQUIRED_ONCE": 3, + "REQUIRED_MULTIPLE": 4 + } + } + } + } + } + }, + "Metadata": { + "fields": { + "documentSplitter": { + "type": "bool", + "id": 1 + }, + "documentAllowMultipleLabels": { + "type": "bool", + "id": 2 + }, + "prefixedNamingOnProperties": { + "type": "bool", + "id": 6 + }, + "skipNamingValidation": { + "type": "bool", + "id": 7 + } } - }, - "skipHumanReview": { - "type": "bool", - "id": 3 } } }, - "HumanReviewStatus": { + "CommonOperationMetadata": { "fields": { "state": { "type": "State", @@ -1148,213 +2175,206 @@ "type": "string", "id": 2 }, - "humanReviewOperation": { + "resource": { "type": "string", + "id": 5 + }, + "createTime": { + "type": "google.protobuf.Timestamp", "id": 3 + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 4 } }, "nested": { "State": { "values": { "STATE_UNSPECIFIED": 0, - "SKIPPED": 1, - "VALIDATION_PASSED": 2, - "IN_PROGRESS": 3, - "ERROR": 4 + "RUNNING": 1, + "CANCELLING": 2, + "SUCCEEDED": 3, + "FAILED": 4, + "CANCELLED": 5 } } } }, - "ProcessResponse": { - "fields": { - "document": { - "type": "Document", - "id": 1 - }, - "humanReviewStatus": { - "type": "HumanReviewStatus", - "id": 3 - } - } - }, - "BatchProcessRequest": { + "ProcessorVersion": { + "options": { + "(google.api.resource).type": "documentai.googleapis.com/ProcessorVersion", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}" + }, "fields": { "name": { "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "documentai.googleapis.com/Processor" - } - }, - "inputDocuments": { - "type": "BatchDocumentsInputConfig", - "id": 5 - }, - "documentOutputConfig": { - "type": "DocumentOutputConfig", - "id": 6 - }, - "skipHumanReview": { - "type": "bool", - "id": 4 - } - } - }, - "BatchProcessResponse": { - "fields": {} - }, - "BatchProcessMetadata": { - "fields": { - "state": { - "type": "State", "id": 1 }, - "stateMessage": { + "displayName": { "type": "string", "id": 2 }, + "state": { + "type": "State", + "id": 6 + }, "createTime": { "type": "google.protobuf.Timestamp", - "id": 3 + "id": 7 }, - "updateTime": { - "type": "google.protobuf.Timestamp", - "id": 4 + "kmsKeyName": { + "type": "string", + "id": 9 }, - "individualProcessStatuses": { - "rule": "repeated", - "type": "IndividualProcessStatus", - "id": 5 + "kmsKeyVersionName": { + "type": "string", + "id": 10 + }, + "googleManaged": { + "type": "bool", + "id": 11 + }, + "deprecationInfo": { + "type": "DeprecationInfo", + "id": 13 } }, "nested": { - "IndividualProcessStatus": { + "DeprecationInfo": { "fields": { - "inputGcsSource": { - "type": "string", + "deprecationTime": { + "type": "google.protobuf.Timestamp", "id": 1 }, - "status": { - "type": "google.rpc.Status", - "id": 2 - }, - "outputGcsDestination": { + "replacementProcessorVersion": { "type": "string", - "id": 3 - }, - "humanReviewStatus": { - "type": "HumanReviewStatus", - "id": 5 + "id": 2, + "options": { + "(google.api.resource_reference).type": "documentai.googleapis.com/ProcessorVersion" + } } } }, "State": { "values": { "STATE_UNSPECIFIED": 0, - "WAITING": 1, - "RUNNING": 2, - "SUCCEEDED": 3, - "CANCELLING": 4, - "CANCELLED": 5, - "FAILED": 6 + "DEPLOYED": 1, + "DEPLOYING": 2, + "UNDEPLOYED": 3, + "UNDEPLOYING": 4, + "CREATING": 5, + "DELETING": 6, + "FAILED": 7 } } } }, - "ReviewDocumentRequest": { - "oneofs": { - "source": { - "oneof": [ - "inlineDocument" - ] - } + "Processor": { + "options": { + "(google.api.resource).type": "documentai.googleapis.com/Processor", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/processors/{processor}" }, "fields": { - "inlineDocument": { - "type": "Document", - "id": 4 - }, - "humanReviewConfig": { + "name": { "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "documentai.googleapis.com/HumanReviewConfig" + "(google.api.field_behavior)": "OUTPUT_ONLY" } }, - "enableSchemaValidation": { - "type": "bool", + "type": { + "type": "string", + "id": 2 + }, + "displayName": { + "type": "string", "id": 3 }, - "priority": { - "type": "Priority", - "id": 5 + "state": { + "type": "State", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "defaultProcessorVersion": { + "type": "string", + "id": 9, + "options": { + "(google.api.resource_reference).type": "documentai.googleapis.com/ProcessorVersion" + } + }, + "processEndpoint": { + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 7 + }, + "kmsKeyName": { + "type": "string", + "id": 8 } }, - "reserved": [ - [ - 2, - 2 - ] - ], "nested": { - "Priority": { + "State": { "values": { - "DEFAULT": 0, - "URGENT": 1 + "STATE_UNSPECIFIED": 0, + "ENABLED": 1, + "DISABLED": 2, + "ENABLING": 3, + "DISABLING": 4, + "CREATING": 5, + "FAILED": 6, + "DELETING": 7 } } } }, - "ReviewDocumentResponse": { - "fields": { - "gcsDestination": { - "type": "string", - "id": 1 - } - } - }, - "ReviewDocumentOperationMetadata": { + "ProcessorType": { + "options": { + "(google.api.resource).type": "documentai.googleapis.com/ProcessorType", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/processorTypes/{processor_type}" + }, "fields": { - "commonMetadata": { - "type": "CommonOperationMetadata", - "id": 5 - }, - "questionId": { + "name": { "type": "string", - "id": 6 - } - } - }, - "CommonOperationMetadata": { - "fields": { - "state": { - "type": "State", "id": 1 }, - "stateMessage": { + "type": { "type": "string", "id": 2 }, - "createTime": { - "type": "google.protobuf.Timestamp", + "category": { + "type": "string", "id": 3 }, - "updateTime": { - "type": "google.protobuf.Timestamp", + "availableLocations": { + "rule": "repeated", + "type": "LocationInfo", "id": 4 + }, + "allowCreation": { + "type": "bool", + "id": 6 + }, + "launchStage": { + "type": "google.api.LaunchStage", + "id": 8 } }, "nested": { - "State": { - "values": { - "STATE_UNSPECIFIED": 0, - "RUNNING": 1, - "CANCELLING": 2, - "SUCCEEDED": 3, - "FAILED": 4, - "CANCELLED": 5 + "LocationInfo": { + "fields": { + "locationId": { + "type": "string", + "id": 1 + } } } } @@ -5005,9 +6025,9 @@ }, "api": { "options": { - "go_package": "google.golang.org/genproto/googleapis/api/annotations;annotations", + "go_package": "google.golang.org/genproto/googleapis/api;api", "java_multiple_files": true, - "java_outer_classname": "ResourceProto", + "java_outer_classname": "LaunchStageProto", "java_package": "com.google.api", "objc_class_prefix": "GAPI", "cc_enable_arenas": true @@ -5210,6 +6230,18 @@ "id": 2 } } + }, + "LaunchStage": { + "values": { + "LAUNCH_STAGE_UNSPECIFIED": 0, + "UNIMPLEMENTED": 6, + "PRELAUNCH": 7, + "EARLY_ACCESS": 1, + "ALPHA": 2, + "BETA": 3, + "GA": 4, + "DEPRECATED": 5 + } } } }, diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js index 33e8eef0fc0..b7ae22929be 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.batch_process_documents.js @@ -26,7 +26,11 @@ function main(name) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The processor resource name. + * Required. The resource name of Processor google.cloud.documentai.v1.Processor or + * ProcessorVersion google.cloud.documentai.v1.ProcessorVersion. + * Format: `projects/{project}/locations/{location}/processors/{processor}`, + * or + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` */ // const name = 'abc123' /** diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.create_processor.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.create_processor.js new file mode 100644 index 00000000000..dabf1797e81 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.create_processor.js @@ -0,0 +1,65 @@ +// 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, processor) { + // [START documentai_v1_generated_DocumentProcessorService_CreateProcessor_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent (project and location) under which to create the processor. + * Format: `projects/{project}/locations/{location}` + */ + // const parent = 'abc123' + /** + * Required. The processor to be created, requires processor_type and display_name + * to be set. Also, the processor is under CMEK if CMEK fields are set. + */ + // const processor = {} + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callCreateProcessor() { + // Construct request + const request = { + parent, + processor, + }; + + // Run request + const response = await documentaiClient.createProcessor(request); + console.log(response); + } + + callCreateProcessor(); + // [END documentai_v1_generated_DocumentProcessorService_CreateProcessor_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor.js new file mode 100644 index 00000000000..9b6be82cf08 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor.js @@ -0,0 +1,59 @@ +// 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_v1_generated_DocumentProcessorService_DeleteProcessor_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The processor resource name to be deleted. + */ + // const name = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callDeleteProcessor() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await documentaiClient.deleteProcessor(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteProcessor(); + // [END documentai_v1_generated_DocumentProcessorService_DeleteProcessor_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor_version.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor_version.js new file mode 100644 index 00000000000..2afd2cb69fa --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.delete_processor_version.js @@ -0,0 +1,59 @@ +// 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_v1_generated_DocumentProcessorService_DeleteProcessorVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The processor version resource name to be deleted. + */ + // const name = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callDeleteProcessorVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await documentaiClient.deleteProcessorVersion(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteProcessorVersion(); + // [END documentai_v1_generated_DocumentProcessorService_DeleteProcessorVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.deploy_processor_version.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.deploy_processor_version.js new file mode 100644 index 00000000000..e2eb5a3f5d9 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.deploy_processor_version.js @@ -0,0 +1,59 @@ +// 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_v1_generated_DocumentProcessorService_DeployProcessorVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The processor version resource name to be deployed. + */ + // const name = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callDeployProcessorVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await documentaiClient.deployProcessorVersion(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeployProcessorVersion(); + // [END documentai_v1_generated_DocumentProcessorService_DeployProcessorVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.disable_processor.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.disable_processor.js new file mode 100644 index 00000000000..31cb7edf0e0 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.disable_processor.js @@ -0,0 +1,59 @@ +// 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_v1_generated_DocumentProcessorService_DisableProcessor_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The processor resource name to be disabled. + */ + // const name = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callDisableProcessor() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await documentaiClient.disableProcessor(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDisableProcessor(); + // [END documentai_v1_generated_DocumentProcessorService_DisableProcessor_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.enable_processor.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.enable_processor.js new file mode 100644 index 00000000000..a0cb036bea4 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.enable_processor.js @@ -0,0 +1,59 @@ +// 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_v1_generated_DocumentProcessorService_EnableProcessor_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The processor resource name to be enabled. + */ + // const name = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callEnableProcessor() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await documentaiClient.enableProcessor(request); + const [response] = await operation.promise(); + console.log(response); + } + + callEnableProcessor(); + // [END documentai_v1_generated_DocumentProcessorService_EnableProcessor_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.fetch_processor_types.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.fetch_processor_types.js new file mode 100644 index 00000000000..d995bb995cb --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.fetch_processor_types.js @@ -0,0 +1,60 @@ +// 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_v1_generated_DocumentProcessorService_FetchProcessorTypes_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The project of processor type to list. + * The available processor types may depend on the allow-listing on projects. + * Format: `projects/{project}/locations/{location}` + */ + // const parent = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callFetchProcessorTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await documentaiClient.fetchProcessorTypes(request); + console.log(response); + } + + callFetchProcessorTypes(); + // [END documentai_v1_generated_DocumentProcessorService_FetchProcessorTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor.js new file mode 100644 index 00000000000..9a15ee51989 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor.js @@ -0,0 +1,58 @@ +// 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_v1_generated_DocumentProcessorService_GetProcessor_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The processor resource name. + */ + // const name = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callGetProcessor() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await documentaiClient.getProcessor(request); + console.log(response); + } + + callGetProcessor(); + // [END documentai_v1_generated_DocumentProcessorService_GetProcessor_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor_version.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor_version.js new file mode 100644 index 00000000000..c15c9e0a94c --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.get_processor_version.js @@ -0,0 +1,58 @@ +// 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_v1_generated_DocumentProcessorService_GetProcessorVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The processor resource name. + */ + // const name = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callGetProcessorVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await documentaiClient.getProcessorVersion(request); + console.log(response); + } + + callGetProcessorVersion(); + // [END documentai_v1_generated_DocumentProcessorService_GetProcessorVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_types.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_types.js new file mode 100644 index 00000000000..64702298034 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_types.js @@ -0,0 +1,72 @@ +// 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_v1_generated_DocumentProcessorService_ListProcessorTypes_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The location of processor type to list. + * The available processor types may depend on the allow-listing on projects. + * Format: `projects/{project}/locations/{location}` + */ + // const parent = 'abc123' + /** + * The maximum number of processor types to return. + * If unspecified, at most 100 processor types will be returned. + * The maximum value is 500; values above 500 will be coerced to 500. + */ + // const pageSize = 1234 + /** + * Used to retrieve the next page of results, empty if at the end of the list. + */ + // const pageToken = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callListProcessorTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await documentaiClient.listProcessorTypesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListProcessorTypes(); + // [END documentai_v1_generated_DocumentProcessorService_ListProcessorTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_versions.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_versions.js new file mode 100644 index 00000000000..0a1c16204e6 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processor_versions.js @@ -0,0 +1,72 @@ +// 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_v1_generated_DocumentProcessorService_ListProcessorVersions_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent (project, location and processor) to list all versions. + * Format: `projects/{project}/locations/{location}/processors/{processor}` + */ + // const parent = 'abc123' + /** + * The maximum number of processor versions to return. + * If unspecified, at most 10 processor versions will be returned. + * The maximum value is 20; values above 20 will be coerced to 20. + */ + // const pageSize = 1234 + /** + * We will return the processor versions sorted by creation time. The page + * token will point to the next processor version. + */ + // const pageToken = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callListProcessorVersions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await documentaiClient.listProcessorVersionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListProcessorVersions(); + // [END documentai_v1_generated_DocumentProcessorService_ListProcessorVersions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processors.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processors.js new file mode 100644 index 00000000000..3038b092980 --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.list_processors.js @@ -0,0 +1,72 @@ +// 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_v1_generated_DocumentProcessorService_ListProcessors_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent (project and location) which owns this collection of Processors. + * Format: `projects/{project}/locations/{location}` + */ + // const parent = 'abc123' + /** + * The maximum number of processors to return. + * If unspecified, at most 50 processors will be returned. + * The maximum value is 100; values above 100 will be coerced to 100. + */ + // const pageSize = 1234 + /** + * We will return the processors sorted by creation time. The page token + * will point to the next processor. + */ + // const pageToken = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callListProcessors() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await documentaiClient.listProcessorsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListProcessors(); + // [END documentai_v1_generated_DocumentProcessorService_ListProcessors_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js index 1ff38d5a965..e22847c4216 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.process_document.js @@ -34,7 +34,12 @@ function main(name) { */ // const rawDocument = {} /** - * Required. The processor resource name. + * Required. The resource name of the Processor google.cloud.documentai.v1.Processor or + * ProcessorVersion google.cloud.documentai.v1.ProcessorVersion + * to use for processing. If a Processor google.cloud.documentai.v1.Processor is specified, the server will use + * its default version google.cloud.documentai.v1.Processor.default_processor_version. Format: + * `projects/{project}/locations/{location}/processors/{processor}`, or + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` */ // const name = 'abc123' /** @@ -42,6 +47,10 @@ function main(name) { * false. */ // const skipHumanReview = true + /** + * Specifies which fields to include in ProcessResponse's document. + */ + // const fieldMask = {} // Imports the Documentai library const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.js index d78861aaedb..8dbd18cb467 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.js +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.review_document.js @@ -42,6 +42,10 @@ function main(humanReviewConfig) { * The priority of the human review task. */ // const priority = {} + /** + * The document schema of the human review task. + */ + // const documentSchema = {} // Imports the Documentai library const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.set_default_processor_version.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.set_default_processor_version.js new file mode 100644 index 00000000000..8005da6375b --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.set_default_processor_version.js @@ -0,0 +1,66 @@ +// 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(processor, defaultProcessorVersion) { + // [START documentai_v1_generated_DocumentProcessorService_SetDefaultProcessorVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the Processor google.cloud.documentai.v1.Processor to change default version. + */ + // const processor = 'abc123' + /** + * Required. The resource name of child ProcessorVersion google.cloud.documentai.v1.ProcessorVersion to use as default. + * Format: + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}` + */ + // const defaultProcessorVersion = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callSetDefaultProcessorVersion() { + // Construct request + const request = { + processor, + defaultProcessorVersion, + }; + + // Run request + const [operation] = await documentaiClient.setDefaultProcessorVersion(request); + const [response] = await operation.promise(); + console.log(response); + } + + callSetDefaultProcessorVersion(); + // [END documentai_v1_generated_DocumentProcessorService_SetDefaultProcessorVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.undeploy_processor_version.js b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.undeploy_processor_version.js new file mode 100644 index 00000000000..7a617c1effc --- /dev/null +++ b/packages/google-cloud-documentai/samples/generated/v1/document_processor_service.undeploy_processor_version.js @@ -0,0 +1,59 @@ +// 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_v1_generated_DocumentProcessorService_UndeployProcessorVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The processor version resource name to be undeployed. + */ + // const name = 'abc123' + + // Imports the Documentai library + const {DocumentProcessorServiceClient} = require('@google-cloud/documentai').v1; + + // Instantiates a client + const documentaiClient = new DocumentProcessorServiceClient(); + + async function callUndeployProcessorVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await documentaiClient.undeployProcessorVersion(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUndeployProcessorVersion(); + // [END documentai_v1_generated_DocumentProcessorService_UndeployProcessorVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json b/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json index aae86640725..8c98d8e34a3 100644 --- a/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json +++ b/packages/google-cloud-documentai/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json @@ -22,7 +22,7 @@ "segments": [ { "start": 25, - "end": 63, + "end": 72, "type": "FULL" } ], @@ -46,6 +46,10 @@ { "name": "skip_human_review", "type": "TYPE_BOOL" + }, + { + "name": "field_mask", + "type": ".google.protobuf.FieldMask" } ], "resultType": ".google.cloud.documentai.v1.ProcessResponse", @@ -74,7 +78,7 @@ "segments": [ { "start": 25, - "end": 64, + "end": 68, "type": "FULL" } ], @@ -115,6 +119,598 @@ } } }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_FetchProcessorTypes_async", + "title": "DocumentProcessorService fetchProcessorTypes Sample", + "origin": "API_DEFINITION", + "description": " Fetches processor types. Note that we do not use ListProcessorTypes here because it is not paginated.", + "canonical": true, + "file": "document_processor_service.fetch_processor_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "FetchProcessorTypes", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.documentai.v1.FetchProcessorTypesResponse", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "FetchProcessorTypes", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_ListProcessorTypes_async", + "title": "DocumentProcessorService listProcessorTypes Sample", + "origin": "API_DEFINITION", + "description": " Lists the processor types that exist.", + "canonical": true, + "file": "document_processor_service.list_processor_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListProcessorTypes", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.documentai.v1.ListProcessorTypesResponse", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "ListProcessorTypes", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_ListProcessors_async", + "title": "DocumentProcessorService listProcessors Sample", + "origin": "API_DEFINITION", + "description": " Lists all processors which belong to this project.", + "canonical": true, + "file": "document_processor_service.list_processors.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListProcessors", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.ListProcessors", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.documentai.v1.ListProcessorsResponse", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "ListProcessors", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.ListProcessors", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_GetProcessor_async", + "title": "DocumentProcessorService getProcessor Sample", + "origin": "API_DEFINITION", + "description": " Gets a processor detail.", + "canonical": true, + "file": "document_processor_service.get_processor.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetProcessor", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.GetProcessor", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.documentai.v1.Processor", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "GetProcessor", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.GetProcessor", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_GetProcessorVersion_async", + "title": "DocumentProcessorService getProcessorVersion Sample", + "origin": "API_DEFINITION", + "description": " Gets a processor version detail.", + "canonical": true, + "file": "document_processor_service.get_processor_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetProcessorVersion", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.GetProcessorVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.documentai.v1.ProcessorVersion", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "GetProcessorVersion", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.GetProcessorVersion", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_ListProcessorVersions_async", + "title": "DocumentProcessorService listProcessorVersions Sample", + "origin": "API_DEFINITION", + "description": " Lists all versions of a processor.", + "canonical": true, + "file": "document_processor_service.list_processor_versions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListProcessorVersions", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.ListProcessorVersions", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.documentai.v1.ListProcessorVersionsResponse", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "ListProcessorVersions", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.ListProcessorVersions", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_DeleteProcessorVersion_async", + "title": "DocumentProcessorService deleteProcessorVersion Sample", + "origin": "API_DEFINITION", + "description": " Deletes the processor version, all artifacts under the processor version will be deleted.", + "canonical": true, + "file": "document_processor_service.delete_processor_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteProcessorVersion", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "DeleteProcessorVersion", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_DeployProcessorVersion_async", + "title": "DocumentProcessorService deployProcessorVersion Sample", + "origin": "API_DEFINITION", + "description": " Deploys the processor version.", + "canonical": true, + "file": "document_processor_service.deploy_processor_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeployProcessorVersion", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "DeployProcessorVersion", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_UndeployProcessorVersion_async", + "title": "DocumentProcessorService undeployProcessorVersion Sample", + "origin": "API_DEFINITION", + "description": " Undeploys the processor version.", + "canonical": true, + "file": "document_processor_service.undeploy_processor_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UndeployProcessorVersion", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "UndeployProcessorVersion", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_CreateProcessor_async", + "title": "DocumentProcessorService createProcessor Sample", + "origin": "API_DEFINITION", + "description": " Creates a processor from the type processor that the user chose. The processor will be at \"ENABLED\" state by default after its creation.", + "canonical": true, + "file": "document_processor_service.create_processor.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateProcessor", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.CreateProcessor", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "processor", + "type": ".google.cloud.documentai.v1.Processor" + } + ], + "resultType": ".google.cloud.documentai.v1.Processor", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "CreateProcessor", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.CreateProcessor", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_DeleteProcessor_async", + "title": "DocumentProcessorService deleteProcessor Sample", + "origin": "API_DEFINITION", + "description": " Deletes the processor, unloads all deployed model artifacts if it was enabled and then deletes all artifacts associated with this processor.", + "canonical": true, + "file": "document_processor_service.delete_processor.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteProcessor", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "DeleteProcessor", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_EnableProcessor_async", + "title": "DocumentProcessorService enableProcessor Sample", + "origin": "API_DEFINITION", + "description": " Enables a processor", + "canonical": true, + "file": "document_processor_service.enable_processor.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "EnableProcessor", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "EnableProcessor", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_DisableProcessor_async", + "title": "DocumentProcessorService disableProcessor Sample", + "origin": "API_DEFINITION", + "description": " Disables a processor", + "canonical": true, + "file": "document_processor_service.disable_processor.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DisableProcessor", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "DisableProcessor", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_SetDefaultProcessorVersion_async", + "title": "DocumentProcessorService setDefaultProcessorVersion Sample", + "origin": "API_DEFINITION", + "description": " Set the default (active) version of a [Processor][google.cloud.documentai.v1.Processor] that will be used in [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument] and [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].", + "canonical": true, + "file": "document_processor_service.set_default_processor_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetDefaultProcessorVersion", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion", + "async": true, + "parameters": [ + { + "name": "processor", + "type": "TYPE_STRING" + }, + { + "name": "default_processor_version", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "SetDefaultProcessorVersion", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, { "regionTag": "documentai_v1_generated_DocumentProcessorService_ReviewDocument_async", "title": "DocumentProcessorService reviewDocument Sample", @@ -126,7 +722,7 @@ "segments": [ { "start": 25, - "end": 64, + "end": 68, "type": "FULL" } ], @@ -150,6 +746,10 @@ { "name": "priority", "type": ".google.cloud.documentai.v1.ReviewDocumentRequest.Priority" + }, + { + "name": "document_schema", + "type": ".google.cloud.documentai.v1.DocumentSchema" } ], "resultType": ".google.longrunning.Operation", 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 d5b6c3542c2..e3293a1ac30 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 @@ -25,8 +25,14 @@ import { ClientOptions, GrpcClientOptions, LROperation, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, } from 'google-gax'; +import {Transform} from 'stream'; +import {RequestType} from 'google-gax/build/src/apitypes'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); /** @@ -63,6 +69,7 @@ export class DocumentProcessorServiceClient { }; warn: (code: string, message: string, warnType?: string) => void; innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; pathTemplates: {[name: string]: gax.PathTemplate}; operationsClient: gax.OperationsClient; documentProcessorServiceStub?: Promise<{[name: string]: Function}>; @@ -139,6 +146,8 @@ export class DocumentProcessorServiceClient { // Set defaultServicePath on the auth object. this.auth.defaultServicePath = staticMembers.servicePath; + this.locationsClient = new LocationsClient(this._gaxGrpc, opts); + // Determine the client header string. const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process !== 'undefined' && 'versions' in process) { @@ -164,9 +173,42 @@ export class DocumentProcessorServiceClient { humanReviewConfigPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/processors/{processor}/humanReviewConfig' ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), processorPathTemplate: new this._gaxModule.PathTemplate( 'projects/{project}/locations/{location}/processors/{processor}' ), + processorTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/processorTypes/{processor_type}' + ), + processorVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listProcessorTypes: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'processorTypes' + ), + listProcessors: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'processors' + ), + listProcessorVersions: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'processorVersions' + ), }; const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); @@ -229,6 +271,48 @@ export class DocumentProcessorServiceClient { const batchProcessDocumentsMetadata = protoFilesRoot.lookup( '.google.cloud.documentai.v1.BatchProcessMetadata' ) as gax.protobuf.Type; + const deleteProcessorVersionResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const deleteProcessorVersionMetadata = protoFilesRoot.lookup( + '.google.cloud.documentai.v1.DeleteProcessorVersionMetadata' + ) as gax.protobuf.Type; + const deployProcessorVersionResponse = protoFilesRoot.lookup( + '.google.cloud.documentai.v1.DeployProcessorVersionResponse' + ) as gax.protobuf.Type; + const deployProcessorVersionMetadata = protoFilesRoot.lookup( + '.google.cloud.documentai.v1.DeployProcessorVersionMetadata' + ) as gax.protobuf.Type; + const undeployProcessorVersionResponse = protoFilesRoot.lookup( + '.google.cloud.documentai.v1.UndeployProcessorVersionResponse' + ) as gax.protobuf.Type; + const undeployProcessorVersionMetadata = protoFilesRoot.lookup( + '.google.cloud.documentai.v1.UndeployProcessorVersionMetadata' + ) as gax.protobuf.Type; + const deleteProcessorResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const deleteProcessorMetadata = protoFilesRoot.lookup( + '.google.cloud.documentai.v1.DeleteProcessorMetadata' + ) as gax.protobuf.Type; + const enableProcessorResponse = protoFilesRoot.lookup( + '.google.cloud.documentai.v1.EnableProcessorResponse' + ) as gax.protobuf.Type; + const enableProcessorMetadata = protoFilesRoot.lookup( + '.google.cloud.documentai.v1.EnableProcessorMetadata' + ) as gax.protobuf.Type; + const disableProcessorResponse = protoFilesRoot.lookup( + '.google.cloud.documentai.v1.DisableProcessorResponse' + ) as gax.protobuf.Type; + const disableProcessorMetadata = protoFilesRoot.lookup( + '.google.cloud.documentai.v1.DisableProcessorMetadata' + ) as gax.protobuf.Type; + const setDefaultProcessorVersionResponse = protoFilesRoot.lookup( + '.google.cloud.documentai.v1.SetDefaultProcessorVersionResponse' + ) as gax.protobuf.Type; + const setDefaultProcessorVersionMetadata = protoFilesRoot.lookup( + '.google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata' + ) as gax.protobuf.Type; const reviewDocumentResponse = protoFilesRoot.lookup( '.google.cloud.documentai.v1.ReviewDocumentResponse' ) as gax.protobuf.Type; @@ -244,6 +328,57 @@ export class DocumentProcessorServiceClient { ), batchProcessDocumentsMetadata.decode.bind(batchProcessDocumentsMetadata) ), + deleteProcessorVersion: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteProcessorVersionResponse.decode.bind( + deleteProcessorVersionResponse + ), + deleteProcessorVersionMetadata.decode.bind( + deleteProcessorVersionMetadata + ) + ), + deployProcessorVersion: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deployProcessorVersionResponse.decode.bind( + deployProcessorVersionResponse + ), + deployProcessorVersionMetadata.decode.bind( + deployProcessorVersionMetadata + ) + ), + undeployProcessorVersion: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + undeployProcessorVersionResponse.decode.bind( + undeployProcessorVersionResponse + ), + undeployProcessorVersionMetadata.decode.bind( + undeployProcessorVersionMetadata + ) + ), + deleteProcessor: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteProcessorResponse.decode.bind(deleteProcessorResponse), + deleteProcessorMetadata.decode.bind(deleteProcessorMetadata) + ), + enableProcessor: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + enableProcessorResponse.decode.bind(enableProcessorResponse), + enableProcessorMetadata.decode.bind(enableProcessorMetadata) + ), + disableProcessor: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + disableProcessorResponse.decode.bind(disableProcessorResponse), + disableProcessorMetadata.decode.bind(disableProcessorMetadata) + ), + setDefaultProcessorVersion: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + setDefaultProcessorVersionResponse.decode.bind( + setDefaultProcessorVersionResponse + ), + setDefaultProcessorVersionMetadata.decode.bind( + setDefaultProcessorVersionMetadata + ) + ), reviewDocument: new this._gaxModule.LongrunningDescriptor( this.operationsClient, reviewDocumentResponse.decode.bind(reviewDocumentResponse), @@ -304,6 +439,20 @@ export class DocumentProcessorServiceClient { const documentProcessorServiceStubMethods = [ 'processDocument', 'batchProcessDocuments', + 'fetchProcessorTypes', + 'listProcessorTypes', + 'listProcessors', + 'getProcessor', + 'getProcessorVersion', + 'listProcessorVersions', + 'deleteProcessorVersion', + 'deployProcessorVersion', + 'undeployProcessorVersion', + 'createProcessor', + 'deleteProcessor', + 'enableProcessor', + 'disableProcessor', + 'setDefaultProcessorVersion', 'reviewDocument', ]; for (const methodName of documentProcessorServiceStubMethods) { @@ -321,7 +470,10 @@ export class DocumentProcessorServiceClient { } ); - const descriptor = this.descriptors.longrunning[methodName] || undefined; + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], @@ -397,10 +549,17 @@ export class DocumentProcessorServiceClient { * @param {google.cloud.documentai.v1.RawDocument} request.rawDocument * A raw document content (bytes). * @param {string} request.name - * Required. The processor resource name. + * Required. The resource name of the {@link google.cloud.documentai.v1.Processor|Processor} or + * {@link google.cloud.documentai.v1.ProcessorVersion|ProcessorVersion} + * to use for processing. If a {@link google.cloud.documentai.v1.Processor|Processor} is specified, the server will use + * its {@link google.cloud.documentai.v1.Processor.default_processor_version|default version}. Format: + * `projects/{project}/locations/{location}/processors/{processor}`, or + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` * @param {boolean} request.skipHumanReview * Whether Human Review feature should be skipped for this request. Default to * false. + * @param {google.protobuf.FieldMask} request.fieldMask + * Specifies which fields to include in ProcessResponse's document. * @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. @@ -477,97 +636,79 @@ export class DocumentProcessorServiceClient { this.initialize(); return this.innerApiCalls.processDocument(request, options, callback); } - /** - * LRO endpoint to batch process many documents. The output is written - * to Cloud Storage as JSON in the [Document] format. + * Fetches processor types. Note that we do not use ListProcessorTypes here + * because it is not paginated. * * @param {Object} request * The request object that will be sent. - * @param {string} request.name - * Required. The processor resource name. - * @param {google.cloud.documentai.v1.BatchDocumentsInputConfig} request.inputDocuments - * The input documents for batch process. - * @param {google.cloud.documentai.v1.DocumentOutputConfig} request.documentOutputConfig - * The overall output config for batch process. - * @param {boolean} request.skipHumanReview - * Whether Human Review feature should be skipped for this request. Default to - * false. + * @param {string} request.parent + * Required. The project of processor type to list. + * The available processor types may depend on the allow-listing on projects. + * Format: `projects/{project}/locations/{location}` * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. + * The first element of the array is an object representing [FetchProcessorTypesResponse]{@link google.cloud.documentai.v1.FetchProcessorTypesResponse}. * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example include:samples/generated/v1/document_processor_service.batch_process_documents.js - * region_tag:documentai_v1_generated_DocumentProcessorService_BatchProcessDocuments_async + * @example include:samples/generated/v1/document_processor_service.fetch_processor_types.js + * region_tag:documentai_v1_generated_DocumentProcessorService_FetchProcessorTypes_async */ - batchProcessDocuments( - request?: protos.google.cloud.documentai.v1.IBatchProcessRequest, + fetchProcessorTypes( + request?: protos.google.cloud.documentai.v1.IFetchProcessorTypesRequest, options?: CallOptions ): Promise< [ - LROperation< - protos.google.cloud.documentai.v1.IBatchProcessResponse, - protos.google.cloud.documentai.v1.IBatchProcessMetadata - >, - protos.google.longrunning.IOperation | undefined, + protos.google.cloud.documentai.v1.IFetchProcessorTypesResponse, + protos.google.cloud.documentai.v1.IFetchProcessorTypesRequest | undefined, {} | undefined ] >; - batchProcessDocuments( - request: protos.google.cloud.documentai.v1.IBatchProcessRequest, + fetchProcessorTypes( + request: protos.google.cloud.documentai.v1.IFetchProcessorTypesRequest, options: CallOptions, callback: Callback< - LROperation< - protos.google.cloud.documentai.v1.IBatchProcessResponse, - protos.google.cloud.documentai.v1.IBatchProcessMetadata - >, - protos.google.longrunning.IOperation | null | undefined, + protos.google.cloud.documentai.v1.IFetchProcessorTypesResponse, + | protos.google.cloud.documentai.v1.IFetchProcessorTypesRequest + | null + | undefined, {} | null | undefined > ): void; - batchProcessDocuments( - request: protos.google.cloud.documentai.v1.IBatchProcessRequest, + fetchProcessorTypes( + request: protos.google.cloud.documentai.v1.IFetchProcessorTypesRequest, callback: Callback< - LROperation< - protos.google.cloud.documentai.v1.IBatchProcessResponse, - protos.google.cloud.documentai.v1.IBatchProcessMetadata - >, - protos.google.longrunning.IOperation | null | undefined, + protos.google.cloud.documentai.v1.IFetchProcessorTypesResponse, + | protos.google.cloud.documentai.v1.IFetchProcessorTypesRequest + | null + | undefined, {} | null | undefined > ): void; - batchProcessDocuments( - request?: protos.google.cloud.documentai.v1.IBatchProcessRequest, + fetchProcessorTypes( + request?: protos.google.cloud.documentai.v1.IFetchProcessorTypesRequest, optionsOrCallback?: | CallOptions | Callback< - LROperation< - protos.google.cloud.documentai.v1.IBatchProcessResponse, - protos.google.cloud.documentai.v1.IBatchProcessMetadata - >, - protos.google.longrunning.IOperation | null | undefined, + protos.google.cloud.documentai.v1.IFetchProcessorTypesResponse, + | protos.google.cloud.documentai.v1.IFetchProcessorTypesRequest + | null + | undefined, {} | null | undefined >, callback?: Callback< - LROperation< - protos.google.cloud.documentai.v1.IBatchProcessResponse, - protos.google.cloud.documentai.v1.IBatchProcessMetadata - >, - protos.google.longrunning.IOperation | null | undefined, + protos.google.cloud.documentai.v1.IFetchProcessorTypesResponse, + | protos.google.cloud.documentai.v1.IFetchProcessorTypesRequest + | null + | undefined, {} | null | undefined > ): Promise< [ - LROperation< - protos.google.cloud.documentai.v1.IBatchProcessResponse, - protos.google.cloud.documentai.v1.IBatchProcessMetadata - >, - protos.google.longrunning.IOperation | undefined, + protos.google.cloud.documentai.v1.IFetchProcessorTypesResponse, + protos.google.cloud.documentai.v1.IFetchProcessorTypesRequest | undefined, {} | undefined ] > | void { @@ -584,135 +725,166 @@ export class DocumentProcessorServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = gax.routingHeader.fromParams({ - name: request.name || '', + parent: request.parent || '', }); this.initialize(); - return this.innerApiCalls.batchProcessDocuments(request, options, callback); + return this.innerApiCalls.fetchProcessorTypes(request, options, callback); } /** - * Check the status of the long running operation returned by `batchProcessDocuments()`. - * @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. + * Gets a processor detail. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The processor resource 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. + * The first element of the array is an object representing [Processor]{@link google.cloud.documentai.v1.Processor}. * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example include:samples/generated/v1/document_processor_service.batch_process_documents.js - * region_tag:documentai_v1_generated_DocumentProcessorService_BatchProcessDocuments_async + * @example include:samples/generated/v1/document_processor_service.get_processor.js + * region_tag:documentai_v1_generated_DocumentProcessorService_GetProcessor_async */ - async checkBatchProcessDocumentsProgress( - name: string + getProcessor( + request?: protos.google.cloud.documentai.v1.IGetProcessorRequest, + options?: CallOptions ): Promise< - LROperation< - protos.google.cloud.documentai.v1.BatchProcessResponse, - protos.google.cloud.documentai.v1.BatchProcessMetadata + [ + protos.google.cloud.documentai.v1.IProcessor, + protos.google.cloud.documentai.v1.IGetProcessorRequest | undefined, + {} | undefined + ] + >; + getProcessor( + request: protos.google.cloud.documentai.v1.IGetProcessorRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.documentai.v1.IProcessor, + protos.google.cloud.documentai.v1.IGetProcessorRequest | null | undefined, + {} | null | undefined > - > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( - operation, - this.descriptors.longrunning.batchProcessDocuments, - gax.createDefaultBackoffSettings() - ); - return decodeOperation as LROperation< - protos.google.cloud.documentai.v1.BatchProcessResponse, - protos.google.cloud.documentai.v1.BatchProcessMetadata - >; + ): void; + getProcessor( + request: protos.google.cloud.documentai.v1.IGetProcessorRequest, + callback: Callback< + protos.google.cloud.documentai.v1.IProcessor, + protos.google.cloud.documentai.v1.IGetProcessorRequest | null | undefined, + {} | null | undefined + > + ): void; + getProcessor( + request?: protos.google.cloud.documentai.v1.IGetProcessorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.documentai.v1.IProcessor, + | protos.google.cloud.documentai.v1.IGetProcessorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.documentai.v1.IProcessor, + protos.google.cloud.documentai.v1.IGetProcessorRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.documentai.v1.IProcessor, + protos.google.cloud.documentai.v1.IGetProcessorRequest | 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'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getProcessor(request, options, callback); } /** - * Send a document for Human Review. The input document should be processed by - * the specified processor. + * Gets a processor version detail. * * @param {Object} request * The request object that will be sent. - * @param {google.cloud.documentai.v1.Document} request.inlineDocument - * An inline document proto. - * @param {string} request.humanReviewConfig - * Required. The resource name of the HumanReviewConfig that the document will be - * reviewed with. - * @param {boolean} request.enableSchemaValidation - * Whether the validation should be performed on the ad-hoc review request. - * @param {google.cloud.documentai.v1.ReviewDocumentRequest.Priority} request.priority - * The priority of the human review task. + * @param {string} request.name + * Required. The processor resource 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. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. + * The first element of the array is an object representing [ProcessorVersion]{@link google.cloud.documentai.v1.ProcessorVersion}. * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example include:samples/generated/v1/document_processor_service.review_document.js - * region_tag:documentai_v1_generated_DocumentProcessorService_ReviewDocument_async + * @example include:samples/generated/v1/document_processor_service.get_processor_version.js + * region_tag:documentai_v1_generated_DocumentProcessorService_GetProcessorVersion_async */ - reviewDocument( - request?: protos.google.cloud.documentai.v1.IReviewDocumentRequest, + getProcessorVersion( + request?: protos.google.cloud.documentai.v1.IGetProcessorVersionRequest, options?: CallOptions ): Promise< [ - LROperation< - protos.google.cloud.documentai.v1.IReviewDocumentResponse, - protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, + protos.google.cloud.documentai.v1.IProcessorVersion, + protos.google.cloud.documentai.v1.IGetProcessorVersionRequest | undefined, {} | undefined ] >; - reviewDocument( - request: protos.google.cloud.documentai.v1.IReviewDocumentRequest, + getProcessorVersion( + request: protos.google.cloud.documentai.v1.IGetProcessorVersionRequest, options: CallOptions, callback: Callback< - LROperation< - protos.google.cloud.documentai.v1.IReviewDocumentResponse, - protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, + protos.google.cloud.documentai.v1.IProcessorVersion, + | protos.google.cloud.documentai.v1.IGetProcessorVersionRequest + | null + | undefined, {} | null | undefined > ): void; - reviewDocument( - request: protos.google.cloud.documentai.v1.IReviewDocumentRequest, + getProcessorVersion( + request: protos.google.cloud.documentai.v1.IGetProcessorVersionRequest, callback: Callback< - LROperation< - protos.google.cloud.documentai.v1.IReviewDocumentResponse, - protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, + protos.google.cloud.documentai.v1.IProcessorVersion, + | protos.google.cloud.documentai.v1.IGetProcessorVersionRequest + | null + | undefined, {} | null | undefined > ): void; - reviewDocument( - request?: protos.google.cloud.documentai.v1.IReviewDocumentRequest, + getProcessorVersion( + request?: protos.google.cloud.documentai.v1.IGetProcessorVersionRequest, optionsOrCallback?: | CallOptions | Callback< - LROperation< - protos.google.cloud.documentai.v1.IReviewDocumentResponse, - protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, + protos.google.cloud.documentai.v1.IProcessorVersion, + | protos.google.cloud.documentai.v1.IGetProcessorVersionRequest + | null + | undefined, {} | null | undefined >, callback?: Callback< - LROperation< - protos.google.cloud.documentai.v1.IReviewDocumentResponse, - protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata - >, - protos.google.longrunning.IOperation | null | undefined, + protos.google.cloud.documentai.v1.IProcessorVersion, + | protos.google.cloud.documentai.v1.IGetProcessorVersionRequest + | null + | undefined, {} | null | undefined > ): Promise< [ - LROperation< - protos.google.cloud.documentai.v1.IReviewDocumentResponse, - protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata - >, - protos.google.longrunning.IOperation | undefined, + protos.google.cloud.documentai.v1.IProcessorVersion, + protos.google.cloud.documentai.v1.IGetProcessorVersionRequest | undefined, {} | undefined ] > | void { @@ -729,22 +901,1364 @@ export class DocumentProcessorServiceClient { options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = gax.routingHeader.fromParams({ - human_review_config: request.humanReviewConfig || '', + name: request.name || '', }); this.initialize(); - return this.innerApiCalls.reviewDocument(request, options, callback); + return this.innerApiCalls.getProcessorVersion(request, options, callback); } /** - * Check the status of the long running operation returned by `reviewDocument()`. - * @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. + * Creates a processor from the type processor that the user chose. + * The processor will be at "ENABLED" state by default after its creation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent (project and location) under which to create the processor. + * Format: `projects/{project}/locations/{location}` + * @param {google.cloud.documentai.v1.Processor} request.processor + * Required. The processor to be created, requires [processor_type] and [display_name] + * to be set. Also, the processor is under CMEK if CMEK fields are set. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Processor]{@link google.cloud.documentai.v1.Processor}. * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. - * @example include:samples/generated/v1/document_processor_service.review_document.js - * region_tag:documentai_v1_generated_DocumentProcessorService_ReviewDocument_async + * @example include:samples/generated/v1/document_processor_service.create_processor.js + * region_tag:documentai_v1_generated_DocumentProcessorService_CreateProcessor_async + */ + createProcessor( + request?: protos.google.cloud.documentai.v1.ICreateProcessorRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.documentai.v1.IProcessor, + protos.google.cloud.documentai.v1.ICreateProcessorRequest | undefined, + {} | undefined + ] + >; + createProcessor( + request: protos.google.cloud.documentai.v1.ICreateProcessorRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.documentai.v1.IProcessor, + | protos.google.cloud.documentai.v1.ICreateProcessorRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createProcessor( + request: protos.google.cloud.documentai.v1.ICreateProcessorRequest, + callback: Callback< + protos.google.cloud.documentai.v1.IProcessor, + | protos.google.cloud.documentai.v1.ICreateProcessorRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createProcessor( + request?: protos.google.cloud.documentai.v1.ICreateProcessorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.documentai.v1.IProcessor, + | protos.google.cloud.documentai.v1.ICreateProcessorRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.documentai.v1.IProcessor, + | protos.google.cloud.documentai.v1.ICreateProcessorRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.documentai.v1.IProcessor, + protos.google.cloud.documentai.v1.ICreateProcessorRequest | 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'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createProcessor(request, options, callback); + } + + /** + * LRO endpoint to batch process many documents. The output is written + * to Cloud Storage as JSON in the [Document] format. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of {@link google.cloud.documentai.v1.Processor|Processor} or + * {@link google.cloud.documentai.v1.ProcessorVersion|ProcessorVersion}. + * Format: `projects/{project}/locations/{location}/processors/{processor}`, + * or + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}` + * @param {google.cloud.documentai.v1.BatchDocumentsInputConfig} request.inputDocuments + * The input documents for batch process. + * @param {google.cloud.documentai.v1.DocumentOutputConfig} request.documentOutputConfig + * The overall output config for batch process. + * @param {boolean} request.skipHumanReview + * Whether Human Review feature should be skipped for this request. Default to + * false. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/document_processor_service.batch_process_documents.js + * region_tag:documentai_v1_generated_DocumentProcessorService_BatchProcessDocuments_async + */ + batchProcessDocuments( + request?: protos.google.cloud.documentai.v1.IBatchProcessRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.IBatchProcessResponse, + protos.google.cloud.documentai.v1.IBatchProcessMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + batchProcessDocuments( + request: protos.google.cloud.documentai.v1.IBatchProcessRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.IBatchProcessResponse, + protos.google.cloud.documentai.v1.IBatchProcessMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchProcessDocuments( + request: protos.google.cloud.documentai.v1.IBatchProcessRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.IBatchProcessResponse, + protos.google.cloud.documentai.v1.IBatchProcessMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchProcessDocuments( + request?: protos.google.cloud.documentai.v1.IBatchProcessRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.documentai.v1.IBatchProcessResponse, + protos.google.cloud.documentai.v1.IBatchProcessMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.documentai.v1.IBatchProcessResponse, + protos.google.cloud.documentai.v1.IBatchProcessMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.IBatchProcessResponse, + protos.google.cloud.documentai.v1.IBatchProcessMetadata + >, + 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'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.batchProcessDocuments(request, options, callback); + } + /** + * Check the status of the long running operation returned by `batchProcessDocuments()`. + * @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/v1/document_processor_service.batch_process_documents.js + * region_tag:documentai_v1_generated_DocumentProcessorService_BatchProcessDocuments_async + */ + async checkBatchProcessDocumentsProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1.BatchProcessResponse, + protos.google.cloud.documentai.v1.BatchProcessMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.batchProcessDocuments, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1.BatchProcessResponse, + protos.google.cloud.documentai.v1.BatchProcessMetadata + >; + } + /** + * Deletes the processor version, all artifacts under the processor version + * will be deleted. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The processor version resource name to be deleted. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/document_processor_service.delete_processor_version.js + * region_tag:documentai_v1_generated_DocumentProcessorService_DeleteProcessorVersion_async + */ + deleteProcessorVersion( + request?: protos.google.cloud.documentai.v1.IDeleteProcessorVersionRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + deleteProcessorVersion( + request: protos.google.cloud.documentai.v1.IDeleteProcessorVersionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteProcessorVersion( + request: protos.google.cloud.documentai.v1.IDeleteProcessorVersionRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteProcessorVersion( + request?: protos.google.cloud.documentai.v1.IDeleteProcessorVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorVersionMetadata + >, + 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'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteProcessorVersion( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `deleteProcessorVersion()`. + * @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/v1/document_processor_service.delete_processor_version.js + * region_tag:documentai_v1_generated_DocumentProcessorService_DeleteProcessorVersion_async + */ + async checkDeleteProcessorVersionProgress( + name: string + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.documentai.v1.DeleteProcessorVersionMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.deleteProcessorVersion, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.documentai.v1.DeleteProcessorVersionMetadata + >; + } + /** + * Deploys the processor version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The processor version resource name to be deployed. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/document_processor_service.deploy_processor_version.js + * region_tag:documentai_v1_generated_DocumentProcessorService_DeployProcessorVersion_async + */ + deployProcessorVersion( + request?: protos.google.cloud.documentai.v1.IDeployProcessorVersionRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IDeployProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + deployProcessorVersion( + request: protos.google.cloud.documentai.v1.IDeployProcessorVersionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IDeployProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deployProcessorVersion( + request: protos.google.cloud.documentai.v1.IDeployProcessorVersionRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IDeployProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deployProcessorVersion( + request?: protos.google.cloud.documentai.v1.IDeployProcessorVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.documentai.v1.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IDeployProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.documentai.v1.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IDeployProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IDeployProcessorVersionMetadata + >, + 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'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deployProcessorVersion( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `deployProcessorVersion()`. + * @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/v1/document_processor_service.deploy_processor_version.js + * region_tag:documentai_v1_generated_DocumentProcessorService_DeployProcessorVersion_async + */ + async checkDeployProcessorVersionProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1.DeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.DeployProcessorVersionMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.deployProcessorVersion, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1.DeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.DeployProcessorVersionMetadata + >; + } + /** + * Undeploys the processor version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The processor version resource name to be undeployed. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/document_processor_service.undeploy_processor_version.js + * region_tag:documentai_v1_generated_DocumentProcessorService_UndeployProcessorVersion_async + */ + undeployProcessorVersion( + request?: protos.google.cloud.documentai.v1.IUndeployProcessorVersionRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IUndeployProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + undeployProcessorVersion( + request: protos.google.cloud.documentai.v1.IUndeployProcessorVersionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IUndeployProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + undeployProcessorVersion( + request: protos.google.cloud.documentai.v1.IUndeployProcessorVersionRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IUndeployProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + undeployProcessorVersion( + request?: protos.google.cloud.documentai.v1.IUndeployProcessorVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.documentai.v1.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IUndeployProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.documentai.v1.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IUndeployProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IUndeployProcessorVersionMetadata + >, + 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'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.undeployProcessorVersion( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `undeployProcessorVersion()`. + * @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/v1/document_processor_service.undeploy_processor_version.js + * region_tag:documentai_v1_generated_DocumentProcessorService_UndeployProcessorVersion_async + */ + async checkUndeployProcessorVersionProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1.UndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.UndeployProcessorVersionMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.undeployProcessorVersion, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1.UndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.UndeployProcessorVersionMetadata + >; + } + /** + * Deletes the processor, unloads all deployed model artifacts if it was + * enabled and then deletes all artifacts associated with this processor. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The processor resource name to be deleted. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/document_processor_service.delete_processor.js + * region_tag:documentai_v1_generated_DocumentProcessorService_DeleteProcessor_async + */ + deleteProcessor( + request?: protos.google.cloud.documentai.v1.IDeleteProcessorRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + deleteProcessor( + request: protos.google.cloud.documentai.v1.IDeleteProcessorRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteProcessor( + request: protos.google.cloud.documentai.v1.IDeleteProcessorRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteProcessor( + request?: protos.google.cloud.documentai.v1.IDeleteProcessorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorMetadata + >, + 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'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteProcessor(request, options, callback); + } + /** + * Check the status of the long running operation returned by `deleteProcessor()`. + * @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/v1/document_processor_service.delete_processor.js + * region_tag:documentai_v1_generated_DocumentProcessorService_DeleteProcessor_async + */ + async checkDeleteProcessorProgress( + name: string + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.documentai.v1.DeleteProcessorMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.deleteProcessor, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.documentai.v1.DeleteProcessorMetadata + >; + } + /** + * Enables a processor + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The processor resource name to be enabled. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/document_processor_service.enable_processor.js + * region_tag:documentai_v1_generated_DocumentProcessorService_EnableProcessor_async + */ + enableProcessor( + request?: protos.google.cloud.documentai.v1.IEnableProcessorRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.IEnableProcessorResponse, + protos.google.cloud.documentai.v1.IEnableProcessorMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + enableProcessor( + request: protos.google.cloud.documentai.v1.IEnableProcessorRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.IEnableProcessorResponse, + protos.google.cloud.documentai.v1.IEnableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + enableProcessor( + request: protos.google.cloud.documentai.v1.IEnableProcessorRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.IEnableProcessorResponse, + protos.google.cloud.documentai.v1.IEnableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + enableProcessor( + request?: protos.google.cloud.documentai.v1.IEnableProcessorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.documentai.v1.IEnableProcessorResponse, + protos.google.cloud.documentai.v1.IEnableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.documentai.v1.IEnableProcessorResponse, + protos.google.cloud.documentai.v1.IEnableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.IEnableProcessorResponse, + protos.google.cloud.documentai.v1.IEnableProcessorMetadata + >, + 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'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.enableProcessor(request, options, callback); + } + /** + * Check the status of the long running operation returned by `enableProcessor()`. + * @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/v1/document_processor_service.enable_processor.js + * region_tag:documentai_v1_generated_DocumentProcessorService_EnableProcessor_async + */ + async checkEnableProcessorProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1.EnableProcessorResponse, + protos.google.cloud.documentai.v1.EnableProcessorMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.enableProcessor, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1.EnableProcessorResponse, + protos.google.cloud.documentai.v1.EnableProcessorMetadata + >; + } + /** + * Disables a processor + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The processor resource name to be disabled. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/document_processor_service.disable_processor.js + * region_tag:documentai_v1_generated_DocumentProcessorService_DisableProcessor_async + */ + disableProcessor( + request?: protos.google.cloud.documentai.v1.IDisableProcessorRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.IDisableProcessorResponse, + protos.google.cloud.documentai.v1.IDisableProcessorMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + disableProcessor( + request: protos.google.cloud.documentai.v1.IDisableProcessorRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.IDisableProcessorResponse, + protos.google.cloud.documentai.v1.IDisableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + disableProcessor( + request: protos.google.cloud.documentai.v1.IDisableProcessorRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.IDisableProcessorResponse, + protos.google.cloud.documentai.v1.IDisableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + disableProcessor( + request?: protos.google.cloud.documentai.v1.IDisableProcessorRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.documentai.v1.IDisableProcessorResponse, + protos.google.cloud.documentai.v1.IDisableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.documentai.v1.IDisableProcessorResponse, + protos.google.cloud.documentai.v1.IDisableProcessorMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.IDisableProcessorResponse, + protos.google.cloud.documentai.v1.IDisableProcessorMetadata + >, + 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'] = + gax.routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.disableProcessor(request, options, callback); + } + /** + * Check the status of the long running operation returned by `disableProcessor()`. + * @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/v1/document_processor_service.disable_processor.js + * region_tag:documentai_v1_generated_DocumentProcessorService_DisableProcessor_async + */ + async checkDisableProcessorProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1.DisableProcessorResponse, + protos.google.cloud.documentai.v1.DisableProcessorMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.disableProcessor, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1.DisableProcessorResponse, + protos.google.cloud.documentai.v1.DisableProcessorMetadata + >; + } + /** + * Set the default (active) version of a {@link google.cloud.documentai.v1.Processor|Processor} that will be used in + * {@link google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument|ProcessDocument} and + * {@link google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments|BatchProcessDocuments}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.processor + * Required. The resource name of the {@link google.cloud.documentai.v1.Processor|Processor} to change default version. + * @param {string} request.defaultProcessorVersion + * Required. The resource name of child {@link google.cloud.documentai.v1.ProcessorVersion|ProcessorVersion} to use as default. + * Format: + * `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/document_processor_service.set_default_processor_version.js + * region_tag:documentai_v1_generated_DocumentProcessorService_SetDefaultProcessorVersion_async + */ + setDefaultProcessorVersion( + request?: protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse, + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + setDefaultProcessorVersion( + request: protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse, + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + setDefaultProcessorVersion( + request: protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse, + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + setDefaultProcessorVersion( + request?: protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse, + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse, + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse, + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata + >, + 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'] = + gax.routingHeader.fromParams({ + processor: request.processor || '', + }); + this.initialize(); + return this.innerApiCalls.setDefaultProcessorVersion( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `setDefaultProcessorVersion()`. + * @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/v1/document_processor_service.set_default_processor_version.js + * region_tag:documentai_v1_generated_DocumentProcessorService_SetDefaultProcessorVersion_async + */ + async checkSetDefaultProcessorVersionProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.documentai.v1.SetDefaultProcessorVersionResponse, + protos.google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata + > + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.setDefaultProcessorVersion, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1.SetDefaultProcessorVersionResponse, + protos.google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata + >; + } + /** + * Send a document for Human Review. The input document should be processed by + * the specified processor. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.documentai.v1.Document} request.inlineDocument + * An inline document proto. + * @param {string} request.humanReviewConfig + * Required. The resource name of the HumanReviewConfig that the document will be + * reviewed with. + * @param {boolean} request.enableSchemaValidation + * Whether the validation should be performed on the ad-hoc review request. + * @param {google.cloud.documentai.v1.ReviewDocumentRequest.Priority} request.priority + * The priority of the human review task. + * @param {google.cloud.documentai.v1.DocumentSchema} request.documentSchema + * The document schema of the human review task. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/document_processor_service.review_document.js + * region_tag:documentai_v1_generated_DocumentProcessorService_ReviewDocument_async + */ + reviewDocument( + request?: protos.google.cloud.documentai.v1.IReviewDocumentRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.IReviewDocumentResponse, + protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + reviewDocument( + request: protos.google.cloud.documentai.v1.IReviewDocumentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.IReviewDocumentResponse, + protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + reviewDocument( + request: protos.google.cloud.documentai.v1.IReviewDocumentRequest, + callback: Callback< + LROperation< + protos.google.cloud.documentai.v1.IReviewDocumentResponse, + protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + reviewDocument( + request?: protos.google.cloud.documentai.v1.IReviewDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.documentai.v1.IReviewDocumentResponse, + protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.documentai.v1.IReviewDocumentResponse, + protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.documentai.v1.IReviewDocumentResponse, + protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata + >, + 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'] = + gax.routingHeader.fromParams({ + human_review_config: request.humanReviewConfig || '', + }); + this.initialize(); + return this.innerApiCalls.reviewDocument(request, options, callback); + } + /** + * Check the status of the long running operation returned by `reviewDocument()`. + * @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/v1/document_processor_service.review_document.js + * region_tag:documentai_v1_generated_DocumentProcessorService_ReviewDocument_async */ async checkReviewDocumentProgress( name: string @@ -753,21 +2267,881 @@ export class DocumentProcessorServiceClient { protos.google.cloud.documentai.v1.ReviewDocumentResponse, protos.google.cloud.documentai.v1.ReviewDocumentOperationMetadata > - > { - const request = new operationsProtos.google.longrunning.GetOperationRequest( - {name} - ); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation( - operation, - this.descriptors.longrunning.reviewDocument, - gax.createDefaultBackoffSettings() + > { + const request = new operationsProtos.google.longrunning.GetOperationRequest( + {name} + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation( + operation, + this.descriptors.longrunning.reviewDocument, + gax.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.documentai.v1.ReviewDocumentResponse, + protos.google.cloud.documentai.v1.ReviewDocumentOperationMetadata + >; + } + /** + * Lists the processor types that exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The location of processor type to list. + * The available processor types may depend on the allow-listing on projects. + * Format: `projects/{project}/locations/{location}` + * @param {number} request.pageSize + * The maximum number of processor types to return. + * If unspecified, at most 100 processor types will be returned. + * The maximum value is 500; values above 500 will be coerced to 500. + * @param {string} request.pageToken + * Used to retrieve the next page of results, empty if at the end of the list. + * @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 [ProcessorType]{@link google.cloud.documentai.v1.ProcessorType}. + * 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 `listProcessorTypesAsync()` + * 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. + */ + listProcessorTypes( + request?: protos.google.cloud.documentai.v1.IListProcessorTypesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.documentai.v1.IProcessorType[], + protos.google.cloud.documentai.v1.IListProcessorTypesRequest | null, + protos.google.cloud.documentai.v1.IListProcessorTypesResponse + ] + >; + listProcessorTypes( + request: protos.google.cloud.documentai.v1.IListProcessorTypesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.documentai.v1.IListProcessorTypesRequest, + | protos.google.cloud.documentai.v1.IListProcessorTypesResponse + | null + | undefined, + protos.google.cloud.documentai.v1.IProcessorType + > + ): void; + listProcessorTypes( + request: protos.google.cloud.documentai.v1.IListProcessorTypesRequest, + callback: PaginationCallback< + protos.google.cloud.documentai.v1.IListProcessorTypesRequest, + | protos.google.cloud.documentai.v1.IListProcessorTypesResponse + | null + | undefined, + protos.google.cloud.documentai.v1.IProcessorType + > + ): void; + listProcessorTypes( + request?: protos.google.cloud.documentai.v1.IListProcessorTypesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.documentai.v1.IListProcessorTypesRequest, + | protos.google.cloud.documentai.v1.IListProcessorTypesResponse + | null + | undefined, + protos.google.cloud.documentai.v1.IProcessorType + >, + callback?: PaginationCallback< + protos.google.cloud.documentai.v1.IListProcessorTypesRequest, + | protos.google.cloud.documentai.v1.IListProcessorTypesResponse + | null + | undefined, + protos.google.cloud.documentai.v1.IProcessorType + > + ): Promise< + [ + protos.google.cloud.documentai.v1.IProcessorType[], + protos.google.cloud.documentai.v1.IListProcessorTypesRequest | null, + protos.google.cloud.documentai.v1.IListProcessorTypesResponse + ] + > | 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'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listProcessorTypes(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 location of processor type to list. + * The available processor types may depend on the allow-listing on projects. + * Format: `projects/{project}/locations/{location}` + * @param {number} request.pageSize + * The maximum number of processor types to return. + * If unspecified, at most 100 processor types will be returned. + * The maximum value is 500; values above 500 will be coerced to 500. + * @param {string} request.pageToken + * Used to retrieve the next page of results, empty if at the end of the list. + * @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 [ProcessorType]{@link google.cloud.documentai.v1.ProcessorType} 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 `listProcessorTypesAsync()` + * 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. + */ + listProcessorTypesStream( + request?: protos.google.cloud.documentai.v1.IListProcessorTypesRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listProcessorTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listProcessorTypes.createStream( + this.innerApiCalls.listProcessorTypes as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listProcessorTypes`, 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 location of processor type to list. + * The available processor types may depend on the allow-listing on projects. + * Format: `projects/{project}/locations/{location}` + * @param {number} request.pageSize + * The maximum number of processor types to return. + * If unspecified, at most 100 processor types will be returned. + * The maximum value is 500; values above 500 will be coerced to 500. + * @param {string} request.pageToken + * Used to retrieve the next page of results, empty if at the end of the list. + * @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 + * [ProcessorType]{@link google.cloud.documentai.v1.ProcessorType}. 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/v1/document_processor_service.list_processor_types.js + * region_tag:documentai_v1_generated_DocumentProcessorService_ListProcessorTypes_async + */ + listProcessorTypesAsync( + request?: protos.google.cloud.documentai.v1.IListProcessorTypesRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listProcessorTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listProcessorTypes.asyncIterate( + this.innerApiCalls['listProcessorTypes'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists all processors which belong to this project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent (project and location) which owns this collection of Processors. + * Format: `projects/{project}/locations/{location}` + * @param {number} request.pageSize + * The maximum number of processors to return. + * If unspecified, at most 50 processors will be returned. + * The maximum value is 100; values above 100 will be coerced to 100. + * @param {string} request.pageToken + * We will return the processors sorted by creation time. The page token + * will point to the next processor. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Processor]{@link google.cloud.documentai.v1.Processor}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listProcessorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listProcessors( + request?: protos.google.cloud.documentai.v1.IListProcessorsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.documentai.v1.IProcessor[], + protos.google.cloud.documentai.v1.IListProcessorsRequest | null, + protos.google.cloud.documentai.v1.IListProcessorsResponse + ] + >; + listProcessors( + request: protos.google.cloud.documentai.v1.IListProcessorsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.documentai.v1.IListProcessorsRequest, + | protos.google.cloud.documentai.v1.IListProcessorsResponse + | null + | undefined, + protos.google.cloud.documentai.v1.IProcessor + > + ): void; + listProcessors( + request: protos.google.cloud.documentai.v1.IListProcessorsRequest, + callback: PaginationCallback< + protos.google.cloud.documentai.v1.IListProcessorsRequest, + | protos.google.cloud.documentai.v1.IListProcessorsResponse + | null + | undefined, + protos.google.cloud.documentai.v1.IProcessor + > + ): void; + listProcessors( + request?: protos.google.cloud.documentai.v1.IListProcessorsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.documentai.v1.IListProcessorsRequest, + | protos.google.cloud.documentai.v1.IListProcessorsResponse + | null + | undefined, + protos.google.cloud.documentai.v1.IProcessor + >, + callback?: PaginationCallback< + protos.google.cloud.documentai.v1.IListProcessorsRequest, + | protos.google.cloud.documentai.v1.IListProcessorsResponse + | null + | undefined, + protos.google.cloud.documentai.v1.IProcessor + > + ): Promise< + [ + protos.google.cloud.documentai.v1.IProcessor[], + protos.google.cloud.documentai.v1.IListProcessorsRequest | null, + protos.google.cloud.documentai.v1.IListProcessorsResponse + ] + > | 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'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listProcessors(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 parent (project and location) which owns this collection of Processors. + * Format: `projects/{project}/locations/{location}` + * @param {number} request.pageSize + * The maximum number of processors to return. + * If unspecified, at most 50 processors will be returned. + * The maximum value is 100; values above 100 will be coerced to 100. + * @param {string} request.pageToken + * We will return the processors sorted by creation time. The page token + * will point to the next processor. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Processor]{@link google.cloud.documentai.v1.Processor} 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 `listProcessorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listProcessorsStream( + request?: protos.google.cloud.documentai.v1.IListProcessorsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listProcessors']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listProcessors.createStream( + this.innerApiCalls.listProcessors as gax.GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listProcessors`, 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 parent (project and location) which owns this collection of Processors. + * Format: `projects/{project}/locations/{location}` + * @param {number} request.pageSize + * The maximum number of processors to return. + * If unspecified, at most 50 processors will be returned. + * The maximum value is 100; values above 100 will be coerced to 100. + * @param {string} request.pageToken + * We will return the processors sorted by creation time. The page token + * will point to the next processor. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {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 + * [Processor]{@link google.cloud.documentai.v1.Processor}. 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/v1/document_processor_service.list_processors.js + * region_tag:documentai_v1_generated_DocumentProcessorService_ListProcessors_async + */ + listProcessorsAsync( + request?: protos.google.cloud.documentai.v1.IListProcessorsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listProcessors']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listProcessors.asyncIterate( + this.innerApiCalls['listProcessors'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists all versions of a processor. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent (project, location and processor) to list all versions. + * Format: `projects/{project}/locations/{location}/processors/{processor}` + * @param {number} request.pageSize + * The maximum number of processor versions to return. + * If unspecified, at most 10 processor versions will be returned. + * The maximum value is 20; values above 20 will be coerced to 20. + * @param {string} request.pageToken + * We will return the processor versions sorted by creation time. The page + * token will point to the next processor version. + * @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 [ProcessorVersion]{@link google.cloud.documentai.v1.ProcessorVersion}. + * 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 `listProcessorVersionsAsync()` + * 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. + */ + listProcessorVersions( + request?: protos.google.cloud.documentai.v1.IListProcessorVersionsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.documentai.v1.IProcessorVersion[], + protos.google.cloud.documentai.v1.IListProcessorVersionsRequest | null, + protos.google.cloud.documentai.v1.IListProcessorVersionsResponse + ] + >; + listProcessorVersions( + request: protos.google.cloud.documentai.v1.IListProcessorVersionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.documentai.v1.IListProcessorVersionsRequest, + | protos.google.cloud.documentai.v1.IListProcessorVersionsResponse + | null + | undefined, + protos.google.cloud.documentai.v1.IProcessorVersion + > + ): void; + listProcessorVersions( + request: protos.google.cloud.documentai.v1.IListProcessorVersionsRequest, + callback: PaginationCallback< + protos.google.cloud.documentai.v1.IListProcessorVersionsRequest, + | protos.google.cloud.documentai.v1.IListProcessorVersionsResponse + | null + | undefined, + protos.google.cloud.documentai.v1.IProcessorVersion + > + ): void; + listProcessorVersions( + request?: protos.google.cloud.documentai.v1.IListProcessorVersionsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.documentai.v1.IListProcessorVersionsRequest, + | protos.google.cloud.documentai.v1.IListProcessorVersionsResponse + | null + | undefined, + protos.google.cloud.documentai.v1.IProcessorVersion + >, + callback?: PaginationCallback< + protos.google.cloud.documentai.v1.IListProcessorVersionsRequest, + | protos.google.cloud.documentai.v1.IListProcessorVersionsResponse + | null + | undefined, + protos.google.cloud.documentai.v1.IProcessorVersion + > + ): Promise< + [ + protos.google.cloud.documentai.v1.IProcessorVersion[], + protos.google.cloud.documentai.v1.IListProcessorVersionsRequest | null, + protos.google.cloud.documentai.v1.IListProcessorVersionsResponse + ] + > | 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'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listProcessorVersions(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 parent (project, location and processor) to list all versions. + * Format: `projects/{project}/locations/{location}/processors/{processor}` + * @param {number} request.pageSize + * The maximum number of processor versions to return. + * If unspecified, at most 10 processor versions will be returned. + * The maximum value is 20; values above 20 will be coerced to 20. + * @param {string} request.pageToken + * We will return the processor versions sorted by creation time. The page + * token will point to the next processor version. + * @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 [ProcessorVersion]{@link google.cloud.documentai.v1.ProcessorVersion} 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 `listProcessorVersionsAsync()` + * 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. + */ + listProcessorVersionsStream( + request?: protos.google.cloud.documentai.v1.IListProcessorVersionsRequest, + options?: CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listProcessorVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listProcessorVersions.createStream( + this.innerApiCalls.listProcessorVersions as gax.GaxCall, + request, + callSettings ); - return decodeOperation as LROperation< - protos.google.cloud.documentai.v1.ReviewDocumentResponse, - protos.google.cloud.documentai.v1.ReviewDocumentOperationMetadata - >; } + + /** + * Equivalent to `listProcessorVersions`, 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 parent (project, location and processor) to list all versions. + * Format: `projects/{project}/locations/{location}/processors/{processor}` + * @param {number} request.pageSize + * The maximum number of processor versions to return. + * If unspecified, at most 10 processor versions will be returned. + * The maximum value is 20; values above 20 will be coerced to 20. + * @param {string} request.pageToken + * We will return the processor versions sorted by creation time. The page + * token will point to the next processor version. + * @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 + * [ProcessorVersion]{@link google.cloud.documentai.v1.ProcessorVersion}. 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/v1/document_processor_service.list_processor_versions.js + * region_tag:documentai_v1_generated_DocumentProcessorService_ListProcessorVersions_async + */ + listProcessorVersionsAsync( + request?: protos.google.cloud.documentai.v1.IListProcessorVersionsRequest, + options?: CallOptions + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const defaultCallSettings = this._defaults['listProcessorVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listProcessorVersions.asyncIterate( + this.innerApiCalls['listProcessorVersions'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + // -------------------- // -- Path templates -- // -------------------- @@ -827,6 +3201,42 @@ export class DocumentProcessorServiceClient { ).processor; } + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project: string, location: string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + /** * Return a fully-qualified processor resource name string. * @@ -879,6 +3289,156 @@ export class DocumentProcessorServiceClient { .processor; } + /** + * Return a fully-qualified processorType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} processor_type + * @returns {string} Resource name string. + */ + processorTypePath(project: string, location: string, processorType: string) { + return this.pathTemplates.processorTypePathTemplate.render({ + project: project, + location: location, + processor_type: processorType, + }); + } + + /** + * Parse the project from ProcessorType resource. + * + * @param {string} processorTypeName + * A fully-qualified path representing ProcessorType resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProcessorTypeName(processorTypeName: string) { + return this.pathTemplates.processorTypePathTemplate.match(processorTypeName) + .project; + } + + /** + * Parse the location from ProcessorType resource. + * + * @param {string} processorTypeName + * A fully-qualified path representing ProcessorType resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProcessorTypeName(processorTypeName: string) { + return this.pathTemplates.processorTypePathTemplate.match(processorTypeName) + .location; + } + + /** + * Parse the processor_type from ProcessorType resource. + * + * @param {string} processorTypeName + * A fully-qualified path representing ProcessorType resource. + * @returns {string} A string representing the processor_type. + */ + matchProcessorTypeFromProcessorTypeName(processorTypeName: string) { + return this.pathTemplates.processorTypePathTemplate.match(processorTypeName) + .processor_type; + } + + /** + * Return a fully-qualified processorVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} processor + * @param {string} processor_version + * @returns {string} Resource name string. + */ + processorVersionPath( + project: string, + location: string, + processor: string, + processorVersion: string + ) { + return this.pathTemplates.processorVersionPathTemplate.render({ + project: project, + location: location, + processor: processor, + processor_version: processorVersion, + }); + } + + /** + * Parse the project from ProcessorVersion resource. + * + * @param {string} processorVersionName + * A fully-qualified path representing ProcessorVersion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProcessorVersionName(processorVersionName: string) { + return this.pathTemplates.processorVersionPathTemplate.match( + processorVersionName + ).project; + } + + /** + * Parse the location from ProcessorVersion resource. + * + * @param {string} processorVersionName + * A fully-qualified path representing ProcessorVersion resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProcessorVersionName(processorVersionName: string) { + return this.pathTemplates.processorVersionPathTemplate.match( + processorVersionName + ).location; + } + + /** + * Parse the processor from ProcessorVersion resource. + * + * @param {string} processorVersionName + * A fully-qualified path representing ProcessorVersion resource. + * @returns {string} A string representing the processor. + */ + matchProcessorFromProcessorVersionName(processorVersionName: string) { + return this.pathTemplates.processorVersionPathTemplate.match( + processorVersionName + ).processor; + } + + /** + * Parse the processor_version from ProcessorVersion resource. + * + * @param {string} processorVersionName + * A fully-qualified path representing ProcessorVersion resource. + * @returns {string} A string representing the processor_version. + */ + matchProcessorVersionFromProcessorVersionName(processorVersionName: string) { + return this.pathTemplates.processorVersionPathTemplate.match( + processorVersionName + ).processor_version; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + /** * Terminate the gRPC channel and close the client. * @@ -890,6 +3450,7 @@ export class DocumentProcessorServiceClient { return this.documentProcessorServiceStub.then(stub => { this._terminated = true; stub.close(); + this.locationsClient.close(); this.operationsClient.close(); }); } diff --git a/packages/google-cloud-documentai/src/v1/document_processor_service_client_config.json b/packages/google-cloud-documentai/src/v1/document_processor_service_client_config.json index 0ded43290cc..d5b952a9834 100644 --- a/packages/google-cloud-documentai/src/v1/document_processor_service_client_config.json +++ b/packages/google-cloud-documentai/src/v1/document_processor_service_client_config.json @@ -30,6 +30,62 @@ "retry_codes_name": "idempotent", "retry_params_name": "default" }, + "FetchProcessorTypes": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListProcessorTypes": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListProcessors": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetProcessor": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetProcessorVersion": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListProcessorVersions": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteProcessorVersion": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeployProcessorVersion": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UndeployProcessorVersion": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateProcessor": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteProcessor": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "EnableProcessor": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DisableProcessor": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetDefaultProcessorVersion": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "ReviewDocument": { "timeout_millis": 120000, "retry_codes_name": "idempotent", diff --git a/packages/google-cloud-documentai/src/v1/document_processor_service_proto_list.json b/packages/google-cloud-documentai/src/v1/document_processor_service_proto_list.json index 49fea13a704..a19f0a8b0ca 100644 --- a/packages/google-cloud-documentai/src/v1/document_processor_service_proto_list.json +++ b/packages/google-cloud-documentai/src/v1/document_processor_service_proto_list.json @@ -1,7 +1,11 @@ [ + "../../protos/google/cloud/documentai/v1/barcode.proto", "../../protos/google/cloud/documentai/v1/document.proto", "../../protos/google/cloud/documentai/v1/document_io.proto", "../../protos/google/cloud/documentai/v1/document_processor_service.proto", + "../../protos/google/cloud/documentai/v1/document_schema.proto", "../../protos/google/cloud/documentai/v1/geometry.proto", - "../../protos/google/cloud/documentai/v1/operation_metadata.proto" + "../../protos/google/cloud/documentai/v1/operation_metadata.proto", + "../../protos/google/cloud/documentai/v1/processor.proto", + "../../protos/google/cloud/documentai/v1/processor_type.proto" ] diff --git a/packages/google-cloud-documentai/src/v1/gapic_metadata.json b/packages/google-cloud-documentai/src/v1/gapic_metadata.json index 05ebff671a8..0c0e9a859b2 100644 --- a/packages/google-cloud-documentai/src/v1/gapic_metadata.json +++ b/packages/google-cloud-documentai/src/v1/gapic_metadata.json @@ -15,15 +15,91 @@ "processDocument" ] }, + "FetchProcessorTypes": { + "methods": [ + "fetchProcessorTypes" + ] + }, + "GetProcessor": { + "methods": [ + "getProcessor" + ] + }, + "GetProcessorVersion": { + "methods": [ + "getProcessorVersion" + ] + }, + "CreateProcessor": { + "methods": [ + "createProcessor" + ] + }, "BatchProcessDocuments": { "methods": [ "batchProcessDocuments" ] }, + "DeleteProcessorVersion": { + "methods": [ + "deleteProcessorVersion" + ] + }, + "DeployProcessorVersion": { + "methods": [ + "deployProcessorVersion" + ] + }, + "UndeployProcessorVersion": { + "methods": [ + "undeployProcessorVersion" + ] + }, + "DeleteProcessor": { + "methods": [ + "deleteProcessor" + ] + }, + "EnableProcessor": { + "methods": [ + "enableProcessor" + ] + }, + "DisableProcessor": { + "methods": [ + "disableProcessor" + ] + }, + "SetDefaultProcessorVersion": { + "methods": [ + "setDefaultProcessorVersion" + ] + }, "ReviewDocument": { "methods": [ "reviewDocument" ] + }, + "ListProcessorTypes": { + "methods": [ + "listProcessorTypes", + "listProcessorTypesStream", + "listProcessorTypesAsync" + ] + }, + "ListProcessors": { + "methods": [ + "listProcessors", + "listProcessorsStream", + "listProcessorsAsync" + ] + }, + "ListProcessorVersions": { + "methods": [ + "listProcessorVersions", + "listProcessorVersionsStream", + "listProcessorVersionsAsync" + ] } } }, @@ -35,15 +111,91 @@ "processDocument" ] }, + "FetchProcessorTypes": { + "methods": [ + "fetchProcessorTypes" + ] + }, + "GetProcessor": { + "methods": [ + "getProcessor" + ] + }, + "GetProcessorVersion": { + "methods": [ + "getProcessorVersion" + ] + }, + "CreateProcessor": { + "methods": [ + "createProcessor" + ] + }, "BatchProcessDocuments": { "methods": [ "batchProcessDocuments" ] }, + "DeleteProcessorVersion": { + "methods": [ + "deleteProcessorVersion" + ] + }, + "DeployProcessorVersion": { + "methods": [ + "deployProcessorVersion" + ] + }, + "UndeployProcessorVersion": { + "methods": [ + "undeployProcessorVersion" + ] + }, + "DeleteProcessor": { + "methods": [ + "deleteProcessor" + ] + }, + "EnableProcessor": { + "methods": [ + "enableProcessor" + ] + }, + "DisableProcessor": { + "methods": [ + "disableProcessor" + ] + }, + "SetDefaultProcessorVersion": { + "methods": [ + "setDefaultProcessorVersion" + ] + }, "ReviewDocument": { "methods": [ "reviewDocument" ] + }, + "ListProcessorTypes": { + "methods": [ + "listProcessorTypes", + "listProcessorTypesStream", + "listProcessorTypesAsync" + ] + }, + "ListProcessors": { + "methods": [ + "listProcessors", + "listProcessorsStream", + "listProcessorsAsync" + ] + }, + "ListProcessorVersions": { + "methods": [ + "listProcessorVersions", + "listProcessorVersionsStream", + "listProcessorVersionsAsync" + ] } } } diff --git a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts index de45bc4c5cc..83450a64348 100644 --- a/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts +++ b/packages/google-cloud-documentai/test/gapic_document_processor_service_v1.ts @@ -23,7 +23,14 @@ import {SinonStub} from 'sinon'; import {describe, it} from 'mocha'; import * as documentprocessorserviceModule from '../src'; -import {protobuf, LROperation, operationsProtos} from 'google-gax'; +import {PassThrough} from 'stream'; + +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} from 'google-gax'; function generateSampleMessage(instance: T) { const filledObject = ( @@ -81,6 +88,67 @@ function stubLongRunningCallWithCallback( : sinon.stub().callsArgWith(2, null, mockOperation); } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + describe('v1.DocumentProcessorServiceClient', () => { it('has servicePath', () => { const servicePath = @@ -319,8 +387,8 @@ describe('v1.DocumentProcessorServiceClient', () => { }); }); - describe('batchProcessDocuments', () => { - it('invokes batchProcessDocuments without error', async () => { + describe('fetchProcessorTypes', () => { + it('invokes fetchProcessorTypes without error', async () => { const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -328,10 +396,10 @@ describe('v1.DocumentProcessorServiceClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1.BatchProcessRequest() + new protos.google.cloud.documentai.v1.FetchProcessorTypesRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; const expectedOptions = { otherArgs: { headers: { @@ -340,21 +408,20 @@ describe('v1.DocumentProcessorServiceClient', () => { }, }; const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() + new protos.google.cloud.documentai.v1.FetchProcessorTypesResponse() ); - client.innerApiCalls.batchProcessDocuments = - stubLongRunningCall(expectedResponse); - const [operation] = await client.batchProcessDocuments(request); - const [response] = await operation.promise(); + client.innerApiCalls.fetchProcessorTypes = + stubSimpleCall(expectedResponse); + const [response] = await client.fetchProcessorTypes(request); assert.deepStrictEqual(response, expectedResponse); assert( - (client.innerApiCalls.batchProcessDocuments as SinonStub) + (client.innerApiCalls.fetchProcessorTypes as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes batchProcessDocuments without error using callback', async () => { + it('invokes fetchProcessorTypes without error using callback', async () => { const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -362,10 +429,10 @@ describe('v1.DocumentProcessorServiceClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1.BatchProcessRequest() + new protos.google.cloud.documentai.v1.FetchProcessorTypesRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; const expectedOptions = { otherArgs: { headers: { @@ -374,19 +441,16 @@ describe('v1.DocumentProcessorServiceClient', () => { }, }; const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() + new protos.google.cloud.documentai.v1.FetchProcessorTypesResponse() ); - client.innerApiCalls.batchProcessDocuments = - stubLongRunningCallWithCallback(expectedResponse); + client.innerApiCalls.fetchProcessorTypes = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.batchProcessDocuments( + client.fetchProcessorTypes( request, ( err?: Error | null, - result?: LROperation< - protos.google.cloud.documentai.v1.IBatchProcessResponse, - protos.google.cloud.documentai.v1.IBatchProcessMetadata - > | null + result?: protos.google.cloud.documentai.v1.IFetchProcessorTypesResponse | null ) => { if (err) { reject(err); @@ -396,20 +460,16 @@ describe('v1.DocumentProcessorServiceClient', () => { } ); }); - const operation = (await promise) as LROperation< - protos.google.cloud.documentai.v1.IBatchProcessResponse, - protos.google.cloud.documentai.v1.IBatchProcessMetadata - >; - const [response] = await operation.promise(); + const response = await promise; assert.deepStrictEqual(response, expectedResponse); assert( - (client.innerApiCalls.batchProcessDocuments as SinonStub) + (client.innerApiCalls.fetchProcessorTypes as SinonStub) .getCall(0) .calledWith(request, expectedOptions /*, callback defined above */) ); }); - it('invokes batchProcessDocuments with call error', async () => { + it('invokes fetchProcessorTypes with error', async () => { const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -417,10 +477,10 @@ describe('v1.DocumentProcessorServiceClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1.BatchProcessRequest() + new protos.google.cloud.documentai.v1.FetchProcessorTypesRequest() ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; const expectedOptions = { otherArgs: { headers: { @@ -429,22 +489,19 @@ describe('v1.DocumentProcessorServiceClient', () => { }, }; const expectedError = new Error('expected'); - client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( + client.innerApiCalls.fetchProcessorTypes = stubSimpleCall( undefined, expectedError ); - await assert.rejects( - client.batchProcessDocuments(request), - expectedError - ); + await assert.rejects(client.fetchProcessorTypes(request), expectedError); assert( - (client.innerApiCalls.batchProcessDocuments as SinonStub) + (client.innerApiCalls.fetchProcessorTypes as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes batchProcessDocuments with LRO error', async () => { + it('invokes fetchProcessorTypes with closed client', async () => { const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -452,7 +509,25 @@ describe('v1.DocumentProcessorServiceClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1.BatchProcessRequest() + new protos.google.cloud.documentai.v1.FetchProcessorTypesRequest() + ); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.fetchProcessorTypes(request), expectedError); + }); + }); + + describe('getProcessor', () => { + it('invokes getProcessor without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.GetProcessorRequest() ); request.name = ''; const expectedHeaderRequestParams = 'name='; @@ -463,67 +538,118 @@ describe('v1.DocumentProcessorServiceClient', () => { }, }, }; - const expectedError = new Error('expected'); - client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( - undefined, - undefined, - expectedError + const expectedResponse = generateSampleMessage( + new protos.google.cloud.documentai.v1.Processor() ); - const [operation] = await client.batchProcessDocuments(request); - await assert.rejects(operation.promise(), expectedError); + client.innerApiCalls.getProcessor = stubSimpleCall(expectedResponse); + const [response] = await client.getProcessor(request); + assert.deepStrictEqual(response, expectedResponse); assert( - (client.innerApiCalls.batchProcessDocuments as SinonStub) + (client.innerApiCalls.getProcessor as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes checkBatchProcessDocumentsProgress without error', async () => { + it('invokes getProcessor without error using callback', async () => { const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.GetProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() + new protos.google.cloud.documentai.v1.Processor() ); - 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.checkBatchProcessDocumentsProgress( - expectedResponse.name + client.innerApiCalls.getProcessor = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getProcessor( + request, + ( + err?: Error | null, + result?: protos.google.cloud.documentai.v1.IProcessor | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.getProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - it('invokes checkBatchProcessDocumentsProgress with error', async () => { + it('invokes getProcessor with error', async () => { const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.GetProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall( + client.innerApiCalls.getProcessor = stubSimpleCall( undefined, expectedError ); - await assert.rejects( - client.checkBatchProcessDocumentsProgress(''), - expectedError + await assert.rejects(client.getProcessor(request), expectedError); + assert( + (client.innerApiCalls.getProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes getProcessor with closed client', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.GetProcessorRequest() + ); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getProcessor(request), expectedError); }); }); - describe('reviewDocument', () => { - it('invokes reviewDocument without error', async () => { + describe('getProcessorVersion', () => { + it('invokes getProcessorVersion without error', async () => { const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -531,10 +657,10 @@ describe('v1.DocumentProcessorServiceClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1.ReviewDocumentRequest() + new protos.google.cloud.documentai.v1.GetProcessorVersionRequest() ); - request.humanReviewConfig = ''; - const expectedHeaderRequestParams = 'human_review_config='; + request.name = ''; + const expectedHeaderRequestParams = 'name='; const expectedOptions = { otherArgs: { headers: { @@ -543,21 +669,20 @@ describe('v1.DocumentProcessorServiceClient', () => { }, }; const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() + new protos.google.cloud.documentai.v1.ProcessorVersion() ); - client.innerApiCalls.reviewDocument = - stubLongRunningCall(expectedResponse); - const [operation] = await client.reviewDocument(request); - const [response] = await operation.promise(); + client.innerApiCalls.getProcessorVersion = + stubSimpleCall(expectedResponse); + const [response] = await client.getProcessorVersion(request); assert.deepStrictEqual(response, expectedResponse); assert( - (client.innerApiCalls.reviewDocument as SinonStub) + (client.innerApiCalls.getProcessorVersion as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes reviewDocument without error using callback', async () => { + it('invokes getProcessorVersion without error using callback', async () => { const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -565,10 +690,10 @@ describe('v1.DocumentProcessorServiceClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1.ReviewDocumentRequest() + new protos.google.cloud.documentai.v1.GetProcessorVersionRequest() ); - request.humanReviewConfig = ''; - const expectedHeaderRequestParams = 'human_review_config='; + request.name = ''; + const expectedHeaderRequestParams = 'name='; const expectedOptions = { otherArgs: { headers: { @@ -577,19 +702,16 @@ describe('v1.DocumentProcessorServiceClient', () => { }, }; const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() + new protos.google.cloud.documentai.v1.ProcessorVersion() ); - client.innerApiCalls.reviewDocument = - stubLongRunningCallWithCallback(expectedResponse); + client.innerApiCalls.getProcessorVersion = + stubSimpleCallWithCallback(expectedResponse); const promise = new Promise((resolve, reject) => { - client.reviewDocument( + client.getProcessorVersion( request, ( err?: Error | null, - result?: LROperation< - protos.google.cloud.documentai.v1.IReviewDocumentResponse, - protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata - > | null + result?: protos.google.cloud.documentai.v1.IProcessorVersion | null ) => { if (err) { reject(err); @@ -599,20 +721,16 @@ describe('v1.DocumentProcessorServiceClient', () => { } ); }); - const operation = (await promise) as LROperation< - protos.google.cloud.documentai.v1.IReviewDocumentResponse, - protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata - >; - const [response] = await operation.promise(); + const response = await promise; assert.deepStrictEqual(response, expectedResponse); assert( - (client.innerApiCalls.reviewDocument as SinonStub) + (client.innerApiCalls.getProcessorVersion as SinonStub) .getCall(0) .calledWith(request, expectedOptions /*, callback defined above */) ); }); - it('invokes reviewDocument with call error', async () => { + it('invokes getProcessorVersion with error', async () => { const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -620,10 +738,10 @@ describe('v1.DocumentProcessorServiceClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1.ReviewDocumentRequest() + new protos.google.cloud.documentai.v1.GetProcessorVersionRequest() ); - request.humanReviewConfig = ''; - const expectedHeaderRequestParams = 'human_review_config='; + request.name = ''; + const expectedHeaderRequestParams = 'name='; const expectedOptions = { otherArgs: { headers: { @@ -632,19 +750,19 @@ describe('v1.DocumentProcessorServiceClient', () => { }, }; const expectedError = new Error('expected'); - client.innerApiCalls.reviewDocument = stubLongRunningCall( + client.innerApiCalls.getProcessorVersion = stubSimpleCall( undefined, expectedError ); - await assert.rejects(client.reviewDocument(request), expectedError); + await assert.rejects(client.getProcessorVersion(request), expectedError); assert( - (client.innerApiCalls.reviewDocument as SinonStub) + (client.innerApiCalls.getProcessorVersion as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes reviewDocument with LRO error', async () => { + it('invokes getProcessorVersion with closed client', async () => { const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, @@ -652,10 +770,28 @@ describe('v1.DocumentProcessorServiceClient', () => { }); client.initialize(); const request = generateSampleMessage( - new protos.google.cloud.documentai.v1.ReviewDocumentRequest() + new protos.google.cloud.documentai.v1.GetProcessorVersionRequest() ); - request.humanReviewConfig = ''; - const expectedHeaderRequestParams = 'human_review_config='; + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getProcessorVersion(request), expectedError); + }); + }); + + describe('createProcessor', () => { + it('invokes createProcessor without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.CreateProcessorRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; const expectedOptions = { otherArgs: { headers: { @@ -663,62 +799,3403 @@ describe('v1.DocumentProcessorServiceClient', () => { }, }, }; - const expectedError = new Error('expected'); - client.innerApiCalls.reviewDocument = stubLongRunningCall( - undefined, - undefined, - expectedError + const expectedResponse = generateSampleMessage( + new protos.google.cloud.documentai.v1.Processor() ); - const [operation] = await client.reviewDocument(request); - await assert.rejects(operation.promise(), expectedError); + client.innerApiCalls.createProcessor = stubSimpleCall(expectedResponse); + const [response] = await client.createProcessor(request); + assert.deepStrictEqual(response, expectedResponse); assert( - (client.innerApiCalls.reviewDocument as SinonStub) + (client.innerApiCalls.createProcessor as SinonStub) .getCall(0) .calledWith(request, expectedOptions, undefined) ); }); - it('invokes checkReviewDocumentProgress without error', async () => { + it('invokes createProcessor without error using callback', async () => { const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.CreateProcessorRequest() ); - 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.checkReviewDocumentProgress( - expectedResponse.name + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.documentai.v1.Processor() + ); + client.innerApiCalls.createProcessor = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createProcessor( + request, + ( + err?: Error | null, + result?: protos.google.cloud.documentai.v1.IProcessor | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.createProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes createProcessor with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.CreateProcessorRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createProcessor = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createProcessor(request), expectedError); + assert( + (client.innerApiCalls.createProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes createProcessor with closed client', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.CreateProcessorRequest() + ); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createProcessor(request), expectedError); + }); + }); + + describe('batchProcessDocuments', () => { + it('invokes batchProcessDocuments without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.BatchProcessRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchProcessDocuments = + stubLongRunningCall(expectedResponse); + const [operation] = await client.batchProcessDocuments(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.batchProcessDocuments as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes batchProcessDocuments without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.BatchProcessRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchProcessDocuments = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchProcessDocuments( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.documentai.v1.IBatchProcessResponse, + protos.google.cloud.documentai.v1.IBatchProcessMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1.IBatchProcessResponse, + protos.google.cloud.documentai.v1.IBatchProcessMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.batchProcessDocuments as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes batchProcessDocuments with call error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.BatchProcessRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.batchProcessDocuments(request), + expectedError + ); + assert( + (client.innerApiCalls.batchProcessDocuments as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes batchProcessDocuments with LRO error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.BatchProcessRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.batchProcessDocuments = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.batchProcessDocuments(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.batchProcessDocuments as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkBatchProcessDocumentsProgress without error', async () => { + const client = + new documentprocessorserviceModule.v1.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.checkBatchProcessDocumentsProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchProcessDocumentsProgress with error', async () => { + const client = + new documentprocessorserviceModule.v1.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.checkBatchProcessDocumentsProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteProcessorVersion', () => { + it('invokes deleteProcessorVersion without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DeleteProcessorVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteProcessorVersion = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteProcessorVersion(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteProcessorVersion without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DeleteProcessorVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteProcessorVersion = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteProcessorVersion( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorVersionMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorVersionMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteProcessorVersion with call error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DeleteProcessorVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteProcessorVersion = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.deleteProcessorVersion(request), + expectedError + ); + assert( + (client.innerApiCalls.deleteProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteProcessorVersion with LRO error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DeleteProcessorVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteProcessorVersion = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deleteProcessorVersion(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.deleteProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkDeleteProcessorVersionProgress without error', async () => { + const client = + new documentprocessorserviceModule.v1.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.checkDeleteProcessorVersionProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteProcessorVersionProgress with error', async () => { + const client = + new documentprocessorserviceModule.v1.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.checkDeleteProcessorVersionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deployProcessorVersion', () => { + it('invokes deployProcessorVersion without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DeployProcessorVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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); + assert( + (client.innerApiCalls.deployProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deployProcessorVersion without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DeployProcessorVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + 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.v1.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IDeployProcessorVersionMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1.IDeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IDeployProcessorVersionMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deployProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deployProcessorVersion with call error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DeployProcessorVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deployProcessorVersion = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.deployProcessorVersion(request), + expectedError + ); + assert( + (client.innerApiCalls.deployProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deployProcessorVersion with LRO error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DeployProcessorVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deployProcessorVersion = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deployProcessorVersion(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.deployProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkDeployProcessorVersionProgress without error', async () => { + const client = + new documentprocessorserviceModule.v1.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.v1.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.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.UndeployProcessorVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.undeployProcessorVersion = + stubLongRunningCall(expectedResponse); + const [operation] = await client.undeployProcessorVersion(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.undeployProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes undeployProcessorVersion without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.UndeployProcessorVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.undeployProcessorVersion = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.undeployProcessorVersion( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.documentai.v1.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IUndeployProcessorVersionMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1.IUndeployProcessorVersionResponse, + protos.google.cloud.documentai.v1.IUndeployProcessorVersionMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.undeployProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes undeployProcessorVersion with call error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.UndeployProcessorVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.undeployProcessorVersion = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.undeployProcessorVersion(request), + expectedError + ); + assert( + (client.innerApiCalls.undeployProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes undeployProcessorVersion with LRO error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.UndeployProcessorVersionRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.undeployProcessorVersion = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.undeployProcessorVersion(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.undeployProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkUndeployProcessorVersionProgress without error', async () => { + const client = + new documentprocessorserviceModule.v1.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.checkUndeployProcessorVersionProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUndeployProcessorVersionProgress with error', async () => { + const client = + new documentprocessorserviceModule.v1.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.checkUndeployProcessorVersionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteProcessor', () => { + it('invokes deleteProcessor without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DeleteProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteProcessor = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteProcessor(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteProcessor without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DeleteProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteProcessor = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteProcessor( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.documentai.v1.IDeleteProcessorMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.deleteProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes deleteProcessor with call error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DeleteProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteProcessor = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteProcessor(request), expectedError); + assert( + (client.innerApiCalls.deleteProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes deleteProcessor with LRO error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DeleteProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteProcessor = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deleteProcessor(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.deleteProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkDeleteProcessorProgress without error', async () => { + const client = + new documentprocessorserviceModule.v1.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.checkDeleteProcessorProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteProcessorProgress with error', async () => { + const client = + new documentprocessorserviceModule.v1.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.checkDeleteProcessorProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('enableProcessor', () => { + it('invokes enableProcessor without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.EnableProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.enableProcessor = + stubLongRunningCall(expectedResponse); + const [operation] = await client.enableProcessor(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.enableProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes enableProcessor without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.EnableProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.enableProcessor = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.enableProcessor( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.documentai.v1.IEnableProcessorResponse, + protos.google.cloud.documentai.v1.IEnableProcessorMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1.IEnableProcessorResponse, + protos.google.cloud.documentai.v1.IEnableProcessorMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.enableProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes enableProcessor with call error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.EnableProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.enableProcessor = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.enableProcessor(request), expectedError); + assert( + (client.innerApiCalls.enableProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes enableProcessor with LRO error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.EnableProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.enableProcessor = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.enableProcessor(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.enableProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkEnableProcessorProgress without error', async () => { + const client = + new documentprocessorserviceModule.v1.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.checkEnableProcessorProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkEnableProcessorProgress with error', async () => { + const client = + new documentprocessorserviceModule.v1.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.checkEnableProcessorProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('disableProcessor', () => { + it('invokes disableProcessor without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DisableProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.disableProcessor = + stubLongRunningCall(expectedResponse); + const [operation] = await client.disableProcessor(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.disableProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes disableProcessor without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DisableProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.disableProcessor = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.disableProcessor( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.documentai.v1.IDisableProcessorResponse, + protos.google.cloud.documentai.v1.IDisableProcessorMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1.IDisableProcessorResponse, + protos.google.cloud.documentai.v1.IDisableProcessorMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.disableProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes disableProcessor with call error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DisableProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.disableProcessor = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.disableProcessor(request), expectedError); + assert( + (client.innerApiCalls.disableProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes disableProcessor with LRO error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.DisableProcessorRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.disableProcessor = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.disableProcessor(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.disableProcessor as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkDisableProcessorProgress without error', async () => { + const client = + new documentprocessorserviceModule.v1.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.checkDisableProcessorProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDisableProcessorProgress with error', async () => { + const client = + new documentprocessorserviceModule.v1.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.checkDisableProcessorProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('setDefaultProcessorVersion', () => { + it('invokes setDefaultProcessorVersion without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.SetDefaultProcessorVersionRequest() + ); + request.processor = ''; + const expectedHeaderRequestParams = 'processor='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.setDefaultProcessorVersion = + stubLongRunningCall(expectedResponse); + const [operation] = await client.setDefaultProcessorVersion(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.setDefaultProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes setDefaultProcessorVersion without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.SetDefaultProcessorVersionRequest() + ); + request.processor = ''; + const expectedHeaderRequestParams = 'processor='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.setDefaultProcessorVersion = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setDefaultProcessorVersion( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse, + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionResponse, + protos.google.cloud.documentai.v1.ISetDefaultProcessorVersionMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.setDefaultProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes setDefaultProcessorVersion with call error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.SetDefaultProcessorVersionRequest() + ); + request.processor = ''; + const expectedHeaderRequestParams = 'processor='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setDefaultProcessorVersion = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.setDefaultProcessorVersion(request), + expectedError + ); + assert( + (client.innerApiCalls.setDefaultProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes setDefaultProcessorVersion with LRO error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.SetDefaultProcessorVersionRequest() + ); + request.processor = ''; + const expectedHeaderRequestParams = 'processor='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setDefaultProcessorVersion = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.setDefaultProcessorVersion(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.setDefaultProcessorVersion as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkSetDefaultProcessorVersionProgress without error', async () => { + const client = + new documentprocessorserviceModule.v1.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.checkSetDefaultProcessorVersionProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkSetDefaultProcessorVersionProgress with error', async () => { + const client = + new documentprocessorserviceModule.v1.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.checkSetDefaultProcessorVersionProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('reviewDocument', () => { + it('invokes reviewDocument without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ReviewDocumentRequest() + ); + request.humanReviewConfig = ''; + const expectedHeaderRequestParams = 'human_review_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.reviewDocument = + stubLongRunningCall(expectedResponse); + const [operation] = await client.reviewDocument(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.reviewDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes reviewDocument without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ReviewDocumentRequest() + ); + request.humanReviewConfig = ''; + const expectedHeaderRequestParams = 'human_review_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.reviewDocument = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.reviewDocument( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.documentai.v1.IReviewDocumentResponse, + protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.documentai.v1.IReviewDocumentResponse, + protos.google.cloud.documentai.v1.IReviewDocumentOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.reviewDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes reviewDocument with call error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ReviewDocumentRequest() + ); + request.humanReviewConfig = ''; + const expectedHeaderRequestParams = 'human_review_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.reviewDocument = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.reviewDocument(request), expectedError); + assert( + (client.innerApiCalls.reviewDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes reviewDocument with LRO error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ReviewDocumentRequest() + ); + request.humanReviewConfig = ''; + const expectedHeaderRequestParams = 'human_review_config='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.reviewDocument = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.reviewDocument(request); + await assert.rejects(operation.promise(), expectedError); + assert( + (client.innerApiCalls.reviewDocument as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes checkReviewDocumentProgress without error', async () => { + const client = + new documentprocessorserviceModule.v1.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.checkReviewDocumentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkReviewDocumentProgress with error', async () => { + const client = + new documentprocessorserviceModule.v1.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.checkReviewDocumentProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listProcessorTypes', () => { + it('invokes listProcessorTypes without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorType() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorType() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorType() + ), + ]; + client.innerApiCalls.listProcessorTypes = + stubSimpleCall(expectedResponse); + const [response] = await client.listProcessorTypes(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listProcessorTypes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listProcessorTypes without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorType() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorType() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorType() + ), + ]; + client.innerApiCalls.listProcessorTypes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listProcessorTypes( + request, + ( + err?: Error | null, + result?: protos.google.cloud.documentai.v1.IProcessorType[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listProcessorTypes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listProcessorTypes with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listProcessorTypes = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listProcessorTypes(request), expectedError); + assert( + (client.innerApiCalls.listProcessorTypes as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listProcessorTypesStream without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorType() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorType() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorType() + ), + ]; + client.descriptors.page.listProcessorTypes.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listProcessorTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.documentai.v1.ProcessorType[] = []; + stream.on( + 'data', + (response: protos.google.cloud.documentai.v1.ProcessorType) => { + 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.listProcessorTypes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listProcessorTypes, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessorTypes.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listProcessorTypesStream with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listProcessorTypes.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listProcessorTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.documentai.v1.ProcessorType[] = []; + stream.on( + 'data', + (response: protos.google.cloud.documentai.v1.ProcessorType) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listProcessorTypes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listProcessorTypes, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessorTypes.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listProcessorTypes without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorType() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorType() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorType() + ), + ]; + client.descriptors.page.listProcessorTypes.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.documentai.v1.IProcessorType[] = []; + const iterable = client.listProcessorTypesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listProcessorTypes.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessorTypes.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listProcessorTypes with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listProcessorTypes.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listProcessorTypesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.documentai.v1.IProcessorType[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listProcessorTypes.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessorTypes.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listProcessors', () => { + it('invokes listProcessors without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.Processor() + ), + ]; + client.innerApiCalls.listProcessors = stubSimpleCall(expectedResponse); + const [response] = await client.listProcessors(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listProcessors as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listProcessors without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.Processor() + ), + ]; + client.innerApiCalls.listProcessors = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listProcessors( + request, + ( + err?: Error | null, + result?: protos.google.cloud.documentai.v1.IProcessor[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listProcessors as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listProcessors with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listProcessors = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listProcessors(request), expectedError); + assert( + (client.innerApiCalls.listProcessors as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listProcessorsStream without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.Processor() + ), + ]; + client.descriptors.page.listProcessors.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listProcessorsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.documentai.v1.Processor[] = []; + stream.on( + 'data', + (response: protos.google.cloud.documentai.v1.Processor) => { + 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.listProcessors.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listProcessors, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessors.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listProcessorsStream with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + 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.v1.Processor[] = []; + stream.on( + 'data', + (response: protos.google.cloud.documentai.v1.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.strictEqual( + ( + client.descriptors.page.listProcessors.createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listProcessors without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.Processor() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.Processor() + ), + ]; + client.descriptors.page.listProcessors.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.documentai.v1.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.strictEqual( + ( + client.descriptors.page.listProcessors.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listProcessors with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + 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.v1.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.strictEqual( + ( + client.descriptors.page.listProcessors.asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listProcessorVersions', () => { + it('invokes listProcessorVersions without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorVersion() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorVersion() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorVersion() + ), + ]; + client.innerApiCalls.listProcessorVersions = + stubSimpleCall(expectedResponse); + const [response] = await client.listProcessorVersions(request); + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listProcessorVersions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listProcessorVersions without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorVersion() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorVersion() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorVersion() + ), + ]; + client.innerApiCalls.listProcessorVersions = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listProcessorVersions( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.documentai.v1.IProcessorVersion[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.listProcessorVersions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions /*, callback defined above */) + ); + }); + + it('invokes listProcessorVersions with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listProcessorVersions = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.listProcessorVersions(request), + expectedError + ); + assert( + (client.innerApiCalls.listProcessorVersions as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + + it('invokes listProcessorVersionsStream without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorVersion() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorVersion() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.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.v1.ProcessorVersion[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.documentai.v1.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.listProcessorVersions, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessorVersions + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listProcessorVersionsStream with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listProcessorVersions.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listProcessorVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.documentai.v1.ProcessorVersion[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.documentai.v1.ProcessorVersion) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listProcessorVersions + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listProcessorVersions, request) + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessorVersions + .createStream as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listProcessorVersions without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorVersion() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorVersion() + ), + generateSampleMessage( + new protos.google.cloud.documentai.v1.ProcessorVersion() + ), + ]; + client.descriptors.page.listProcessorVersions.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.documentai.v1.IProcessorVersion[] = + []; + const iterable = client.listProcessorVersionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listProcessorVersions + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessorVersions + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listProcessorVersions with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1.ListProcessorVersionsRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('expected'); + client.descriptors.page.listProcessorVersions.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listProcessorVersionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.documentai.v1.IProcessorVersion[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listProcessorVersions + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.descriptors.page.listProcessorVersions + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert.strictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) ); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - - it('invokes checkReviewDocumentProgress with error', async () => { + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall( + client.operationsClient.deleteOperation = stubSimpleCall( undefined, expectedError ); - await assert.rejects( - client.checkReviewDocumentProgress(''), - expectedError + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request ); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); }); @@ -800,6 +4277,56 @@ describe('v1.DocumentProcessorServiceClient', () => { }); }); + describe('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.locationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath('projectValue', 'locationValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + describe('processor', () => { const fakePath = '/rendered/path/processor'; const expectedParameters = { @@ -864,5 +4391,190 @@ describe('v1.DocumentProcessorServiceClient', () => { ); }); }); + + describe('processorType', () => { + const fakePath = '/rendered/path/processorType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + processor_type: 'processorTypeValue', + }; + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.processorTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.processorTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('processorTypePath', () => { + const result = client.processorTypePath( + 'projectValue', + 'locationValue', + 'processorTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.processorTypePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProcessorTypeName', () => { + const result = client.matchProjectFromProcessorTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.processorTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProcessorTypeName', () => { + const result = client.matchLocationFromProcessorTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.processorTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProcessorTypeFromProcessorTypeName', () => { + const result = client.matchProcessorTypeFromProcessorTypeName(fakePath); + assert.strictEqual(result, 'processorTypeValue'); + assert( + (client.pathTemplates.processorTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('processorVersion', () => { + const fakePath = '/rendered/path/processorVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + processor: 'processorValue', + processor_version: 'processorVersionValue', + }; + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.processorVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.processorVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('processorVersionPath', () => { + const result = client.processorVersionPath( + 'projectValue', + 'locationValue', + 'processorValue', + 'processorVersionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.processorVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProcessorVersionName', () => { + const result = client.matchProjectFromProcessorVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.processorVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProcessorVersionName', () => { + const result = client.matchLocationFromProcessorVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.processorVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProcessorFromProcessorVersionName', () => { + const result = client.matchProcessorFromProcessorVersionName(fakePath); + assert.strictEqual(result, 'processorValue'); + assert( + (client.pathTemplates.processorVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchProcessorVersionFromProcessorVersionName', () => { + const result = + client.matchProcessorVersionFromProcessorVersionName(fakePath); + assert.strictEqual(result, 'processorVersionValue'); + assert( + (client.pathTemplates.processorVersionPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); }); });