diff --git a/protos/google/cloud/documentai/v1/document.proto b/protos/google/cloud/documentai/v1/document.proto index 467a44921..e6368bad5 100644 --- a/protos/google/cloud/documentai/v1/document.proto +++ b/protos/google/cloud/documentai/v1/document.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. @@ -16,6 +16,7 @@ syntax = "proto3"; package google.cloud.documentai.v1; +import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "google/cloud/documentai/v1/geometry.proto"; import "google/protobuf/timestamp.proto"; @@ -25,7 +26,6 @@ import "google/type/date.proto"; import "google/type/datetime.proto"; import "google/type/money.proto"; import "google/type/postal_address.proto"; -import "google/api/annotations.proto"; option csharp_namespace = "Google.Cloud.DocumentAI.V1"; option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1;documentai"; @@ -51,7 +51,8 @@ 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,7 +69,8 @@ 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. @@ -165,25 +167,31 @@ 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. @@ -195,7 +203,8 @@ 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. @@ -208,7 +217,8 @@ 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. @@ -220,7 +230,8 @@ 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 { @@ -241,10 +252,12 @@ 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. @@ -254,13 +267,25 @@ message Document { Provenance provenance = 4; } + // A detected symbol. + message 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. + repeated DetectedLanguage detected_languages = 2; + } + // 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. @@ -277,7 +302,8 @@ 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. @@ -290,7 +316,8 @@ 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. @@ -305,11 +332,13 @@ 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. @@ -333,16 +362,18 @@ message Document { message DetectedLanguage { // The BCP-47 language code, such as "en-US" or "sr-Latn". For more // information, see - // http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + // https://www.unicode.org/reports/tr35/#Unicode_locale_identifier. string language_code = 1; // Confidence of detected language. Range [0, 1]. 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 @@ -389,17 +420,23 @@ message Document { // A list of visually detected form fields on the page. repeated FormField form_fields = 11; + // A list of visually detected symbols on the page. + repeated Symbol symbols = 12; + // The history of this page. Provenance provenance = 16; } - // A phrase in the text that is a known entity type, such as a person, an - // organization, or location. + // An entity that could be a phrase in the text or a property that belongs to + // the document. It is a known entity type, such as a person, an organization, + // or location. message Entity { // Parsed and normalized entity value. message NormalizedValue { - // Structured entity value. Must match entity type defined in schema if - // known. If this field is present, the 'text' field is still populated. + // An optional structured entity value. + // Must match entity type defined in schema if + // known. If this field is present, the `text` field could also be + // populated. oneof structured_value { // Money value. See also: // https://github.com/googleapis/googleapis/blob/master/google/type/money.proto @@ -422,24 +459,29 @@ message Document { bool boolean_value = 6; } - // Required. Normalized entity value stored as a string. This field is populated for - // supported document type (e.g. Invoice). For some entity types, one of - // respective 'structured_value' fields may also be populated. + // Optional. An optional field to store a normalized string. + // For some entity types, one of respective `structured_value` fields may + // also be populated. Also not all the types of `structured_value` will be + // normalized. For example, some processors may not generate float + // or int normalized text by default. // + // Below are sample formats mapped to structured values. // - Money/Currency type (`money_value`) is in the ISO 4217 text format. // - Date type (`date_value`) is in the ISO 8601 text format. // - Datetime type (`datetime_value`) is in the ISO 8601 text format. - string text = 1 [(google.api.field_behavior) = REQUIRED]; + string text = 1 [(google.api.field_behavior) = OPTIONAL]; } // 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]; // Entity type from a schema e.g. `Address`. string type = 2; - // Optional. Text value in the document e.g. `1600 Amphitheatre Pkwy`. + // 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. @@ -448,32 +490,35 @@ 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; @@ -485,31 +530,40 @@ 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 - // not have to look it up in the text_segments. + // not have to look it up in the text_segments. It is always + // populated for formFields. 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 { @@ -518,47 +572,65 @@ 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]; } @@ -569,15 +641,14 @@ message Document { // Structure to identify provenance relationships between annotations in // different revisions. message Provenance { - // Structure for referencing parent provenances. When an element replaces - // one of more other elements parent references identify the elements that - // are replaced. + // The parent element the current element is based on. Used for + // referencing/aligning, removal and replacement operations. message Parent { - // The index of the [Document.revisions] identifying the parent revision. + // The index of the index into current revision's parent_ids list. int32 revision = 1; - // The index of the parent revisions corresponding collection of items - // (eg. list of entities, properties within entities, etc.) + // The index of the parent item in the corresponding item list (eg. list + // of entities, properties within entities, etc.) in the parent revision. int32 index = 3; // The id of the parent provenance. @@ -586,19 +657,20 @@ message Document { // If a processor or agent does an explicit operation on existing elements. enum OperationType { - // Operation type unspecified. + // Operation type unspecified. If no operation is specified a provenance + // entry is simply used to match against a `parent`. OPERATION_TYPE_UNSPECIFIED = 0; - // Add an element. Implicit if no `parents` are set for the provenance. + // Add an element. ADD = 1; - // The element is removed. No `parents` should be set. + // Remove an element identified by `parent`. REMOVE = 2; - // Explicitly replaces the element(s) identified by `parents`. + // Replace an element identified by `parent`. REPLACE = 3; - // Element is requested for human review. + // Request human review for the element identified by `parent`. EVAL_REQUESTED = 4; // Element is reviewed and approved at human review, confidence will be @@ -664,8 +736,9 @@ 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; @@ -706,11 +779,13 @@ message Document { // 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]. + // 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 diff --git a/protos/google/cloud/documentai/v1beta3/document.proto b/protos/google/cloud/documentai/v1beta3/document.proto index abba3ae19..760cd5115 100644 --- a/protos/google/cloud/documentai/v1beta3/document.proto +++ b/protos/google/cloud/documentai/v1beta3/document.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. @@ -16,6 +16,7 @@ syntax = "proto3"; package google.cloud.documentai.v1beta3; +import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "google/cloud/documentai/v1beta3/geometry.proto"; import "google/protobuf/timestamp.proto"; @@ -25,7 +26,6 @@ import "google/type/date.proto"; import "google/type/datetime.proto"; import "google/type/money.proto"; import "google/type/postal_address.proto"; -import "google/api/annotations.proto"; option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta3"; option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3;documentai"; @@ -51,8 +51,9 @@ message Document { // Total number of shards. int64 shard_count = 2; - // The index of the first character in [Document.text][google.cloud.documentai.v1beta3.Document.text] in the overall - // document global text. + // The index of the first character in + // [Document.text][google.cloud.documentai.v1beta3.Document.text] in the + // overall document global text. int64 text_offset = 3; } @@ -68,7 +69,8 @@ message Document { string unit = 2; } - // Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text]. + // Text anchor indexing into the + // [Document.text][google.cloud.documentai.v1beta3.Document.text]. TextAnchor text_anchor = 1; // Text color. @@ -165,25 +167,31 @@ message Document { PAGE_LEFT = 4; } - // Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text]. + // Text anchor indexing into the + // [Document.text][google.cloud.documentai.v1beta3.Document.text]. TextAnchor text_anchor = 1; - // Confidence of the current [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] within context of the object this - // layout is for. e.g. confidence can be for a single token, a table, - // a visual element, etc. depending on context. Range [0, 1]. + // Confidence of the current + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] within + // context of the object this layout is for. e.g. confidence can be for a + // single token, a table, a visual element, etc. depending on context. + // Range [0, 1]. float confidence = 2; - // The bounding polygon for the [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout]. + // The bounding polygon for the + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout]. BoundingPoly bounding_poly = 3; - // Detected orientation for the [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout]. + // Detected orientation for the + // [Layout][google.cloud.documentai.v1beta3.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.v1beta3.Document.Page.Layout] for [Block][google.cloud.documentai.v1beta3.Document.Page.Block]. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for + // [Block][google.cloud.documentai.v1beta3.Document.Page.Block]. Layout layout = 1; // A list of detected languages together with confidence. @@ -195,7 +203,8 @@ message Document { // A collection of lines that a human would perceive as a paragraph. message Paragraph { - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [Paragraph][google.cloud.documentai.v1beta3.Document.Page.Paragraph]. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for + // [Paragraph][google.cloud.documentai.v1beta3.Document.Page.Paragraph]. Layout layout = 1; // A list of detected languages together with confidence. @@ -208,7 +217,8 @@ 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.v1beta3.Document.Page.Layout] for [Line][google.cloud.documentai.v1beta3.Document.Page.Line]. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for + // [Line][google.cloud.documentai.v1beta3.Document.Page.Line]. Layout layout = 1; // A list of detected languages together with confidence. @@ -220,7 +230,8 @@ message Document { // A detected token. message Token { - // Detected break at the end of a [Token][google.cloud.documentai.v1beta3.Document.Page.Token]. + // Detected break at the end of a + // [Token][google.cloud.documentai.v1beta3.Document.Page.Token]. message DetectedBreak { // Enum to denote the type of break found. enum Type { @@ -241,10 +252,12 @@ message Document { Type type = 1; } - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [Token][google.cloud.documentai.v1beta3.Document.Page.Token]. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for + // [Token][google.cloud.documentai.v1beta3.Document.Page.Token]. Layout layout = 1; - // Detected break at the end of a [Token][google.cloud.documentai.v1beta3.Document.Page.Token]. + // Detected break at the end of a + // [Token][google.cloud.documentai.v1beta3.Document.Page.Token]. DetectedBreak detected_break = 2; // A list of detected languages together with confidence. @@ -254,13 +267,25 @@ message Document { Provenance provenance = 4; } + // A detected symbol. + message Symbol { + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for + // [Symbol][google.cloud.documentai.v1beta3.Document.Page.Symbol]. + Layout layout = 1; + + // A list of detected languages together with confidence. + repeated DetectedLanguage detected_languages = 2; + } + // Detected non-text visual elements e.g. checkbox, signature etc. on the // page. message VisualElement { - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [VisualElement][google.cloud.documentai.v1beta3.Document.Page.VisualElement]. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for + // [VisualElement][google.cloud.documentai.v1beta3.Document.Page.VisualElement]. Layout layout = 1; - // Type of the [VisualElement][google.cloud.documentai.v1beta3.Document.Page.VisualElement]. + // Type of the + // [VisualElement][google.cloud.documentai.v1beta3.Document.Page.VisualElement]. string type = 2; // A list of detected languages together with confidence. @@ -277,7 +302,8 @@ message Document { // A cell representation inside the table. message TableCell { - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [TableCell][google.cloud.documentai.v1beta3.Document.Page.Table.TableCell]. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for + // [TableCell][google.cloud.documentai.v1beta3.Document.Page.Table.TableCell]. Layout layout = 1; // How many rows this cell spans. @@ -290,7 +316,8 @@ message Document { repeated DetectedLanguage detected_languages = 4; } - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [Table][google.cloud.documentai.v1beta3.Document.Page.Table]. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for + // [Table][google.cloud.documentai.v1beta3.Document.Page.Table]. Layout layout = 1; // Header rows of the table. @@ -305,11 +332,14 @@ message Document { // A form field detected on the page. message FormField { - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for the [FormField][google.cloud.documentai.v1beta3.Document.Page.FormField] name. e.g. `Address`, `Email`, - // `Grand total`, `Phone number`, etc. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for the + // [FormField][google.cloud.documentai.v1beta3.Document.Page.FormField] + // name. e.g. `Address`, `Email`, `Grand total`, `Phone number`, etc. Layout field_name = 1; - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for the [FormField][google.cloud.documentai.v1beta3.Document.Page.FormField] value. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for the + // [FormField][google.cloud.documentai.v1beta3.Document.Page.FormField] + // value. Layout field_value = 2; // A list of detected languages for name together with confidence. @@ -333,16 +363,18 @@ message Document { message DetectedLanguage { // The BCP-47 language code, such as "en-US" or "sr-Latn". For more // information, see - // http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. + // https://www.unicode.org/reports/tr35/#Unicode_locale_identifier. string language_code = 1; // Confidence of detected language. Range [0, 1]. float confidence = 2; } - // 1-based index for current [Page][google.cloud.documentai.v1beta3.Document.Page] in a parent [Document][google.cloud.documentai.v1beta3.Document]. - // Useful when a page is taken out of a [Document][google.cloud.documentai.v1beta3.Document] for individual - // processing. + // 1-based index for current + // [Page][google.cloud.documentai.v1beta3.Document.Page] in a parent + // [Document][google.cloud.documentai.v1beta3.Document]. Useful when a page + // is taken out of a [Document][google.cloud.documentai.v1beta3.Document] + // for individual processing. int32 page_number = 1; // Rendered image for this page. This image is preprocessed to remove any @@ -351,13 +383,15 @@ message Document { Image image = 13; // Transformation matrices that were applied to the original document image - // to produce [Page.image][google.cloud.documentai.v1beta3.Document.Page.image]. + // to produce + // [Page.image][google.cloud.documentai.v1beta3.Document.Page.image]. repeated Matrix transforms = 14; // Physical dimension of the page. Dimension dimension = 2; - // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for the page. + // [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for the + // page. Layout layout = 3; // A list of detected languages together with confidence. @@ -389,17 +423,23 @@ message Document { // A list of visually detected form fields on the page. repeated FormField form_fields = 11; + // A list of visually detected symbols on the page. + repeated Symbol symbols = 12; + // The history of this page. Provenance provenance = 16; } - // A phrase in the text that is a known entity type, such as a person, an - // organization, or location. + // An entity that could be a phrase in the text or a property that belongs to + // the document. It is a known entity type, such as a person, an organization, + // or location. message Entity { // Parsed and normalized entity value. message NormalizedValue { - // Structured entity value. Must match entity type defined in schema if - // known. If this field is present, the 'text' field is still populated. + // An optional structured entity value. + // Must match entity type defined in schema if + // known. If this field is present, the `text` field could also be + // populated. oneof structured_value { // Money value. See also: // https://github.com/googleapis/googleapis/blob/master/google/type/money.proto @@ -422,24 +462,29 @@ message Document { bool boolean_value = 6; } - // Required. Normalized entity value stored as a string. This field is populated for - // supported document type (e.g. Invoice). For some entity types, one of - // respective 'structured_value' fields may also be populated. + // Optional. An optional field to store a normalized string. + // For some entity types, one of respective `structured_value` fields may + // also be populated. Also not all the types of `structured_value` will be + // normalized. For example, some processors may not generate float + // or int normalized text by default. // + // Below are sample formats mapped to structured values. // - Money/Currency type (`money_value`) is in the ISO 4217 text format. // - Date type (`date_value`) is in the ISO 8601 text format. // - Datetime type (`datetime_value`) is in the ISO 8601 text format. - string text = 1 [(google.api.field_behavior) = REQUIRED]; + string text = 1 [(google.api.field_behavior) = OPTIONAL]; } // Optional. Provenance of the entity. - // Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text]. + // Text anchor indexing into the + // [Document.text][google.cloud.documentai.v1beta3.Document.text]. TextAnchor text_anchor = 1 [(google.api.field_behavior) = OPTIONAL]; // Entity type from a schema e.g. `Address`. string type = 2; - // Optional. Text value in the document e.g. `1600 Amphitheatre Pkwy`. + // 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. @@ -448,32 +493,35 @@ 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.v1beta3.Document.Entity]. + // Relationship between + // [Entities][google.cloud.documentai.v1beta3.Document.Entity]. message EntityRelation { // Subject entity id. string subject_id = 1; @@ -485,30 +533,39 @@ message Document { string relation = 3; } - // Text reference indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text]. + // Text reference indexing into the + // [Document.text][google.cloud.documentai.v1beta3.Document.text]. message TextAnchor { - // A text segment in the [Document.text][google.cloud.documentai.v1beta3.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.v1beta3.Document.ShardInfo.text_offset] + // A text segment in the + // [Document.text][google.cloud.documentai.v1beta3.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.v1beta3.Document.ShardInfo.text_offset] message TextSegment { - // [TextSegment][google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment] start UTF-8 char index in the [Document.text][google.cloud.documentai.v1beta3.Document.text]. + // [TextSegment][google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment] + // start UTF-8 char index in the + // [Document.text][google.cloud.documentai.v1beta3.Document.text]. int64 start_index = 1; - // [TextSegment][google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment] half open end UTF-8 char index in the + // [TextSegment][google.cloud.documentai.v1beta3.Document.TextAnchor.TextSegment] + // half open end UTF-8 char index in the // [Document.text][google.cloud.documentai.v1beta3.Document.text]. int64 end_index = 2; } - // The text segments from the [Document.text][google.cloud.documentai.v1beta3.Document.text]. + // The text segments from the + // [Document.text][google.cloud.documentai.v1beta3.Document.text]. repeated TextSegment text_segments = 1; // Contains the content of the text span so that users do - // not have to look it up in the text_segments. + // not have to look it up in the text_segments. It is always + // populated for formFields. string content = 2; } - // Referencing the visual context of the entity in the [Document.pages][google.cloud.documentai.v1beta3.Document.pages]. - // Page anchors can be cross-page, consist of multiple bounding polygons and + // Referencing the visual context of the entity in the + // [Document.pages][google.cloud.documentai.v1beta3.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. @@ -518,47 +575,66 @@ message Document { // Layout Unspecified. LAYOUT_TYPE_UNSPECIFIED = 0; - // References a [Page.blocks][google.cloud.documentai.v1beta3.Document.Page.blocks] element. + // References a + // [Page.blocks][google.cloud.documentai.v1beta3.Document.Page.blocks] + // element. BLOCK = 1; - // References a [Page.paragraphs][google.cloud.documentai.v1beta3.Document.Page.paragraphs] element. + // References a + // [Page.paragraphs][google.cloud.documentai.v1beta3.Document.Page.paragraphs] + // element. PARAGRAPH = 2; - // References a [Page.lines][google.cloud.documentai.v1beta3.Document.Page.lines] element. + // References a + // [Page.lines][google.cloud.documentai.v1beta3.Document.Page.lines] + // element. LINE = 3; - // References a [Page.tokens][google.cloud.documentai.v1beta3.Document.Page.tokens] element. + // References a + // [Page.tokens][google.cloud.documentai.v1beta3.Document.Page.tokens] + // element. TOKEN = 4; - // References a [Page.visual_elements][google.cloud.documentai.v1beta3.Document.Page.visual_elements] element. + // References a + // [Page.visual_elements][google.cloud.documentai.v1beta3.Document.Page.visual_elements] + // element. VISUAL_ELEMENT = 5; - // Refrrences a [Page.tables][google.cloud.documentai.v1beta3.Document.Page.tables] element. + // Refrrences a + // [Page.tables][google.cloud.documentai.v1beta3.Document.Page.tables] + // element. TABLE = 6; - // References a [Page.form_fields][google.cloud.documentai.v1beta3.Document.Page.form_fields] element. + // References a + // [Page.form_fields][google.cloud.documentai.v1beta3.Document.Page.form_fields] + // element. FORM_FIELD = 7; } - // Required. Index into the [Document.pages][google.cloud.documentai.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.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]; } @@ -569,15 +645,14 @@ message Document { // Structure to identify provenance relationships between annotations in // different revisions. message Provenance { - // Structure for referencing parent provenances. When an element replaces - // one of more other elements parent references identify the elements that - // are replaced. + // The parent element the current element is based on. Used for + // referencing/aligning, removal and replacement operations. message Parent { - // The index of the [Document.revisions] identifying the parent revision. + // The index of the index into current revision's parent_ids list. int32 revision = 1; - // The index of the parent revisions corresponding collection of items - // (eg. list of entities, properties within entities, etc.) + // The index of the parent item in the corresponding item list (eg. list + // of entities, properties within entities, etc.) in the parent revision. int32 index = 3; // The id of the parent provenance. @@ -586,19 +661,20 @@ message Document { // If a processor or agent does an explicit operation on existing elements. enum OperationType { - // Operation type unspecified. + // Operation type unspecified. If no operation is specified a provenance + // entry is simply used to match against a `parent`. OPERATION_TYPE_UNSPECIFIED = 0; - // Add an element. Implicit if no `parents` are set for the provenance. + // Add an element. ADD = 1; - // The element is removed. No `parents` should be set. + // Remove an element identified by `parent`. REMOVE = 2; - // Explicitly replaces the element(s) identified by `parents`. + // Replace an element identified by `parent`. REPLACE = 3; - // Element is requested for human review. + // Request human review for the element identified by `parent`. EVAL_REQUESTED = 4; // Element is reviewed and approved at human review, confidence will be @@ -664,10 +740,11 @@ 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.v1beta3.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. + // Text anchor indexing into the + // [Document.text][google.cloud.documentai.v1beta3.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; // The text that replaces the text identified in the `text_anchor`. @@ -700,22 +777,26 @@ 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.v1beta3.Document.text]. + // Placeholder. Styles for the + // [Document.text][google.cloud.documentai.v1beta3.Document.text]. repeated Style text_styles = 5; - // Visual page layout for the [Document][google.cloud.documentai.v1beta3.Document]. + // Visual page layout for the + // [Document][google.cloud.documentai.v1beta3.Document]. repeated Page pages = 6; - // A list of entities detected on [Document.text][google.cloud.documentai.v1beta3.Document.text]. For document shards, - // entities in this list may cross shard boundaries. + // A list of entities detected on + // [Document.text][google.cloud.documentai.v1beta3.Document.text]. For + // document shards, entities in this list may cross shard boundaries. repeated Entity entities = 7; - // Relationship among [Document.entities][google.cloud.documentai.v1beta3.Document.entities]. + // Placeholder. Relationship among + // [Document.entities][google.cloud.documentai.v1beta3.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 @@ -725,6 +806,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/protos/protos.d.ts b/protos/protos.d.ts index 6e5f5789d..acb31c79a 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -556,6 +556,9 @@ export namespace google { /** Page formFields */ formFields?: (google.cloud.documentai.v1.Document.Page.IFormField[]|null); + /** Page symbols */ + symbols?: (google.cloud.documentai.v1.Document.Page.ISymbol[]|null); + /** Page provenance */ provenance?: (google.cloud.documentai.v1.Document.IProvenance|null); } @@ -608,6 +611,9 @@ export namespace google { /** Page formFields. */ public formFields: google.cloud.documentai.v1.Document.Page.IFormField[]; + /** Page symbols. */ + public symbols: google.cloud.documentai.v1.Document.Page.ISymbol[]; + /** Page provenance. */ public provenance?: (google.cloud.documentai.v1.Document.IProvenance|null); @@ -1640,6 +1646,102 @@ export namespace google { } } + /** Properties of a Symbol. */ + interface ISymbol { + + /** Symbol layout */ + layout?: (google.cloud.documentai.v1.Document.Page.ILayout|null); + + /** Symbol detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1.Document.Page.IDetectedLanguage[]|null); + } + + /** Represents a Symbol. */ + class Symbol implements ISymbol { + + /** + * Constructs a new Symbol. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.Page.ISymbol); + + /** Symbol layout. */ + public layout?: (google.cloud.documentai.v1.Document.Page.ILayout|null); + + /** Symbol detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1.Document.Page.IDetectedLanguage[]; + + /** + * Creates a new Symbol instance using the specified properties. + * @param [properties] Properties to set + * @returns Symbol instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.Page.ISymbol): google.cloud.documentai.v1.Document.Page.Symbol; + + /** + * Encodes the specified Symbol message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Symbol.verify|verify} messages. + * @param message Symbol message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.Page.ISymbol, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Symbol message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Symbol.verify|verify} messages. + * @param message Symbol message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.Page.ISymbol, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Symbol message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Symbol + * @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.Symbol; + + /** + * Decodes a Symbol message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Symbol + * @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.Symbol; + + /** + * Verifies a Symbol 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 Symbol message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Symbol + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.Page.Symbol; + + /** + * Creates a plain object from a Symbol message. Also converts values to other types if specified. + * @param message Symbol + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.Page.Symbol, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Symbol to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a VisualElement. */ interface IVisualElement { @@ -15238,6 +15340,9 @@ export namespace google { /** Page formFields */ formFields?: (google.cloud.documentai.v1beta3.Document.Page.IFormField[]|null); + /** Page symbols */ + symbols?: (google.cloud.documentai.v1beta3.Document.Page.ISymbol[]|null); + /** Page provenance */ provenance?: (google.cloud.documentai.v1beta3.Document.IProvenance|null); } @@ -15290,6 +15395,9 @@ export namespace google { /** Page formFields. */ public formFields: google.cloud.documentai.v1beta3.Document.Page.IFormField[]; + /** Page symbols. */ + public symbols: google.cloud.documentai.v1beta3.Document.Page.ISymbol[]; + /** Page provenance. */ public provenance?: (google.cloud.documentai.v1beta3.Document.IProvenance|null); @@ -16322,6 +16430,102 @@ export namespace google { } } + /** Properties of a Symbol. */ + interface ISymbol { + + /** Symbol layout */ + layout?: (google.cloud.documentai.v1beta3.Document.Page.ILayout|null); + + /** Symbol detectedLanguages */ + detectedLanguages?: (google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage[]|null); + } + + /** Represents a Symbol. */ + class Symbol implements ISymbol { + + /** + * Constructs a new Symbol. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.Document.Page.ISymbol); + + /** Symbol layout. */ + public layout?: (google.cloud.documentai.v1beta3.Document.Page.ILayout|null); + + /** Symbol detectedLanguages. */ + public detectedLanguages: google.cloud.documentai.v1beta3.Document.Page.IDetectedLanguage[]; + + /** + * Creates a new Symbol instance using the specified properties. + * @param [properties] Properties to set + * @returns Symbol instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.Document.Page.ISymbol): google.cloud.documentai.v1beta3.Document.Page.Symbol; + + /** + * Encodes the specified Symbol message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Symbol.verify|verify} messages. + * @param message Symbol message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.Document.Page.ISymbol, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Symbol message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Symbol.verify|verify} messages. + * @param message Symbol message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.Document.Page.ISymbol, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Symbol message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Symbol + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.Document.Page.Symbol; + + /** + * Decodes a Symbol message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Symbol + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.Document.Page.Symbol; + + /** + * Verifies a Symbol 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 Symbol message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Symbol + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.Document.Page.Symbol; + + /** + * Creates a plain object from a Symbol message. Also converts values to other types if specified. + * @param message Symbol + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.Document.Page.Symbol, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Symbol to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Properties of a VisualElement. */ interface IVisualElement { @@ -22432,18 +22636,6 @@ export namespace google { /** Namespace api. */ namespace api { - /** FieldBehavior enum. */ - enum FieldBehavior { - FIELD_BEHAVIOR_UNSPECIFIED = 0, - OPTIONAL = 1, - REQUIRED = 2, - OUTPUT_ONLY = 3, - INPUT_ONLY = 4, - IMMUTABLE = 5, - UNORDERED_LIST = 6, - NON_EMPTY_DEFAULT = 7 - } - /** Properties of a Http. */ interface IHttp { @@ -22783,6 +22975,18 @@ export namespace google { public toJSON(): { [k: string]: any }; } + /** FieldBehavior enum. */ + enum FieldBehavior { + FIELD_BEHAVIOR_UNSPECIFIED = 0, + OPTIONAL = 1, + REQUIRED = 2, + OUTPUT_ONLY = 3, + INPUT_ONLY = 4, + IMMUTABLE = 5, + UNORDERED_LIST = 6, + NON_EMPTY_DEFAULT = 7 + } + /** Properties of a ResourceDescriptor. */ interface IResourceDescriptor { diff --git a/protos/protos.js b/protos/protos.js index e2761b092..cfa1f8eac 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -1502,6 +1502,7 @@ * @property {Array.|null} [visualElements] Page visualElements * @property {Array.|null} [tables] Page tables * @property {Array.|null} [formFields] Page formFields + * @property {Array.|null} [symbols] Page symbols * @property {google.cloud.documentai.v1.Document.IProvenance|null} [provenance] Page provenance */ @@ -1523,6 +1524,7 @@ this.visualElements = []; this.tables = []; this.formFields = []; + this.symbols = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -1633,6 +1635,14 @@ */ Page.prototype.formFields = $util.emptyArray; + /** + * Page symbols. + * @member {Array.} symbols + * @memberof google.cloud.documentai.v1.Document.Page + * @instance + */ + Page.prototype.symbols = $util.emptyArray; + /** * Page provenance. * @member {google.cloud.documentai.v1.Document.IProvenance|null|undefined} provenance @@ -1695,6 +1705,9 @@ if (message.formFields != null && message.formFields.length) for (var i = 0; i < message.formFields.length; ++i) $root.google.cloud.documentai.v1.Document.Page.FormField.encode(message.formFields[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.symbols != null && message.symbols.length) + for (var i = 0; i < message.symbols.length; ++i) + $root.google.cloud.documentai.v1.Document.Page.Symbol.encode(message.symbols[i], writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); if (message.image != null && Object.hasOwnProperty.call(message, "image")) $root.google.cloud.documentai.v1.Document.Page.Image.encode(message.image, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); if (message.transforms != null && message.transforms.length) @@ -1793,6 +1806,11 @@ message.formFields = []; message.formFields.push($root.google.cloud.documentai.v1.Document.Page.FormField.decode(reader, reader.uint32())); break; + case 12: + if (!(message.symbols && message.symbols.length)) + message.symbols = []; + message.symbols.push($root.google.cloud.documentai.v1.Document.Page.Symbol.decode(reader, reader.uint32())); + break; case 16: message.provenance = $root.google.cloud.documentai.v1.Document.Provenance.decode(reader, reader.uint32()); break; @@ -1930,6 +1948,15 @@ return "formFields." + error; } } + if (message.symbols != null && message.hasOwnProperty("symbols")) { + if (!Array.isArray(message.symbols)) + return "symbols: array expected"; + for (var i = 0; i < message.symbols.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Page.Symbol.verify(message.symbols[i]); + if (error) + return "symbols." + error; + } + } if (message.provenance != null && message.hasOwnProperty("provenance")) { var error = $root.google.cloud.documentai.v1.Document.Provenance.verify(message.provenance); if (error) @@ -2057,6 +2084,16 @@ message.formFields[i] = $root.google.cloud.documentai.v1.Document.Page.FormField.fromObject(object.formFields[i]); } } + if (object.symbols) { + if (!Array.isArray(object.symbols)) + throw TypeError(".google.cloud.documentai.v1.Document.Page.symbols: array expected"); + message.symbols = []; + for (var i = 0; i < object.symbols.length; ++i) { + if (typeof object.symbols[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.symbols: object expected"); + message.symbols[i] = $root.google.cloud.documentai.v1.Document.Page.Symbol.fromObject(object.symbols[i]); + } + } if (object.provenance != null) { if (typeof object.provenance !== "object") throw TypeError(".google.cloud.documentai.v1.Document.Page.provenance: object expected"); @@ -2087,6 +2124,7 @@ object.visualElements = []; object.tables = []; object.formFields = []; + object.symbols = []; object.transforms = []; } if (options.defaults) { @@ -2142,6 +2180,11 @@ for (var j = 0; j < message.formFields.length; ++j) object.formFields[j] = $root.google.cloud.documentai.v1.Document.Page.FormField.toObject(message.formFields[j], options); } + if (message.symbols && message.symbols.length) { + object.symbols = []; + for (var j = 0; j < message.symbols.length; ++j) + object.symbols[j] = $root.google.cloud.documentai.v1.Document.Page.Symbol.toObject(message.symbols[j], options); + } if (message.image != null && message.hasOwnProperty("image")) object.image = $root.google.cloud.documentai.v1.Document.Page.Image.toObject(message.image, options); if (message.transforms && message.transforms.length) { @@ -4546,6 +4589,242 @@ return Token; })(); + Page.Symbol = (function() { + + /** + * Properties of a Symbol. + * @memberof google.cloud.documentai.v1.Document.Page + * @interface ISymbol + * @property {google.cloud.documentai.v1.Document.Page.ILayout|null} [layout] Symbol layout + * @property {Array.|null} [detectedLanguages] Symbol detectedLanguages + */ + + /** + * Constructs a new Symbol. + * @memberof google.cloud.documentai.v1.Document.Page + * @classdesc Represents a Symbol. + * @implements ISymbol + * @constructor + * @param {google.cloud.documentai.v1.Document.Page.ISymbol=} [properties] Properties to set + */ + function Symbol(properties) { + this.detectedLanguages = []; + 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]]; + } + + /** + * Symbol layout. + * @member {google.cloud.documentai.v1.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1.Document.Page.Symbol + * @instance + */ + Symbol.prototype.layout = null; + + /** + * Symbol detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1.Document.Page.Symbol + * @instance + */ + Symbol.prototype.detectedLanguages = $util.emptyArray; + + /** + * Creates a new Symbol instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.Page.Symbol + * @static + * @param {google.cloud.documentai.v1.Document.Page.ISymbol=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.Page.Symbol} Symbol instance + */ + Symbol.create = function create(properties) { + return new Symbol(properties); + }; + + /** + * Encodes the specified Symbol message. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Symbol.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.Page.Symbol + * @static + * @param {google.cloud.documentai.v1.Document.Page.ISymbol} message Symbol message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Symbol.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.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Symbol message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.Page.Symbol.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.Symbol + * @static + * @param {google.cloud.documentai.v1.Document.Page.ISymbol} message Symbol message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Symbol.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Symbol message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.Page.Symbol + * @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.Symbol} Symbol + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Symbol.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.Symbol(); + 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: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Symbol message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.Page.Symbol + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.Page.Symbol} Symbol + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Symbol.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Symbol message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.Page.Symbol + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Symbol.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.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + return null; + }; + + /** + * Creates a Symbol message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.Page.Symbol + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.Page.Symbol} Symbol + */ + Symbol.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.Page.Symbol) + return object; + var message = new $root.google.cloud.documentai.v1.Document.Page.Symbol(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.Symbol.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.fromObject(object.layout); + } + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1.Document.Page.Symbol.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.Page.Symbol.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Symbol message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.Page.Symbol + * @static + * @param {google.cloud.documentai.v1.Document.Page.Symbol} message Symbol + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Symbol.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedLanguages = []; + if (options.defaults) + object.layout = null; + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1.Document.Page.Layout.toObject(message.layout, options); + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + return object; + }; + + /** + * Converts this Symbol to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.Page.Symbol + * @instance + * @returns {Object.} JSON object + */ + Symbol.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Symbol; + })(); + Page.VisualElement = (function() { /** @@ -38618,6 +38897,7 @@ * @property {Array.|null} [visualElements] Page visualElements * @property {Array.|null} [tables] Page tables * @property {Array.|null} [formFields] Page formFields + * @property {Array.|null} [symbols] Page symbols * @property {google.cloud.documentai.v1beta3.Document.IProvenance|null} [provenance] Page provenance */ @@ -38639,6 +38919,7 @@ this.visualElements = []; this.tables = []; this.formFields = []; + this.symbols = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -38749,6 +39030,14 @@ */ Page.prototype.formFields = $util.emptyArray; + /** + * Page symbols. + * @member {Array.} symbols + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @instance + */ + Page.prototype.symbols = $util.emptyArray; + /** * Page provenance. * @member {google.cloud.documentai.v1beta3.Document.IProvenance|null|undefined} provenance @@ -38811,6 +39100,9 @@ if (message.formFields != null && message.formFields.length) for (var i = 0; i < message.formFields.length; ++i) $root.google.cloud.documentai.v1beta3.Document.Page.FormField.encode(message.formFields[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.symbols != null && message.symbols.length) + for (var i = 0; i < message.symbols.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Page.Symbol.encode(message.symbols[i], writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); if (message.image != null && Object.hasOwnProperty.call(message, "image")) $root.google.cloud.documentai.v1beta3.Document.Page.Image.encode(message.image, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); if (message.transforms != null && message.transforms.length) @@ -38909,6 +39201,11 @@ message.formFields = []; message.formFields.push($root.google.cloud.documentai.v1beta3.Document.Page.FormField.decode(reader, reader.uint32())); break; + case 12: + if (!(message.symbols && message.symbols.length)) + message.symbols = []; + message.symbols.push($root.google.cloud.documentai.v1beta3.Document.Page.Symbol.decode(reader, reader.uint32())); + break; case 16: message.provenance = $root.google.cloud.documentai.v1beta3.Document.Provenance.decode(reader, reader.uint32()); break; @@ -39046,6 +39343,15 @@ return "formFields." + error; } } + if (message.symbols != null && message.hasOwnProperty("symbols")) { + if (!Array.isArray(message.symbols)) + return "symbols: array expected"; + for (var i = 0; i < message.symbols.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.Symbol.verify(message.symbols[i]); + if (error) + return "symbols." + error; + } + } if (message.provenance != null && message.hasOwnProperty("provenance")) { var error = $root.google.cloud.documentai.v1beta3.Document.Provenance.verify(message.provenance); if (error) @@ -39173,6 +39479,16 @@ message.formFields[i] = $root.google.cloud.documentai.v1beta3.Document.Page.FormField.fromObject(object.formFields[i]); } } + if (object.symbols) { + if (!Array.isArray(object.symbols)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.symbols: array expected"); + message.symbols = []; + for (var i = 0; i < object.symbols.length; ++i) { + if (typeof object.symbols[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.symbols: object expected"); + message.symbols[i] = $root.google.cloud.documentai.v1beta3.Document.Page.Symbol.fromObject(object.symbols[i]); + } + } if (object.provenance != null) { if (typeof object.provenance !== "object") throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.provenance: object expected"); @@ -39203,6 +39519,7 @@ object.visualElements = []; object.tables = []; object.formFields = []; + object.symbols = []; object.transforms = []; } if (options.defaults) { @@ -39258,6 +39575,11 @@ for (var j = 0; j < message.formFields.length; ++j) object.formFields[j] = $root.google.cloud.documentai.v1beta3.Document.Page.FormField.toObject(message.formFields[j], options); } + if (message.symbols && message.symbols.length) { + object.symbols = []; + for (var j = 0; j < message.symbols.length; ++j) + object.symbols[j] = $root.google.cloud.documentai.v1beta3.Document.Page.Symbol.toObject(message.symbols[j], options); + } if (message.image != null && message.hasOwnProperty("image")) object.image = $root.google.cloud.documentai.v1beta3.Document.Page.Image.toObject(message.image, options); if (message.transforms && message.transforms.length) { @@ -41662,6 +41984,242 @@ return Token; })(); + Page.Symbol = (function() { + + /** + * Properties of a Symbol. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @interface ISymbol + * @property {google.cloud.documentai.v1beta3.Document.Page.ILayout|null} [layout] Symbol layout + * @property {Array.|null} [detectedLanguages] Symbol detectedLanguages + */ + + /** + * Constructs a new Symbol. + * @memberof google.cloud.documentai.v1beta3.Document.Page + * @classdesc Represents a Symbol. + * @implements ISymbol + * @constructor + * @param {google.cloud.documentai.v1beta3.Document.Page.ISymbol=} [properties] Properties to set + */ + function Symbol(properties) { + this.detectedLanguages = []; + 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]]; + } + + /** + * Symbol layout. + * @member {google.cloud.documentai.v1beta3.Document.Page.ILayout|null|undefined} layout + * @memberof google.cloud.documentai.v1beta3.Document.Page.Symbol + * @instance + */ + Symbol.prototype.layout = null; + + /** + * Symbol detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.documentai.v1beta3.Document.Page.Symbol + * @instance + */ + Symbol.prototype.detectedLanguages = $util.emptyArray; + + /** + * Creates a new Symbol instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.Document.Page.Symbol + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.ISymbol=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.Document.Page.Symbol} Symbol instance + */ + Symbol.create = function create(properties) { + return new Symbol(properties); + }; + + /** + * Encodes the specified Symbol message. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Symbol.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.Document.Page.Symbol + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.ISymbol} message Symbol message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Symbol.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.layout != null && Object.hasOwnProperty.call(message, "layout")) + $root.google.cloud.documentai.v1beta3.Document.Page.Layout.encode(message.layout, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Symbol message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.Document.Page.Symbol.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.Symbol + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.ISymbol} message Symbol message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Symbol.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Symbol message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.Document.Page.Symbol + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.Document.Page.Symbol} Symbol + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Symbol.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.Document.Page.Symbol(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Symbol message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.Document.Page.Symbol + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.Document.Page.Symbol} Symbol + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Symbol.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Symbol message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.Document.Page.Symbol + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Symbol.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.v1beta3.Document.Page.Layout.verify(message.layout); + if (error) + return "layout." + error; + } + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + return null; + }; + + /** + * Creates a Symbol message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.Symbol + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.Document.Page.Symbol} Symbol + */ + Symbol.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.Document.Page.Symbol) + return object; + var message = new $root.google.cloud.documentai.v1beta3.Document.Page.Symbol(); + if (object.layout != null) { + if (typeof object.layout !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Symbol.layout: object expected"); + message.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.fromObject(object.layout); + } + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Symbol.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.Document.Page.Symbol.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Symbol message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.Document.Page.Symbol + * @static + * @param {google.cloud.documentai.v1beta3.Document.Page.Symbol} message Symbol + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Symbol.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedLanguages = []; + if (options.defaults) + object.layout = null; + if (message.layout != null && message.hasOwnProperty("layout")) + object.layout = $root.google.cloud.documentai.v1beta3.Document.Page.Layout.toObject(message.layout, options); + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.documentai.v1beta3.Document.Page.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + return object; + }; + + /** + * Converts this Symbol to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.Document.Page.Symbol + * @instance + * @returns {Object.} JSON object + */ + Symbol.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Symbol; + })(); + Page.VisualElement = (function() { /** @@ -56305,32 +56863,6 @@ */ var api = {}; - /** - * FieldBehavior enum. - * @name google.api.FieldBehavior - * @enum {number} - * @property {number} FIELD_BEHAVIOR_UNSPECIFIED=0 FIELD_BEHAVIOR_UNSPECIFIED value - * @property {number} OPTIONAL=1 OPTIONAL value - * @property {number} REQUIRED=2 REQUIRED value - * @property {number} OUTPUT_ONLY=3 OUTPUT_ONLY value - * @property {number} INPUT_ONLY=4 INPUT_ONLY value - * @property {number} IMMUTABLE=5 IMMUTABLE value - * @property {number} UNORDERED_LIST=6 UNORDERED_LIST value - * @property {number} NON_EMPTY_DEFAULT=7 NON_EMPTY_DEFAULT value - */ - api.FieldBehavior = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "FIELD_BEHAVIOR_UNSPECIFIED"] = 0; - values[valuesById[1] = "OPTIONAL"] = 1; - values[valuesById[2] = "REQUIRED"] = 2; - values[valuesById[3] = "OUTPUT_ONLY"] = 3; - values[valuesById[4] = "INPUT_ONLY"] = 4; - values[valuesById[5] = "IMMUTABLE"] = 5; - values[valuesById[6] = "UNORDERED_LIST"] = 6; - values[valuesById[7] = "NON_EMPTY_DEFAULT"] = 7; - return values; - })(); - api.Http = (function() { /** @@ -57235,6 +57767,32 @@ return CustomHttpPattern; })(); + /** + * FieldBehavior enum. + * @name google.api.FieldBehavior + * @enum {number} + * @property {number} FIELD_BEHAVIOR_UNSPECIFIED=0 FIELD_BEHAVIOR_UNSPECIFIED value + * @property {number} OPTIONAL=1 OPTIONAL value + * @property {number} REQUIRED=2 REQUIRED value + * @property {number} OUTPUT_ONLY=3 OUTPUT_ONLY value + * @property {number} INPUT_ONLY=4 INPUT_ONLY value + * @property {number} IMMUTABLE=5 IMMUTABLE value + * @property {number} UNORDERED_LIST=6 UNORDERED_LIST value + * @property {number} NON_EMPTY_DEFAULT=7 NON_EMPTY_DEFAULT value + */ + api.FieldBehavior = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "FIELD_BEHAVIOR_UNSPECIFIED"] = 0; + values[valuesById[1] = "OPTIONAL"] = 1; + values[valuesById[2] = "REQUIRED"] = 2; + values[valuesById[3] = "OUTPUT_ONLY"] = 3; + values[valuesById[4] = "INPUT_ONLY"] = 4; + values[valuesById[5] = "IMMUTABLE"] = 5; + values[valuesById[6] = "UNORDERED_LIST"] = 6; + values[valuesById[7] = "NON_EMPTY_DEFAULT"] = 7; + return values; + })(); + api.ResourceDescriptor = (function() { /** diff --git a/protos/protos.json b/protos/protos.json index 9ccf231fb..d24ee7e24 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -219,6 +219,11 @@ "type": "FormField", "id": 11 }, + "symbols": { + "rule": "repeated", + "type": "Symbol", + "id": 12 + }, "provenance": { "type": "Provenance", "id": 16 @@ -404,6 +409,19 @@ } } }, + "Symbol": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 2 + } + } + }, "VisualElement": { "fields": { "layout": { @@ -636,7 +654,7 @@ "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "OPTIONAL" } } } @@ -3369,6 +3387,11 @@ "type": "FormField", "id": 11 }, + "symbols": { + "rule": "repeated", + "type": "Symbol", + "id": 12 + }, "provenance": { "type": "Provenance", "id": 16 @@ -3554,6 +3577,19 @@ } } }, + "Symbol": { + "fields": { + "layout": { + "type": "Layout", + "id": 1 + }, + "detectedLanguages": { + "rule": "repeated", + "type": "DetectedLanguage", + "id": 2 + } + } + }, "VisualElement": { "fields": { "layout": { @@ -3786,7 +3822,7 @@ "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "OPTIONAL" } } } @@ -4968,24 +5004,6 @@ "cc_enable_arenas": true }, "nested": { - "fieldBehavior": { - "rule": "repeated", - "type": "google.api.FieldBehavior", - "id": 1052, - "extend": "google.protobuf.FieldOptions" - }, - "FieldBehavior": { - "values": { - "FIELD_BEHAVIOR_UNSPECIFIED": 0, - "OPTIONAL": 1, - "REQUIRED": 2, - "OUTPUT_ONLY": 3, - "INPUT_ONLY": 4, - "IMMUTABLE": 5, - "UNORDERED_LIST": 6, - "NON_EMPTY_DEFAULT": 7 - } - }, "http": { "type": "HttpRule", "id": 72295728, @@ -5073,6 +5091,24 @@ } } }, + "fieldBehavior": { + "rule": "repeated", + "type": "google.api.FieldBehavior", + "id": 1052, + "extend": "google.protobuf.FieldOptions" + }, + "FieldBehavior": { + "values": { + "FIELD_BEHAVIOR_UNSPECIFIED": 0, + "OPTIONAL": 1, + "REQUIRED": 2, + "OUTPUT_ONLY": 3, + "INPUT_ONLY": 4, + "IMMUTABLE": 5, + "UNORDERED_LIST": 6, + "NON_EMPTY_DEFAULT": 7 + } + }, "methodSignature": { "rule": "repeated", "type": "string", diff --git a/samples/generated/v1/document_processor_service.batch_process_documents.js b/samples/generated/v1/document_processor_service.batch_process_documents.js index 6651cd4d8..33e8eef0f 100644 --- a/samples/generated/v1/document_processor_service.batch_process_documents.js +++ b/samples/generated/v1/document_processor_service.batch_process_documents.js @@ -1,16 +1,21 @@ -// 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. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/samples/generated/v1/document_processor_service.process_document.js b/samples/generated/v1/document_processor_service.process_document.js index 849d86196..1ff38d5a9 100644 --- a/samples/generated/v1/document_processor_service.process_document.js +++ b/samples/generated/v1/document_processor_service.process_document.js @@ -1,16 +1,21 @@ -// 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. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/samples/generated/v1/document_processor_service.review_document.js b/samples/generated/v1/document_processor_service.review_document.js index 3ced01432..d78861aae 100644 --- a/samples/generated/v1/document_processor_service.review_document.js +++ b/samples/generated/v1/document_processor_service.review_document.js @@ -1,16 +1,21 @@ -// 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. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json b/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json new file mode 100644 index 000000000..1d4eabaf9 --- /dev/null +++ b/samples/generated/v1/snippet_metadata.google.cloud.documentai.v1.json @@ -0,0 +1,171 @@ +{ + "clientLibrary": { + "name": "nodejs-documentai", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.documentai.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_ProcessDocument_async", + "title": "DocumentProcessorService processDocument Sample", + "origin": "API_DEFINITION", + "description": " Processes a single document.", + "canonical": true, + "file": "document_processor_service.process_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ProcessDocument", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument", + "async": true, + "parameters": [ + { + "name": "inline_document", + "type": ".google.cloud.documentai.v1.Document" + }, + { + "name": "raw_document", + "type": ".google.cloud.documentai.v1.RawDocument" + }, + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "skip_human_review", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.documentai.v1.ProcessResponse", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "ProcessDocument", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_BatchProcessDocuments_async", + "title": "DocumentProcessorService batchProcessDocuments Sample", + "origin": "API_DEFINITION", + "description": " LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.", + "canonical": true, + "file": "document_processor_service.batch_process_documents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchProcessDocuments", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "input_documents", + "type": ".google.cloud.documentai.v1.BatchDocumentsInputConfig" + }, + { + "name": "document_output_config", + "type": ".google.cloud.documentai.v1.DocumentOutputConfig" + }, + { + "name": "skip_human_review", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "BatchProcessDocuments", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1_generated_DocumentProcessorService_ReviewDocument_async", + "title": "DocumentProcessorService reviewDocument Sample", + "origin": "API_DEFINITION", + "description": " Send a document for Human Review. The input document should be processed by the specified processor.", + "canonical": true, + "file": "document_processor_service.review_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReviewDocument", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument", + "async": true, + "parameters": [ + { + "name": "inline_document", + "type": ".google.cloud.documentai.v1.Document" + }, + { + "name": "human_review_config", + "type": "TYPE_STRING" + }, + { + "name": "enable_schema_validation", + "type": "TYPE_BOOL" + }, + { + "name": "priority", + "type": ".google.cloud.documentai.v1.ReviewDocumentRequest.Priority" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "ReviewDocument", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1.DocumentProcessorService" + } + } + } + } + ] +} diff --git a/samples/generated/v1beta1/document_understanding_service.batch_process_documents.js b/samples/generated/v1beta1/document_understanding_service.batch_process_documents.js index 4e9d54da9..b521d8f8f 100644 --- a/samples/generated/v1beta1/document_understanding_service.batch_process_documents.js +++ b/samples/generated/v1beta1/document_understanding_service.batch_process_documents.js @@ -1,16 +1,21 @@ -// 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. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json b/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json new file mode 100644 index 000000000..6fb76dcd0 --- /dev/null +++ b/samples/generated/v1beta1/snippet_metadata.google.cloud.documentai.v1beta1.json @@ -0,0 +1,59 @@ +{ + "clientLibrary": { + "name": "nodejs-documentai", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.documentai.v1beta1", + "version": "v1beta1" + } + ] + }, + "snippets": [ + { + "regionTag": "documentai_v1beta1_generated_DocumentUnderstandingService_BatchProcessDocuments_async", + "title": "DocumentUnderstandingService batchProcessDocuments Sample", + "origin": "API_DEFINITION", + "description": " LRO endpoint to batch process many documents.", + "canonical": true, + "file": "document_understanding_service.batch_process_documents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchProcessDocuments", + "fullName": "google.cloud.documentai.v1beta1.DocumentUnderstandingService.BatchProcessDocuments", + "async": true, + "parameters": [ + { + "name": "requests", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentUnderstandingServiceClient", + "fullName": "google.cloud.documentai.v1beta1.DocumentUnderstandingServiceClient" + }, + "method": { + "shortName": "BatchProcessDocuments", + "fullName": "google.cloud.documentai.v1beta1.DocumentUnderstandingService.BatchProcessDocuments", + "service": { + "shortName": "DocumentUnderstandingService", + "fullName": "google.cloud.documentai.v1beta1.DocumentUnderstandingService" + } + } + } + } + ] +} diff --git a/samples/generated/v1beta2/document_understanding_service.batch_process_documents.js b/samples/generated/v1beta2/document_understanding_service.batch_process_documents.js index ad7d7d1e1..8b2ab19f5 100644 --- a/samples/generated/v1beta2/document_understanding_service.batch_process_documents.js +++ b/samples/generated/v1beta2/document_understanding_service.batch_process_documents.js @@ -1,16 +1,21 @@ -// 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. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/samples/generated/v1beta2/document_understanding_service.process_document.js b/samples/generated/v1beta2/document_understanding_service.process_document.js index 5864d9937..f689731c7 100644 --- a/samples/generated/v1beta2/document_understanding_service.process_document.js +++ b/samples/generated/v1beta2/document_understanding_service.process_document.js @@ -1,16 +1,21 @@ -// 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. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json b/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json new file mode 100644 index 000000000..ad1852149 --- /dev/null +++ b/samples/generated/v1beta2/snippet_metadata.google.cloud.documentai.v1beta2.json @@ -0,0 +1,131 @@ +{ + "clientLibrary": { + "name": "nodejs-documentai", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.documentai.v1beta2", + "version": "v1beta2" + } + ] + }, + "snippets": [ + { + "regionTag": "documentai_v1beta2_generated_DocumentUnderstandingService_BatchProcessDocuments_async", + "title": "DocumentUnderstandingService batchProcessDocuments Sample", + "origin": "API_DEFINITION", + "description": " LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.", + "canonical": true, + "file": "document_understanding_service.batch_process_documents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchProcessDocuments", + "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingService.BatchProcessDocuments", + "async": true, + "parameters": [ + { + "name": "requests", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentUnderstandingServiceClient", + "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingServiceClient" + }, + "method": { + "shortName": "BatchProcessDocuments", + "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingService.BatchProcessDocuments", + "service": { + "shortName": "DocumentUnderstandingService", + "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingService" + } + } + } + }, + { + "regionTag": "documentai_v1beta2_generated_DocumentUnderstandingService_ProcessDocument_async", + "title": "DocumentUnderstandingService processDocument Sample", + "origin": "API_DEFINITION", + "description": " Processes a single document.", + "canonical": true, + "file": "document_understanding_service.process_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 93, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ProcessDocument", + "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingService.ProcessDocument", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "input_config", + "type": ".google.cloud.documentai.v1beta2.InputConfig" + }, + { + "name": "output_config", + "type": ".google.cloud.documentai.v1beta2.OutputConfig" + }, + { + "name": "document_type", + "type": "TYPE_STRING" + }, + { + "name": "table_extraction_params", + "type": ".google.cloud.documentai.v1beta2.TableExtractionParams" + }, + { + "name": "form_extraction_params", + "type": ".google.cloud.documentai.v1beta2.FormExtractionParams" + }, + { + "name": "entity_extraction_params", + "type": ".google.cloud.documentai.v1beta2.EntityExtractionParams" + }, + { + "name": "ocr_params", + "type": ".google.cloud.documentai.v1beta2.OcrParams" + }, + { + "name": "automl_params", + "type": ".google.cloud.documentai.v1beta2.AutoMlParams" + } + ], + "resultType": ".google.cloud.documentai.v1beta2.Document", + "client": { + "shortName": "DocumentUnderstandingServiceClient", + "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingServiceClient" + }, + "method": { + "shortName": "ProcessDocument", + "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingService.ProcessDocument", + "service": { + "shortName": "DocumentUnderstandingService", + "fullName": "google.cloud.documentai.v1beta2.DocumentUnderstandingService" + } + } + } + } + ] +} diff --git a/samples/generated/v1beta3/document_processor_service.batch_process_documents.js b/samples/generated/v1beta3/document_processor_service.batch_process_documents.js index 596ffb8e7..65ed20475 100644 --- a/samples/generated/v1beta3/document_processor_service.batch_process_documents.js +++ b/samples/generated/v1beta3/document_processor_service.batch_process_documents.js @@ -1,16 +1,21 @@ -// 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. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/samples/generated/v1beta3/document_processor_service.create_processor.js b/samples/generated/v1beta3/document_processor_service.create_processor.js index cedc57901..6fa2b2766 100644 --- a/samples/generated/v1beta3/document_processor_service.create_processor.js +++ b/samples/generated/v1beta3/document_processor_service.create_processor.js @@ -1,16 +1,21 @@ -// 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. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/samples/generated/v1beta3/document_processor_service.delete_processor.js b/samples/generated/v1beta3/document_processor_service.delete_processor.js index 3b20ac69a..23228e139 100644 --- a/samples/generated/v1beta3/document_processor_service.delete_processor.js +++ b/samples/generated/v1beta3/document_processor_service.delete_processor.js @@ -1,16 +1,21 @@ -// 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. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/samples/generated/v1beta3/document_processor_service.disable_processor.js b/samples/generated/v1beta3/document_processor_service.disable_processor.js index b6bbe5af0..219f687ea 100644 --- a/samples/generated/v1beta3/document_processor_service.disable_processor.js +++ b/samples/generated/v1beta3/document_processor_service.disable_processor.js @@ -1,16 +1,21 @@ -// 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. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/samples/generated/v1beta3/document_processor_service.enable_processor.js b/samples/generated/v1beta3/document_processor_service.enable_processor.js index 32f84b4da..88e78e8d9 100644 --- a/samples/generated/v1beta3/document_processor_service.enable_processor.js +++ b/samples/generated/v1beta3/document_processor_service.enable_processor.js @@ -1,16 +1,21 @@ -// 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. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js b/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js index ad17c02ad..c0c9b717e 100644 --- a/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js +++ b/samples/generated/v1beta3/document_processor_service.fetch_processor_types.js @@ -1,16 +1,21 @@ -// 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. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/samples/generated/v1beta3/document_processor_service.list_processors.js b/samples/generated/v1beta3/document_processor_service.list_processors.js index 0e7a5e8d1..cfea7fd67 100644 --- a/samples/generated/v1beta3/document_processor_service.list_processors.js +++ b/samples/generated/v1beta3/document_processor_service.list_processors.js @@ -1,16 +1,21 @@ -// 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. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/samples/generated/v1beta3/document_processor_service.process_document.js b/samples/generated/v1beta3/document_processor_service.process_document.js index 112ef1e6b..2c0d6e90f 100644 --- a/samples/generated/v1beta3/document_processor_service.process_document.js +++ b/samples/generated/v1beta3/document_processor_service.process_document.js @@ -1,16 +1,21 @@ -// 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. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/samples/generated/v1beta3/document_processor_service.review_document.js b/samples/generated/v1beta3/document_processor_service.review_document.js index fc4ee4528..fd35938f6 100644 --- a/samples/generated/v1beta3/document_processor_service.review_document.js +++ b/samples/generated/v1beta3/document_processor_service.review_document.js @@ -1,16 +1,21 @@ -// 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. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// 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'; diff --git a/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json b/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json new file mode 100644 index 000000000..fc76128ab --- /dev/null +++ b/samples/generated/v1beta3/snippet_metadata.google.cloud.documentai.v1beta3.json @@ -0,0 +1,439 @@ +{ + "clientLibrary": { + "name": "nodejs-documentai", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.documentai.v1beta3", + "version": "v1beta3" + } + ] + }, + "snippets": [ + { + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_ProcessDocument_async", + "title": "DocumentProcessorService processDocument Sample", + "origin": "API_DEFINITION", + "description": " Processes a single document.", + "canonical": true, + "file": "document_processor_service.process_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ProcessDocument", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.ProcessDocument", + "async": true, + "parameters": [ + { + "name": "inline_document", + "type": ".google.cloud.documentai.v1beta3.Document" + }, + { + "name": "raw_document", + "type": ".google.cloud.documentai.v1beta3.RawDocument" + }, + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "document", + "type": ".google.cloud.documentai.v1beta3.Document" + }, + { + "name": "skip_human_review", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.documentai.v1beta3.ProcessResponse", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "ProcessDocument", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.ProcessDocument", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_BatchProcessDocuments_async", + "title": "DocumentProcessorService batchProcessDocuments Sample", + "origin": "API_DEFINITION", + "description": " LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.", + "canonical": true, + "file": "document_processor_service.batch_process_documents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchProcessDocuments", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.BatchProcessDocuments", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "input_configs", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "output_config", + "type": ".google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig" + }, + { + "name": "input_documents", + "type": ".google.cloud.documentai.v1beta3.BatchDocumentsInputConfig" + }, + { + "name": "document_output_config", + "type": ".google.cloud.documentai.v1beta3.DocumentOutputConfig" + }, + { + "name": "skip_human_review", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "BatchProcessDocuments", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.BatchProcessDocuments", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_FetchProcessorTypes_async", + "title": "DocumentProcessorService fetchProcessorTypes Sample", + "origin": "API_DEFINITION", + "description": " Fetches processor types.", + "canonical": true, + "file": "document_processor_service.fetch_processor_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "FetchProcessorTypes", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.FetchProcessorTypes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.documentai.v1beta3.FetchProcessorTypesResponse", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "FetchProcessorTypes", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.FetchProcessorTypes", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1beta3_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.v1beta3.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.v1beta3.ListProcessorsResponse", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "ListProcessors", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.ListProcessors", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1beta3_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.v1beta3.DocumentProcessorService.CreateProcessor", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "processor", + "type": ".google.cloud.documentai.v1beta3.Processor" + } + ], + "resultType": ".google.cloud.documentai.v1beta3.Processor", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "CreateProcessor", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.CreateProcessor", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1beta3_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.v1beta3.DocumentProcessorService.DeleteProcessor", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "DeleteProcessor", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.DeleteProcessor", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1beta3_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.v1beta3.DocumentProcessorService.EnableProcessor", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "EnableProcessor", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.EnableProcessor", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1beta3_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.v1beta3.DocumentProcessorService.DisableProcessor", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "DisableProcessor", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.DisableProcessor", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } + }, + { + "regionTag": "documentai_v1beta3_generated_DocumentProcessorService_ReviewDocument_async", + "title": "DocumentProcessorService reviewDocument Sample", + "origin": "API_DEFINITION", + "description": " Send a document for Human Review. The input document should be processed by the specified processor.", + "canonical": true, + "file": "document_processor_service.review_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReviewDocument", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.ReviewDocument", + "async": true, + "parameters": [ + { + "name": "inline_document", + "type": ".google.cloud.documentai.v1beta3.Document" + }, + { + "name": "human_review_config", + "type": "TYPE_STRING" + }, + { + "name": "document", + "type": ".google.cloud.documentai.v1beta3.Document" + }, + { + "name": "enable_schema_validation", + "type": "TYPE_BOOL" + }, + { + "name": "priority", + "type": ".google.cloud.documentai.v1beta3.ReviewDocumentRequest.Priority" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentProcessorServiceClient", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorServiceClient" + }, + "method": { + "shortName": "ReviewDocument", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService.ReviewDocument", + "service": { + "shortName": "DocumentProcessorService", + "fullName": "google.cloud.documentai.v1beta3.DocumentProcessorService" + } + } + } + } + ] +} diff --git a/src/v1/document_processor_service_client.ts b/src/v1/document_processor_service_client.ts index 794cc921c..038d6c11d 100644 --- a/src/v1/document_processor_service_client.ts +++ b/src/v1/document_processor_service_client.ts @@ -844,9 +844,8 @@ export class DocumentProcessorServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.documentProcessorServiceStub!.then(stub => { + if (this.documentProcessorServiceStub && !this._terminated) { + return this.documentProcessorServiceStub.then(stub => { this._terminated = true; stub.close(); this.operationsClient.close(); diff --git a/src/v1beta1/document_understanding_service_client.ts b/src/v1beta1/document_understanding_service_client.ts index 4135b2201..238a9b913 100644 --- a/src/v1beta1/document_understanding_service_client.ts +++ b/src/v1beta1/document_understanding_service_client.ts @@ -468,9 +468,8 @@ export class DocumentUnderstandingServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.documentUnderstandingServiceStub!.then(stub => { + if (this.documentUnderstandingServiceStub && !this._terminated) { + return this.documentUnderstandingServiceStub.then(stub => { this._terminated = true; stub.close(); this.operationsClient.close(); diff --git a/src/v1beta2/document_understanding_service_client.ts b/src/v1beta2/document_understanding_service_client.ts index 8d24e78da..24c3cd2fa 100644 --- a/src/v1beta2/document_understanding_service_client.ts +++ b/src/v1beta2/document_understanding_service_client.ts @@ -598,9 +598,8 @@ export class DocumentUnderstandingServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.documentUnderstandingServiceStub!.then(stub => { + if (this.documentUnderstandingServiceStub && !this._terminated) { + return this.documentUnderstandingServiceStub.then(stub => { this._terminated = true; stub.close(); this.operationsClient.close(); diff --git a/src/v1beta3/document_processor_service_client.ts b/src/v1beta3/document_processor_service_client.ts index d9f6bcf37..0d5704520 100644 --- a/src/v1beta3/document_processor_service_client.ts +++ b/src/v1beta3/document_processor_service_client.ts @@ -1844,9 +1844,8 @@ export class DocumentProcessorServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.documentProcessorServiceStub!.then(stub => { + if (this.documentProcessorServiceStub && !this._terminated) { + return this.documentProcessorServiceStub.then(stub => { this._terminated = true; stub.close(); this.operationsClient.close(); diff --git a/test/gapic_document_processor_service_v1.ts b/test/gapic_document_processor_service_v1.ts index 4c9a793a3..79ba37f22 100644 --- a/test/gapic_document_processor_service_v1.ts +++ b/test/gapic_document_processor_service_v1.ts @@ -128,13 +128,29 @@ describe('v1.DocumentProcessorServiceClient', () => { assert(client.documentProcessorServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - client.close(); + client.initialize(); + assert(client.documentProcessorServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = + new documentprocessorserviceModule.v1.DocumentProcessorServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.documentProcessorServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { @@ -285,6 +301,23 @@ describe('v1.DocumentProcessorServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes processDocument 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.ProcessRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.processDocument(request), expectedError); + }); }); describe('batchProcessDocuments', () => { diff --git a/test/gapic_document_processor_service_v1beta3.ts b/test/gapic_document_processor_service_v1beta3.ts index 377013c94..438415632 100644 --- a/test/gapic_document_processor_service_v1beta3.ts +++ b/test/gapic_document_processor_service_v1beta3.ts @@ -196,7 +196,7 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { assert(client.documentProcessorServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( { @@ -204,7 +204,25 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { projectId: 'bogus', } ); - client.close(); + client.initialize(); + assert(client.documentProcessorServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual(client.documentProcessorServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { @@ -365,6 +383,25 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes processDocument with closed client', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.ProcessRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.processDocument(request), expectedError); + }); }); describe('fetchProcessorTypes', () => { @@ -486,6 +523,25 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes fetchProcessorTypes with closed client', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.FetchProcessorTypesRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.fetchProcessorTypes(request), expectedError); + }); }); describe('createProcessor', () => { @@ -606,6 +662,25 @@ describe('v1beta3.DocumentProcessorServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes createProcessor with closed client', async () => { + const client = + new documentprocessorserviceModule.v1beta3.DocumentProcessorServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta3.CreateProcessorRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createProcessor(request), expectedError); + }); }); describe('batchProcessDocuments', () => { diff --git a/test/gapic_document_understanding_service_v1beta1.ts b/test/gapic_document_understanding_service_v1beta1.ts index 90b5ea5dd..521250e72 100644 --- a/test/gapic_document_understanding_service_v1beta1.ts +++ b/test/gapic_document_understanding_service_v1beta1.ts @@ -124,7 +124,7 @@ describe('v1beta1.DocumentUnderstandingServiceClient', () => { assert(client.documentUnderstandingServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( { @@ -132,7 +132,25 @@ describe('v1beta1.DocumentUnderstandingServiceClient', () => { projectId: 'bogus', } ); - client.close(); + client.initialize(); + assert(client.documentUnderstandingServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = + new documentunderstandingserviceModule.v1beta1.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual(client.documentUnderstandingServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { diff --git a/test/gapic_document_understanding_service_v1beta2.ts b/test/gapic_document_understanding_service_v1beta2.ts index c277620b8..e92cfd7d3 100644 --- a/test/gapic_document_understanding_service_v1beta2.ts +++ b/test/gapic_document_understanding_service_v1beta2.ts @@ -133,7 +133,7 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { assert(client.documentUnderstandingServiceStub); }); - it('has close method', () => { + it('has close method for the initialized client', done => { const client = new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( { @@ -141,7 +141,25 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { projectId: 'bogus', } ); - client.close(); + client.initialize(); + assert(client.documentUnderstandingServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = + new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + assert.strictEqual(client.documentUnderstandingServiceStub, undefined); + client.close().then(() => { + done(); + }); }); it('has getProjectId method', async () => { @@ -302,6 +320,25 @@ describe('v1beta2.DocumentUnderstandingServiceClient', () => { .calledWith(request, expectedOptions, undefined) ); }); + + it('invokes processDocument with closed client', async () => { + const client = + new documentunderstandingserviceModule.v1beta2.DocumentUnderstandingServiceClient( + { + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + } + ); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.documentai.v1beta2.ProcessDocumentRequest() + ); + request.parent = ''; + const expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.processDocument(request), expectedError); + }); }); describe('batchProcessDocuments', () => {