diff --git a/packages/google-cloud-contentwarehouse/protos/google/cloud/documentai/v1/document.proto b/packages/google-cloud-contentwarehouse/protos/google/cloud/documentai/v1/document.proto index f476f0501e7..74184552a92 100644 --- a/packages/google-cloud-contentwarehouse/protos/google/cloud/documentai/v1/document.proto +++ b/packages/google-cloud-contentwarehouse/protos/google/cloud/documentai/v1/document.proto @@ -893,6 +893,160 @@ message Document { repeated Provenance provenance = 3 [deprecated = true]; } + // Represents the parsed layout of a document as a collection of blocks that + // the document is divided into. + message DocumentLayout { + // Represents a block. A block could be one of the various types (text, + // table, list) supported. + message DocumentLayoutBlock { + // Represents where the block starts and ends in the document. + message LayoutPageSpan { + // Page where block starts in the document. + int32 page_start = 1; + + // Page where block ends in the document. + int32 page_end = 2; + } + + // Represents a text type block. + message LayoutTextBlock { + // Text content stored in the block. + string text = 1; + + // Type of the text in the block. Available options are: `paragraph`, + // `subtitle`, `heading-1`, `heading-2`, `heading-3`, `heading-4`, + // `heading-5`, `header`, `footer`. + string type = 2; + + // A text block could further have child blocks. + // Repeated blocks support further hierarchies and nested blocks. + repeated DocumentLayoutBlock blocks = 3; + } + + // Represents a table type block. + message LayoutTableBlock { + // Header rows at the top of the table. + repeated LayoutTableRow header_rows = 1; + + // Body rows containing main table content. + repeated LayoutTableRow body_rows = 2; + + // Table caption/title. + string caption = 3; + } + + // Represents a row in a table. + message LayoutTableRow { + // A table row is a list of table cells. + repeated LayoutTableCell cells = 1; + } + + // Represents a cell in a table row. + message LayoutTableCell { + // A table cell is a list of blocks. + // Repeated blocks support further hierarchies and nested blocks. + repeated DocumentLayoutBlock blocks = 1; + + // How many rows this cell spans. + int32 row_span = 2; + + // How many columns this cell spans. + int32 col_span = 3; + } + + // Represents a list type block. + message LayoutListBlock { + // List entries that constitute a list block. + repeated LayoutListEntry list_entries = 1; + + // Type of the list_entries (if exist). Available options are `ordered` + // and `unordered`. + string type = 2; + } + + // Represents an entry in the list. + message LayoutListEntry { + // A list entry is a list of blocks. + // Repeated blocks support further hierarchies and nested blocks. + repeated DocumentLayoutBlock blocks = 1; + } + + oneof block { + // Block consisting of text content. + LayoutTextBlock text_block = 2; + + // Block consisting of table content/structure. + LayoutTableBlock table_block = 3; + + // Block consisting of list content/structure. + LayoutListBlock list_block = 4; + } + + // ID of the block. + string block_id = 1; + + // Page span of the block. + LayoutPageSpan page_span = 5; + } + + // List of blocks in the document. + repeated DocumentLayoutBlock blocks = 1; + } + + // Represents the chunks that the document is divided into. + message ChunkedDocument { + // Represents a chunk. + message Chunk { + // Represents where the chunk starts and ends in the document. + message ChunkPageSpan { + // Page where chunk starts in the document. + int32 page_start = 1; + + // Page where chunk ends in the document. + int32 page_end = 2; + } + + // Represents the page header associated with the chunk. + message ChunkPageHeader { + // Header in text format. + string text = 1; + + // Page span of the header. + ChunkPageSpan page_span = 2; + } + + // Represents the page footer associated with the chunk. + message ChunkPageFooter { + // Footer in text format. + string text = 1; + + // Page span of the footer. + ChunkPageSpan page_span = 2; + } + + // ID of the chunk. + string chunk_id = 1; + + // Unused. + repeated string source_block_ids = 2; + + // Text content of the chunk. + string content = 3; + + // Page span of the chunk. + ChunkPageSpan page_span = 4; + + // Page headers associated with the chunk. + repeated ChunkPageHeader page_headers = 5; + + // Page footers associated with the chunk. + repeated ChunkPageFooter page_footers = 6; + } + + // List of chunks. + repeated Chunk chunks = 1; + } + // Original source document from the user. oneof source { // Optional. Currently supports Google Cloud Storage URI of the form @@ -944,4 +1098,10 @@ message Document { // Placeholder. Revision history of this document. repeated Revision revisions = 13; + + // Parsed layout of the document. + DocumentLayout document_layout = 17; + + // Document chunked based on chunking config. + ChunkedDocument chunked_document = 18; } diff --git a/packages/google-cloud-contentwarehouse/protos/google/cloud/documentai/v1/document_processor_service.proto b/packages/google-cloud-contentwarehouse/protos/google/cloud/documentai/v1/document_processor_service.proto index 102f5bae37e..a5571cc1879 100644 --- a/packages/google-cloud-contentwarehouse/protos/google/cloud/documentai/v1/document_processor_service.proto +++ b/packages/google-cloud-contentwarehouse/protos/google/cloud/documentai/v1/document_processor_service.proto @@ -328,6 +328,23 @@ service DocumentProcessorService { // Options for Process API message ProcessOptions { + // Serving config for layout parser processor. + message LayoutConfig { + // Serving config for chunking. + message ChunkingConfig { + // Optional. The chunk sizes to use when splitting documents, in order of + // level. + int32 chunk_size = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Whether or not to include ancestor headings when splitting. + bool include_ancestor_headings = 2 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. Config for chunking in layout parser processor. + ChunkingConfig chunking_config = 1 [(google.api.field_behavior) = OPTIONAL]; + } + // A list of individual page numbers. message IndividualPageSelector { // Optional. Indices of the pages (starting from 1). @@ -356,6 +373,10 @@ message ProcessOptions { // Returns error if set on other processor types. OcrConfig ocr_config = 1; + // Optional. Only applicable to `LAYOUT_PARSER_PROCESSOR`. + // Returns error if set on other processor types. + LayoutConfig layout_config = 9 [(google.api.field_behavior) = OPTIONAL]; + // Optional. Override the schema of the // [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]. Will // return an Invalid Argument error if this field is set when the underlying diff --git a/packages/google-cloud-contentwarehouse/protos/google/cloud/documentai/v1/processor.proto b/packages/google-cloud-contentwarehouse/protos/google/cloud/documentai/v1/processor.proto index 03d58269085..6b86a0ab327 100644 --- a/packages/google-cloud-contentwarehouse/protos/google/cloud/documentai/v1/processor.proto +++ b/packages/google-cloud-contentwarehouse/protos/google/cloud/documentai/v1/processor.proto @@ -128,6 +128,12 @@ message ProcessorVersion { // Output only. The model type of this processor version. ModelType model_type = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Reserved for future use. + bool satisfies_pzs = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Reserved for future use. + bool satisfies_pzi = 17 [(google.api.field_behavior) = OUTPUT_ONLY]; } // Contains the alias and the aliased resource name of processor version. @@ -224,4 +230,10 @@ message Processor { // The [KMS key](https://cloud.google.com/security-key-management) used for // encryption and decryption in CMEK scenarios. string kms_key_name = 8; + + // Output only. Reserved for future use. + bool satisfies_pzs = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Reserved for future use. + bool satisfies_pzi = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; } diff --git a/packages/google-cloud-contentwarehouse/protos/protos.d.ts b/packages/google-cloud-contentwarehouse/protos/protos.d.ts index f18b6cdaf63..950b5f54d2e 100644 --- a/packages/google-cloud-contentwarehouse/protos/protos.d.ts +++ b/packages/google-cloud-contentwarehouse/protos/protos.d.ts @@ -13387,6 +13387,12 @@ export namespace google { /** Document revisions */ revisions?: (google.cloud.documentai.v1.Document.IRevision[]|null); + + /** Document documentLayout */ + documentLayout?: (google.cloud.documentai.v1.Document.IDocumentLayout|null); + + /** Document chunkedDocument */ + chunkedDocument?: (google.cloud.documentai.v1.Document.IChunkedDocument|null); } /** Represents a Document. */ @@ -13434,6 +13440,12 @@ export namespace google { /** Document revisions. */ public revisions: google.cloud.documentai.v1.Document.IRevision[]; + /** Document documentLayout. */ + public documentLayout?: (google.cloud.documentai.v1.Document.IDocumentLayout|null); + + /** Document chunkedDocument. */ + public chunkedDocument?: (google.cloud.documentai.v1.Document.IChunkedDocument|null); + /** Document source. */ public source?: ("uri"|"content"); @@ -17820,6 +17832,1499 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } + + /** Properties of a DocumentLayout. */ + interface IDocumentLayout { + + /** DocumentLayout blocks */ + blocks?: (google.cloud.documentai.v1.Document.DocumentLayout.IDocumentLayoutBlock[]|null); + } + + /** Represents a DocumentLayout. */ + class DocumentLayout implements IDocumentLayout { + + /** + * Constructs a new DocumentLayout. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.IDocumentLayout); + + /** DocumentLayout blocks. */ + public blocks: google.cloud.documentai.v1.Document.DocumentLayout.IDocumentLayoutBlock[]; + + /** + * Creates a new DocumentLayout instance using the specified properties. + * @param [properties] Properties to set + * @returns DocumentLayout instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.IDocumentLayout): google.cloud.documentai.v1.Document.DocumentLayout; + + /** + * Encodes the specified DocumentLayout message. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.verify|verify} messages. + * @param message DocumentLayout message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.IDocumentLayout, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DocumentLayout message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.verify|verify} messages. + * @param message DocumentLayout message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.IDocumentLayout, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DocumentLayout message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DocumentLayout + * @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.DocumentLayout; + + /** + * Decodes a DocumentLayout message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DocumentLayout + * @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.DocumentLayout; + + /** + * Verifies a DocumentLayout 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 DocumentLayout message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DocumentLayout + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.DocumentLayout; + + /** + * Creates a plain object from a DocumentLayout message. Also converts values to other types if specified. + * @param message DocumentLayout + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.DocumentLayout, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DocumentLayout to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DocumentLayout + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace DocumentLayout { + + /** Properties of a DocumentLayoutBlock. */ + interface IDocumentLayoutBlock { + + /** DocumentLayoutBlock textBlock */ + textBlock?: (google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTextBlock|null); + + /** DocumentLayoutBlock tableBlock */ + tableBlock?: (google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableBlock|null); + + /** DocumentLayoutBlock listBlock */ + listBlock?: (google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutListBlock|null); + + /** DocumentLayoutBlock blockId */ + blockId?: (string|null); + + /** DocumentLayoutBlock pageSpan */ + pageSpan?: (google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutPageSpan|null); + } + + /** Represents a DocumentLayoutBlock. */ + class DocumentLayoutBlock implements IDocumentLayoutBlock { + + /** + * Constructs a new DocumentLayoutBlock. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.DocumentLayout.IDocumentLayoutBlock); + + /** DocumentLayoutBlock textBlock. */ + public textBlock?: (google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTextBlock|null); + + /** DocumentLayoutBlock tableBlock. */ + public tableBlock?: (google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableBlock|null); + + /** DocumentLayoutBlock listBlock. */ + public listBlock?: (google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutListBlock|null); + + /** DocumentLayoutBlock blockId. */ + public blockId: string; + + /** DocumentLayoutBlock pageSpan. */ + public pageSpan?: (google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutPageSpan|null); + + /** DocumentLayoutBlock block. */ + public block?: ("textBlock"|"tableBlock"|"listBlock"); + + /** + * Creates a new DocumentLayoutBlock instance using the specified properties. + * @param [properties] Properties to set + * @returns DocumentLayoutBlock instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.DocumentLayout.IDocumentLayoutBlock): google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock; + + /** + * Encodes the specified DocumentLayoutBlock message. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.verify|verify} messages. + * @param message DocumentLayoutBlock message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.DocumentLayout.IDocumentLayoutBlock, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DocumentLayoutBlock message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.verify|verify} messages. + * @param message DocumentLayoutBlock message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.DocumentLayout.IDocumentLayoutBlock, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DocumentLayoutBlock message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DocumentLayoutBlock + * @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.DocumentLayout.DocumentLayoutBlock; + + /** + * Decodes a DocumentLayoutBlock message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DocumentLayoutBlock + * @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.DocumentLayout.DocumentLayoutBlock; + + /** + * Verifies a DocumentLayoutBlock 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 DocumentLayoutBlock message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DocumentLayoutBlock + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock; + + /** + * Creates a plain object from a DocumentLayoutBlock message. Also converts values to other types if specified. + * @param message DocumentLayoutBlock + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DocumentLayoutBlock to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DocumentLayoutBlock + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace DocumentLayoutBlock { + + /** Properties of a LayoutPageSpan. */ + interface ILayoutPageSpan { + + /** LayoutPageSpan pageStart */ + pageStart?: (number|null); + + /** LayoutPageSpan pageEnd */ + pageEnd?: (number|null); + } + + /** Represents a LayoutPageSpan. */ + class LayoutPageSpan implements ILayoutPageSpan { + + /** + * Constructs a new LayoutPageSpan. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutPageSpan); + + /** LayoutPageSpan pageStart. */ + public pageStart: number; + + /** LayoutPageSpan pageEnd. */ + public pageEnd: number; + + /** + * Creates a new LayoutPageSpan instance using the specified properties. + * @param [properties] Properties to set + * @returns LayoutPageSpan instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutPageSpan): google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan; + + /** + * Encodes the specified LayoutPageSpan message. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan.verify|verify} messages. + * @param message LayoutPageSpan message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutPageSpan, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LayoutPageSpan message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan.verify|verify} messages. + * @param message LayoutPageSpan message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutPageSpan, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LayoutPageSpan message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LayoutPageSpan + * @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.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan; + + /** + * Decodes a LayoutPageSpan message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LayoutPageSpan + * @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.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan; + + /** + * Verifies a LayoutPageSpan 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 LayoutPageSpan message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LayoutPageSpan + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan; + + /** + * Creates a plain object from a LayoutPageSpan message. Also converts values to other types if specified. + * @param message LayoutPageSpan + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LayoutPageSpan to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LayoutPageSpan + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a LayoutTextBlock. */ + interface ILayoutTextBlock { + + /** LayoutTextBlock text */ + text?: (string|null); + + /** LayoutTextBlock type */ + type?: (string|null); + + /** LayoutTextBlock blocks */ + blocks?: (google.cloud.documentai.v1.Document.DocumentLayout.IDocumentLayoutBlock[]|null); + } + + /** Represents a LayoutTextBlock. */ + class LayoutTextBlock implements ILayoutTextBlock { + + /** + * Constructs a new LayoutTextBlock. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTextBlock); + + /** LayoutTextBlock text. */ + public text: string; + + /** LayoutTextBlock type. */ + public type: string; + + /** LayoutTextBlock blocks. */ + public blocks: google.cloud.documentai.v1.Document.DocumentLayout.IDocumentLayoutBlock[]; + + /** + * Creates a new LayoutTextBlock instance using the specified properties. + * @param [properties] Properties to set + * @returns LayoutTextBlock instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTextBlock): google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock; + + /** + * Encodes the specified LayoutTextBlock message. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock.verify|verify} messages. + * @param message LayoutTextBlock message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTextBlock, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LayoutTextBlock message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock.verify|verify} messages. + * @param message LayoutTextBlock message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTextBlock, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LayoutTextBlock message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LayoutTextBlock + * @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.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock; + + /** + * Decodes a LayoutTextBlock message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LayoutTextBlock + * @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.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock; + + /** + * Verifies a LayoutTextBlock 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 LayoutTextBlock message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LayoutTextBlock + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock; + + /** + * Creates a plain object from a LayoutTextBlock message. Also converts values to other types if specified. + * @param message LayoutTextBlock + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LayoutTextBlock to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LayoutTextBlock + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a LayoutTableBlock. */ + interface ILayoutTableBlock { + + /** LayoutTableBlock headerRows */ + headerRows?: (google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableRow[]|null); + + /** LayoutTableBlock bodyRows */ + bodyRows?: (google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableRow[]|null); + + /** LayoutTableBlock caption */ + caption?: (string|null); + } + + /** Represents a LayoutTableBlock. */ + class LayoutTableBlock implements ILayoutTableBlock { + + /** + * Constructs a new LayoutTableBlock. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableBlock); + + /** LayoutTableBlock headerRows. */ + public headerRows: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableRow[]; + + /** LayoutTableBlock bodyRows. */ + public bodyRows: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableRow[]; + + /** LayoutTableBlock caption. */ + public caption: string; + + /** + * Creates a new LayoutTableBlock instance using the specified properties. + * @param [properties] Properties to set + * @returns LayoutTableBlock instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableBlock): google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock; + + /** + * Encodes the specified LayoutTableBlock message. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock.verify|verify} messages. + * @param message LayoutTableBlock message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableBlock, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LayoutTableBlock message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock.verify|verify} messages. + * @param message LayoutTableBlock message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableBlock, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LayoutTableBlock message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LayoutTableBlock + * @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.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock; + + /** + * Decodes a LayoutTableBlock message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LayoutTableBlock + * @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.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock; + + /** + * Verifies a LayoutTableBlock 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 LayoutTableBlock message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LayoutTableBlock + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock; + + /** + * Creates a plain object from a LayoutTableBlock message. Also converts values to other types if specified. + * @param message LayoutTableBlock + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LayoutTableBlock to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LayoutTableBlock + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a LayoutTableRow. */ + interface ILayoutTableRow { + + /** LayoutTableRow cells */ + cells?: (google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableCell[]|null); + } + + /** Represents a LayoutTableRow. */ + class LayoutTableRow implements ILayoutTableRow { + + /** + * Constructs a new LayoutTableRow. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableRow); + + /** LayoutTableRow cells. */ + public cells: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableCell[]; + + /** + * Creates a new LayoutTableRow instance using the specified properties. + * @param [properties] Properties to set + * @returns LayoutTableRow instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableRow): google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow; + + /** + * Encodes the specified LayoutTableRow message. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow.verify|verify} messages. + * @param message LayoutTableRow message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableRow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LayoutTableRow message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow.verify|verify} messages. + * @param message LayoutTableRow message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableRow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LayoutTableRow message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LayoutTableRow + * @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.DocumentLayout.DocumentLayoutBlock.LayoutTableRow; + + /** + * Decodes a LayoutTableRow message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LayoutTableRow + * @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.DocumentLayout.DocumentLayoutBlock.LayoutTableRow; + + /** + * Verifies a LayoutTableRow 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 LayoutTableRow message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LayoutTableRow + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow; + + /** + * Creates a plain object from a LayoutTableRow message. Also converts values to other types if specified. + * @param message LayoutTableRow + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LayoutTableRow to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LayoutTableRow + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a LayoutTableCell. */ + interface ILayoutTableCell { + + /** LayoutTableCell blocks */ + blocks?: (google.cloud.documentai.v1.Document.DocumentLayout.IDocumentLayoutBlock[]|null); + + /** LayoutTableCell rowSpan */ + rowSpan?: (number|null); + + /** LayoutTableCell colSpan */ + colSpan?: (number|null); + } + + /** Represents a LayoutTableCell. */ + class LayoutTableCell implements ILayoutTableCell { + + /** + * Constructs a new LayoutTableCell. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableCell); + + /** LayoutTableCell blocks. */ + public blocks: google.cloud.documentai.v1.Document.DocumentLayout.IDocumentLayoutBlock[]; + + /** LayoutTableCell rowSpan. */ + public rowSpan: number; + + /** LayoutTableCell colSpan. */ + public colSpan: number; + + /** + * Creates a new LayoutTableCell instance using the specified properties. + * @param [properties] Properties to set + * @returns LayoutTableCell instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableCell): google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell; + + /** + * Encodes the specified LayoutTableCell message. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell.verify|verify} messages. + * @param message LayoutTableCell message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableCell, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LayoutTableCell message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell.verify|verify} messages. + * @param message LayoutTableCell message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableCell, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LayoutTableCell message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LayoutTableCell + * @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.DocumentLayout.DocumentLayoutBlock.LayoutTableCell; + + /** + * Decodes a LayoutTableCell message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LayoutTableCell + * @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.DocumentLayout.DocumentLayoutBlock.LayoutTableCell; + + /** + * Verifies a LayoutTableCell 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 LayoutTableCell message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LayoutTableCell + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell; + + /** + * Creates a plain object from a LayoutTableCell message. Also converts values to other types if specified. + * @param message LayoutTableCell + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LayoutTableCell to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LayoutTableCell + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a LayoutListBlock. */ + interface ILayoutListBlock { + + /** LayoutListBlock listEntries */ + listEntries?: (google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutListEntry[]|null); + + /** LayoutListBlock type */ + type?: (string|null); + } + + /** Represents a LayoutListBlock. */ + class LayoutListBlock implements ILayoutListBlock { + + /** + * Constructs a new LayoutListBlock. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutListBlock); + + /** LayoutListBlock listEntries. */ + public listEntries: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutListEntry[]; + + /** LayoutListBlock type. */ + public type: string; + + /** + * Creates a new LayoutListBlock instance using the specified properties. + * @param [properties] Properties to set + * @returns LayoutListBlock instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutListBlock): google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock; + + /** + * Encodes the specified LayoutListBlock message. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock.verify|verify} messages. + * @param message LayoutListBlock message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutListBlock, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LayoutListBlock message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock.verify|verify} messages. + * @param message LayoutListBlock message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutListBlock, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LayoutListBlock message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LayoutListBlock + * @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.DocumentLayout.DocumentLayoutBlock.LayoutListBlock; + + /** + * Decodes a LayoutListBlock message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LayoutListBlock + * @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.DocumentLayout.DocumentLayoutBlock.LayoutListBlock; + + /** + * Verifies a LayoutListBlock 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 LayoutListBlock message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LayoutListBlock + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock; + + /** + * Creates a plain object from a LayoutListBlock message. Also converts values to other types if specified. + * @param message LayoutListBlock + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LayoutListBlock to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LayoutListBlock + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a LayoutListEntry. */ + interface ILayoutListEntry { + + /** LayoutListEntry blocks */ + blocks?: (google.cloud.documentai.v1.Document.DocumentLayout.IDocumentLayoutBlock[]|null); + } + + /** Represents a LayoutListEntry. */ + class LayoutListEntry implements ILayoutListEntry { + + /** + * Constructs a new LayoutListEntry. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutListEntry); + + /** LayoutListEntry blocks. */ + public blocks: google.cloud.documentai.v1.Document.DocumentLayout.IDocumentLayoutBlock[]; + + /** + * Creates a new LayoutListEntry instance using the specified properties. + * @param [properties] Properties to set + * @returns LayoutListEntry instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutListEntry): google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry; + + /** + * Encodes the specified LayoutListEntry message. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry.verify|verify} messages. + * @param message LayoutListEntry message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutListEntry, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LayoutListEntry message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry.verify|verify} messages. + * @param message LayoutListEntry message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutListEntry, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LayoutListEntry message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LayoutListEntry + * @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.DocumentLayout.DocumentLayoutBlock.LayoutListEntry; + + /** + * Decodes a LayoutListEntry message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LayoutListEntry + * @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.DocumentLayout.DocumentLayoutBlock.LayoutListEntry; + + /** + * Verifies a LayoutListEntry 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 LayoutListEntry message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LayoutListEntry + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry; + + /** + * Creates a plain object from a LayoutListEntry message. Also converts values to other types if specified. + * @param message LayoutListEntry + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LayoutListEntry to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LayoutListEntry + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + } + + /** Properties of a ChunkedDocument. */ + interface IChunkedDocument { + + /** ChunkedDocument chunks */ + chunks?: (google.cloud.documentai.v1.Document.ChunkedDocument.IChunk[]|null); + } + + /** Represents a ChunkedDocument. */ + class ChunkedDocument implements IChunkedDocument { + + /** + * Constructs a new ChunkedDocument. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.IChunkedDocument); + + /** ChunkedDocument chunks. */ + public chunks: google.cloud.documentai.v1.Document.ChunkedDocument.IChunk[]; + + /** + * Creates a new ChunkedDocument instance using the specified properties. + * @param [properties] Properties to set + * @returns ChunkedDocument instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.IChunkedDocument): google.cloud.documentai.v1.Document.ChunkedDocument; + + /** + * Encodes the specified ChunkedDocument message. Does not implicitly {@link google.cloud.documentai.v1.Document.ChunkedDocument.verify|verify} messages. + * @param message ChunkedDocument message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.IChunkedDocument, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ChunkedDocument message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.ChunkedDocument.verify|verify} messages. + * @param message ChunkedDocument message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.IChunkedDocument, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ChunkedDocument message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ChunkedDocument + * @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.ChunkedDocument; + + /** + * Decodes a ChunkedDocument message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ChunkedDocument + * @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.ChunkedDocument; + + /** + * Verifies a ChunkedDocument 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 ChunkedDocument message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ChunkedDocument + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.ChunkedDocument; + + /** + * Creates a plain object from a ChunkedDocument message. Also converts values to other types if specified. + * @param message ChunkedDocument + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.ChunkedDocument, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ChunkedDocument to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ChunkedDocument + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ChunkedDocument { + + /** Properties of a Chunk. */ + interface IChunk { + + /** Chunk chunkId */ + chunkId?: (string|null); + + /** Chunk sourceBlockIds */ + sourceBlockIds?: (string[]|null); + + /** Chunk content */ + content?: (string|null); + + /** Chunk pageSpan */ + pageSpan?: (google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageSpan|null); + + /** Chunk pageHeaders */ + pageHeaders?: (google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageHeader[]|null); + + /** Chunk pageFooters */ + pageFooters?: (google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageFooter[]|null); + } + + /** Represents a Chunk. */ + class Chunk implements IChunk { + + /** + * Constructs a new Chunk. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.ChunkedDocument.IChunk); + + /** Chunk chunkId. */ + public chunkId: string; + + /** Chunk sourceBlockIds. */ + public sourceBlockIds: string[]; + + /** Chunk content. */ + public content: string; + + /** Chunk pageSpan. */ + public pageSpan?: (google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageSpan|null); + + /** Chunk pageHeaders. */ + public pageHeaders: google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageHeader[]; + + /** Chunk pageFooters. */ + public pageFooters: google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageFooter[]; + + /** + * Creates a new Chunk instance using the specified properties. + * @param [properties] Properties to set + * @returns Chunk instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.ChunkedDocument.IChunk): google.cloud.documentai.v1.Document.ChunkedDocument.Chunk; + + /** + * Encodes the specified Chunk message. Does not implicitly {@link google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.verify|verify} messages. + * @param message Chunk message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.ChunkedDocument.IChunk, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Chunk message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.verify|verify} messages. + * @param message Chunk message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.ChunkedDocument.IChunk, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Chunk message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Chunk + * @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.ChunkedDocument.Chunk; + + /** + * Decodes a Chunk message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Chunk + * @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.ChunkedDocument.Chunk; + + /** + * Verifies a Chunk 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 Chunk message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Chunk + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.ChunkedDocument.Chunk; + + /** + * Creates a plain object from a Chunk message. Also converts values to other types if specified. + * @param message Chunk + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.ChunkedDocument.Chunk, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Chunk to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Chunk + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Chunk { + + /** Properties of a ChunkPageSpan. */ + interface IChunkPageSpan { + + /** ChunkPageSpan pageStart */ + pageStart?: (number|null); + + /** ChunkPageSpan pageEnd */ + pageEnd?: (number|null); + } + + /** Represents a ChunkPageSpan. */ + class ChunkPageSpan implements IChunkPageSpan { + + /** + * Constructs a new ChunkPageSpan. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageSpan); + + /** ChunkPageSpan pageStart. */ + public pageStart: number; + + /** ChunkPageSpan pageEnd. */ + public pageEnd: number; + + /** + * Creates a new ChunkPageSpan instance using the specified properties. + * @param [properties] Properties to set + * @returns ChunkPageSpan instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageSpan): google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan; + + /** + * Encodes the specified ChunkPageSpan message. Does not implicitly {@link google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan.verify|verify} messages. + * @param message ChunkPageSpan message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageSpan, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ChunkPageSpan message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan.verify|verify} messages. + * @param message ChunkPageSpan message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageSpan, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ChunkPageSpan message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ChunkPageSpan + * @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.ChunkedDocument.Chunk.ChunkPageSpan; + + /** + * Decodes a ChunkPageSpan message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ChunkPageSpan + * @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.ChunkedDocument.Chunk.ChunkPageSpan; + + /** + * Verifies a ChunkPageSpan 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 ChunkPageSpan message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ChunkPageSpan + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan; + + /** + * Creates a plain object from a ChunkPageSpan message. Also converts values to other types if specified. + * @param message ChunkPageSpan + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ChunkPageSpan to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ChunkPageSpan + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ChunkPageHeader. */ + interface IChunkPageHeader { + + /** ChunkPageHeader text */ + text?: (string|null); + + /** ChunkPageHeader pageSpan */ + pageSpan?: (google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageSpan|null); + } + + /** Represents a ChunkPageHeader. */ + class ChunkPageHeader implements IChunkPageHeader { + + /** + * Constructs a new ChunkPageHeader. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageHeader); + + /** ChunkPageHeader text. */ + public text: string; + + /** ChunkPageHeader pageSpan. */ + public pageSpan?: (google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageSpan|null); + + /** + * Creates a new ChunkPageHeader instance using the specified properties. + * @param [properties] Properties to set + * @returns ChunkPageHeader instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageHeader): google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader; + + /** + * Encodes the specified ChunkPageHeader message. Does not implicitly {@link google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader.verify|verify} messages. + * @param message ChunkPageHeader message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageHeader, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ChunkPageHeader message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader.verify|verify} messages. + * @param message ChunkPageHeader message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageHeader, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ChunkPageHeader message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ChunkPageHeader + * @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.ChunkedDocument.Chunk.ChunkPageHeader; + + /** + * Decodes a ChunkPageHeader message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ChunkPageHeader + * @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.ChunkedDocument.Chunk.ChunkPageHeader; + + /** + * Verifies a ChunkPageHeader 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 ChunkPageHeader message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ChunkPageHeader + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader; + + /** + * Creates a plain object from a ChunkPageHeader message. Also converts values to other types if specified. + * @param message ChunkPageHeader + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ChunkPageHeader to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ChunkPageHeader + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ChunkPageFooter. */ + interface IChunkPageFooter { + + /** ChunkPageFooter text */ + text?: (string|null); + + /** ChunkPageFooter pageSpan */ + pageSpan?: (google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageSpan|null); + } + + /** Represents a ChunkPageFooter. */ + class ChunkPageFooter implements IChunkPageFooter { + + /** + * Constructs a new ChunkPageFooter. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageFooter); + + /** ChunkPageFooter text. */ + public text: string; + + /** ChunkPageFooter pageSpan. */ + public pageSpan?: (google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageSpan|null); + + /** + * Creates a new ChunkPageFooter instance using the specified properties. + * @param [properties] Properties to set + * @returns ChunkPageFooter instance + */ + public static create(properties?: google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageFooter): google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter; + + /** + * Encodes the specified ChunkPageFooter message. Does not implicitly {@link google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter.verify|verify} messages. + * @param message ChunkPageFooter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageFooter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ChunkPageFooter message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter.verify|verify} messages. + * @param message ChunkPageFooter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageFooter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ChunkPageFooter message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ChunkPageFooter + * @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.ChunkedDocument.Chunk.ChunkPageFooter; + + /** + * Decodes a ChunkPageFooter message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ChunkPageFooter + * @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.ChunkedDocument.Chunk.ChunkPageFooter; + + /** + * Verifies a ChunkPageFooter 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 ChunkPageFooter message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ChunkPageFooter + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter; + + /** + * Creates a plain object from a ChunkPageFooter message. Also converts values to other types if specified. + * @param message ChunkPageFooter + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ChunkPageFooter to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ChunkPageFooter + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + } } /** Properties of a Barcode. */ diff --git a/packages/google-cloud-contentwarehouse/protos/protos.js b/packages/google-cloud-contentwarehouse/protos/protos.js index f5fda0638d4..2cdabb27bac 100644 --- a/packages/google-cloud-contentwarehouse/protos/protos.js +++ b/packages/google-cloud-contentwarehouse/protos/protos.js @@ -32363,6 +32363,8 @@ * @property {google.cloud.documentai.v1.Document.IShardInfo|null} [shardInfo] Document shardInfo * @property {google.rpc.IStatus|null} [error] Document error * @property {Array.|null} [revisions] Document revisions + * @property {google.cloud.documentai.v1.Document.IDocumentLayout|null} [documentLayout] Document documentLayout + * @property {google.cloud.documentai.v1.Document.IChunkedDocument|null} [chunkedDocument] Document chunkedDocument */ /** @@ -32482,6 +32484,22 @@ */ Document.prototype.revisions = $util.emptyArray; + /** + * Document documentLayout. + * @member {google.cloud.documentai.v1.Document.IDocumentLayout|null|undefined} documentLayout + * @memberof google.cloud.documentai.v1.Document + * @instance + */ + Document.prototype.documentLayout = null; + + /** + * Document chunkedDocument. + * @member {google.cloud.documentai.v1.Document.IChunkedDocument|null|undefined} chunkedDocument + * @memberof google.cloud.documentai.v1.Document + * @instance + */ + Document.prototype.chunkedDocument = null; + // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -32550,6 +32568,10 @@ if (message.textChanges != null && message.textChanges.length) for (var i = 0; i < message.textChanges.length; ++i) $root.google.cloud.documentai.v1.Document.TextChange.encode(message.textChanges[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.documentLayout != null && Object.hasOwnProperty.call(message, "documentLayout")) + $root.google.cloud.documentai.v1.Document.DocumentLayout.encode(message.documentLayout, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.chunkedDocument != null && Object.hasOwnProperty.call(message, "chunkedDocument")) + $root.google.cloud.documentai.v1.Document.ChunkedDocument.encode(message.chunkedDocument, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); return writer; }; @@ -32644,6 +32666,14 @@ message.revisions.push($root.google.cloud.documentai.v1.Document.Revision.decode(reader, reader.uint32())); break; } + case 17: { + message.documentLayout = $root.google.cloud.documentai.v1.Document.DocumentLayout.decode(reader, reader.uint32()); + break; + } + case 18: { + message.chunkedDocument = $root.google.cloud.documentai.v1.Document.ChunkedDocument.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -32762,6 +32792,16 @@ return "revisions." + error; } } + if (message.documentLayout != null && message.hasOwnProperty("documentLayout")) { + var error = $root.google.cloud.documentai.v1.Document.DocumentLayout.verify(message.documentLayout); + if (error) + return "documentLayout." + error; + } + if (message.chunkedDocument != null && message.hasOwnProperty("chunkedDocument")) { + var error = $root.google.cloud.documentai.v1.Document.ChunkedDocument.verify(message.chunkedDocument); + if (error) + return "chunkedDocument." + error; + } return null; }; @@ -32858,6 +32898,16 @@ message.revisions[i] = $root.google.cloud.documentai.v1.Document.Revision.fromObject(object.revisions[i]); } } + if (object.documentLayout != null) { + if (typeof object.documentLayout !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.documentLayout: object expected"); + message.documentLayout = $root.google.cloud.documentai.v1.Document.DocumentLayout.fromObject(object.documentLayout); + } + if (object.chunkedDocument != null) { + if (typeof object.chunkedDocument !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.chunkedDocument: object expected"); + message.chunkedDocument = $root.google.cloud.documentai.v1.Document.ChunkedDocument.fromObject(object.chunkedDocument); + } return message; }; @@ -32887,6 +32937,8 @@ object.text = ""; object.shardInfo = null; object.error = null; + object.documentLayout = null; + object.chunkedDocument = null; } if (message.uri != null && message.hasOwnProperty("uri")) { object.uri = message.uri; @@ -32936,6 +32988,10 @@ for (var j = 0; j < message.textChanges.length; ++j) object.textChanges[j] = $root.google.cloud.documentai.v1.Document.TextChange.toObject(message.textChanges[j], options); } + if (message.documentLayout != null && message.hasOwnProperty("documentLayout")) + object.documentLayout = $root.google.cloud.documentai.v1.Document.DocumentLayout.toObject(message.documentLayout, options); + if (message.chunkedDocument != null && message.hasOwnProperty("chunkedDocument")) + object.chunkedDocument = $root.google.cloud.documentai.v1.Document.ChunkedDocument.toObject(message.chunkedDocument, options); return object; }; @@ -44437,6 +44493,3639 @@ return TextChange; })(); + Document.DocumentLayout = (function() { + + /** + * Properties of a DocumentLayout. + * @memberof google.cloud.documentai.v1.Document + * @interface IDocumentLayout + * @property {Array.|null} [blocks] DocumentLayout blocks + */ + + /** + * Constructs a new DocumentLayout. + * @memberof google.cloud.documentai.v1.Document + * @classdesc Represents a DocumentLayout. + * @implements IDocumentLayout + * @constructor + * @param {google.cloud.documentai.v1.Document.IDocumentLayout=} [properties] Properties to set + */ + function DocumentLayout(properties) { + this.blocks = []; + 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]]; + } + + /** + * DocumentLayout blocks. + * @member {Array.} blocks + * @memberof google.cloud.documentai.v1.Document.DocumentLayout + * @instance + */ + DocumentLayout.prototype.blocks = $util.emptyArray; + + /** + * Creates a new DocumentLayout instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.DocumentLayout + * @static + * @param {google.cloud.documentai.v1.Document.IDocumentLayout=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.DocumentLayout} DocumentLayout instance + */ + DocumentLayout.create = function create(properties) { + return new DocumentLayout(properties); + }; + + /** + * Encodes the specified DocumentLayout message. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.DocumentLayout + * @static + * @param {google.cloud.documentai.v1.Document.IDocumentLayout} message DocumentLayout message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentLayout.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.blocks != null && message.blocks.length) + for (var i = 0; i < message.blocks.length; ++i) + $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.encode(message.blocks[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DocumentLayout message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.DocumentLayout + * @static + * @param {google.cloud.documentai.v1.Document.IDocumentLayout} message DocumentLayout message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentLayout.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DocumentLayout message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.DocumentLayout + * @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.DocumentLayout} DocumentLayout + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentLayout.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.DocumentLayout(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.blocks && message.blocks.length)) + message.blocks = []; + message.blocks.push($root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DocumentLayout message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.DocumentLayout + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.DocumentLayout} DocumentLayout + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentLayout.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DocumentLayout message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.DocumentLayout + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DocumentLayout.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.blocks != null && message.hasOwnProperty("blocks")) { + if (!Array.isArray(message.blocks)) + return "blocks: array expected"; + for (var i = 0; i < message.blocks.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.verify(message.blocks[i]); + if (error) + return "blocks." + error; + } + } + return null; + }; + + /** + * Creates a DocumentLayout message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.DocumentLayout + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.DocumentLayout} DocumentLayout + */ + DocumentLayout.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.DocumentLayout) + return object; + var message = new $root.google.cloud.documentai.v1.Document.DocumentLayout(); + if (object.blocks) { + if (!Array.isArray(object.blocks)) + throw TypeError(".google.cloud.documentai.v1.Document.DocumentLayout.blocks: array expected"); + message.blocks = []; + for (var i = 0; i < object.blocks.length; ++i) { + if (typeof object.blocks[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.DocumentLayout.blocks: object expected"); + message.blocks[i] = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.fromObject(object.blocks[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a DocumentLayout message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.DocumentLayout + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout} message DocumentLayout + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DocumentLayout.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.blocks = []; + if (message.blocks && message.blocks.length) { + object.blocks = []; + for (var j = 0; j < message.blocks.length; ++j) + object.blocks[j] = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.toObject(message.blocks[j], options); + } + return object; + }; + + /** + * Converts this DocumentLayout to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.DocumentLayout + * @instance + * @returns {Object.} JSON object + */ + DocumentLayout.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DocumentLayout + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.DocumentLayout + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DocumentLayout.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.DocumentLayout"; + }; + + DocumentLayout.DocumentLayoutBlock = (function() { + + /** + * Properties of a DocumentLayoutBlock. + * @memberof google.cloud.documentai.v1.Document.DocumentLayout + * @interface IDocumentLayoutBlock + * @property {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTextBlock|null} [textBlock] DocumentLayoutBlock textBlock + * @property {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableBlock|null} [tableBlock] DocumentLayoutBlock tableBlock + * @property {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutListBlock|null} [listBlock] DocumentLayoutBlock listBlock + * @property {string|null} [blockId] DocumentLayoutBlock blockId + * @property {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutPageSpan|null} [pageSpan] DocumentLayoutBlock pageSpan + */ + + /** + * Constructs a new DocumentLayoutBlock. + * @memberof google.cloud.documentai.v1.Document.DocumentLayout + * @classdesc Represents a DocumentLayoutBlock. + * @implements IDocumentLayoutBlock + * @constructor + * @param {google.cloud.documentai.v1.Document.DocumentLayout.IDocumentLayoutBlock=} [properties] Properties to set + */ + function DocumentLayoutBlock(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DocumentLayoutBlock textBlock. + * @member {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTextBlock|null|undefined} textBlock + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock + * @instance + */ + DocumentLayoutBlock.prototype.textBlock = null; + + /** + * DocumentLayoutBlock tableBlock. + * @member {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableBlock|null|undefined} tableBlock + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock + * @instance + */ + DocumentLayoutBlock.prototype.tableBlock = null; + + /** + * DocumentLayoutBlock listBlock. + * @member {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutListBlock|null|undefined} listBlock + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock + * @instance + */ + DocumentLayoutBlock.prototype.listBlock = null; + + /** + * DocumentLayoutBlock blockId. + * @member {string} blockId + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock + * @instance + */ + DocumentLayoutBlock.prototype.blockId = ""; + + /** + * DocumentLayoutBlock pageSpan. + * @member {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutPageSpan|null|undefined} pageSpan + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock + * @instance + */ + DocumentLayoutBlock.prototype.pageSpan = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * DocumentLayoutBlock block. + * @member {"textBlock"|"tableBlock"|"listBlock"|undefined} block + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock + * @instance + */ + Object.defineProperty(DocumentLayoutBlock.prototype, "block", { + get: $util.oneOfGetter($oneOfFields = ["textBlock", "tableBlock", "listBlock"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new DocumentLayoutBlock instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.IDocumentLayoutBlock=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock} DocumentLayoutBlock instance + */ + DocumentLayoutBlock.create = function create(properties) { + return new DocumentLayoutBlock(properties); + }; + + /** + * Encodes the specified DocumentLayoutBlock message. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.IDocumentLayoutBlock} message DocumentLayoutBlock message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentLayoutBlock.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.blockId != null && Object.hasOwnProperty.call(message, "blockId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.blockId); + if (message.textBlock != null && Object.hasOwnProperty.call(message, "textBlock")) + $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock.encode(message.textBlock, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.tableBlock != null && Object.hasOwnProperty.call(message, "tableBlock")) + $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock.encode(message.tableBlock, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.listBlock != null && Object.hasOwnProperty.call(message, "listBlock")) + $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock.encode(message.listBlock, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.pageSpan != null && Object.hasOwnProperty.call(message, "pageSpan")) + $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan.encode(message.pageSpan, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DocumentLayoutBlock message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.IDocumentLayoutBlock} message DocumentLayoutBlock message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentLayoutBlock.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DocumentLayoutBlock message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock + * @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.DocumentLayout.DocumentLayoutBlock} DocumentLayoutBlock + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentLayoutBlock.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.DocumentLayout.DocumentLayoutBlock(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + message.textBlock = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock.decode(reader, reader.uint32()); + break; + } + case 3: { + message.tableBlock = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock.decode(reader, reader.uint32()); + break; + } + case 4: { + message.listBlock = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock.decode(reader, reader.uint32()); + break; + } + case 1: { + message.blockId = reader.string(); + break; + } + case 5: { + message.pageSpan = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DocumentLayoutBlock message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock} DocumentLayoutBlock + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentLayoutBlock.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DocumentLayoutBlock message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DocumentLayoutBlock.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.textBlock != null && message.hasOwnProperty("textBlock")) { + properties.block = 1; + { + var error = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock.verify(message.textBlock); + if (error) + return "textBlock." + error; + } + } + if (message.tableBlock != null && message.hasOwnProperty("tableBlock")) { + if (properties.block === 1) + return "block: multiple values"; + properties.block = 1; + { + var error = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock.verify(message.tableBlock); + if (error) + return "tableBlock." + error; + } + } + if (message.listBlock != null && message.hasOwnProperty("listBlock")) { + if (properties.block === 1) + return "block: multiple values"; + properties.block = 1; + { + var error = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock.verify(message.listBlock); + if (error) + return "listBlock." + error; + } + } + if (message.blockId != null && message.hasOwnProperty("blockId")) + if (!$util.isString(message.blockId)) + return "blockId: string expected"; + if (message.pageSpan != null && message.hasOwnProperty("pageSpan")) { + var error = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan.verify(message.pageSpan); + if (error) + return "pageSpan." + error; + } + return null; + }; + + /** + * Creates a DocumentLayoutBlock message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock} DocumentLayoutBlock + */ + DocumentLayoutBlock.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock) + return object; + var message = new $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock(); + if (object.textBlock != null) { + if (typeof object.textBlock !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.textBlock: object expected"); + message.textBlock = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock.fromObject(object.textBlock); + } + if (object.tableBlock != null) { + if (typeof object.tableBlock !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.tableBlock: object expected"); + message.tableBlock = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock.fromObject(object.tableBlock); + } + if (object.listBlock != null) { + if (typeof object.listBlock !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.listBlock: object expected"); + message.listBlock = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock.fromObject(object.listBlock); + } + if (object.blockId != null) + message.blockId = String(object.blockId); + if (object.pageSpan != null) { + if (typeof object.pageSpan !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.pageSpan: object expected"); + message.pageSpan = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan.fromObject(object.pageSpan); + } + return message; + }; + + /** + * Creates a plain object from a DocumentLayoutBlock message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock} message DocumentLayoutBlock + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DocumentLayoutBlock.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.blockId = ""; + object.pageSpan = null; + } + if (message.blockId != null && message.hasOwnProperty("blockId")) + object.blockId = message.blockId; + if (message.textBlock != null && message.hasOwnProperty("textBlock")) { + object.textBlock = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock.toObject(message.textBlock, options); + if (options.oneofs) + object.block = "textBlock"; + } + if (message.tableBlock != null && message.hasOwnProperty("tableBlock")) { + object.tableBlock = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock.toObject(message.tableBlock, options); + if (options.oneofs) + object.block = "tableBlock"; + } + if (message.listBlock != null && message.hasOwnProperty("listBlock")) { + object.listBlock = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock.toObject(message.listBlock, options); + if (options.oneofs) + object.block = "listBlock"; + } + if (message.pageSpan != null && message.hasOwnProperty("pageSpan")) + object.pageSpan = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan.toObject(message.pageSpan, options); + return object; + }; + + /** + * Converts this DocumentLayoutBlock to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock + * @instance + * @returns {Object.} JSON object + */ + DocumentLayoutBlock.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DocumentLayoutBlock + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DocumentLayoutBlock.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock"; + }; + + DocumentLayoutBlock.LayoutPageSpan = (function() { + + /** + * Properties of a LayoutPageSpan. + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock + * @interface ILayoutPageSpan + * @property {number|null} [pageStart] LayoutPageSpan pageStart + * @property {number|null} [pageEnd] LayoutPageSpan pageEnd + */ + + /** + * Constructs a new LayoutPageSpan. + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock + * @classdesc Represents a LayoutPageSpan. + * @implements ILayoutPageSpan + * @constructor + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutPageSpan=} [properties] Properties to set + */ + function LayoutPageSpan(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LayoutPageSpan pageStart. + * @member {number} pageStart + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan + * @instance + */ + LayoutPageSpan.prototype.pageStart = 0; + + /** + * LayoutPageSpan pageEnd. + * @member {number} pageEnd + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan + * @instance + */ + LayoutPageSpan.prototype.pageEnd = 0; + + /** + * Creates a new LayoutPageSpan instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutPageSpan=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan} LayoutPageSpan instance + */ + LayoutPageSpan.create = function create(properties) { + return new LayoutPageSpan(properties); + }; + + /** + * Encodes the specified LayoutPageSpan message. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutPageSpan} message LayoutPageSpan message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LayoutPageSpan.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pageStart != null && Object.hasOwnProperty.call(message, "pageStart")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.pageStart); + if (message.pageEnd != null && Object.hasOwnProperty.call(message, "pageEnd")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageEnd); + return writer; + }; + + /** + * Encodes the specified LayoutPageSpan message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutPageSpan} message LayoutPageSpan message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LayoutPageSpan.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LayoutPageSpan message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan + * @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.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan} LayoutPageSpan + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LayoutPageSpan.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.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.pageStart = reader.int32(); + break; + } + case 2: { + message.pageEnd = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LayoutPageSpan message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan} LayoutPageSpan + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LayoutPageSpan.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LayoutPageSpan message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LayoutPageSpan.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pageStart != null && message.hasOwnProperty("pageStart")) + if (!$util.isInteger(message.pageStart)) + return "pageStart: integer expected"; + if (message.pageEnd != null && message.hasOwnProperty("pageEnd")) + if (!$util.isInteger(message.pageEnd)) + return "pageEnd: integer expected"; + return null; + }; + + /** + * Creates a LayoutPageSpan message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan} LayoutPageSpan + */ + LayoutPageSpan.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan) + return object; + var message = new $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan(); + if (object.pageStart != null) + message.pageStart = object.pageStart | 0; + if (object.pageEnd != null) + message.pageEnd = object.pageEnd | 0; + return message; + }; + + /** + * Creates a plain object from a LayoutPageSpan message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan} message LayoutPageSpan + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LayoutPageSpan.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.pageStart = 0; + object.pageEnd = 0; + } + if (message.pageStart != null && message.hasOwnProperty("pageStart")) + object.pageStart = message.pageStart; + if (message.pageEnd != null && message.hasOwnProperty("pageEnd")) + object.pageEnd = message.pageEnd; + return object; + }; + + /** + * Converts this LayoutPageSpan to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan + * @instance + * @returns {Object.} JSON object + */ + LayoutPageSpan.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LayoutPageSpan + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LayoutPageSpan.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan"; + }; + + return LayoutPageSpan; + })(); + + DocumentLayoutBlock.LayoutTextBlock = (function() { + + /** + * Properties of a LayoutTextBlock. + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock + * @interface ILayoutTextBlock + * @property {string|null} [text] LayoutTextBlock text + * @property {string|null} [type] LayoutTextBlock type + * @property {Array.|null} [blocks] LayoutTextBlock blocks + */ + + /** + * Constructs a new LayoutTextBlock. + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock + * @classdesc Represents a LayoutTextBlock. + * @implements ILayoutTextBlock + * @constructor + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTextBlock=} [properties] Properties to set + */ + function LayoutTextBlock(properties) { + this.blocks = []; + 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]]; + } + + /** + * LayoutTextBlock text. + * @member {string} text + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock + * @instance + */ + LayoutTextBlock.prototype.text = ""; + + /** + * LayoutTextBlock type. + * @member {string} type + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock + * @instance + */ + LayoutTextBlock.prototype.type = ""; + + /** + * LayoutTextBlock blocks. + * @member {Array.} blocks + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock + * @instance + */ + LayoutTextBlock.prototype.blocks = $util.emptyArray; + + /** + * Creates a new LayoutTextBlock instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTextBlock=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock} LayoutTextBlock instance + */ + LayoutTextBlock.create = function create(properties) { + return new LayoutTextBlock(properties); + }; + + /** + * Encodes the specified LayoutTextBlock message. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTextBlock} message LayoutTextBlock message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LayoutTextBlock.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + if (message.blocks != null && message.blocks.length) + for (var i = 0; i < message.blocks.length; ++i) + $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.encode(message.blocks[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified LayoutTextBlock message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTextBlock} message LayoutTextBlock message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LayoutTextBlock.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LayoutTextBlock message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock + * @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.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock} LayoutTextBlock + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LayoutTextBlock.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.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.text = reader.string(); + break; + } + case 2: { + message.type = reader.string(); + break; + } + case 3: { + if (!(message.blocks && message.blocks.length)) + message.blocks = []; + message.blocks.push($root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LayoutTextBlock message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock} LayoutTextBlock + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LayoutTextBlock.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LayoutTextBlock message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LayoutTextBlock.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.blocks != null && message.hasOwnProperty("blocks")) { + if (!Array.isArray(message.blocks)) + return "blocks: array expected"; + for (var i = 0; i < message.blocks.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.verify(message.blocks[i]); + if (error) + return "blocks." + error; + } + } + return null; + }; + + /** + * Creates a LayoutTextBlock message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock} LayoutTextBlock + */ + LayoutTextBlock.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock) + return object; + var message = new $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock(); + if (object.text != null) + message.text = String(object.text); + if (object.type != null) + message.type = String(object.type); + if (object.blocks) { + if (!Array.isArray(object.blocks)) + throw TypeError(".google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock.blocks: array expected"); + message.blocks = []; + for (var i = 0; i < object.blocks.length; ++i) { + if (typeof object.blocks[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock.blocks: object expected"); + message.blocks[i] = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.fromObject(object.blocks[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a LayoutTextBlock message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock} message LayoutTextBlock + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LayoutTextBlock.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.blocks = []; + if (options.defaults) { + object.text = ""; + object.type = ""; + } + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.blocks && message.blocks.length) { + object.blocks = []; + for (var j = 0; j < message.blocks.length; ++j) + object.blocks[j] = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.toObject(message.blocks[j], options); + } + return object; + }; + + /** + * Converts this LayoutTextBlock to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock + * @instance + * @returns {Object.} JSON object + */ + LayoutTextBlock.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LayoutTextBlock + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LayoutTextBlock.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock"; + }; + + return LayoutTextBlock; + })(); + + DocumentLayoutBlock.LayoutTableBlock = (function() { + + /** + * Properties of a LayoutTableBlock. + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock + * @interface ILayoutTableBlock + * @property {Array.|null} [headerRows] LayoutTableBlock headerRows + * @property {Array.|null} [bodyRows] LayoutTableBlock bodyRows + * @property {string|null} [caption] LayoutTableBlock caption + */ + + /** + * Constructs a new LayoutTableBlock. + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock + * @classdesc Represents a LayoutTableBlock. + * @implements ILayoutTableBlock + * @constructor + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableBlock=} [properties] Properties to set + */ + function LayoutTableBlock(properties) { + this.headerRows = []; + this.bodyRows = []; + 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]]; + } + + /** + * LayoutTableBlock headerRows. + * @member {Array.} headerRows + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock + * @instance + */ + LayoutTableBlock.prototype.headerRows = $util.emptyArray; + + /** + * LayoutTableBlock bodyRows. + * @member {Array.} bodyRows + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock + * @instance + */ + LayoutTableBlock.prototype.bodyRows = $util.emptyArray; + + /** + * LayoutTableBlock caption. + * @member {string} caption + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock + * @instance + */ + LayoutTableBlock.prototype.caption = ""; + + /** + * Creates a new LayoutTableBlock instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableBlock=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock} LayoutTableBlock instance + */ + LayoutTableBlock.create = function create(properties) { + return new LayoutTableBlock(properties); + }; + + /** + * Encodes the specified LayoutTableBlock message. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableBlock} message LayoutTableBlock message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LayoutTableBlock.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.headerRows != null && message.headerRows.length) + for (var i = 0; i < message.headerRows.length; ++i) + $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow.encode(message.headerRows[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.bodyRows != null && message.bodyRows.length) + for (var i = 0; i < message.bodyRows.length; ++i) + $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow.encode(message.bodyRows[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.caption != null && Object.hasOwnProperty.call(message, "caption")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.caption); + return writer; + }; + + /** + * Encodes the specified LayoutTableBlock message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableBlock} message LayoutTableBlock message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LayoutTableBlock.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LayoutTableBlock message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock + * @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.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock} LayoutTableBlock + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LayoutTableBlock.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.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.headerRows && message.headerRows.length)) + message.headerRows = []; + message.headerRows.push($root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow.decode(reader, reader.uint32())); + break; + } + case 2: { + if (!(message.bodyRows && message.bodyRows.length)) + message.bodyRows = []; + message.bodyRows.push($root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow.decode(reader, reader.uint32())); + break; + } + case 3: { + message.caption = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LayoutTableBlock message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock} LayoutTableBlock + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LayoutTableBlock.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LayoutTableBlock message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LayoutTableBlock.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.headerRows != null && message.hasOwnProperty("headerRows")) { + if (!Array.isArray(message.headerRows)) + return "headerRows: array expected"; + for (var i = 0; i < message.headerRows.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow.verify(message.headerRows[i]); + if (error) + return "headerRows." + error; + } + } + if (message.bodyRows != null && message.hasOwnProperty("bodyRows")) { + if (!Array.isArray(message.bodyRows)) + return "bodyRows: array expected"; + for (var i = 0; i < message.bodyRows.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow.verify(message.bodyRows[i]); + if (error) + return "bodyRows." + error; + } + } + if (message.caption != null && message.hasOwnProperty("caption")) + if (!$util.isString(message.caption)) + return "caption: string expected"; + return null; + }; + + /** + * Creates a LayoutTableBlock message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock} LayoutTableBlock + */ + LayoutTableBlock.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock) + return object; + var message = new $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock(); + if (object.headerRows) { + if (!Array.isArray(object.headerRows)) + throw TypeError(".google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock.headerRows: array expected"); + message.headerRows = []; + for (var i = 0; i < object.headerRows.length; ++i) { + if (typeof object.headerRows[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock.headerRows: object expected"); + message.headerRows[i] = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow.fromObject(object.headerRows[i]); + } + } + if (object.bodyRows) { + if (!Array.isArray(object.bodyRows)) + throw TypeError(".google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock.bodyRows: array expected"); + message.bodyRows = []; + for (var i = 0; i < object.bodyRows.length; ++i) { + if (typeof object.bodyRows[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock.bodyRows: object expected"); + message.bodyRows[i] = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow.fromObject(object.bodyRows[i]); + } + } + if (object.caption != null) + message.caption = String(object.caption); + return message; + }; + + /** + * Creates a plain object from a LayoutTableBlock message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock} message LayoutTableBlock + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LayoutTableBlock.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.headerRows = []; + object.bodyRows = []; + } + if (options.defaults) + object.caption = ""; + if (message.headerRows && message.headerRows.length) { + object.headerRows = []; + for (var j = 0; j < message.headerRows.length; ++j) + object.headerRows[j] = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow.toObject(message.headerRows[j], options); + } + if (message.bodyRows && message.bodyRows.length) { + object.bodyRows = []; + for (var j = 0; j < message.bodyRows.length; ++j) + object.bodyRows[j] = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow.toObject(message.bodyRows[j], options); + } + if (message.caption != null && message.hasOwnProperty("caption")) + object.caption = message.caption; + return object; + }; + + /** + * Converts this LayoutTableBlock to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock + * @instance + * @returns {Object.} JSON object + */ + LayoutTableBlock.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LayoutTableBlock + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LayoutTableBlock.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock"; + }; + + return LayoutTableBlock; + })(); + + DocumentLayoutBlock.LayoutTableRow = (function() { + + /** + * Properties of a LayoutTableRow. + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock + * @interface ILayoutTableRow + * @property {Array.|null} [cells] LayoutTableRow cells + */ + + /** + * Constructs a new LayoutTableRow. + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock + * @classdesc Represents a LayoutTableRow. + * @implements ILayoutTableRow + * @constructor + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableRow=} [properties] Properties to set + */ + function LayoutTableRow(properties) { + this.cells = []; + 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]]; + } + + /** + * LayoutTableRow cells. + * @member {Array.} cells + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow + * @instance + */ + LayoutTableRow.prototype.cells = $util.emptyArray; + + /** + * Creates a new LayoutTableRow instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableRow=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow} LayoutTableRow instance + */ + LayoutTableRow.create = function create(properties) { + return new LayoutTableRow(properties); + }; + + /** + * Encodes the specified LayoutTableRow message. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableRow} message LayoutTableRow message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LayoutTableRow.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.cells != null && message.cells.length) + for (var i = 0; i < message.cells.length; ++i) + $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell.encode(message.cells[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified LayoutTableRow message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableRow} message LayoutTableRow message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LayoutTableRow.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LayoutTableRow message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow + * @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.DocumentLayout.DocumentLayoutBlock.LayoutTableRow} LayoutTableRow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LayoutTableRow.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.DocumentLayout.DocumentLayoutBlock.LayoutTableRow(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.cells && message.cells.length)) + message.cells = []; + message.cells.push($root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LayoutTableRow message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow} LayoutTableRow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LayoutTableRow.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LayoutTableRow message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LayoutTableRow.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.cells != null && message.hasOwnProperty("cells")) { + if (!Array.isArray(message.cells)) + return "cells: array expected"; + for (var i = 0; i < message.cells.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell.verify(message.cells[i]); + if (error) + return "cells." + error; + } + } + return null; + }; + + /** + * Creates a LayoutTableRow message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow} LayoutTableRow + */ + LayoutTableRow.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow) + return object; + var message = new $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow(); + if (object.cells) { + if (!Array.isArray(object.cells)) + throw TypeError(".google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow.cells: array expected"); + message.cells = []; + for (var i = 0; i < object.cells.length; ++i) { + if (typeof object.cells[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow.cells: object expected"); + message.cells[i] = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell.fromObject(object.cells[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a LayoutTableRow message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow} message LayoutTableRow + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LayoutTableRow.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.cells = []; + if (message.cells && message.cells.length) { + object.cells = []; + for (var j = 0; j < message.cells.length; ++j) + object.cells[j] = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell.toObject(message.cells[j], options); + } + return object; + }; + + /** + * Converts this LayoutTableRow to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow + * @instance + * @returns {Object.} JSON object + */ + LayoutTableRow.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LayoutTableRow + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LayoutTableRow.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow"; + }; + + return LayoutTableRow; + })(); + + DocumentLayoutBlock.LayoutTableCell = (function() { + + /** + * Properties of a LayoutTableCell. + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock + * @interface ILayoutTableCell + * @property {Array.|null} [blocks] LayoutTableCell blocks + * @property {number|null} [rowSpan] LayoutTableCell rowSpan + * @property {number|null} [colSpan] LayoutTableCell colSpan + */ + + /** + * Constructs a new LayoutTableCell. + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock + * @classdesc Represents a LayoutTableCell. + * @implements ILayoutTableCell + * @constructor + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableCell=} [properties] Properties to set + */ + function LayoutTableCell(properties) { + this.blocks = []; + 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]]; + } + + /** + * LayoutTableCell blocks. + * @member {Array.} blocks + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell + * @instance + */ + LayoutTableCell.prototype.blocks = $util.emptyArray; + + /** + * LayoutTableCell rowSpan. + * @member {number} rowSpan + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell + * @instance + */ + LayoutTableCell.prototype.rowSpan = 0; + + /** + * LayoutTableCell colSpan. + * @member {number} colSpan + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell + * @instance + */ + LayoutTableCell.prototype.colSpan = 0; + + /** + * Creates a new LayoutTableCell instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableCell=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell} LayoutTableCell instance + */ + LayoutTableCell.create = function create(properties) { + return new LayoutTableCell(properties); + }; + + /** + * Encodes the specified LayoutTableCell message. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableCell} message LayoutTableCell message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LayoutTableCell.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.blocks != null && message.blocks.length) + for (var i = 0; i < message.blocks.length; ++i) + $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.encode(message.blocks[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.rowSpan != null && Object.hasOwnProperty.call(message, "rowSpan")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.rowSpan); + if (message.colSpan != null && Object.hasOwnProperty.call(message, "colSpan")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.colSpan); + return writer; + }; + + /** + * Encodes the specified LayoutTableCell message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutTableCell} message LayoutTableCell message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LayoutTableCell.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LayoutTableCell message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell + * @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.DocumentLayout.DocumentLayoutBlock.LayoutTableCell} LayoutTableCell + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LayoutTableCell.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.DocumentLayout.DocumentLayoutBlock.LayoutTableCell(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.blocks && message.blocks.length)) + message.blocks = []; + message.blocks.push($root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.decode(reader, reader.uint32())); + break; + } + case 2: { + message.rowSpan = reader.int32(); + break; + } + case 3: { + message.colSpan = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LayoutTableCell message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell} LayoutTableCell + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LayoutTableCell.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LayoutTableCell message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LayoutTableCell.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.blocks != null && message.hasOwnProperty("blocks")) { + if (!Array.isArray(message.blocks)) + return "blocks: array expected"; + for (var i = 0; i < message.blocks.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.verify(message.blocks[i]); + if (error) + return "blocks." + error; + } + } + if (message.rowSpan != null && message.hasOwnProperty("rowSpan")) + if (!$util.isInteger(message.rowSpan)) + return "rowSpan: integer expected"; + if (message.colSpan != null && message.hasOwnProperty("colSpan")) + if (!$util.isInteger(message.colSpan)) + return "colSpan: integer expected"; + return null; + }; + + /** + * Creates a LayoutTableCell message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell} LayoutTableCell + */ + LayoutTableCell.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell) + return object; + var message = new $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell(); + if (object.blocks) { + if (!Array.isArray(object.blocks)) + throw TypeError(".google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell.blocks: array expected"); + message.blocks = []; + for (var i = 0; i < object.blocks.length; ++i) { + if (typeof object.blocks[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell.blocks: object expected"); + message.blocks[i] = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.fromObject(object.blocks[i]); + } + } + if (object.rowSpan != null) + message.rowSpan = object.rowSpan | 0; + if (object.colSpan != null) + message.colSpan = object.colSpan | 0; + return message; + }; + + /** + * Creates a plain object from a LayoutTableCell message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell} message LayoutTableCell + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LayoutTableCell.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.blocks = []; + if (options.defaults) { + object.rowSpan = 0; + object.colSpan = 0; + } + if (message.blocks && message.blocks.length) { + object.blocks = []; + for (var j = 0; j < message.blocks.length; ++j) + object.blocks[j] = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.toObject(message.blocks[j], options); + } + if (message.rowSpan != null && message.hasOwnProperty("rowSpan")) + object.rowSpan = message.rowSpan; + if (message.colSpan != null && message.hasOwnProperty("colSpan")) + object.colSpan = message.colSpan; + return object; + }; + + /** + * Converts this LayoutTableCell to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell + * @instance + * @returns {Object.} JSON object + */ + LayoutTableCell.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LayoutTableCell + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LayoutTableCell.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell"; + }; + + return LayoutTableCell; + })(); + + DocumentLayoutBlock.LayoutListBlock = (function() { + + /** + * Properties of a LayoutListBlock. + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock + * @interface ILayoutListBlock + * @property {Array.|null} [listEntries] LayoutListBlock listEntries + * @property {string|null} [type] LayoutListBlock type + */ + + /** + * Constructs a new LayoutListBlock. + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock + * @classdesc Represents a LayoutListBlock. + * @implements ILayoutListBlock + * @constructor + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutListBlock=} [properties] Properties to set + */ + function LayoutListBlock(properties) { + this.listEntries = []; + 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]]; + } + + /** + * LayoutListBlock listEntries. + * @member {Array.} listEntries + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock + * @instance + */ + LayoutListBlock.prototype.listEntries = $util.emptyArray; + + /** + * LayoutListBlock type. + * @member {string} type + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock + * @instance + */ + LayoutListBlock.prototype.type = ""; + + /** + * Creates a new LayoutListBlock instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutListBlock=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock} LayoutListBlock instance + */ + LayoutListBlock.create = function create(properties) { + return new LayoutListBlock(properties); + }; + + /** + * Encodes the specified LayoutListBlock message. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutListBlock} message LayoutListBlock message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LayoutListBlock.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.listEntries != null && message.listEntries.length) + for (var i = 0; i < message.listEntries.length; ++i) + $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry.encode(message.listEntries[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + return writer; + }; + + /** + * Encodes the specified LayoutListBlock message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutListBlock} message LayoutListBlock message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LayoutListBlock.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LayoutListBlock message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock + * @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.DocumentLayout.DocumentLayoutBlock.LayoutListBlock} LayoutListBlock + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LayoutListBlock.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.DocumentLayout.DocumentLayoutBlock.LayoutListBlock(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.listEntries && message.listEntries.length)) + message.listEntries = []; + message.listEntries.push($root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry.decode(reader, reader.uint32())); + break; + } + case 2: { + message.type = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LayoutListBlock message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock} LayoutListBlock + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LayoutListBlock.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LayoutListBlock message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LayoutListBlock.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.listEntries != null && message.hasOwnProperty("listEntries")) { + if (!Array.isArray(message.listEntries)) + return "listEntries: array expected"; + for (var i = 0; i < message.listEntries.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry.verify(message.listEntries[i]); + if (error) + return "listEntries." + error; + } + } + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + return null; + }; + + /** + * Creates a LayoutListBlock message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock} LayoutListBlock + */ + LayoutListBlock.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock) + return object; + var message = new $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock(); + if (object.listEntries) { + if (!Array.isArray(object.listEntries)) + throw TypeError(".google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock.listEntries: array expected"); + message.listEntries = []; + for (var i = 0; i < object.listEntries.length; ++i) { + if (typeof object.listEntries[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock.listEntries: object expected"); + message.listEntries[i] = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry.fromObject(object.listEntries[i]); + } + } + if (object.type != null) + message.type = String(object.type); + return message; + }; + + /** + * Creates a plain object from a LayoutListBlock message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock} message LayoutListBlock + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LayoutListBlock.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.listEntries = []; + if (options.defaults) + object.type = ""; + if (message.listEntries && message.listEntries.length) { + object.listEntries = []; + for (var j = 0; j < message.listEntries.length; ++j) + object.listEntries[j] = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry.toObject(message.listEntries[j], options); + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + return object; + }; + + /** + * Converts this LayoutListBlock to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock + * @instance + * @returns {Object.} JSON object + */ + LayoutListBlock.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LayoutListBlock + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LayoutListBlock.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock"; + }; + + return LayoutListBlock; + })(); + + DocumentLayoutBlock.LayoutListEntry = (function() { + + /** + * Properties of a LayoutListEntry. + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock + * @interface ILayoutListEntry + * @property {Array.|null} [blocks] LayoutListEntry blocks + */ + + /** + * Constructs a new LayoutListEntry. + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock + * @classdesc Represents a LayoutListEntry. + * @implements ILayoutListEntry + * @constructor + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutListEntry=} [properties] Properties to set + */ + function LayoutListEntry(properties) { + this.blocks = []; + 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]]; + } + + /** + * LayoutListEntry blocks. + * @member {Array.} blocks + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry + * @instance + */ + LayoutListEntry.prototype.blocks = $util.emptyArray; + + /** + * Creates a new LayoutListEntry instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutListEntry=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry} LayoutListEntry instance + */ + LayoutListEntry.create = function create(properties) { + return new LayoutListEntry(properties); + }; + + /** + * Encodes the specified LayoutListEntry message. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutListEntry} message LayoutListEntry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LayoutListEntry.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.blocks != null && message.blocks.length) + for (var i = 0; i < message.blocks.length; ++i) + $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.encode(message.blocks[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified LayoutListEntry message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.ILayoutListEntry} message LayoutListEntry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LayoutListEntry.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LayoutListEntry message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry + * @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.DocumentLayout.DocumentLayoutBlock.LayoutListEntry} LayoutListEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LayoutListEntry.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.DocumentLayout.DocumentLayoutBlock.LayoutListEntry(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.blocks && message.blocks.length)) + message.blocks = []; + message.blocks.push($root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LayoutListEntry message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry} LayoutListEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LayoutListEntry.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LayoutListEntry message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LayoutListEntry.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.blocks != null && message.hasOwnProperty("blocks")) { + if (!Array.isArray(message.blocks)) + return "blocks: array expected"; + for (var i = 0; i < message.blocks.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.verify(message.blocks[i]); + if (error) + return "blocks." + error; + } + } + return null; + }; + + /** + * Creates a LayoutListEntry message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry} LayoutListEntry + */ + LayoutListEntry.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry) + return object; + var message = new $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry(); + if (object.blocks) { + if (!Array.isArray(object.blocks)) + throw TypeError(".google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry.blocks: array expected"); + message.blocks = []; + for (var i = 0; i < object.blocks.length; ++i) { + if (typeof object.blocks[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry.blocks: object expected"); + message.blocks[i] = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.fromObject(object.blocks[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a LayoutListEntry message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry + * @static + * @param {google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry} message LayoutListEntry + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LayoutListEntry.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.blocks = []; + if (message.blocks && message.blocks.length) { + object.blocks = []; + for (var j = 0; j < message.blocks.length; ++j) + object.blocks[j] = $root.google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.toObject(message.blocks[j], options); + } + return object; + }; + + /** + * Converts this LayoutListEntry to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry + * @instance + * @returns {Object.} JSON object + */ + LayoutListEntry.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LayoutListEntry + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LayoutListEntry.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry"; + }; + + return LayoutListEntry; + })(); + + return DocumentLayoutBlock; + })(); + + return DocumentLayout; + })(); + + Document.ChunkedDocument = (function() { + + /** + * Properties of a ChunkedDocument. + * @memberof google.cloud.documentai.v1.Document + * @interface IChunkedDocument + * @property {Array.|null} [chunks] ChunkedDocument chunks + */ + + /** + * Constructs a new ChunkedDocument. + * @memberof google.cloud.documentai.v1.Document + * @classdesc Represents a ChunkedDocument. + * @implements IChunkedDocument + * @constructor + * @param {google.cloud.documentai.v1.Document.IChunkedDocument=} [properties] Properties to set + */ + function ChunkedDocument(properties) { + this.chunks = []; + 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]]; + } + + /** + * ChunkedDocument chunks. + * @member {Array.} chunks + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument + * @instance + */ + ChunkedDocument.prototype.chunks = $util.emptyArray; + + /** + * Creates a new ChunkedDocument instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument + * @static + * @param {google.cloud.documentai.v1.Document.IChunkedDocument=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.ChunkedDocument} ChunkedDocument instance + */ + ChunkedDocument.create = function create(properties) { + return new ChunkedDocument(properties); + }; + + /** + * Encodes the specified ChunkedDocument message. Does not implicitly {@link google.cloud.documentai.v1.Document.ChunkedDocument.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument + * @static + * @param {google.cloud.documentai.v1.Document.IChunkedDocument} message ChunkedDocument message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ChunkedDocument.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.chunks != null && message.chunks.length) + for (var i = 0; i < message.chunks.length; ++i) + $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.encode(message.chunks[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ChunkedDocument message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.ChunkedDocument.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument + * @static + * @param {google.cloud.documentai.v1.Document.IChunkedDocument} message ChunkedDocument message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ChunkedDocument.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ChunkedDocument message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument + * @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.ChunkedDocument} ChunkedDocument + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ChunkedDocument.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.ChunkedDocument(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.chunks && message.chunks.length)) + message.chunks = []; + message.chunks.push($root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ChunkedDocument message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.ChunkedDocument} ChunkedDocument + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ChunkedDocument.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ChunkedDocument message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ChunkedDocument.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.chunks != null && message.hasOwnProperty("chunks")) { + if (!Array.isArray(message.chunks)) + return "chunks: array expected"; + for (var i = 0; i < message.chunks.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.verify(message.chunks[i]); + if (error) + return "chunks." + error; + } + } + return null; + }; + + /** + * Creates a ChunkedDocument message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.ChunkedDocument} ChunkedDocument + */ + ChunkedDocument.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.ChunkedDocument) + return object; + var message = new $root.google.cloud.documentai.v1.Document.ChunkedDocument(); + if (object.chunks) { + if (!Array.isArray(object.chunks)) + throw TypeError(".google.cloud.documentai.v1.Document.ChunkedDocument.chunks: array expected"); + message.chunks = []; + for (var i = 0; i < object.chunks.length; ++i) { + if (typeof object.chunks[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.ChunkedDocument.chunks: object expected"); + message.chunks[i] = $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.fromObject(object.chunks[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ChunkedDocument message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument + * @static + * @param {google.cloud.documentai.v1.Document.ChunkedDocument} message ChunkedDocument + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ChunkedDocument.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.chunks = []; + if (message.chunks && message.chunks.length) { + object.chunks = []; + for (var j = 0; j < message.chunks.length; ++j) + object.chunks[j] = $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.toObject(message.chunks[j], options); + } + return object; + }; + + /** + * Converts this ChunkedDocument to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument + * @instance + * @returns {Object.} JSON object + */ + ChunkedDocument.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ChunkedDocument + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ChunkedDocument.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.ChunkedDocument"; + }; + + ChunkedDocument.Chunk = (function() { + + /** + * Properties of a Chunk. + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument + * @interface IChunk + * @property {string|null} [chunkId] Chunk chunkId + * @property {Array.|null} [sourceBlockIds] Chunk sourceBlockIds + * @property {string|null} [content] Chunk content + * @property {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageSpan|null} [pageSpan] Chunk pageSpan + * @property {Array.|null} [pageHeaders] Chunk pageHeaders + * @property {Array.|null} [pageFooters] Chunk pageFooters + */ + + /** + * Constructs a new Chunk. + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument + * @classdesc Represents a Chunk. + * @implements IChunk + * @constructor + * @param {google.cloud.documentai.v1.Document.ChunkedDocument.IChunk=} [properties] Properties to set + */ + function Chunk(properties) { + this.sourceBlockIds = []; + this.pageHeaders = []; + this.pageFooters = []; + 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]]; + } + + /** + * Chunk chunkId. + * @member {string} chunkId + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk + * @instance + */ + Chunk.prototype.chunkId = ""; + + /** + * Chunk sourceBlockIds. + * @member {Array.} sourceBlockIds + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk + * @instance + */ + Chunk.prototype.sourceBlockIds = $util.emptyArray; + + /** + * Chunk content. + * @member {string} content + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk + * @instance + */ + Chunk.prototype.content = ""; + + /** + * Chunk pageSpan. + * @member {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageSpan|null|undefined} pageSpan + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk + * @instance + */ + Chunk.prototype.pageSpan = null; + + /** + * Chunk pageHeaders. + * @member {Array.} pageHeaders + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk + * @instance + */ + Chunk.prototype.pageHeaders = $util.emptyArray; + + /** + * Chunk pageFooters. + * @member {Array.} pageFooters + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk + * @instance + */ + Chunk.prototype.pageFooters = $util.emptyArray; + + /** + * Creates a new Chunk instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk + * @static + * @param {google.cloud.documentai.v1.Document.ChunkedDocument.IChunk=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk} Chunk instance + */ + Chunk.create = function create(properties) { + return new Chunk(properties); + }; + + /** + * Encodes the specified Chunk message. Does not implicitly {@link google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk + * @static + * @param {google.cloud.documentai.v1.Document.ChunkedDocument.IChunk} message Chunk message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Chunk.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.chunkId != null && Object.hasOwnProperty.call(message, "chunkId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.chunkId); + if (message.sourceBlockIds != null && message.sourceBlockIds.length) + for (var i = 0; i < message.sourceBlockIds.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceBlockIds[i]); + if (message.content != null && Object.hasOwnProperty.call(message, "content")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.content); + if (message.pageSpan != null && Object.hasOwnProperty.call(message, "pageSpan")) + $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan.encode(message.pageSpan, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.pageHeaders != null && message.pageHeaders.length) + for (var i = 0; i < message.pageHeaders.length; ++i) + $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader.encode(message.pageHeaders[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.pageFooters != null && message.pageFooters.length) + for (var i = 0; i < message.pageFooters.length; ++i) + $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter.encode(message.pageFooters[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Chunk message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk + * @static + * @param {google.cloud.documentai.v1.Document.ChunkedDocument.IChunk} message Chunk message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Chunk.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Chunk message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk + * @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.ChunkedDocument.Chunk} Chunk + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Chunk.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.ChunkedDocument.Chunk(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.chunkId = reader.string(); + break; + } + case 2: { + if (!(message.sourceBlockIds && message.sourceBlockIds.length)) + message.sourceBlockIds = []; + message.sourceBlockIds.push(reader.string()); + break; + } + case 3: { + message.content = reader.string(); + break; + } + case 4: { + message.pageSpan = $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan.decode(reader, reader.uint32()); + break; + } + case 5: { + if (!(message.pageHeaders && message.pageHeaders.length)) + message.pageHeaders = []; + message.pageHeaders.push($root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader.decode(reader, reader.uint32())); + break; + } + case 6: { + if (!(message.pageFooters && message.pageFooters.length)) + message.pageFooters = []; + message.pageFooters.push($root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Chunk message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk} Chunk + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Chunk.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Chunk message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Chunk.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.chunkId != null && message.hasOwnProperty("chunkId")) + if (!$util.isString(message.chunkId)) + return "chunkId: string expected"; + if (message.sourceBlockIds != null && message.hasOwnProperty("sourceBlockIds")) { + if (!Array.isArray(message.sourceBlockIds)) + return "sourceBlockIds: array expected"; + for (var i = 0; i < message.sourceBlockIds.length; ++i) + if (!$util.isString(message.sourceBlockIds[i])) + return "sourceBlockIds: string[] expected"; + } + if (message.content != null && message.hasOwnProperty("content")) + if (!$util.isString(message.content)) + return "content: string expected"; + if (message.pageSpan != null && message.hasOwnProperty("pageSpan")) { + var error = $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan.verify(message.pageSpan); + if (error) + return "pageSpan." + error; + } + if (message.pageHeaders != null && message.hasOwnProperty("pageHeaders")) { + if (!Array.isArray(message.pageHeaders)) + return "pageHeaders: array expected"; + for (var i = 0; i < message.pageHeaders.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader.verify(message.pageHeaders[i]); + if (error) + return "pageHeaders." + error; + } + } + if (message.pageFooters != null && message.hasOwnProperty("pageFooters")) { + if (!Array.isArray(message.pageFooters)) + return "pageFooters: array expected"; + for (var i = 0; i < message.pageFooters.length; ++i) { + var error = $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter.verify(message.pageFooters[i]); + if (error) + return "pageFooters." + error; + } + } + return null; + }; + + /** + * Creates a Chunk message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk} Chunk + */ + Chunk.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk) + return object; + var message = new $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk(); + if (object.chunkId != null) + message.chunkId = String(object.chunkId); + if (object.sourceBlockIds) { + if (!Array.isArray(object.sourceBlockIds)) + throw TypeError(".google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.sourceBlockIds: array expected"); + message.sourceBlockIds = []; + for (var i = 0; i < object.sourceBlockIds.length; ++i) + message.sourceBlockIds[i] = String(object.sourceBlockIds[i]); + } + if (object.content != null) + message.content = String(object.content); + if (object.pageSpan != null) { + if (typeof object.pageSpan !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.pageSpan: object expected"); + message.pageSpan = $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan.fromObject(object.pageSpan); + } + if (object.pageHeaders) { + if (!Array.isArray(object.pageHeaders)) + throw TypeError(".google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.pageHeaders: array expected"); + message.pageHeaders = []; + for (var i = 0; i < object.pageHeaders.length; ++i) { + if (typeof object.pageHeaders[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.pageHeaders: object expected"); + message.pageHeaders[i] = $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader.fromObject(object.pageHeaders[i]); + } + } + if (object.pageFooters) { + if (!Array.isArray(object.pageFooters)) + throw TypeError(".google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.pageFooters: array expected"); + message.pageFooters = []; + for (var i = 0; i < object.pageFooters.length; ++i) { + if (typeof object.pageFooters[i] !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.pageFooters: object expected"); + message.pageFooters[i] = $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter.fromObject(object.pageFooters[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Chunk message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk + * @static + * @param {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk} message Chunk + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Chunk.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.sourceBlockIds = []; + object.pageHeaders = []; + object.pageFooters = []; + } + if (options.defaults) { + object.chunkId = ""; + object.content = ""; + object.pageSpan = null; + } + if (message.chunkId != null && message.hasOwnProperty("chunkId")) + object.chunkId = message.chunkId; + if (message.sourceBlockIds && message.sourceBlockIds.length) { + object.sourceBlockIds = []; + for (var j = 0; j < message.sourceBlockIds.length; ++j) + object.sourceBlockIds[j] = message.sourceBlockIds[j]; + } + if (message.content != null && message.hasOwnProperty("content")) + object.content = message.content; + if (message.pageSpan != null && message.hasOwnProperty("pageSpan")) + object.pageSpan = $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan.toObject(message.pageSpan, options); + if (message.pageHeaders && message.pageHeaders.length) { + object.pageHeaders = []; + for (var j = 0; j < message.pageHeaders.length; ++j) + object.pageHeaders[j] = $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader.toObject(message.pageHeaders[j], options); + } + if (message.pageFooters && message.pageFooters.length) { + object.pageFooters = []; + for (var j = 0; j < message.pageFooters.length; ++j) + object.pageFooters[j] = $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter.toObject(message.pageFooters[j], options); + } + return object; + }; + + /** + * Converts this Chunk to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk + * @instance + * @returns {Object.} JSON object + */ + Chunk.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Chunk + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Chunk.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk"; + }; + + Chunk.ChunkPageSpan = (function() { + + /** + * Properties of a ChunkPageSpan. + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk + * @interface IChunkPageSpan + * @property {number|null} [pageStart] ChunkPageSpan pageStart + * @property {number|null} [pageEnd] ChunkPageSpan pageEnd + */ + + /** + * Constructs a new ChunkPageSpan. + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk + * @classdesc Represents a ChunkPageSpan. + * @implements IChunkPageSpan + * @constructor + * @param {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageSpan=} [properties] Properties to set + */ + function ChunkPageSpan(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ChunkPageSpan pageStart. + * @member {number} pageStart + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan + * @instance + */ + ChunkPageSpan.prototype.pageStart = 0; + + /** + * ChunkPageSpan pageEnd. + * @member {number} pageEnd + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan + * @instance + */ + ChunkPageSpan.prototype.pageEnd = 0; + + /** + * Creates a new ChunkPageSpan instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan + * @static + * @param {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageSpan=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan} ChunkPageSpan instance + */ + ChunkPageSpan.create = function create(properties) { + return new ChunkPageSpan(properties); + }; + + /** + * Encodes the specified ChunkPageSpan message. Does not implicitly {@link google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan + * @static + * @param {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageSpan} message ChunkPageSpan message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ChunkPageSpan.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pageStart != null && Object.hasOwnProperty.call(message, "pageStart")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.pageStart); + if (message.pageEnd != null && Object.hasOwnProperty.call(message, "pageEnd")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageEnd); + return writer; + }; + + /** + * Encodes the specified ChunkPageSpan message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan + * @static + * @param {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageSpan} message ChunkPageSpan message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ChunkPageSpan.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ChunkPageSpan message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan + * @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.ChunkedDocument.Chunk.ChunkPageSpan} ChunkPageSpan + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ChunkPageSpan.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.ChunkedDocument.Chunk.ChunkPageSpan(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.pageStart = reader.int32(); + break; + } + case 2: { + message.pageEnd = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ChunkPageSpan message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan} ChunkPageSpan + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ChunkPageSpan.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ChunkPageSpan message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ChunkPageSpan.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pageStart != null && message.hasOwnProperty("pageStart")) + if (!$util.isInteger(message.pageStart)) + return "pageStart: integer expected"; + if (message.pageEnd != null && message.hasOwnProperty("pageEnd")) + if (!$util.isInteger(message.pageEnd)) + return "pageEnd: integer expected"; + return null; + }; + + /** + * Creates a ChunkPageSpan message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan} ChunkPageSpan + */ + ChunkPageSpan.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan) + return object; + var message = new $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan(); + if (object.pageStart != null) + message.pageStart = object.pageStart | 0; + if (object.pageEnd != null) + message.pageEnd = object.pageEnd | 0; + return message; + }; + + /** + * Creates a plain object from a ChunkPageSpan message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan + * @static + * @param {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan} message ChunkPageSpan + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ChunkPageSpan.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.pageStart = 0; + object.pageEnd = 0; + } + if (message.pageStart != null && message.hasOwnProperty("pageStart")) + object.pageStart = message.pageStart; + if (message.pageEnd != null && message.hasOwnProperty("pageEnd")) + object.pageEnd = message.pageEnd; + return object; + }; + + /** + * Converts this ChunkPageSpan to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan + * @instance + * @returns {Object.} JSON object + */ + ChunkPageSpan.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ChunkPageSpan + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ChunkPageSpan.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan"; + }; + + return ChunkPageSpan; + })(); + + Chunk.ChunkPageHeader = (function() { + + /** + * Properties of a ChunkPageHeader. + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk + * @interface IChunkPageHeader + * @property {string|null} [text] ChunkPageHeader text + * @property {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageSpan|null} [pageSpan] ChunkPageHeader pageSpan + */ + + /** + * Constructs a new ChunkPageHeader. + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk + * @classdesc Represents a ChunkPageHeader. + * @implements IChunkPageHeader + * @constructor + * @param {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageHeader=} [properties] Properties to set + */ + function ChunkPageHeader(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ChunkPageHeader text. + * @member {string} text + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader + * @instance + */ + ChunkPageHeader.prototype.text = ""; + + /** + * ChunkPageHeader pageSpan. + * @member {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageSpan|null|undefined} pageSpan + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader + * @instance + */ + ChunkPageHeader.prototype.pageSpan = null; + + /** + * Creates a new ChunkPageHeader instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader + * @static + * @param {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageHeader=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader} ChunkPageHeader instance + */ + ChunkPageHeader.create = function create(properties) { + return new ChunkPageHeader(properties); + }; + + /** + * Encodes the specified ChunkPageHeader message. Does not implicitly {@link google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader + * @static + * @param {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageHeader} message ChunkPageHeader message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ChunkPageHeader.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + if (message.pageSpan != null && Object.hasOwnProperty.call(message, "pageSpan")) + $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan.encode(message.pageSpan, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ChunkPageHeader message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader + * @static + * @param {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageHeader} message ChunkPageHeader message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ChunkPageHeader.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ChunkPageHeader message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader + * @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.ChunkedDocument.Chunk.ChunkPageHeader} ChunkPageHeader + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ChunkPageHeader.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.ChunkedDocument.Chunk.ChunkPageHeader(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.text = reader.string(); + break; + } + case 2: { + message.pageSpan = $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ChunkPageHeader message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader} ChunkPageHeader + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ChunkPageHeader.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ChunkPageHeader message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ChunkPageHeader.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + if (message.pageSpan != null && message.hasOwnProperty("pageSpan")) { + var error = $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan.verify(message.pageSpan); + if (error) + return "pageSpan." + error; + } + return null; + }; + + /** + * Creates a ChunkPageHeader message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader} ChunkPageHeader + */ + ChunkPageHeader.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader) + return object; + var message = new $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader(); + if (object.text != null) + message.text = String(object.text); + if (object.pageSpan != null) { + if (typeof object.pageSpan !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader.pageSpan: object expected"); + message.pageSpan = $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan.fromObject(object.pageSpan); + } + return message; + }; + + /** + * Creates a plain object from a ChunkPageHeader message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader + * @static + * @param {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader} message ChunkPageHeader + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ChunkPageHeader.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.text = ""; + object.pageSpan = null; + } + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + if (message.pageSpan != null && message.hasOwnProperty("pageSpan")) + object.pageSpan = $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan.toObject(message.pageSpan, options); + return object; + }; + + /** + * Converts this ChunkPageHeader to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader + * @instance + * @returns {Object.} JSON object + */ + ChunkPageHeader.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ChunkPageHeader + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ChunkPageHeader.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader"; + }; + + return ChunkPageHeader; + })(); + + Chunk.ChunkPageFooter = (function() { + + /** + * Properties of a ChunkPageFooter. + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk + * @interface IChunkPageFooter + * @property {string|null} [text] ChunkPageFooter text + * @property {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageSpan|null} [pageSpan] ChunkPageFooter pageSpan + */ + + /** + * Constructs a new ChunkPageFooter. + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk + * @classdesc Represents a ChunkPageFooter. + * @implements IChunkPageFooter + * @constructor + * @param {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageFooter=} [properties] Properties to set + */ + function ChunkPageFooter(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ChunkPageFooter text. + * @member {string} text + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter + * @instance + */ + ChunkPageFooter.prototype.text = ""; + + /** + * ChunkPageFooter pageSpan. + * @member {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageSpan|null|undefined} pageSpan + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter + * @instance + */ + ChunkPageFooter.prototype.pageSpan = null; + + /** + * Creates a new ChunkPageFooter instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter + * @static + * @param {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageFooter=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter} ChunkPageFooter instance + */ + ChunkPageFooter.create = function create(properties) { + return new ChunkPageFooter(properties); + }; + + /** + * Encodes the specified ChunkPageFooter message. Does not implicitly {@link google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter + * @static + * @param {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageFooter} message ChunkPageFooter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ChunkPageFooter.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + if (message.pageSpan != null && Object.hasOwnProperty.call(message, "pageSpan")) + $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan.encode(message.pageSpan, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ChunkPageFooter message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter + * @static + * @param {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.IChunkPageFooter} message ChunkPageFooter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ChunkPageFooter.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ChunkPageFooter message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter + * @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.ChunkedDocument.Chunk.ChunkPageFooter} ChunkPageFooter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ChunkPageFooter.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.ChunkedDocument.Chunk.ChunkPageFooter(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.text = reader.string(); + break; + } + case 2: { + message.pageSpan = $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ChunkPageFooter message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter} ChunkPageFooter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ChunkPageFooter.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ChunkPageFooter message. + * @function verify + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ChunkPageFooter.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + if (message.pageSpan != null && message.hasOwnProperty("pageSpan")) { + var error = $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan.verify(message.pageSpan); + if (error) + return "pageSpan." + error; + } + return null; + }; + + /** + * Creates a ChunkPageFooter message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter} ChunkPageFooter + */ + ChunkPageFooter.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter) + return object; + var message = new $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter(); + if (object.text != null) + message.text = String(object.text); + if (object.pageSpan != null) { + if (typeof object.pageSpan !== "object") + throw TypeError(".google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter.pageSpan: object expected"); + message.pageSpan = $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan.fromObject(object.pageSpan); + } + return message; + }; + + /** + * Creates a plain object from a ChunkPageFooter message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter + * @static + * @param {google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter} message ChunkPageFooter + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ChunkPageFooter.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.text = ""; + object.pageSpan = null; + } + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + if (message.pageSpan != null && message.hasOwnProperty("pageSpan")) + object.pageSpan = $root.google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan.toObject(message.pageSpan, options); + return object; + }; + + /** + * Converts this ChunkPageFooter to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter + * @instance + * @returns {Object.} JSON object + */ + ChunkPageFooter.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ChunkPageFooter + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ChunkPageFooter.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter"; + }; + + return ChunkPageFooter; + })(); + + return Chunk; + })(); + + return ChunkedDocument; + })(); + return Document; })(); diff --git a/packages/google-cloud-contentwarehouse/protos/protos.json b/packages/google-cloud-contentwarehouse/protos/protos.json index 72732cb3e79..fc996899dc9 100644 --- a/packages/google-cloud-contentwarehouse/protos/protos.json +++ b/packages/google-cloud-contentwarehouse/protos/protos.json @@ -3116,6 +3116,14 @@ "rule": "repeated", "type": "Revision", "id": 13 + }, + "documentLayout": { + "type": "DocumentLayout", + "id": 17 + }, + "chunkedDocument": { + "type": "ChunkedDocument", + "id": 18 } }, "nested": { @@ -4106,6 +4114,227 @@ } } } + }, + "DocumentLayout": { + "fields": { + "blocks": { + "rule": "repeated", + "type": "DocumentLayoutBlock", + "id": 1 + } + }, + "nested": { + "DocumentLayoutBlock": { + "oneofs": { + "block": { + "oneof": [ + "textBlock", + "tableBlock", + "listBlock" + ] + } + }, + "fields": { + "textBlock": { + "type": "LayoutTextBlock", + "id": 2 + }, + "tableBlock": { + "type": "LayoutTableBlock", + "id": 3 + }, + "listBlock": { + "type": "LayoutListBlock", + "id": 4 + }, + "blockId": { + "type": "string", + "id": 1 + }, + "pageSpan": { + "type": "LayoutPageSpan", + "id": 5 + } + }, + "nested": { + "LayoutPageSpan": { + "fields": { + "pageStart": { + "type": "int32", + "id": 1 + }, + "pageEnd": { + "type": "int32", + "id": 2 + } + } + }, + "LayoutTextBlock": { + "fields": { + "text": { + "type": "string", + "id": 1 + }, + "type": { + "type": "string", + "id": 2 + }, + "blocks": { + "rule": "repeated", + "type": "DocumentLayoutBlock", + "id": 3 + } + } + }, + "LayoutTableBlock": { + "fields": { + "headerRows": { + "rule": "repeated", + "type": "LayoutTableRow", + "id": 1 + }, + "bodyRows": { + "rule": "repeated", + "type": "LayoutTableRow", + "id": 2 + }, + "caption": { + "type": "string", + "id": 3 + } + } + }, + "LayoutTableRow": { + "fields": { + "cells": { + "rule": "repeated", + "type": "LayoutTableCell", + "id": 1 + } + } + }, + "LayoutTableCell": { + "fields": { + "blocks": { + "rule": "repeated", + "type": "DocumentLayoutBlock", + "id": 1 + }, + "rowSpan": { + "type": "int32", + "id": 2 + }, + "colSpan": { + "type": "int32", + "id": 3 + } + } + }, + "LayoutListBlock": { + "fields": { + "listEntries": { + "rule": "repeated", + "type": "LayoutListEntry", + "id": 1 + }, + "type": { + "type": "string", + "id": 2 + } + } + }, + "LayoutListEntry": { + "fields": { + "blocks": { + "rule": "repeated", + "type": "DocumentLayoutBlock", + "id": 1 + } + } + } + } + } + } + }, + "ChunkedDocument": { + "fields": { + "chunks": { + "rule": "repeated", + "type": "Chunk", + "id": 1 + } + }, + "nested": { + "Chunk": { + "fields": { + "chunkId": { + "type": "string", + "id": 1 + }, + "sourceBlockIds": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "content": { + "type": "string", + "id": 3 + }, + "pageSpan": { + "type": "ChunkPageSpan", + "id": 4 + }, + "pageHeaders": { + "rule": "repeated", + "type": "ChunkPageHeader", + "id": 5 + }, + "pageFooters": { + "rule": "repeated", + "type": "ChunkPageFooter", + "id": 6 + } + }, + "nested": { + "ChunkPageSpan": { + "fields": { + "pageStart": { + "type": "int32", + "id": 1 + }, + "pageEnd": { + "type": "int32", + "id": 2 + } + } + }, + "ChunkPageHeader": { + "fields": { + "text": { + "type": "string", + "id": 1 + }, + "pageSpan": { + "type": "ChunkPageSpan", + "id": 2 + } + } + }, + "ChunkPageFooter": { + "fields": { + "text": { + "type": "string", + "id": 1 + }, + "pageSpan": { + "type": "ChunkPageSpan", + "id": 2 + } + } + } + } + } + } } } }, diff --git a/packages/google-cloud-contentwarehouse/samples/generated/v1/snippet_metadata.google.cloud.contentwarehouse.v1.json b/packages/google-cloud-contentwarehouse/samples/generated/v1/snippet_metadata.google.cloud.contentwarehouse.v1.json index 3163a9d5ed9..0a6daff3404 100644 --- a/packages/google-cloud-contentwarehouse/samples/generated/v1/snippet_metadata.google.cloud.contentwarehouse.v1.json +++ b/packages/google-cloud-contentwarehouse/samples/generated/v1/snippet_metadata.google.cloud.contentwarehouse.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-contentwarehouse", - "version": "1.7.0", + "version": "1.8.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-contentwarehouse/samples/generated/v1/snippet_metadata_google.cloud.contentwarehouse.v1.json b/packages/google-cloud-contentwarehouse/samples/generated/v1/snippet_metadata_google.cloud.contentwarehouse.v1.json index eec8655a9d2..3cee4c64261 100644 --- a/packages/google-cloud-contentwarehouse/samples/generated/v1/snippet_metadata_google.cloud.contentwarehouse.v1.json +++ b/packages/google-cloud-contentwarehouse/samples/generated/v1/snippet_metadata_google.cloud.contentwarehouse.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-contentwarehouse", - "version": "1.7.0", + "version": "1.8.0", "language": "TYPESCRIPT", "apis": [ {