From 19e9aedfddebc4319993fc1d3fba4030f436d38c Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 13 Dec 2022 23:42:15 +0000 Subject: [PATCH] feat: added sharding_config field in DocumentOutputConfig.GcsOutputConfig in document_io.proto (#3734) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 495051185 Source-Link: https://togithub.com/googleapis/googleapis/commit/0ff0b240ca1026d914e2256d4a32f885d1a31c54 Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/ffa8b5f51bd4258481b8fc73ca7370f78847d5d7 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWRvY3VtZW50YWkvLk93bEJvdC55YW1sIiwiaCI6ImZmYThiNWY1MWJkNDI1ODQ4MWI4ZmM3M2NhNzM3MGY3ODg0N2Q1ZDcifQ== BEGIN_NESTED_COMMIT feat: added sharding_config field in DocumentOutputConfig.GcsOutputConfig in document_io.proto PiperOrigin-RevId: 495050408 Source-Link: https://togithub.com/googleapis/googleapis/commit/46a1452f5f7835512f2d18e88956b4da218ca6bc Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/865eeff1ce9e70e0989d6b0213ae6a5c987b10d7 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWRvY3VtZW50YWkvLk93bEJvdC55YW1sIiwiaCI6Ijg2NWVlZmYxY2U5ZTcwZTA5ODlkNmIwMjEzYWU2YTVjOTg3YjEwZDcifQ== END_NESTED_COMMIT --- .../cloud/documentai/v1/document_io.proto | 12 + .../documentai/v1beta3/document_io.proto | 12 + .../protos/protos.d.ts | 224 ++++++++ .../google-cloud-documentai/protos/protos.js | 510 ++++++++++++++++++ .../protos/protos.json | 36 ++ 5 files changed, 794 insertions(+) diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_io.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_io.proto index 3240d494e8f..d56086336d2 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_io.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1/document_io.proto @@ -74,6 +74,15 @@ message BatchDocumentsInputConfig { message DocumentOutputConfig { // The configuration used when outputting documents. message GcsOutputConfig { + // The sharding config for the output document. + message ShardingConfig { + // The number of pages per shard. + int32 pages_per_shard = 1; + + // The number of overlapping pages between consecutive shards. + int32 pages_overlap = 2; + } + // The Cloud Storage uri (a directory) of the output. string gcs_uri = 1; @@ -81,6 +90,9 @@ message DocumentOutputConfig { // Only supports top level document and pages field so it must be in the // form of `{document_field_name}` or `pages.{page_field_name}`. google.protobuf.FieldMask field_mask = 2; + + // Specifies the sharding config for the output document. + ShardingConfig sharding_config = 3; } // The destination of the results. diff --git a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_io.proto b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_io.proto index e41458e0a24..db905d07079 100644 --- a/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_io.proto +++ b/packages/google-cloud-documentai/protos/google/cloud/documentai/v1beta3/document_io.proto @@ -74,6 +74,15 @@ message BatchDocumentsInputConfig { message DocumentOutputConfig { // The configuration used when outputting documents. message GcsOutputConfig { + // The sharding config for the output document. + message ShardingConfig { + // The number of pages per shard. + int32 pages_per_shard = 1; + + // The number of overlapping pages between consecutive shards. + int32 pages_overlap = 2; + } + // The Cloud Storage uri (a directory) of the output. string gcs_uri = 1; @@ -81,6 +90,9 @@ message DocumentOutputConfig { // Only supports top level document and pages field so it must be in the // form of `{document_field_name}` or `pages.{page_field_name}`. google.protobuf.FieldMask field_mask = 2; + + // Specifies the sharding config for the output document. + ShardingConfig sharding_config = 3; } // The destination of the results. diff --git a/packages/google-cloud-documentai/protos/protos.d.ts b/packages/google-cloud-documentai/protos/protos.d.ts index 4c85bb63f92..7b6d5593255 100644 --- a/packages/google-cloud-documentai/protos/protos.d.ts +++ b/packages/google-cloud-documentai/protos/protos.d.ts @@ -5345,6 +5345,9 @@ export namespace google { /** GcsOutputConfig fieldMask */ fieldMask?: (google.protobuf.IFieldMask|null); + + /** GcsOutputConfig shardingConfig */ + shardingConfig?: (google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.IShardingConfig|null); } /** Represents a GcsOutputConfig. */ @@ -5362,6 +5365,9 @@ export namespace google { /** GcsOutputConfig fieldMask. */ public fieldMask?: (google.protobuf.IFieldMask|null); + /** GcsOutputConfig shardingConfig. */ + public shardingConfig?: (google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.IShardingConfig|null); + /** * Creates a new GcsOutputConfig instance using the specified properties. * @param [properties] Properties to set @@ -5439,6 +5445,112 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } + + namespace GcsOutputConfig { + + /** Properties of a ShardingConfig. */ + interface IShardingConfig { + + /** ShardingConfig pagesPerShard */ + pagesPerShard?: (number|null); + + /** ShardingConfig pagesOverlap */ + pagesOverlap?: (number|null); + } + + /** Represents a ShardingConfig. */ + class ShardingConfig implements IShardingConfig { + + /** + * Constructs a new ShardingConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.IShardingConfig); + + /** ShardingConfig pagesPerShard. */ + public pagesPerShard: number; + + /** ShardingConfig pagesOverlap. */ + public pagesOverlap: number; + + /** + * Creates a new ShardingConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ShardingConfig instance + */ + public static create(properties?: google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.IShardingConfig): google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig; + + /** + * Encodes the specified ShardingConfig message. Does not implicitly {@link google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig.verify|verify} messages. + * @param message ShardingConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.IShardingConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ShardingConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig.verify|verify} messages. + * @param message ShardingConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.IShardingConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ShardingConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ShardingConfig + * @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.DocumentOutputConfig.GcsOutputConfig.ShardingConfig; + + /** + * Decodes a ShardingConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ShardingConfig + * @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.DocumentOutputConfig.GcsOutputConfig.ShardingConfig; + + /** + * Verifies a ShardingConfig 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 ShardingConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ShardingConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig; + + /** + * Creates a plain object from a ShardingConfig message. Also converts values to other types if specified. + * @param message ShardingConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ShardingConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ShardingConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } } /** Represents a DocumentProcessorService */ @@ -26078,6 +26190,9 @@ export namespace google { /** GcsOutputConfig fieldMask */ fieldMask?: (google.protobuf.IFieldMask|null); + + /** GcsOutputConfig shardingConfig */ + shardingConfig?: (google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.IShardingConfig|null); } /** Represents a GcsOutputConfig. */ @@ -26095,6 +26210,9 @@ export namespace google { /** GcsOutputConfig fieldMask. */ public fieldMask?: (google.protobuf.IFieldMask|null); + /** GcsOutputConfig shardingConfig. */ + public shardingConfig?: (google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.IShardingConfig|null); + /** * Creates a new GcsOutputConfig instance using the specified properties. * @param [properties] Properties to set @@ -26172,6 +26290,112 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } + + namespace GcsOutputConfig { + + /** Properties of a ShardingConfig. */ + interface IShardingConfig { + + /** ShardingConfig pagesPerShard */ + pagesPerShard?: (number|null); + + /** ShardingConfig pagesOverlap */ + pagesOverlap?: (number|null); + } + + /** Represents a ShardingConfig. */ + class ShardingConfig implements IShardingConfig { + + /** + * Constructs a new ShardingConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.IShardingConfig); + + /** ShardingConfig pagesPerShard. */ + public pagesPerShard: number; + + /** ShardingConfig pagesOverlap. */ + public pagesOverlap: number; + + /** + * Creates a new ShardingConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ShardingConfig instance + */ + public static create(properties?: google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.IShardingConfig): google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig; + + /** + * Encodes the specified ShardingConfig message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig.verify|verify} messages. + * @param message ShardingConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.IShardingConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ShardingConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig.verify|verify} messages. + * @param message ShardingConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.IShardingConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ShardingConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ShardingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig; + + /** + * Decodes a ShardingConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ShardingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig; + + /** + * Verifies a ShardingConfig 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 ShardingConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ShardingConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig; + + /** + * Creates a plain object from a ShardingConfig message. Also converts values to other types if specified. + * @param message ShardingConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ShardingConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ShardingConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } } /** Represents a DocumentProcessorService */ diff --git a/packages/google-cloud-documentai/protos/protos.js b/packages/google-cloud-documentai/protos/protos.js index ee6e3946501..24edb0743e3 100644 --- a/packages/google-cloud-documentai/protos/protos.js +++ b/packages/google-cloud-documentai/protos/protos.js @@ -13947,6 +13947,7 @@ * @interface IGcsOutputConfig * @property {string|null} [gcsUri] GcsOutputConfig gcsUri * @property {google.protobuf.IFieldMask|null} [fieldMask] GcsOutputConfig fieldMask + * @property {google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.IShardingConfig|null} [shardingConfig] GcsOutputConfig shardingConfig */ /** @@ -13980,6 +13981,14 @@ */ GcsOutputConfig.prototype.fieldMask = null; + /** + * GcsOutputConfig shardingConfig. + * @member {google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.IShardingConfig|null|undefined} shardingConfig + * @memberof google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig + * @instance + */ + GcsOutputConfig.prototype.shardingConfig = null; + /** * Creates a new GcsOutputConfig instance using the specified properties. * @function create @@ -14008,6 +14017,8 @@ writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsUri); if (message.fieldMask != null && Object.hasOwnProperty.call(message, "fieldMask")) $root.google.protobuf.FieldMask.encode(message.fieldMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.shardingConfig != null && Object.hasOwnProperty.call(message, "shardingConfig")) + $root.google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig.encode(message.shardingConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; @@ -14050,6 +14061,10 @@ message.fieldMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); break; } + case 3: { + message.shardingConfig = $root.google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -14093,6 +14108,11 @@ if (error) return "fieldMask." + error; } + if (message.shardingConfig != null && message.hasOwnProperty("shardingConfig")) { + var error = $root.google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig.verify(message.shardingConfig); + if (error) + return "shardingConfig." + error; + } return null; }; @@ -14115,6 +14135,11 @@ throw TypeError(".google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.fieldMask: object expected"); message.fieldMask = $root.google.protobuf.FieldMask.fromObject(object.fieldMask); } + if (object.shardingConfig != null) { + if (typeof object.shardingConfig !== "object") + throw TypeError(".google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.shardingConfig: object expected"); + message.shardingConfig = $root.google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig.fromObject(object.shardingConfig); + } return message; }; @@ -14134,11 +14159,14 @@ if (options.defaults) { object.gcsUri = ""; object.fieldMask = null; + object.shardingConfig = null; } if (message.gcsUri != null && message.hasOwnProperty("gcsUri")) object.gcsUri = message.gcsUri; if (message.fieldMask != null && message.hasOwnProperty("fieldMask")) object.fieldMask = $root.google.protobuf.FieldMask.toObject(message.fieldMask, options); + if (message.shardingConfig != null && message.hasOwnProperty("shardingConfig")) + object.shardingConfig = $root.google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig.toObject(message.shardingConfig, options); return object; }; @@ -14168,6 +14196,233 @@ return typeUrlPrefix + "/google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig"; }; + GcsOutputConfig.ShardingConfig = (function() { + + /** + * Properties of a ShardingConfig. + * @memberof google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig + * @interface IShardingConfig + * @property {number|null} [pagesPerShard] ShardingConfig pagesPerShard + * @property {number|null} [pagesOverlap] ShardingConfig pagesOverlap + */ + + /** + * Constructs a new ShardingConfig. + * @memberof google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig + * @classdesc Represents a ShardingConfig. + * @implements IShardingConfig + * @constructor + * @param {google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.IShardingConfig=} [properties] Properties to set + */ + function ShardingConfig(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]]; + } + + /** + * ShardingConfig pagesPerShard. + * @member {number} pagesPerShard + * @memberof google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig + * @instance + */ + ShardingConfig.prototype.pagesPerShard = 0; + + /** + * ShardingConfig pagesOverlap. + * @member {number} pagesOverlap + * @memberof google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig + * @instance + */ + ShardingConfig.prototype.pagesOverlap = 0; + + /** + * Creates a new ShardingConfig instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig + * @static + * @param {google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.IShardingConfig=} [properties] Properties to set + * @returns {google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig} ShardingConfig instance + */ + ShardingConfig.create = function create(properties) { + return new ShardingConfig(properties); + }; + + /** + * Encodes the specified ShardingConfig message. Does not implicitly {@link google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig + * @static + * @param {google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.IShardingConfig} message ShardingConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ShardingConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pagesPerShard != null && Object.hasOwnProperty.call(message, "pagesPerShard")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.pagesPerShard); + if (message.pagesOverlap != null && Object.hasOwnProperty.call(message, "pagesOverlap")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pagesOverlap); + return writer; + }; + + /** + * Encodes the specified ShardingConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig + * @static + * @param {google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.IShardingConfig} message ShardingConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ShardingConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ShardingConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig + * @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.DocumentOutputConfig.GcsOutputConfig.ShardingConfig} ShardingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ShardingConfig.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.DocumentOutputConfig.GcsOutputConfig.ShardingConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.pagesPerShard = reader.int32(); + break; + } + case 2: { + message.pagesOverlap = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ShardingConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig} ShardingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ShardingConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ShardingConfig message. + * @function verify + * @memberof google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ShardingConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pagesPerShard != null && message.hasOwnProperty("pagesPerShard")) + if (!$util.isInteger(message.pagesPerShard)) + return "pagesPerShard: integer expected"; + if (message.pagesOverlap != null && message.hasOwnProperty("pagesOverlap")) + if (!$util.isInteger(message.pagesOverlap)) + return "pagesOverlap: integer expected"; + return null; + }; + + /** + * Creates a ShardingConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig} ShardingConfig + */ + ShardingConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig) + return object; + var message = new $root.google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig(); + if (object.pagesPerShard != null) + message.pagesPerShard = object.pagesPerShard | 0; + if (object.pagesOverlap != null) + message.pagesOverlap = object.pagesOverlap | 0; + return message; + }; + + /** + * Creates a plain object from a ShardingConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig + * @static + * @param {google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig} message ShardingConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ShardingConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.pagesPerShard = 0; + object.pagesOverlap = 0; + } + if (message.pagesPerShard != null && message.hasOwnProperty("pagesPerShard")) + object.pagesPerShard = message.pagesPerShard; + if (message.pagesOverlap != null && message.hasOwnProperty("pagesOverlap")) + object.pagesOverlap = message.pagesOverlap; + return object; + }; + + /** + * Converts this ShardingConfig to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig + * @instance + * @returns {Object.} JSON object + */ + ShardingConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ShardingConfig + * @function getTypeUrl + * @memberof google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ShardingConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig"; + }; + + return ShardingConfig; + })(); + return GcsOutputConfig; })(); @@ -65371,6 +65626,7 @@ * @interface IGcsOutputConfig * @property {string|null} [gcsUri] GcsOutputConfig gcsUri * @property {google.protobuf.IFieldMask|null} [fieldMask] GcsOutputConfig fieldMask + * @property {google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.IShardingConfig|null} [shardingConfig] GcsOutputConfig shardingConfig */ /** @@ -65404,6 +65660,14 @@ */ GcsOutputConfig.prototype.fieldMask = null; + /** + * GcsOutputConfig shardingConfig. + * @member {google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.IShardingConfig|null|undefined} shardingConfig + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig + * @instance + */ + GcsOutputConfig.prototype.shardingConfig = null; + /** * Creates a new GcsOutputConfig instance using the specified properties. * @function create @@ -65432,6 +65696,8 @@ writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsUri); if (message.fieldMask != null && Object.hasOwnProperty.call(message, "fieldMask")) $root.google.protobuf.FieldMask.encode(message.fieldMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.shardingConfig != null && Object.hasOwnProperty.call(message, "shardingConfig")) + $root.google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig.encode(message.shardingConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; @@ -65474,6 +65740,10 @@ message.fieldMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); break; } + case 3: { + message.shardingConfig = $root.google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -65517,6 +65787,11 @@ if (error) return "fieldMask." + error; } + if (message.shardingConfig != null && message.hasOwnProperty("shardingConfig")) { + var error = $root.google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig.verify(message.shardingConfig); + if (error) + return "shardingConfig." + error; + } return null; }; @@ -65539,6 +65814,11 @@ throw TypeError(".google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.fieldMask: object expected"); message.fieldMask = $root.google.protobuf.FieldMask.fromObject(object.fieldMask); } + if (object.shardingConfig != null) { + if (typeof object.shardingConfig !== "object") + throw TypeError(".google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.shardingConfig: object expected"); + message.shardingConfig = $root.google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig.fromObject(object.shardingConfig); + } return message; }; @@ -65558,11 +65838,14 @@ if (options.defaults) { object.gcsUri = ""; object.fieldMask = null; + object.shardingConfig = null; } if (message.gcsUri != null && message.hasOwnProperty("gcsUri")) object.gcsUri = message.gcsUri; if (message.fieldMask != null && message.hasOwnProperty("fieldMask")) object.fieldMask = $root.google.protobuf.FieldMask.toObject(message.fieldMask, options); + if (message.shardingConfig != null && message.hasOwnProperty("shardingConfig")) + object.shardingConfig = $root.google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig.toObject(message.shardingConfig, options); return object; }; @@ -65592,6 +65875,233 @@ return typeUrlPrefix + "/google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig"; }; + GcsOutputConfig.ShardingConfig = (function() { + + /** + * Properties of a ShardingConfig. + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig + * @interface IShardingConfig + * @property {number|null} [pagesPerShard] ShardingConfig pagesPerShard + * @property {number|null} [pagesOverlap] ShardingConfig pagesOverlap + */ + + /** + * Constructs a new ShardingConfig. + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig + * @classdesc Represents a ShardingConfig. + * @implements IShardingConfig + * @constructor + * @param {google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.IShardingConfig=} [properties] Properties to set + */ + function ShardingConfig(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]]; + } + + /** + * ShardingConfig pagesPerShard. + * @member {number} pagesPerShard + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig + * @instance + */ + ShardingConfig.prototype.pagesPerShard = 0; + + /** + * ShardingConfig pagesOverlap. + * @member {number} pagesOverlap + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig + * @instance + */ + ShardingConfig.prototype.pagesOverlap = 0; + + /** + * Creates a new ShardingConfig instance using the specified properties. + * @function create + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig + * @static + * @param {google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.IShardingConfig=} [properties] Properties to set + * @returns {google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig} ShardingConfig instance + */ + ShardingConfig.create = function create(properties) { + return new ShardingConfig(properties); + }; + + /** + * Encodes the specified ShardingConfig message. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig + * @static + * @param {google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.IShardingConfig} message ShardingConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ShardingConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pagesPerShard != null && Object.hasOwnProperty.call(message, "pagesPerShard")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.pagesPerShard); + if (message.pagesOverlap != null && Object.hasOwnProperty.call(message, "pagesOverlap")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pagesOverlap); + return writer; + }; + + /** + * Encodes the specified ShardingConfig message, length delimited. Does not implicitly {@link google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig + * @static + * @param {google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.IShardingConfig} message ShardingConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ShardingConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ShardingConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig} ShardingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ShardingConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.pagesPerShard = reader.int32(); + break; + } + case 2: { + message.pagesOverlap = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ShardingConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig} ShardingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ShardingConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ShardingConfig message. + * @function verify + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ShardingConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pagesPerShard != null && message.hasOwnProperty("pagesPerShard")) + if (!$util.isInteger(message.pagesPerShard)) + return "pagesPerShard: integer expected"; + if (message.pagesOverlap != null && message.hasOwnProperty("pagesOverlap")) + if (!$util.isInteger(message.pagesOverlap)) + return "pagesOverlap: integer expected"; + return null; + }; + + /** + * Creates a ShardingConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig} ShardingConfig + */ + ShardingConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig) + return object; + var message = new $root.google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig(); + if (object.pagesPerShard != null) + message.pagesPerShard = object.pagesPerShard | 0; + if (object.pagesOverlap != null) + message.pagesOverlap = object.pagesOverlap | 0; + return message; + }; + + /** + * Creates a plain object from a ShardingConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig + * @static + * @param {google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig} message ShardingConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ShardingConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.pagesPerShard = 0; + object.pagesOverlap = 0; + } + if (message.pagesPerShard != null && message.hasOwnProperty("pagesPerShard")) + object.pagesPerShard = message.pagesPerShard; + if (message.pagesOverlap != null && message.hasOwnProperty("pagesOverlap")) + object.pagesOverlap = message.pagesOverlap; + return object; + }; + + /** + * Converts this ShardingConfig to JSON. + * @function toJSON + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig + * @instance + * @returns {Object.} JSON object + */ + ShardingConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ShardingConfig + * @function getTypeUrl + * @memberof google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ShardingConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.documentai.v1beta3.DocumentOutputConfig.GcsOutputConfig.ShardingConfig"; + }; + + return ShardingConfig; + })(); + return GcsOutputConfig; })(); diff --git a/packages/google-cloud-documentai/protos/protos.json b/packages/google-cloud-documentai/protos/protos.json index 90f36807e1c..a0d6d65074f 100644 --- a/packages/google-cloud-documentai/protos/protos.json +++ b/packages/google-cloud-documentai/protos/protos.json @@ -1137,6 +1137,24 @@ "fieldMask": { "type": "google.protobuf.FieldMask", "id": 2 + }, + "shardingConfig": { + "type": "ShardingConfig", + "id": 3 + } + }, + "nested": { + "ShardingConfig": { + "fields": { + "pagesPerShard": { + "type": "int32", + "id": 1 + }, + "pagesOverlap": { + "type": "int32", + "id": 2 + } + } } } } @@ -5396,6 +5414,24 @@ "fieldMask": { "type": "google.protobuf.FieldMask", "id": 2 + }, + "shardingConfig": { + "type": "ShardingConfig", + "id": 3 + } + }, + "nested": { + "ShardingConfig": { + "fields": { + "pagesPerShard": { + "type": "int32", + "id": 1 + }, + "pagesOverlap": { + "type": "int32", + "id": 2 + } + } } } }