diff --git a/packages/google-cloud-vision/.gitignore b/packages/google-cloud-vision/.gitignore index 23cb08fcba9..5d32b23782f 100644 --- a/packages/google-cloud-vision/.gitignore +++ b/packages/google-cloud-vision/.gitignore @@ -1,6 +1,7 @@ **/*.log **/node_modules .coverage +coverage .nyc_output docs/ out/ @@ -9,6 +10,5 @@ system-test/secrets.js system-test/*key.json *.lock .DS_Store -__pycache__ package-lock.json -.vscode +__pycache__ diff --git a/packages/google-cloud-vision/.jsdoc.js b/packages/google-cloud-vision/.jsdoc.js index 052146efd45..cdb45108733 100644 --- a/packages/google-cloud-vision/.jsdoc.js +++ b/packages/google-cloud-vision/.jsdoc.js @@ -12,6 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. // +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** 'use strict'; @@ -31,7 +34,7 @@ module.exports = { source: { excludePattern: '(^|\\/|\\\\)[._]', include: [ - 'src', + 'build/src', 'protos' ], includePattern: '\\.js$' @@ -43,7 +46,7 @@ module.exports = { systemName: '@google-cloud/vision', theme: 'lumen', default: { - "outputSourceFiles": false + outputSourceFiles: false } }, markdown: { diff --git a/packages/google-cloud-vision/linkinator.config.json b/packages/google-cloud-vision/linkinator.config.json index df783331349..b555215ca02 100644 --- a/packages/google-cloud-vision/linkinator.config.json +++ b/packages/google-cloud-vision/linkinator.config.json @@ -3,7 +3,6 @@ "skip": [ "https://codecov.io/gh/googleapis/", "www.googleapis.com", - "setEndpoint.js", "img.shields.io" ] } diff --git a/packages/google-cloud-vision/package.json b/packages/google-cloud-vision/package.json index fb715ea44d9..a4c537dd5f7 100644 --- a/packages/google-cloud-vision/package.json +++ b/packages/google-cloud-vision/package.json @@ -8,10 +8,10 @@ "node": ">=8.10.0" }, "repository": "googleapis/nodejs-vision", - "main": "src/index.js", + "main": "build/src/index.js", "files": [ - "protos", - "src" + "build/protos", + "build/src" ], "keywords": [ "google apis client", @@ -27,37 +27,53 @@ "Google Cloud Vision API" ], "scripts": { + "test": "c8 mocha build/test", + "samples-test": "cd samples/ && npm link ../ && npm install && npm test && cd ../", + "lint": "gts fix && eslint --fix samples/*.js", "docs": "jsdoc -c .jsdoc.js", - "lint": "eslint '**/*.js'", - "samples-test": "cd samples/ && npm link ../ && npm test && cd ../", - "system-test": "mocha system-test/*.js smoke-test/*.js --timeout 600000", + "system-test": "mocha build/system-test", + "fix": "gts fix", "test-no-cover": "mocha test/*.js", - "test": "nyc mocha", - "fix": "eslint --fix '**/*.js'", "docs-test": "linkinator docs", "predocs-test": "npm run docs", - "prelint": "cd samples; npm link ../; npm i" + "prelint": "cd samples; npm link ../; npm i", + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "compile-protos": "compileProtos src", + "prepare": "npm run compile" }, "dependencies": { - "@google-cloud/promisify": "^1.0.0", - "google-gax": "^1.7.5", - "is": "^3.2.1" + "@google-cloud/promisify": "^1.0.4", + "google-gax": "^1.14.1", + "is": "^3.3.0" }, "devDependencies": { - "@google-cloud/storage": "^4.0.0", - "codecov": "^3.0.2", - "eslint": "^6.0.0", - "eslint-config-prettier": "^6.0.0", + "@types/mocha": "^7.0.1", + "@types/node": "^13.7.4", + "@types/is": "0.0.21", + "@types/sinon": "^7.5.1", + "@types/uuid": "^3.4.7", + "c8": "^7.1.0", + "@google-cloud/storage": "^4.3.1", + "codecov": "^3.6.5", + "eslint": "^6.8.0", + "eslint-config-prettier": "^6.10.0", "eslint-plugin-node": "^11.0.0", - "eslint-plugin-prettier": "^3.0.0", - "jsdoc": "^3.6.2", - "jsdoc-fresh": "^1.0.1", - "jsdoc-region-tag": "^1.0.2", - "linkinator": "^2.0.0", - "mocha": "^7.0.0", - "nyc": "^14.0.0", - "prettier": "^1.13.6", + "eslint-plugin-prettier": "^3.1.2", + "gts": "^1.1.2", + "jsdoc": "^3.6.3", + "jsdoc-fresh": "^1.0.2", + "jsdoc-region-tag": "^1.0.4", + "linkinator": "^2.0.3", + "mocha": "^7.0.1", + "prettier": "^1.19.1", "sinon": "^9.0.0", - "uuid": "^7.0.0" + "uuid": "^3.4.0", + "null-loader": "^3.0.0", + "pack-n-play": "^1.0.0-2", + "ts-loader": "^6.2.1", + "typescript": "^3.7.0", + "webpack": "^4.41.6", + "webpack-cli": "^3.3.11" } } diff --git a/packages/google-cloud-vision/protos/google/cloud/common_resources.proto b/packages/google-cloud-vision/protos/google/cloud/common_resources.proto new file mode 100644 index 00000000000..56c9f800d5e --- /dev/null +++ b/packages/google-cloud-vision/protos/google/cloud/common_resources.proto @@ -0,0 +1,52 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This file contains stub messages for common resources in GCP. +// It is not intended to be directly generated, and is instead used by +// other tooling to be able to match common resource patterns. +syntax = "proto3"; + +package google.cloud; + +import "google/api/resource.proto"; + + +option (google.api.resource_definition) = { + type: "cloudresourcemanager.googleapis.com/Project" + pattern: "projects/{project}" +}; + + +option (google.api.resource_definition) = { + type: "cloudresourcemanager.googleapis.com/Organization" + pattern: "organizations/{organization}" +}; + + +option (google.api.resource_definition) = { + type: "cloudresourcemanager.googleapis.com/Folder" + pattern: "folders/{folder}" +}; + + +option (google.api.resource_definition) = { + type: "cloudbilling.googleapis.com/BillingAccount" + pattern: "billingAccounts/{billing_account}" +}; + +option (google.api.resource_definition) = { + type: "locations.googleapis.com/Location" + pattern: "projects/{project}/locations/{location}" +}; + diff --git a/packages/google-cloud-vision/protos/protos.d.ts b/packages/google-cloud-vision/protos/protos.d.ts index 62b66ddbf70..6a3a711abee 100644 --- a/packages/google-cloud-vision/protos/protos.d.ts +++ b/packages/google-cloud-vision/protos/protos.d.ts @@ -26,6 +26,396 @@ export namespace google { /** Namespace v1. */ namespace v1 { + /** Properties of a Vertex. */ + interface IVertex { + + /** Vertex x */ + x?: (number|null); + + /** Vertex y */ + y?: (number|null); + } + + /** Represents a Vertex. */ + class Vertex implements IVertex { + + /** + * Constructs a new Vertex. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.vision.v1.IVertex); + + /** Vertex x. */ + public x: number; + + /** Vertex y. */ + public y: number; + + /** + * Creates a new Vertex instance using the specified properties. + * @param [properties] Properties to set + * @returns Vertex instance + */ + public static create(properties?: google.cloud.vision.v1.IVertex): google.cloud.vision.v1.Vertex; + + /** + * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.vision.v1.Vertex.verify|verify} messages. + * @param message Vertex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.vision.v1.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1.Vertex.verify|verify} messages. + * @param message Vertex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.vision.v1.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Vertex message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Vertex + * @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.vision.v1.Vertex; + + /** + * Decodes a Vertex message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Vertex + * @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.vision.v1.Vertex; + + /** + * Verifies a Vertex 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 Vertex message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Vertex + */ + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.Vertex; + + /** + * Creates a plain object from a Vertex message. Also converts values to other types if specified. + * @param message Vertex + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.vision.v1.Vertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Vertex to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a NormalizedVertex. */ + interface INormalizedVertex { + + /** NormalizedVertex x */ + x?: (number|null); + + /** NormalizedVertex y */ + y?: (number|null); + } + + /** Represents a NormalizedVertex. */ + class NormalizedVertex implements INormalizedVertex { + + /** + * Constructs a new NormalizedVertex. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.vision.v1.INormalizedVertex); + + /** NormalizedVertex x. */ + public x: number; + + /** NormalizedVertex y. */ + public y: number; + + /** + * Creates a new NormalizedVertex instance using the specified properties. + * @param [properties] Properties to set + * @returns NormalizedVertex instance + */ + public static create(properties?: google.cloud.vision.v1.INormalizedVertex): google.cloud.vision.v1.NormalizedVertex; + + /** + * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.vision.v1.NormalizedVertex.verify|verify} messages. + * @param message NormalizedVertex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.vision.v1.INormalizedVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NormalizedVertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1.NormalizedVertex.verify|verify} messages. + * @param message NormalizedVertex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.vision.v1.INormalizedVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NormalizedVertex message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NormalizedVertex + * @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.vision.v1.NormalizedVertex; + + /** + * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NormalizedVertex + * @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.vision.v1.NormalizedVertex; + + /** + * Verifies a NormalizedVertex 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 NormalizedVertex message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NormalizedVertex + */ + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.NormalizedVertex; + + /** + * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. + * @param message NormalizedVertex + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.vision.v1.NormalizedVertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NormalizedVertex to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BoundingPoly. */ + interface IBoundingPoly { + + /** BoundingPoly vertices */ + vertices?: (google.cloud.vision.v1.IVertex[]|null); + + /** BoundingPoly normalizedVertices */ + normalizedVertices?: (google.cloud.vision.v1.INormalizedVertex[]|null); + } + + /** Represents a BoundingPoly. */ + class BoundingPoly implements IBoundingPoly { + + /** + * Constructs a new BoundingPoly. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.vision.v1.IBoundingPoly); + + /** BoundingPoly vertices. */ + public vertices: google.cloud.vision.v1.IVertex[]; + + /** BoundingPoly normalizedVertices. */ + public normalizedVertices: google.cloud.vision.v1.INormalizedVertex[]; + + /** + * Creates a new BoundingPoly instance using the specified properties. + * @param [properties] Properties to set + * @returns BoundingPoly instance + */ + public static create(properties?: google.cloud.vision.v1.IBoundingPoly): google.cloud.vision.v1.BoundingPoly; + + /** + * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.vision.v1.BoundingPoly.verify|verify} messages. + * @param message BoundingPoly message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.vision.v1.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.vision.v1.BoundingPoly.verify|verify} messages. + * @param message BoundingPoly message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.vision.v1.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BoundingPoly message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BoundingPoly + * @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.vision.v1.BoundingPoly; + + /** + * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BoundingPoly + * @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.vision.v1.BoundingPoly; + + /** + * Verifies a BoundingPoly 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 BoundingPoly message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BoundingPoly + */ + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.BoundingPoly; + + /** + * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. + * @param message BoundingPoly + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.vision.v1.BoundingPoly, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BoundingPoly to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Position. */ + interface IPosition { + + /** Position x */ + x?: (number|null); + + /** Position y */ + y?: (number|null); + + /** Position z */ + z?: (number|null); + } + + /** Represents a Position. */ + class Position implements IPosition { + + /** + * Constructs a new Position. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.vision.v1.IPosition); + + /** Position x. */ + public x: number; + + /** Position y. */ + public y: number; + + /** Position z. */ + public z: number; + + /** + * Creates a new Position instance using the specified properties. + * @param [properties] Properties to set + * @returns Position instance + */ + public static create(properties?: google.cloud.vision.v1.IPosition): google.cloud.vision.v1.Position; + + /** + * Encodes the specified Position message. Does not implicitly {@link google.cloud.vision.v1.Position.verify|verify} messages. + * @param message Position message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.vision.v1.IPosition, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Position message, length delimited. Does not implicitly {@link google.cloud.vision.v1.Position.verify|verify} messages. + * @param message Position message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.vision.v1.IPosition, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Position message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Position + * @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.vision.v1.Position; + + /** + * Decodes a Position message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Position + * @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.vision.v1.Position; + + /** + * Verifies a Position 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 Position message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Position + */ + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.Position; + + /** + * Creates a plain object from a Position message. Also converts values to other types if specified. + * @param message Position + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.vision.v1.Position, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Position to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Represents an ImageAnnotator */ class ImageAnnotator extends $protobuf.rpc.Service { @@ -4253,396 +4643,6 @@ export namespace google { } } - /** Properties of a Vertex. */ - interface IVertex { - - /** Vertex x */ - x?: (number|null); - - /** Vertex y */ - y?: (number|null); - } - - /** Represents a Vertex. */ - class Vertex implements IVertex { - - /** - * Constructs a new Vertex. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IVertex); - - /** Vertex x. */ - public x: number; - - /** Vertex y. */ - public y: number; - - /** - * Creates a new Vertex instance using the specified properties. - * @param [properties] Properties to set - * @returns Vertex instance - */ - public static create(properties?: google.cloud.vision.v1.IVertex): google.cloud.vision.v1.Vertex; - - /** - * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.vision.v1.Vertex.verify|verify} messages. - * @param message Vertex message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1.Vertex.verify|verify} messages. - * @param message Vertex message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Vertex message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Vertex - * @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.vision.v1.Vertex; - - /** - * Decodes a Vertex message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Vertex - * @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.vision.v1.Vertex; - - /** - * Verifies a Vertex 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 Vertex message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Vertex - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.Vertex; - - /** - * Creates a plain object from a Vertex message. Also converts values to other types if specified. - * @param message Vertex - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.Vertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Vertex to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - - /** Properties of a NormalizedVertex. */ - interface INormalizedVertex { - - /** NormalizedVertex x */ - x?: (number|null); - - /** NormalizedVertex y */ - y?: (number|null); - } - - /** Represents a NormalizedVertex. */ - class NormalizedVertex implements INormalizedVertex { - - /** - * Constructs a new NormalizedVertex. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.INormalizedVertex); - - /** NormalizedVertex x. */ - public x: number; - - /** NormalizedVertex y. */ - public y: number; - - /** - * Creates a new NormalizedVertex instance using the specified properties. - * @param [properties] Properties to set - * @returns NormalizedVertex instance - */ - public static create(properties?: google.cloud.vision.v1.INormalizedVertex): google.cloud.vision.v1.NormalizedVertex; - - /** - * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.vision.v1.NormalizedVertex.verify|verify} messages. - * @param message NormalizedVertex message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.INormalizedVertex, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified NormalizedVertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1.NormalizedVertex.verify|verify} messages. - * @param message NormalizedVertex message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.INormalizedVertex, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a NormalizedVertex message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns NormalizedVertex - * @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.vision.v1.NormalizedVertex; - - /** - * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns NormalizedVertex - * @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.vision.v1.NormalizedVertex; - - /** - * Verifies a NormalizedVertex 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 NormalizedVertex message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns NormalizedVertex - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.NormalizedVertex; - - /** - * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. - * @param message NormalizedVertex - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.NormalizedVertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this NormalizedVertex to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - - /** Properties of a BoundingPoly. */ - interface IBoundingPoly { - - /** BoundingPoly vertices */ - vertices?: (google.cloud.vision.v1.IVertex[]|null); - - /** BoundingPoly normalizedVertices */ - normalizedVertices?: (google.cloud.vision.v1.INormalizedVertex[]|null); - } - - /** Represents a BoundingPoly. */ - class BoundingPoly implements IBoundingPoly { - - /** - * Constructs a new BoundingPoly. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IBoundingPoly); - - /** BoundingPoly vertices. */ - public vertices: google.cloud.vision.v1.IVertex[]; - - /** BoundingPoly normalizedVertices. */ - public normalizedVertices: google.cloud.vision.v1.INormalizedVertex[]; - - /** - * Creates a new BoundingPoly instance using the specified properties. - * @param [properties] Properties to set - * @returns BoundingPoly instance - */ - public static create(properties?: google.cloud.vision.v1.IBoundingPoly): google.cloud.vision.v1.BoundingPoly; - - /** - * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.vision.v1.BoundingPoly.verify|verify} messages. - * @param message BoundingPoly message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.vision.v1.BoundingPoly.verify|verify} messages. - * @param message BoundingPoly message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a BoundingPoly message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BoundingPoly - * @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.vision.v1.BoundingPoly; - - /** - * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BoundingPoly - * @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.vision.v1.BoundingPoly; - - /** - * Verifies a BoundingPoly 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 BoundingPoly message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BoundingPoly - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.BoundingPoly; - - /** - * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. - * @param message BoundingPoly - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.BoundingPoly, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BoundingPoly to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - - /** Properties of a Position. */ - interface IPosition { - - /** Position x */ - x?: (number|null); - - /** Position y */ - y?: (number|null); - - /** Position z */ - z?: (number|null); - } - - /** Represents a Position. */ - class Position implements IPosition { - - /** - * Constructs a new Position. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1.IPosition); - - /** Position x. */ - public x: number; - - /** Position y. */ - public y: number; - - /** Position z. */ - public z: number; - - /** - * Creates a new Position instance using the specified properties. - * @param [properties] Properties to set - * @returns Position instance - */ - public static create(properties?: google.cloud.vision.v1.IPosition): google.cloud.vision.v1.Position; - - /** - * Encodes the specified Position message. Does not implicitly {@link google.cloud.vision.v1.Position.verify|verify} messages. - * @param message Position message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1.IPosition, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Position message, length delimited. Does not implicitly {@link google.cloud.vision.v1.Position.verify|verify} messages. - * @param message Position message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1.IPosition, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Position message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Position - * @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.vision.v1.Position; - - /** - * Decodes a Position message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Position - * @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.vision.v1.Position; - - /** - * Verifies a Position 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 Position message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Position - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1.Position; - - /** - * Creates a plain object from a Position message. Also converts values to other types if specified. - * @param message Position - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1.Position, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Position to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - /** Properties of a ProductSearchParams. */ interface IProductSearchParams { @@ -10232,6 +10232,294 @@ export namespace google { /** Namespace v1p1beta1. */ namespace v1p1beta1 { + /** Properties of a Vertex. */ + interface IVertex { + + /** Vertex x */ + x?: (number|null); + + /** Vertex y */ + y?: (number|null); + } + + /** Represents a Vertex. */ + class Vertex implements IVertex { + + /** + * Constructs a new Vertex. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.vision.v1p1beta1.IVertex); + + /** Vertex x. */ + public x: number; + + /** Vertex y. */ + public y: number; + + /** + * Creates a new Vertex instance using the specified properties. + * @param [properties] Properties to set + * @returns Vertex instance + */ + public static create(properties?: google.cloud.vision.v1p1beta1.IVertex): google.cloud.vision.v1p1beta1.Vertex; + + /** + * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.vision.v1p1beta1.Vertex.verify|verify} messages. + * @param message Vertex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.vision.v1p1beta1.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.Vertex.verify|verify} messages. + * @param message Vertex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.vision.v1p1beta1.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Vertex message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Vertex + * @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.vision.v1p1beta1.Vertex; + + /** + * Decodes a Vertex message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Vertex + * @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.vision.v1p1beta1.Vertex; + + /** + * Verifies a Vertex 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 Vertex message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Vertex + */ + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.Vertex; + + /** + * Creates a plain object from a Vertex message. Also converts values to other types if specified. + * @param message Vertex + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.vision.v1p1beta1.Vertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Vertex to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BoundingPoly. */ + interface IBoundingPoly { + + /** BoundingPoly vertices */ + vertices?: (google.cloud.vision.v1p1beta1.IVertex[]|null); + } + + /** Represents a BoundingPoly. */ + class BoundingPoly implements IBoundingPoly { + + /** + * Constructs a new BoundingPoly. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.vision.v1p1beta1.IBoundingPoly); + + /** BoundingPoly vertices. */ + public vertices: google.cloud.vision.v1p1beta1.IVertex[]; + + /** + * Creates a new BoundingPoly instance using the specified properties. + * @param [properties] Properties to set + * @returns BoundingPoly instance + */ + public static create(properties?: google.cloud.vision.v1p1beta1.IBoundingPoly): google.cloud.vision.v1p1beta1.BoundingPoly; + + /** + * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.vision.v1p1beta1.BoundingPoly.verify|verify} messages. + * @param message BoundingPoly message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.vision.v1p1beta1.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.BoundingPoly.verify|verify} messages. + * @param message BoundingPoly message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.vision.v1p1beta1.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BoundingPoly message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BoundingPoly + * @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.vision.v1p1beta1.BoundingPoly; + + /** + * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BoundingPoly + * @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.vision.v1p1beta1.BoundingPoly; + + /** + * Verifies a BoundingPoly 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 BoundingPoly message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BoundingPoly + */ + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.BoundingPoly; + + /** + * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. + * @param message BoundingPoly + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.vision.v1p1beta1.BoundingPoly, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BoundingPoly to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Position. */ + interface IPosition { + + /** Position x */ + x?: (number|null); + + /** Position y */ + y?: (number|null); + + /** Position z */ + z?: (number|null); + } + + /** Represents a Position. */ + class Position implements IPosition { + + /** + * Constructs a new Position. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.vision.v1p1beta1.IPosition); + + /** Position x. */ + public x: number; + + /** Position y. */ + public y: number; + + /** Position z. */ + public z: number; + + /** + * Creates a new Position instance using the specified properties. + * @param [properties] Properties to set + * @returns Position instance + */ + public static create(properties?: google.cloud.vision.v1p1beta1.IPosition): google.cloud.vision.v1p1beta1.Position; + + /** + * Encodes the specified Position message. Does not implicitly {@link google.cloud.vision.v1p1beta1.Position.verify|verify} messages. + * @param message Position message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.vision.v1p1beta1.IPosition, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Position message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.Position.verify|verify} messages. + * @param message Position message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.vision.v1p1beta1.IPosition, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Position message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Position + * @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.vision.v1p1beta1.Position; + + /** + * Decodes a Position message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Position + * @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.vision.v1p1beta1.Position; + + /** + * Verifies a Position 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 Position message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Position + */ + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.Position; + + /** + * Creates a plain object from a Position message. Also converts values to other types if specified. + * @param message Position + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.vision.v1p1beta1.Position, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Position to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Represents an ImageAnnotator */ class ImageAnnotator extends $protobuf.rpc.Service { @@ -12648,294 +12936,6 @@ export namespace google { VERY_LIKELY = 5 } - /** Properties of a Vertex. */ - interface IVertex { - - /** Vertex x */ - x?: (number|null); - - /** Vertex y */ - y?: (number|null); - } - - /** Represents a Vertex. */ - class Vertex implements IVertex { - - /** - * Constructs a new Vertex. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.IVertex); - - /** Vertex x. */ - public x: number; - - /** Vertex y. */ - public y: number; - - /** - * Creates a new Vertex instance using the specified properties. - * @param [properties] Properties to set - * @returns Vertex instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.IVertex): google.cloud.vision.v1p1beta1.Vertex; - - /** - * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.vision.v1p1beta1.Vertex.verify|verify} messages. - * @param message Vertex message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p1beta1.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.Vertex.verify|verify} messages. - * @param message Vertex message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p1beta1.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Vertex message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Vertex - * @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.vision.v1p1beta1.Vertex; - - /** - * Decodes a Vertex message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Vertex - * @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.vision.v1p1beta1.Vertex; - - /** - * Verifies a Vertex 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 Vertex message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Vertex - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.Vertex; - - /** - * Creates a plain object from a Vertex message. Also converts values to other types if specified. - * @param message Vertex - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p1beta1.Vertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Vertex to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - - /** Properties of a BoundingPoly. */ - interface IBoundingPoly { - - /** BoundingPoly vertices */ - vertices?: (google.cloud.vision.v1p1beta1.IVertex[]|null); - } - - /** Represents a BoundingPoly. */ - class BoundingPoly implements IBoundingPoly { - - /** - * Constructs a new BoundingPoly. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.IBoundingPoly); - - /** BoundingPoly vertices. */ - public vertices: google.cloud.vision.v1p1beta1.IVertex[]; - - /** - * Creates a new BoundingPoly instance using the specified properties. - * @param [properties] Properties to set - * @returns BoundingPoly instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.IBoundingPoly): google.cloud.vision.v1p1beta1.BoundingPoly; - - /** - * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.vision.v1p1beta1.BoundingPoly.verify|verify} messages. - * @param message BoundingPoly message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p1beta1.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.BoundingPoly.verify|verify} messages. - * @param message BoundingPoly message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p1beta1.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a BoundingPoly message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BoundingPoly - * @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.vision.v1p1beta1.BoundingPoly; - - /** - * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BoundingPoly - * @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.vision.v1p1beta1.BoundingPoly; - - /** - * Verifies a BoundingPoly 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 BoundingPoly message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BoundingPoly - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.BoundingPoly; - - /** - * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. - * @param message BoundingPoly - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p1beta1.BoundingPoly, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BoundingPoly to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - - /** Properties of a Position. */ - interface IPosition { - - /** Position x */ - x?: (number|null); - - /** Position y */ - y?: (number|null); - - /** Position z */ - z?: (number|null); - } - - /** Represents a Position. */ - class Position implements IPosition { - - /** - * Constructs a new Position. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p1beta1.IPosition); - - /** Position x. */ - public x: number; - - /** Position y. */ - public y: number; - - /** Position z. */ - public z: number; - - /** - * Creates a new Position instance using the specified properties. - * @param [properties] Properties to set - * @returns Position instance - */ - public static create(properties?: google.cloud.vision.v1p1beta1.IPosition): google.cloud.vision.v1p1beta1.Position; - - /** - * Encodes the specified Position message. Does not implicitly {@link google.cloud.vision.v1p1beta1.Position.verify|verify} messages. - * @param message Position message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p1beta1.IPosition, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Position message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.Position.verify|verify} messages. - * @param message Position message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p1beta1.IPosition, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Position message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Position - * @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.vision.v1p1beta1.Position; - - /** - * Decodes a Position message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Position - * @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.vision.v1p1beta1.Position; - - /** - * Verifies a Position 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 Position message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Position - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p1beta1.Position; - - /** - * Creates a plain object from a Position message. Also converts values to other types if specified. - * @param message Position - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p1beta1.Position, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Position to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - /** Properties of a TextAnnotation. */ interface ITextAnnotation { @@ -14436,6 +14436,396 @@ export namespace google { /** Namespace v1p2beta1. */ namespace v1p2beta1 { + /** Properties of a Vertex. */ + interface IVertex { + + /** Vertex x */ + x?: (number|null); + + /** Vertex y */ + y?: (number|null); + } + + /** Represents a Vertex. */ + class Vertex implements IVertex { + + /** + * Constructs a new Vertex. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.vision.v1p2beta1.IVertex); + + /** Vertex x. */ + public x: number; + + /** Vertex y. */ + public y: number; + + /** + * Creates a new Vertex instance using the specified properties. + * @param [properties] Properties to set + * @returns Vertex instance + */ + public static create(properties?: google.cloud.vision.v1p2beta1.IVertex): google.cloud.vision.v1p2beta1.Vertex; + + /** + * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Vertex.verify|verify} messages. + * @param message Vertex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.vision.v1p2beta1.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.Vertex.verify|verify} messages. + * @param message Vertex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.vision.v1p2beta1.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Vertex message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Vertex + * @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.vision.v1p2beta1.Vertex; + + /** + * Decodes a Vertex message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Vertex + * @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.vision.v1p2beta1.Vertex; + + /** + * Verifies a Vertex 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 Vertex message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Vertex + */ + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.Vertex; + + /** + * Creates a plain object from a Vertex message. Also converts values to other types if specified. + * @param message Vertex + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.vision.v1p2beta1.Vertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Vertex to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a NormalizedVertex. */ + interface INormalizedVertex { + + /** NormalizedVertex x */ + x?: (number|null); + + /** NormalizedVertex y */ + y?: (number|null); + } + + /** Represents a NormalizedVertex. */ + class NormalizedVertex implements INormalizedVertex { + + /** + * Constructs a new NormalizedVertex. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.vision.v1p2beta1.INormalizedVertex); + + /** NormalizedVertex x. */ + public x: number; + + /** NormalizedVertex y. */ + public y: number; + + /** + * Creates a new NormalizedVertex instance using the specified properties. + * @param [properties] Properties to set + * @returns NormalizedVertex instance + */ + public static create(properties?: google.cloud.vision.v1p2beta1.INormalizedVertex): google.cloud.vision.v1p2beta1.NormalizedVertex; + + /** + * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.vision.v1p2beta1.NormalizedVertex.verify|verify} messages. + * @param message NormalizedVertex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.vision.v1p2beta1.INormalizedVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NormalizedVertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.NormalizedVertex.verify|verify} messages. + * @param message NormalizedVertex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.vision.v1p2beta1.INormalizedVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NormalizedVertex message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NormalizedVertex + * @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.vision.v1p2beta1.NormalizedVertex; + + /** + * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NormalizedVertex + * @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.vision.v1p2beta1.NormalizedVertex; + + /** + * Verifies a NormalizedVertex 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 NormalizedVertex message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NormalizedVertex + */ + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.NormalizedVertex; + + /** + * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. + * @param message NormalizedVertex + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.vision.v1p2beta1.NormalizedVertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NormalizedVertex to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BoundingPoly. */ + interface IBoundingPoly { + + /** BoundingPoly vertices */ + vertices?: (google.cloud.vision.v1p2beta1.IVertex[]|null); + + /** BoundingPoly normalizedVertices */ + normalizedVertices?: (google.cloud.vision.v1p2beta1.INormalizedVertex[]|null); + } + + /** Represents a BoundingPoly. */ + class BoundingPoly implements IBoundingPoly { + + /** + * Constructs a new BoundingPoly. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.vision.v1p2beta1.IBoundingPoly); + + /** BoundingPoly vertices. */ + public vertices: google.cloud.vision.v1p2beta1.IVertex[]; + + /** BoundingPoly normalizedVertices. */ + public normalizedVertices: google.cloud.vision.v1p2beta1.INormalizedVertex[]; + + /** + * Creates a new BoundingPoly instance using the specified properties. + * @param [properties] Properties to set + * @returns BoundingPoly instance + */ + public static create(properties?: google.cloud.vision.v1p2beta1.IBoundingPoly): google.cloud.vision.v1p2beta1.BoundingPoly; + + /** + * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.vision.v1p2beta1.BoundingPoly.verify|verify} messages. + * @param message BoundingPoly message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.vision.v1p2beta1.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.BoundingPoly.verify|verify} messages. + * @param message BoundingPoly message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.vision.v1p2beta1.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BoundingPoly message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BoundingPoly + * @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.vision.v1p2beta1.BoundingPoly; + + /** + * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BoundingPoly + * @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.vision.v1p2beta1.BoundingPoly; + + /** + * Verifies a BoundingPoly 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 BoundingPoly message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BoundingPoly + */ + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.BoundingPoly; + + /** + * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. + * @param message BoundingPoly + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.vision.v1p2beta1.BoundingPoly, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BoundingPoly to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Position. */ + interface IPosition { + + /** Position x */ + x?: (number|null); + + /** Position y */ + y?: (number|null); + + /** Position z */ + z?: (number|null); + } + + /** Represents a Position. */ + class Position implements IPosition { + + /** + * Constructs a new Position. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.vision.v1p2beta1.IPosition); + + /** Position x. */ + public x: number; + + /** Position y. */ + public y: number; + + /** Position z. */ + public z: number; + + /** + * Creates a new Position instance using the specified properties. + * @param [properties] Properties to set + * @returns Position instance + */ + public static create(properties?: google.cloud.vision.v1p2beta1.IPosition): google.cloud.vision.v1p2beta1.Position; + + /** + * Encodes the specified Position message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Position.verify|verify} messages. + * @param message Position message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.vision.v1p2beta1.IPosition, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Position message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.Position.verify|verify} messages. + * @param message Position message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.vision.v1p2beta1.IPosition, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Position message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Position + * @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.vision.v1p2beta1.Position; + + /** + * Decodes a Position message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Position + * @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.vision.v1p2beta1.Position; + + /** + * Verifies a Position 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 Position message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Position + */ + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.Position; + + /** + * Creates a plain object from a Position message. Also converts values to other types if specified. + * @param message Position + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.vision.v1p2beta1.Position, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Position to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Represents an ImageAnnotator */ class ImageAnnotator extends $protobuf.rpc.Service { @@ -17935,396 +18325,6 @@ export namespace google { VERY_LIKELY = 5 } - /** Properties of a Vertex. */ - interface IVertex { - - /** Vertex x */ - x?: (number|null); - - /** Vertex y */ - y?: (number|null); - } - - /** Represents a Vertex. */ - class Vertex implements IVertex { - - /** - * Constructs a new Vertex. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IVertex); - - /** Vertex x. */ - public x: number; - - /** Vertex y. */ - public y: number; - - /** - * Creates a new Vertex instance using the specified properties. - * @param [properties] Properties to set - * @returns Vertex instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IVertex): google.cloud.vision.v1p2beta1.Vertex; - - /** - * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Vertex.verify|verify} messages. - * @param message Vertex message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p2beta1.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.Vertex.verify|verify} messages. - * @param message Vertex message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p2beta1.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Vertex message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Vertex - * @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.vision.v1p2beta1.Vertex; - - /** - * Decodes a Vertex message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Vertex - * @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.vision.v1p2beta1.Vertex; - - /** - * Verifies a Vertex 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 Vertex message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Vertex - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.Vertex; - - /** - * Creates a plain object from a Vertex message. Also converts values to other types if specified. - * @param message Vertex - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p2beta1.Vertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Vertex to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - - /** Properties of a NormalizedVertex. */ - interface INormalizedVertex { - - /** NormalizedVertex x */ - x?: (number|null); - - /** NormalizedVertex y */ - y?: (number|null); - } - - /** Represents a NormalizedVertex. */ - class NormalizedVertex implements INormalizedVertex { - - /** - * Constructs a new NormalizedVertex. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.INormalizedVertex); - - /** NormalizedVertex x. */ - public x: number; - - /** NormalizedVertex y. */ - public y: number; - - /** - * Creates a new NormalizedVertex instance using the specified properties. - * @param [properties] Properties to set - * @returns NormalizedVertex instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.INormalizedVertex): google.cloud.vision.v1p2beta1.NormalizedVertex; - - /** - * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.vision.v1p2beta1.NormalizedVertex.verify|verify} messages. - * @param message NormalizedVertex message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p2beta1.INormalizedVertex, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified NormalizedVertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.NormalizedVertex.verify|verify} messages. - * @param message NormalizedVertex message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p2beta1.INormalizedVertex, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a NormalizedVertex message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns NormalizedVertex - * @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.vision.v1p2beta1.NormalizedVertex; - - /** - * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns NormalizedVertex - * @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.vision.v1p2beta1.NormalizedVertex; - - /** - * Verifies a NormalizedVertex 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 NormalizedVertex message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns NormalizedVertex - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.NormalizedVertex; - - /** - * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. - * @param message NormalizedVertex - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p2beta1.NormalizedVertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this NormalizedVertex to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - - /** Properties of a BoundingPoly. */ - interface IBoundingPoly { - - /** BoundingPoly vertices */ - vertices?: (google.cloud.vision.v1p2beta1.IVertex[]|null); - - /** BoundingPoly normalizedVertices */ - normalizedVertices?: (google.cloud.vision.v1p2beta1.INormalizedVertex[]|null); - } - - /** Represents a BoundingPoly. */ - class BoundingPoly implements IBoundingPoly { - - /** - * Constructs a new BoundingPoly. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IBoundingPoly); - - /** BoundingPoly vertices. */ - public vertices: google.cloud.vision.v1p2beta1.IVertex[]; - - /** BoundingPoly normalizedVertices. */ - public normalizedVertices: google.cloud.vision.v1p2beta1.INormalizedVertex[]; - - /** - * Creates a new BoundingPoly instance using the specified properties. - * @param [properties] Properties to set - * @returns BoundingPoly instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IBoundingPoly): google.cloud.vision.v1p2beta1.BoundingPoly; - - /** - * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.vision.v1p2beta1.BoundingPoly.verify|verify} messages. - * @param message BoundingPoly message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p2beta1.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.BoundingPoly.verify|verify} messages. - * @param message BoundingPoly message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p2beta1.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a BoundingPoly message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BoundingPoly - * @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.vision.v1p2beta1.BoundingPoly; - - /** - * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BoundingPoly - * @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.vision.v1p2beta1.BoundingPoly; - - /** - * Verifies a BoundingPoly 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 BoundingPoly message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BoundingPoly - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.BoundingPoly; - - /** - * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. - * @param message BoundingPoly - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p2beta1.BoundingPoly, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BoundingPoly to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - - /** Properties of a Position. */ - interface IPosition { - - /** Position x */ - x?: (number|null); - - /** Position y */ - y?: (number|null); - - /** Position z */ - z?: (number|null); - } - - /** Represents a Position. */ - class Position implements IPosition { - - /** - * Constructs a new Position. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p2beta1.IPosition); - - /** Position x. */ - public x: number; - - /** Position y. */ - public y: number; - - /** Position z. */ - public z: number; - - /** - * Creates a new Position instance using the specified properties. - * @param [properties] Properties to set - * @returns Position instance - */ - public static create(properties?: google.cloud.vision.v1p2beta1.IPosition): google.cloud.vision.v1p2beta1.Position; - - /** - * Encodes the specified Position message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Position.verify|verify} messages. - * @param message Position message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p2beta1.IPosition, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Position message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.Position.verify|verify} messages. - * @param message Position message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p2beta1.IPosition, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Position message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Position - * @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.vision.v1p2beta1.Position; - - /** - * Decodes a Position message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Position - * @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.vision.v1p2beta1.Position; - - /** - * Verifies a Position 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 Position message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Position - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p2beta1.Position; - - /** - * Creates a plain object from a Position message. Also converts values to other types if specified. - * @param message Position - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p2beta1.Position, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Position to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - /** Properties of a TextAnnotation. */ interface ITextAnnotation { @@ -19825,6 +19825,486 @@ export namespace google { /** Namespace v1p3beta1. */ namespace v1p3beta1 { + /** Properties of a Vertex. */ + interface IVertex { + + /** Vertex x */ + x?: (number|null); + + /** Vertex y */ + y?: (number|null); + } + + /** Represents a Vertex. */ + class Vertex implements IVertex { + + /** + * Constructs a new Vertex. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.vision.v1p3beta1.IVertex); + + /** Vertex x. */ + public x: number; + + /** Vertex y. */ + public y: number; + + /** + * Creates a new Vertex instance using the specified properties. + * @param [properties] Properties to set + * @returns Vertex instance + */ + public static create(properties?: google.cloud.vision.v1p3beta1.IVertex): google.cloud.vision.v1p3beta1.Vertex; + + /** + * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Vertex.verify|verify} messages. + * @param message Vertex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.vision.v1p3beta1.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.Vertex.verify|verify} messages. + * @param message Vertex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Vertex message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Vertex + * @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.vision.v1p3beta1.Vertex; + + /** + * Decodes a Vertex message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Vertex + * @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.vision.v1p3beta1.Vertex; + + /** + * Verifies a Vertex 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 Vertex message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Vertex + */ + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.Vertex; + + /** + * Creates a plain object from a Vertex message. Also converts values to other types if specified. + * @param message Vertex + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.vision.v1p3beta1.Vertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Vertex to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a NormalizedVertex. */ + interface INormalizedVertex { + + /** NormalizedVertex x */ + x?: (number|null); + + /** NormalizedVertex y */ + y?: (number|null); + } + + /** Represents a NormalizedVertex. */ + class NormalizedVertex implements INormalizedVertex { + + /** + * Constructs a new NormalizedVertex. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.vision.v1p3beta1.INormalizedVertex); + + /** NormalizedVertex x. */ + public x: number; + + /** NormalizedVertex y. */ + public y: number; + + /** + * Creates a new NormalizedVertex instance using the specified properties. + * @param [properties] Properties to set + * @returns NormalizedVertex instance + */ + public static create(properties?: google.cloud.vision.v1p3beta1.INormalizedVertex): google.cloud.vision.v1p3beta1.NormalizedVertex; + + /** + * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.vision.v1p3beta1.NormalizedVertex.verify|verify} messages. + * @param message NormalizedVertex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.vision.v1p3beta1.INormalizedVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NormalizedVertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.NormalizedVertex.verify|verify} messages. + * @param message NormalizedVertex message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.vision.v1p3beta1.INormalizedVertex, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NormalizedVertex message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NormalizedVertex + * @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.vision.v1p3beta1.NormalizedVertex; + + /** + * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NormalizedVertex + * @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.vision.v1p3beta1.NormalizedVertex; + + /** + * Verifies a NormalizedVertex 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 NormalizedVertex message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NormalizedVertex + */ + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.NormalizedVertex; + + /** + * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. + * @param message NormalizedVertex + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.vision.v1p3beta1.NormalizedVertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NormalizedVertex to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a BoundingPoly. */ + interface IBoundingPoly { + + /** BoundingPoly vertices */ + vertices?: (google.cloud.vision.v1p3beta1.IVertex[]|null); + + /** BoundingPoly normalizedVertices */ + normalizedVertices?: (google.cloud.vision.v1p3beta1.INormalizedVertex[]|null); + } + + /** Represents a BoundingPoly. */ + class BoundingPoly implements IBoundingPoly { + + /** + * Constructs a new BoundingPoly. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.vision.v1p3beta1.IBoundingPoly); + + /** BoundingPoly vertices. */ + public vertices: google.cloud.vision.v1p3beta1.IVertex[]; + + /** BoundingPoly normalizedVertices. */ + public normalizedVertices: google.cloud.vision.v1p3beta1.INormalizedVertex[]; + + /** + * Creates a new BoundingPoly instance using the specified properties. + * @param [properties] Properties to set + * @returns BoundingPoly instance + */ + public static create(properties?: google.cloud.vision.v1p3beta1.IBoundingPoly): google.cloud.vision.v1p3beta1.BoundingPoly; + + /** + * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.vision.v1p3beta1.BoundingPoly.verify|verify} messages. + * @param message BoundingPoly message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.vision.v1p3beta1.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.BoundingPoly.verify|verify} messages. + * @param message BoundingPoly message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BoundingPoly message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BoundingPoly + * @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.vision.v1p3beta1.BoundingPoly; + + /** + * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BoundingPoly + * @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.vision.v1p3beta1.BoundingPoly; + + /** + * Verifies a BoundingPoly 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 BoundingPoly message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BoundingPoly + */ + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.BoundingPoly; + + /** + * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. + * @param message BoundingPoly + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.vision.v1p3beta1.BoundingPoly, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BoundingPoly to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a NormalizedBoundingPoly. */ + interface INormalizedBoundingPoly { + + /** NormalizedBoundingPoly vertices */ + vertices?: (google.cloud.vision.v1p3beta1.INormalizedVertex[]|null); + } + + /** Represents a NormalizedBoundingPoly. */ + class NormalizedBoundingPoly implements INormalizedBoundingPoly { + + /** + * Constructs a new NormalizedBoundingPoly. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.vision.v1p3beta1.INormalizedBoundingPoly); + + /** NormalizedBoundingPoly vertices. */ + public vertices: google.cloud.vision.v1p3beta1.INormalizedVertex[]; + + /** + * Creates a new NormalizedBoundingPoly instance using the specified properties. + * @param [properties] Properties to set + * @returns NormalizedBoundingPoly instance + */ + public static create(properties?: google.cloud.vision.v1p3beta1.INormalizedBoundingPoly): google.cloud.vision.v1p3beta1.NormalizedBoundingPoly; + + /** + * Encodes the specified NormalizedBoundingPoly message. Does not implicitly {@link google.cloud.vision.v1p3beta1.NormalizedBoundingPoly.verify|verify} messages. + * @param message NormalizedBoundingPoly message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.vision.v1p3beta1.INormalizedBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NormalizedBoundingPoly message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.NormalizedBoundingPoly.verify|verify} messages. + * @param message NormalizedBoundingPoly message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.vision.v1p3beta1.INormalizedBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NormalizedBoundingPoly message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NormalizedBoundingPoly + * @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.vision.v1p3beta1.NormalizedBoundingPoly; + + /** + * Decodes a NormalizedBoundingPoly message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NormalizedBoundingPoly + * @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.vision.v1p3beta1.NormalizedBoundingPoly; + + /** + * Verifies a NormalizedBoundingPoly 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 NormalizedBoundingPoly message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NormalizedBoundingPoly + */ + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.NormalizedBoundingPoly; + + /** + * Creates a plain object from a NormalizedBoundingPoly message. Also converts values to other types if specified. + * @param message NormalizedBoundingPoly + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.vision.v1p3beta1.NormalizedBoundingPoly, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NormalizedBoundingPoly to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + /** Properties of a Position. */ + interface IPosition { + + /** Position x */ + x?: (number|null); + + /** Position y */ + y?: (number|null); + + /** Position z */ + z?: (number|null); + } + + /** Represents a Position. */ + class Position implements IPosition { + + /** + * Constructs a new Position. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.vision.v1p3beta1.IPosition); + + /** Position x. */ + public x: number; + + /** Position y. */ + public y: number; + + /** Position z. */ + public z: number; + + /** + * Creates a new Position instance using the specified properties. + * @param [properties] Properties to set + * @returns Position instance + */ + public static create(properties?: google.cloud.vision.v1p3beta1.IPosition): google.cloud.vision.v1p3beta1.Position; + + /** + * Encodes the specified Position message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Position.verify|verify} messages. + * @param message Position message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.vision.v1p3beta1.IPosition, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Position message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.Position.verify|verify} messages. + * @param message Position message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IPosition, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Position message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Position + * @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.vision.v1p3beta1.Position; + + /** + * Decodes a Position message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Position + * @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.vision.v1p3beta1.Position; + + /** + * Verifies a Position 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 Position message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Position + */ + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.Position; + + /** + * Creates a plain object from a Position message. Also converts values to other types if specified. + * @param message Position + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.vision.v1p3beta1.Position, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Position to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + /** Represents an ImageAnnotator */ class ImageAnnotator extends $protobuf.rpc.Service { @@ -23458,486 +23938,6 @@ export namespace google { } } - /** Properties of a Vertex. */ - interface IVertex { - - /** Vertex x */ - x?: (number|null); - - /** Vertex y */ - y?: (number|null); - } - - /** Represents a Vertex. */ - class Vertex implements IVertex { - - /** - * Constructs a new Vertex. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IVertex); - - /** Vertex x. */ - public x: number; - - /** Vertex y. */ - public y: number; - - /** - * Creates a new Vertex instance using the specified properties. - * @param [properties] Properties to set - * @returns Vertex instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IVertex): google.cloud.vision.v1p3beta1.Vertex; - - /** - * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Vertex.verify|verify} messages. - * @param message Vertex message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.Vertex.verify|verify} messages. - * @param message Vertex message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Vertex message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Vertex - * @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.vision.v1p3beta1.Vertex; - - /** - * Decodes a Vertex message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Vertex - * @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.vision.v1p3beta1.Vertex; - - /** - * Verifies a Vertex 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 Vertex message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Vertex - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.Vertex; - - /** - * Creates a plain object from a Vertex message. Also converts values to other types if specified. - * @param message Vertex - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.Vertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Vertex to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - - /** Properties of a NormalizedVertex. */ - interface INormalizedVertex { - - /** NormalizedVertex x */ - x?: (number|null); - - /** NormalizedVertex y */ - y?: (number|null); - } - - /** Represents a NormalizedVertex. */ - class NormalizedVertex implements INormalizedVertex { - - /** - * Constructs a new NormalizedVertex. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.INormalizedVertex); - - /** NormalizedVertex x. */ - public x: number; - - /** NormalizedVertex y. */ - public y: number; - - /** - * Creates a new NormalizedVertex instance using the specified properties. - * @param [properties] Properties to set - * @returns NormalizedVertex instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.INormalizedVertex): google.cloud.vision.v1p3beta1.NormalizedVertex; - - /** - * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.vision.v1p3beta1.NormalizedVertex.verify|verify} messages. - * @param message NormalizedVertex message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.INormalizedVertex, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified NormalizedVertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.NormalizedVertex.verify|verify} messages. - * @param message NormalizedVertex message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.INormalizedVertex, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a NormalizedVertex message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns NormalizedVertex - * @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.vision.v1p3beta1.NormalizedVertex; - - /** - * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns NormalizedVertex - * @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.vision.v1p3beta1.NormalizedVertex; - - /** - * Verifies a NormalizedVertex 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 NormalizedVertex message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns NormalizedVertex - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.NormalizedVertex; - - /** - * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. - * @param message NormalizedVertex - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.NormalizedVertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this NormalizedVertex to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - - /** Properties of a BoundingPoly. */ - interface IBoundingPoly { - - /** BoundingPoly vertices */ - vertices?: (google.cloud.vision.v1p3beta1.IVertex[]|null); - - /** BoundingPoly normalizedVertices */ - normalizedVertices?: (google.cloud.vision.v1p3beta1.INormalizedVertex[]|null); - } - - /** Represents a BoundingPoly. */ - class BoundingPoly implements IBoundingPoly { - - /** - * Constructs a new BoundingPoly. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IBoundingPoly); - - /** BoundingPoly vertices. */ - public vertices: google.cloud.vision.v1p3beta1.IVertex[]; - - /** BoundingPoly normalizedVertices. */ - public normalizedVertices: google.cloud.vision.v1p3beta1.INormalizedVertex[]; - - /** - * Creates a new BoundingPoly instance using the specified properties. - * @param [properties] Properties to set - * @returns BoundingPoly instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IBoundingPoly): google.cloud.vision.v1p3beta1.BoundingPoly; - - /** - * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.vision.v1p3beta1.BoundingPoly.verify|verify} messages. - * @param message BoundingPoly message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.BoundingPoly.verify|verify} messages. - * @param message BoundingPoly message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a BoundingPoly message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BoundingPoly - * @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.vision.v1p3beta1.BoundingPoly; - - /** - * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BoundingPoly - * @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.vision.v1p3beta1.BoundingPoly; - - /** - * Verifies a BoundingPoly 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 BoundingPoly message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BoundingPoly - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.BoundingPoly; - - /** - * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. - * @param message BoundingPoly - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.BoundingPoly, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BoundingPoly to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - - /** Properties of a NormalizedBoundingPoly. */ - interface INormalizedBoundingPoly { - - /** NormalizedBoundingPoly vertices */ - vertices?: (google.cloud.vision.v1p3beta1.INormalizedVertex[]|null); - } - - /** Represents a NormalizedBoundingPoly. */ - class NormalizedBoundingPoly implements INormalizedBoundingPoly { - - /** - * Constructs a new NormalizedBoundingPoly. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.INormalizedBoundingPoly); - - /** NormalizedBoundingPoly vertices. */ - public vertices: google.cloud.vision.v1p3beta1.INormalizedVertex[]; - - /** - * Creates a new NormalizedBoundingPoly instance using the specified properties. - * @param [properties] Properties to set - * @returns NormalizedBoundingPoly instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.INormalizedBoundingPoly): google.cloud.vision.v1p3beta1.NormalizedBoundingPoly; - - /** - * Encodes the specified NormalizedBoundingPoly message. Does not implicitly {@link google.cloud.vision.v1p3beta1.NormalizedBoundingPoly.verify|verify} messages. - * @param message NormalizedBoundingPoly message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.INormalizedBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified NormalizedBoundingPoly message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.NormalizedBoundingPoly.verify|verify} messages. - * @param message NormalizedBoundingPoly message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.INormalizedBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a NormalizedBoundingPoly message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns NormalizedBoundingPoly - * @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.vision.v1p3beta1.NormalizedBoundingPoly; - - /** - * Decodes a NormalizedBoundingPoly message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns NormalizedBoundingPoly - * @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.vision.v1p3beta1.NormalizedBoundingPoly; - - /** - * Verifies a NormalizedBoundingPoly 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 NormalizedBoundingPoly message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns NormalizedBoundingPoly - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.NormalizedBoundingPoly; - - /** - * Creates a plain object from a NormalizedBoundingPoly message. Also converts values to other types if specified. - * @param message NormalizedBoundingPoly - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.NormalizedBoundingPoly, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this NormalizedBoundingPoly to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - - /** Properties of a Position. */ - interface IPosition { - - /** Position x */ - x?: (number|null); - - /** Position y */ - y?: (number|null); - - /** Position z */ - z?: (number|null); - } - - /** Represents a Position. */ - class Position implements IPosition { - - /** - * Constructs a new Position. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p3beta1.IPosition); - - /** Position x. */ - public x: number; - - /** Position y. */ - public y: number; - - /** Position z. */ - public z: number; - - /** - * Creates a new Position instance using the specified properties. - * @param [properties] Properties to set - * @returns Position instance - */ - public static create(properties?: google.cloud.vision.v1p3beta1.IPosition): google.cloud.vision.v1p3beta1.Position; - - /** - * Encodes the specified Position message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Position.verify|verify} messages. - * @param message Position message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p3beta1.IPosition, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Position message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.Position.verify|verify} messages. - * @param message Position message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p3beta1.IPosition, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Position message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Position - * @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.vision.v1p3beta1.Position; - - /** - * Decodes a Position message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Position - * @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.vision.v1p3beta1.Position; - - /** - * Verifies a Position 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 Position message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Position - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p3beta1.Position; - - /** - * Creates a plain object from a Position message. Also converts values to other types if specified. - * @param message Position - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p3beta1.Position, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Position to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - /** Properties of a ProductSearchParams. */ interface IProductSearchParams { @@ -29252,4863 +29252,4863 @@ export namespace google { /** Namespace v1p4beta1. */ namespace v1p4beta1 { - /** Represents an ImageAnnotator */ - class ImageAnnotator extends $protobuf.rpc.Service { - - /** - * Constructs a new ImageAnnotator service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + /** Properties of a FaceRecognitionParams. */ + interface IFaceRecognitionParams { - /** - * Creates new ImageAnnotator service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): ImageAnnotator; + /** FaceRecognitionParams celebritySet */ + celebritySet?: (string[]|null); + } - /** - * Calls BatchAnnotateImages. - * @param request BatchAnnotateImagesRequest message or plain object - * @param callback Node-style callback called with the error, if any, and BatchAnnotateImagesResponse - */ - public batchAnnotateImages(request: google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest, callback: google.cloud.vision.v1p4beta1.ImageAnnotator.BatchAnnotateImagesCallback): void; + /** Represents a FaceRecognitionParams. */ + class FaceRecognitionParams implements IFaceRecognitionParams { /** - * Calls BatchAnnotateImages. - * @param request BatchAnnotateImagesRequest message or plain object - * @returns Promise + * Constructs a new FaceRecognitionParams. + * @param [properties] Properties to set */ - public batchAnnotateImages(request: google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest): Promise; + constructor(properties?: google.cloud.vision.v1p4beta1.IFaceRecognitionParams); - /** - * Calls BatchAnnotateFiles. - * @param request BatchAnnotateFilesRequest message or plain object - * @param callback Node-style callback called with the error, if any, and BatchAnnotateFilesResponse - */ - public batchAnnotateFiles(request: google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest, callback: google.cloud.vision.v1p4beta1.ImageAnnotator.BatchAnnotateFilesCallback): void; + /** FaceRecognitionParams celebritySet. */ + public celebritySet: string[]; /** - * Calls BatchAnnotateFiles. - * @param request BatchAnnotateFilesRequest message or plain object - * @returns Promise + * Creates a new FaceRecognitionParams instance using the specified properties. + * @param [properties] Properties to set + * @returns FaceRecognitionParams instance */ - public batchAnnotateFiles(request: google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest): Promise; + public static create(properties?: google.cloud.vision.v1p4beta1.IFaceRecognitionParams): google.cloud.vision.v1p4beta1.FaceRecognitionParams; /** - * Calls AsyncBatchAnnotateImages. - * @param request AsyncBatchAnnotateImagesRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Encodes the specified FaceRecognitionParams message. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceRecognitionParams.verify|verify} messages. + * @param message FaceRecognitionParams message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public asyncBatchAnnotateImages(request: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest, callback: google.cloud.vision.v1p4beta1.ImageAnnotator.AsyncBatchAnnotateImagesCallback): void; + public static encode(message: google.cloud.vision.v1p4beta1.IFaceRecognitionParams, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls AsyncBatchAnnotateImages. - * @param request AsyncBatchAnnotateImagesRequest message or plain object - * @returns Promise + * Encodes the specified FaceRecognitionParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceRecognitionParams.verify|verify} messages. + * @param message FaceRecognitionParams message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer */ - public asyncBatchAnnotateImages(request: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest): Promise; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IFaceRecognitionParams, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Calls AsyncBatchAnnotateFiles. - * @param request AsyncBatchAnnotateFilesRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation + * Decodes a FaceRecognitionParams message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FaceRecognitionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public asyncBatchAnnotateFiles(request: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest, callback: google.cloud.vision.v1p4beta1.ImageAnnotator.AsyncBatchAnnotateFilesCallback): void; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.FaceRecognitionParams; /** - * Calls AsyncBatchAnnotateFiles. - * @param request AsyncBatchAnnotateFilesRequest message or plain object - * @returns Promise + * Decodes a FaceRecognitionParams message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FaceRecognitionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public asyncBatchAnnotateFiles(request: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest): Promise; - } - - namespace ImageAnnotator { + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.FaceRecognitionParams; /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ImageAnnotator#batchAnnotateImages}. - * @param error Error, if any - * @param [response] BatchAnnotateImagesResponse + * Verifies a FaceRecognitionParams message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not */ - type BatchAnnotateImagesCallback = (error: (Error|null), response?: google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse) => void; + public static verify(message: { [k: string]: any }): (string|null); /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ImageAnnotator#batchAnnotateFiles}. - * @param error Error, if any - * @param [response] BatchAnnotateFilesResponse + * Creates a FaceRecognitionParams message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FaceRecognitionParams */ - type BatchAnnotateFilesCallback = (error: (Error|null), response?: google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse) => void; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.FaceRecognitionParams; /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ImageAnnotator#asyncBatchAnnotateImages}. - * @param error Error, if any - * @param [response] Operation + * Creates a plain object from a FaceRecognitionParams message. Also converts values to other types if specified. + * @param message FaceRecognitionParams + * @param [options] Conversion options + * @returns Plain object */ - type AsyncBatchAnnotateImagesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + public static toObject(message: google.cloud.vision.v1p4beta1.FaceRecognitionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ImageAnnotator#asyncBatchAnnotateFiles}. - * @param error Error, if any - * @param [response] Operation + * Converts this FaceRecognitionParams to JSON. + * @returns JSON object */ - type AsyncBatchAnnotateFilesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + public toJSON(): { [k: string]: any }; } - /** Properties of a Feature. */ - interface IFeature { + /** Properties of a Celebrity. */ + interface ICelebrity { - /** Feature type */ - type?: (google.cloud.vision.v1p4beta1.Feature.Type|keyof typeof google.cloud.vision.v1p4beta1.Feature.Type|null); + /** Celebrity name */ + name?: (string|null); - /** Feature maxResults */ - maxResults?: (number|null); + /** Celebrity displayName */ + displayName?: (string|null); - /** Feature model */ - model?: (string|null); + /** Celebrity description */ + description?: (string|null); } - /** Represents a Feature. */ - class Feature implements IFeature { + /** Represents a Celebrity. */ + class Celebrity implements ICelebrity { /** - * Constructs a new Feature. + * Constructs a new Celebrity. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IFeature); + constructor(properties?: google.cloud.vision.v1p4beta1.ICelebrity); - /** Feature type. */ - public type: (google.cloud.vision.v1p4beta1.Feature.Type|keyof typeof google.cloud.vision.v1p4beta1.Feature.Type); + /** Celebrity name. */ + public name: string; - /** Feature maxResults. */ - public maxResults: number; + /** Celebrity displayName. */ + public displayName: string; - /** Feature model. */ - public model: string; + /** Celebrity description. */ + public description: string; /** - * Creates a new Feature instance using the specified properties. + * Creates a new Celebrity instance using the specified properties. * @param [properties] Properties to set - * @returns Feature instance + * @returns Celebrity instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IFeature): google.cloud.vision.v1p4beta1.Feature; + public static create(properties?: google.cloud.vision.v1p4beta1.ICelebrity): google.cloud.vision.v1p4beta1.Celebrity; /** - * Encodes the specified Feature message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Feature.verify|verify} messages. - * @param message Feature message or plain object to encode + * Encodes the specified Celebrity message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Celebrity.verify|verify} messages. + * @param message Celebrity message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IFeature, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.ICelebrity, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Feature message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Feature.verify|verify} messages. - * @param message Feature message or plain object to encode + * Encodes the specified Celebrity message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Celebrity.verify|verify} messages. + * @param message Celebrity message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IFeature, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ICelebrity, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Feature message from the specified reader or buffer. + * Decodes a Celebrity message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Feature + * @returns Celebrity * @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.vision.v1p4beta1.Feature; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.Celebrity; /** - * Decodes a Feature message from the specified reader or buffer, length delimited. + * Decodes a Celebrity message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Feature + * @returns Celebrity * @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.vision.v1p4beta1.Feature; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.Celebrity; /** - * Verifies a Feature message. + * Verifies a Celebrity 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 Feature message from a plain object. Also converts values to their respective internal types. + * Creates a Celebrity message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Feature + * @returns Celebrity */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.Feature; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.Celebrity; /** - * Creates a plain object from a Feature message. Also converts values to other types if specified. - * @param message Feature + * Creates a plain object from a Celebrity message. Also converts values to other types if specified. + * @param message Celebrity * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.Feature, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.Celebrity, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Feature to JSON. + * Converts this Celebrity to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace Feature { - - /** Type enum. */ - enum Type { - TYPE_UNSPECIFIED = 0, - FACE_DETECTION = 1, - LANDMARK_DETECTION = 2, - LOGO_DETECTION = 3, - LABEL_DETECTION = 4, - TEXT_DETECTION = 5, - DOCUMENT_TEXT_DETECTION = 11, - SAFE_SEARCH_DETECTION = 6, - IMAGE_PROPERTIES = 7, - CROP_HINTS = 9, - WEB_DETECTION = 10, - PRODUCT_SEARCH = 12, - OBJECT_LOCALIZATION = 19 - } - } - - /** Properties of an ImageSource. */ - interface IImageSource { + /** Properties of a FaceRecognitionResult. */ + interface IFaceRecognitionResult { - /** ImageSource gcsImageUri */ - gcsImageUri?: (string|null); + /** FaceRecognitionResult celebrity */ + celebrity?: (google.cloud.vision.v1p4beta1.ICelebrity|null); - /** ImageSource imageUri */ - imageUri?: (string|null); + /** FaceRecognitionResult confidence */ + confidence?: (number|null); } - /** Represents an ImageSource. */ - class ImageSource implements IImageSource { + /** Represents a FaceRecognitionResult. */ + class FaceRecognitionResult implements IFaceRecognitionResult { /** - * Constructs a new ImageSource. + * Constructs a new FaceRecognitionResult. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IImageSource); + constructor(properties?: google.cloud.vision.v1p4beta1.IFaceRecognitionResult); - /** ImageSource gcsImageUri. */ - public gcsImageUri: string; + /** FaceRecognitionResult celebrity. */ + public celebrity?: (google.cloud.vision.v1p4beta1.ICelebrity|null); - /** ImageSource imageUri. */ - public imageUri: string; + /** FaceRecognitionResult confidence. */ + public confidence: number; /** - * Creates a new ImageSource instance using the specified properties. + * Creates a new FaceRecognitionResult instance using the specified properties. * @param [properties] Properties to set - * @returns ImageSource instance + * @returns FaceRecognitionResult instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IImageSource): google.cloud.vision.v1p4beta1.ImageSource; + public static create(properties?: google.cloud.vision.v1p4beta1.IFaceRecognitionResult): google.cloud.vision.v1p4beta1.FaceRecognitionResult; /** - * Encodes the specified ImageSource message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageSource.verify|verify} messages. - * @param message ImageSource message or plain object to encode + * Encodes the specified FaceRecognitionResult message. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceRecognitionResult.verify|verify} messages. + * @param message FaceRecognitionResult message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IImageSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IFaceRecognitionResult, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImageSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageSource.verify|verify} messages. - * @param message ImageSource message or plain object to encode + * Encodes the specified FaceRecognitionResult message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceRecognitionResult.verify|verify} messages. + * @param message FaceRecognitionResult message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IImageSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IFaceRecognitionResult, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImageSource message from the specified reader or buffer. + * Decodes a FaceRecognitionResult message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImageSource + * @returns FaceRecognitionResult * @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.vision.v1p4beta1.ImageSource; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.FaceRecognitionResult; /** - * Decodes an ImageSource message from the specified reader or buffer, length delimited. + * Decodes a FaceRecognitionResult message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImageSource + * @returns FaceRecognitionResult * @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.vision.v1p4beta1.ImageSource; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.FaceRecognitionResult; /** - * Verifies an ImageSource message. + * Verifies a FaceRecognitionResult message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImageSource message from a plain object. Also converts values to their respective internal types. + * Creates a FaceRecognitionResult message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImageSource + * @returns FaceRecognitionResult */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ImageSource; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.FaceRecognitionResult; /** - * Creates a plain object from an ImageSource message. Also converts values to other types if specified. - * @param message ImageSource + * Creates a plain object from a FaceRecognitionResult message. Also converts values to other types if specified. + * @param message FaceRecognitionResult * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.ImageSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.FaceRecognitionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImageSource to JSON. + * Converts this FaceRecognitionResult to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an Image. */ - interface IImage { + /** Properties of a Vertex. */ + interface IVertex { - /** Image content */ - content?: (Uint8Array|string|null); + /** Vertex x */ + x?: (number|null); - /** Image source */ - source?: (google.cloud.vision.v1p4beta1.IImageSource|null); + /** Vertex y */ + y?: (number|null); } - /** Represents an Image. */ - class Image implements IImage { + /** Represents a Vertex. */ + class Vertex implements IVertex { /** - * Constructs a new Image. + * Constructs a new Vertex. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IImage); + constructor(properties?: google.cloud.vision.v1p4beta1.IVertex); - /** Image content. */ - public content: (Uint8Array|string); + /** Vertex x. */ + public x: number; - /** Image source. */ - public source?: (google.cloud.vision.v1p4beta1.IImageSource|null); + /** Vertex y. */ + public y: number; /** - * Creates a new Image instance using the specified properties. + * Creates a new Vertex instance using the specified properties. * @param [properties] Properties to set - * @returns Image instance + * @returns Vertex instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IImage): google.cloud.vision.v1p4beta1.Image; + public static create(properties?: google.cloud.vision.v1p4beta1.IVertex): google.cloud.vision.v1p4beta1.Vertex; /** - * Encodes the specified Image message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Image.verify|verify} messages. - * @param message Image message or plain object to encode + * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Vertex.verify|verify} messages. + * @param message Vertex message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IImage, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Image.verify|verify} messages. - * @param message Image message or plain object to encode + * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Vertex.verify|verify} messages. + * @param message Vertex message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IImage, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an Image message from the specified reader or buffer. + * Decodes a Vertex message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Image + * @returns Vertex * @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.vision.v1p4beta1.Image; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.Vertex; /** - * Decodes an Image message from the specified reader or buffer, length delimited. + * Decodes a Vertex message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Image + * @returns Vertex * @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.vision.v1p4beta1.Image; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.Vertex; /** - * Verifies an Image message. + * Verifies a Vertex message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an Image message from a plain object. Also converts values to their respective internal types. + * Creates a Vertex message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Image + * @returns Vertex */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.Image; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.Vertex; /** - * Creates a plain object from an Image message. Also converts values to other types if specified. - * @param message Image + * Creates a plain object from a Vertex message. Also converts values to other types if specified. + * @param message Vertex * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.Image, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.Vertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Image to JSON. + * Converts this Vertex to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Likelihood enum. */ - enum Likelihood { - UNKNOWN = 0, - VERY_UNLIKELY = 1, - UNLIKELY = 2, - POSSIBLE = 3, - LIKELY = 4, - VERY_LIKELY = 5 - } - - /** Properties of a FaceAnnotation. */ - interface IFaceAnnotation { - - /** FaceAnnotation boundingPoly */ - boundingPoly?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); - - /** FaceAnnotation fdBoundingPoly */ - fdBoundingPoly?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); - - /** FaceAnnotation landmarks */ - landmarks?: (google.cloud.vision.v1p4beta1.FaceAnnotation.ILandmark[]|null); - - /** FaceAnnotation rollAngle */ - rollAngle?: (number|null); - - /** FaceAnnotation panAngle */ - panAngle?: (number|null); - - /** FaceAnnotation tiltAngle */ - tiltAngle?: (number|null); - - /** FaceAnnotation detectionConfidence */ - detectionConfidence?: (number|null); - - /** FaceAnnotation landmarkingConfidence */ - landmarkingConfidence?: (number|null); - - /** FaceAnnotation joyLikelihood */ - joyLikelihood?: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood|null); - - /** FaceAnnotation sorrowLikelihood */ - sorrowLikelihood?: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood|null); - - /** FaceAnnotation angerLikelihood */ - angerLikelihood?: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood|null); - - /** FaceAnnotation surpriseLikelihood */ - surpriseLikelihood?: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood|null); - - /** FaceAnnotation underExposedLikelihood */ - underExposedLikelihood?: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood|null); - - /** FaceAnnotation blurredLikelihood */ - blurredLikelihood?: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood|null); + /** Properties of a NormalizedVertex. */ + interface INormalizedVertex { - /** FaceAnnotation headwearLikelihood */ - headwearLikelihood?: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood|null); + /** NormalizedVertex x */ + x?: (number|null); - /** FaceAnnotation recognitionResult */ - recognitionResult?: (google.cloud.vision.v1p4beta1.IFaceRecognitionResult[]|null); + /** NormalizedVertex y */ + y?: (number|null); } - /** Represents a FaceAnnotation. */ - class FaceAnnotation implements IFaceAnnotation { + /** Represents a NormalizedVertex. */ + class NormalizedVertex implements INormalizedVertex { /** - * Constructs a new FaceAnnotation. + * Constructs a new NormalizedVertex. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IFaceAnnotation); - - /** FaceAnnotation boundingPoly. */ - public boundingPoly?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); - - /** FaceAnnotation fdBoundingPoly. */ - public fdBoundingPoly?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); - - /** FaceAnnotation landmarks. */ - public landmarks: google.cloud.vision.v1p4beta1.FaceAnnotation.ILandmark[]; - - /** FaceAnnotation rollAngle. */ - public rollAngle: number; - - /** FaceAnnotation panAngle. */ - public panAngle: number; - - /** FaceAnnotation tiltAngle. */ - public tiltAngle: number; - - /** FaceAnnotation detectionConfidence. */ - public detectionConfidence: number; - - /** FaceAnnotation landmarkingConfidence. */ - public landmarkingConfidence: number; - - /** FaceAnnotation joyLikelihood. */ - public joyLikelihood: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood); - - /** FaceAnnotation sorrowLikelihood. */ - public sorrowLikelihood: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood); - - /** FaceAnnotation angerLikelihood. */ - public angerLikelihood: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood); - - /** FaceAnnotation surpriseLikelihood. */ - public surpriseLikelihood: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood); - - /** FaceAnnotation underExposedLikelihood. */ - public underExposedLikelihood: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood); - - /** FaceAnnotation blurredLikelihood. */ - public blurredLikelihood: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood); + constructor(properties?: google.cloud.vision.v1p4beta1.INormalizedVertex); - /** FaceAnnotation headwearLikelihood. */ - public headwearLikelihood: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood); + /** NormalizedVertex x. */ + public x: number; - /** FaceAnnotation recognitionResult. */ - public recognitionResult: google.cloud.vision.v1p4beta1.IFaceRecognitionResult[]; + /** NormalizedVertex y. */ + public y: number; /** - * Creates a new FaceAnnotation instance using the specified properties. + * Creates a new NormalizedVertex instance using the specified properties. * @param [properties] Properties to set - * @returns FaceAnnotation instance + * @returns NormalizedVertex instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IFaceAnnotation): google.cloud.vision.v1p4beta1.FaceAnnotation; + public static create(properties?: google.cloud.vision.v1p4beta1.INormalizedVertex): google.cloud.vision.v1p4beta1.NormalizedVertex; /** - * Encodes the specified FaceAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceAnnotation.verify|verify} messages. - * @param message FaceAnnotation message or plain object to encode + * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.vision.v1p4beta1.NormalizedVertex.verify|verify} messages. + * @param message NormalizedVertex message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IFaceAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.INormalizedVertex, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified FaceAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceAnnotation.verify|verify} messages. - * @param message FaceAnnotation message or plain object to encode + * Encodes the specified NormalizedVertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.NormalizedVertex.verify|verify} messages. + * @param message NormalizedVertex message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IFaceAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.INormalizedVertex, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a FaceAnnotation message from the specified reader or buffer. + * Decodes a NormalizedVertex message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns FaceAnnotation + * @returns NormalizedVertex * @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.vision.v1p4beta1.FaceAnnotation; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.NormalizedVertex; /** - * Decodes a FaceAnnotation message from the specified reader or buffer, length delimited. + * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns FaceAnnotation + * @returns NormalizedVertex * @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.vision.v1p4beta1.FaceAnnotation; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.NormalizedVertex; /** - * Verifies a FaceAnnotation message. + * Verifies a NormalizedVertex 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 FaceAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates a NormalizedVertex message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns FaceAnnotation + * @returns NormalizedVertex */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.FaceAnnotation; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.NormalizedVertex; /** - * Creates a plain object from a FaceAnnotation message. Also converts values to other types if specified. - * @param message FaceAnnotation + * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. + * @param message NormalizedVertex * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.FaceAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.NormalizedVertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this FaceAnnotation to JSON. + * Converts this NormalizedVertex to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace FaceAnnotation { - - /** Properties of a Landmark. */ - interface ILandmark { - - /** Landmark type */ - type?: (google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.Type|keyof typeof google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.Type|null); - - /** Landmark position */ - position?: (google.cloud.vision.v1p4beta1.IPosition|null); - } - - /** Represents a Landmark. */ - class Landmark implements ILandmark { - - /** - * Constructs a new Landmark. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.vision.v1p4beta1.FaceAnnotation.ILandmark); - - /** Landmark type. */ - public type: (google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.Type|keyof typeof google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.Type); - - /** Landmark position. */ - public position?: (google.cloud.vision.v1p4beta1.IPosition|null); - - /** - * Creates a new Landmark instance using the specified properties. - * @param [properties] Properties to set - * @returns Landmark instance - */ - public static create(properties?: google.cloud.vision.v1p4beta1.FaceAnnotation.ILandmark): google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark; - - /** - * Encodes the specified Landmark message. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.verify|verify} messages. - * @param message Landmark message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.vision.v1p4beta1.FaceAnnotation.ILandmark, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Landmark message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.verify|verify} messages. - * @param message Landmark message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.FaceAnnotation.ILandmark, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Landmark message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Landmark - * @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.vision.v1p4beta1.FaceAnnotation.Landmark; - - /** - * Decodes a Landmark message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Landmark - * @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.vision.v1p4beta1.FaceAnnotation.Landmark; - - /** - * Verifies a Landmark 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 Landmark message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Landmark - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark; - - /** - * Creates a plain object from a Landmark message. Also converts values to other types if specified. - * @param message Landmark - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Landmark to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - - namespace Landmark { - - /** Type enum. */ - enum Type { - UNKNOWN_LANDMARK = 0, - LEFT_EYE = 1, - RIGHT_EYE = 2, - LEFT_OF_LEFT_EYEBROW = 3, - RIGHT_OF_LEFT_EYEBROW = 4, - LEFT_OF_RIGHT_EYEBROW = 5, - RIGHT_OF_RIGHT_EYEBROW = 6, - MIDPOINT_BETWEEN_EYES = 7, - NOSE_TIP = 8, - UPPER_LIP = 9, - LOWER_LIP = 10, - MOUTH_LEFT = 11, - MOUTH_RIGHT = 12, - MOUTH_CENTER = 13, - NOSE_BOTTOM_RIGHT = 14, - NOSE_BOTTOM_LEFT = 15, - NOSE_BOTTOM_CENTER = 16, - LEFT_EYE_TOP_BOUNDARY = 17, - LEFT_EYE_RIGHT_CORNER = 18, - LEFT_EYE_BOTTOM_BOUNDARY = 19, - LEFT_EYE_LEFT_CORNER = 20, - RIGHT_EYE_TOP_BOUNDARY = 21, - RIGHT_EYE_RIGHT_CORNER = 22, - RIGHT_EYE_BOTTOM_BOUNDARY = 23, - RIGHT_EYE_LEFT_CORNER = 24, - LEFT_EYEBROW_UPPER_MIDPOINT = 25, - RIGHT_EYEBROW_UPPER_MIDPOINT = 26, - LEFT_EAR_TRAGION = 27, - RIGHT_EAR_TRAGION = 28, - LEFT_EYE_PUPIL = 29, - RIGHT_EYE_PUPIL = 30, - FOREHEAD_GLABELLA = 31, - CHIN_GNATHION = 32, - CHIN_LEFT_GONION = 33, - CHIN_RIGHT_GONION = 34 - } - } - } + /** Properties of a BoundingPoly. */ + interface IBoundingPoly { - /** Properties of a LocationInfo. */ - interface ILocationInfo { + /** BoundingPoly vertices */ + vertices?: (google.cloud.vision.v1p4beta1.IVertex[]|null); - /** LocationInfo latLng */ - latLng?: (google.type.ILatLng|null); + /** BoundingPoly normalizedVertices */ + normalizedVertices?: (google.cloud.vision.v1p4beta1.INormalizedVertex[]|null); } - /** Represents a LocationInfo. */ - class LocationInfo implements ILocationInfo { + /** Represents a BoundingPoly. */ + class BoundingPoly implements IBoundingPoly { /** - * Constructs a new LocationInfo. + * Constructs a new BoundingPoly. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.ILocationInfo); + constructor(properties?: google.cloud.vision.v1p4beta1.IBoundingPoly); - /** LocationInfo latLng. */ - public latLng?: (google.type.ILatLng|null); + /** BoundingPoly vertices. */ + public vertices: google.cloud.vision.v1p4beta1.IVertex[]; + + /** BoundingPoly normalizedVertices. */ + public normalizedVertices: google.cloud.vision.v1p4beta1.INormalizedVertex[]; /** - * Creates a new LocationInfo instance using the specified properties. + * Creates a new BoundingPoly instance using the specified properties. * @param [properties] Properties to set - * @returns LocationInfo instance + * @returns BoundingPoly instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.ILocationInfo): google.cloud.vision.v1p4beta1.LocationInfo; + public static create(properties?: google.cloud.vision.v1p4beta1.IBoundingPoly): google.cloud.vision.v1p4beta1.BoundingPoly; /** - * Encodes the specified LocationInfo message. Does not implicitly {@link google.cloud.vision.v1p4beta1.LocationInfo.verify|verify} messages. - * @param message LocationInfo message or plain object to encode + * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.vision.v1p4beta1.BoundingPoly.verify|verify} messages. + * @param message BoundingPoly message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.ILocationInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified LocationInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.LocationInfo.verify|verify} messages. - * @param message LocationInfo message or plain object to encode + * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.BoundingPoly.verify|verify} messages. + * @param message BoundingPoly message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ILocationInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a LocationInfo message from the specified reader or buffer. + * Decodes a BoundingPoly message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns LocationInfo + * @returns BoundingPoly * @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.vision.v1p4beta1.LocationInfo; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.BoundingPoly; /** - * Decodes a LocationInfo message from the specified reader or buffer, length delimited. + * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns LocationInfo + * @returns BoundingPoly * @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.vision.v1p4beta1.LocationInfo; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.BoundingPoly; /** - * Verifies a LocationInfo message. + * Verifies a BoundingPoly message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a LocationInfo message from a plain object. Also converts values to their respective internal types. + * Creates a BoundingPoly message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns LocationInfo + * @returns BoundingPoly */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.LocationInfo; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.BoundingPoly; /** - * Creates a plain object from a LocationInfo message. Also converts values to other types if specified. - * @param message LocationInfo + * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. + * @param message BoundingPoly * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.LocationInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.BoundingPoly, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this LocationInfo to JSON. + * Converts this BoundingPoly to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a Property. */ - interface IProperty { + /** Properties of a Position. */ + interface IPosition { - /** Property name */ - name?: (string|null); + /** Position x */ + x?: (number|null); - /** Property value */ - value?: (string|null); + /** Position y */ + y?: (number|null); - /** Property uint64Value */ - uint64Value?: (number|Long|string|null); + /** Position z */ + z?: (number|null); } - /** Represents a Property. */ - class Property implements IProperty { + /** Represents a Position. */ + class Position implements IPosition { /** - * Constructs a new Property. + * Constructs a new Position. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IProperty); + constructor(properties?: google.cloud.vision.v1p4beta1.IPosition); - /** Property name. */ - public name: string; + /** Position x. */ + public x: number; - /** Property value. */ - public value: string; + /** Position y. */ + public y: number; - /** Property uint64Value. */ - public uint64Value: (number|Long|string); + /** Position z. */ + public z: number; /** - * Creates a new Property instance using the specified properties. + * Creates a new Position instance using the specified properties. * @param [properties] Properties to set - * @returns Property instance + * @returns Position instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IProperty): google.cloud.vision.v1p4beta1.Property; + public static create(properties?: google.cloud.vision.v1p4beta1.IPosition): google.cloud.vision.v1p4beta1.Position; /** - * Encodes the specified Property message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Property.verify|verify} messages. - * @param message Property message or plain object to encode + * Encodes the specified Position message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Position.verify|verify} messages. + * @param message Position message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IProperty, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IPosition, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Property message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Property.verify|verify} messages. - * @param message Property message or plain object to encode + * Encodes the specified Position message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Position.verify|verify} messages. + * @param message Position message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IProperty, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IPosition, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Property message from the specified reader or buffer. + * Decodes a Position message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Property + * @returns Position * @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.vision.v1p4beta1.Property; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.Position; /** - * Decodes a Property message from the specified reader or buffer, length delimited. + * Decodes a Position message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Property + * @returns Position * @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.vision.v1p4beta1.Property; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.Position; /** - * Verifies a Property message. + * Verifies a Position message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Property message from a plain object. Also converts values to their respective internal types. + * Creates a Position message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Property + * @returns Position */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.Property; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.Position; /** - * Creates a plain object from a Property message. Also converts values to other types if specified. - * @param message Property + * Creates a plain object from a Position message. Also converts values to other types if specified. + * @param message Position * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.Property, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.Position, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Property to JSON. + * Converts this Position to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an EntityAnnotation. */ - interface IEntityAnnotation { - - /** EntityAnnotation mid */ - mid?: (string|null); - - /** EntityAnnotation locale */ - locale?: (string|null); - - /** EntityAnnotation description */ - description?: (string|null); - - /** EntityAnnotation score */ - score?: (number|null); - - /** EntityAnnotation confidence */ - confidence?: (number|null); - - /** EntityAnnotation topicality */ - topicality?: (number|null); - - /** EntityAnnotation boundingPoly */ - boundingPoly?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); - - /** EntityAnnotation locations */ - locations?: (google.cloud.vision.v1p4beta1.ILocationInfo[]|null); - - /** EntityAnnotation properties */ - properties?: (google.cloud.vision.v1p4beta1.IProperty[]|null); - } - - /** Represents an EntityAnnotation. */ - class EntityAnnotation implements IEntityAnnotation { + /** Represents an ImageAnnotator */ + class ImageAnnotator extends $protobuf.rpc.Service { /** - * Constructs a new EntityAnnotation. - * @param [properties] Properties to set + * Constructs a new ImageAnnotator service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited */ - constructor(properties?: google.cloud.vision.v1p4beta1.IEntityAnnotation); - - /** EntityAnnotation mid. */ - public mid: string; - - /** EntityAnnotation locale. */ - public locale: string; - - /** EntityAnnotation description. */ - public description: string; - - /** EntityAnnotation score. */ - public score: number; - - /** EntityAnnotation confidence. */ - public confidence: number; + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - /** EntityAnnotation topicality. */ - public topicality: number; + /** + * Creates new ImageAnnotator service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): ImageAnnotator; - /** EntityAnnotation boundingPoly. */ - public boundingPoly?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); + /** + * Calls BatchAnnotateImages. + * @param request BatchAnnotateImagesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and BatchAnnotateImagesResponse + */ + public batchAnnotateImages(request: google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest, callback: google.cloud.vision.v1p4beta1.ImageAnnotator.BatchAnnotateImagesCallback): void; - /** EntityAnnotation locations. */ - public locations: google.cloud.vision.v1p4beta1.ILocationInfo[]; + /** + * Calls BatchAnnotateImages. + * @param request BatchAnnotateImagesRequest message or plain object + * @returns Promise + */ + public batchAnnotateImages(request: google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest): Promise; - /** EntityAnnotation properties. */ - public properties: google.cloud.vision.v1p4beta1.IProperty[]; + /** + * Calls BatchAnnotateFiles. + * @param request BatchAnnotateFilesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and BatchAnnotateFilesResponse + */ + public batchAnnotateFiles(request: google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest, callback: google.cloud.vision.v1p4beta1.ImageAnnotator.BatchAnnotateFilesCallback): void; /** - * Creates a new EntityAnnotation instance using the specified properties. - * @param [properties] Properties to set - * @returns EntityAnnotation instance + * Calls BatchAnnotateFiles. + * @param request BatchAnnotateFilesRequest message or plain object + * @returns Promise */ - public static create(properties?: google.cloud.vision.v1p4beta1.IEntityAnnotation): google.cloud.vision.v1p4beta1.EntityAnnotation; + public batchAnnotateFiles(request: google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest): Promise; /** - * Encodes the specified EntityAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.EntityAnnotation.verify|verify} messages. - * @param message EntityAnnotation message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Calls AsyncBatchAnnotateImages. + * @param request AsyncBatchAnnotateImagesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - public static encode(message: google.cloud.vision.v1p4beta1.IEntityAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + public asyncBatchAnnotateImages(request: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest, callback: google.cloud.vision.v1p4beta1.ImageAnnotator.AsyncBatchAnnotateImagesCallback): void; /** - * Encodes the specified EntityAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.EntityAnnotation.verify|verify} messages. - * @param message EntityAnnotation message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer + * Calls AsyncBatchAnnotateImages. + * @param request AsyncBatchAnnotateImagesRequest message or plain object + * @returns Promise */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IEntityAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + public asyncBatchAnnotateImages(request: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest): Promise; /** - * Decodes an EntityAnnotation message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns EntityAnnotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls AsyncBatchAnnotateFiles. + * @param request AsyncBatchAnnotateFilesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.EntityAnnotation; + public asyncBatchAnnotateFiles(request: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest, callback: google.cloud.vision.v1p4beta1.ImageAnnotator.AsyncBatchAnnotateFilesCallback): void; /** - * Decodes an EntityAnnotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns EntityAnnotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls AsyncBatchAnnotateFiles. + * @param request AsyncBatchAnnotateFilesRequest message or plain object + * @returns Promise */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.EntityAnnotation; + public asyncBatchAnnotateFiles(request: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest): Promise; + } + + namespace ImageAnnotator { /** - * Verifies an EntityAnnotation message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not + * Callback as used by {@link google.cloud.vision.v1p4beta1.ImageAnnotator#batchAnnotateImages}. + * @param error Error, if any + * @param [response] BatchAnnotateImagesResponse */ - public static verify(message: { [k: string]: any }): (string|null); + type BatchAnnotateImagesCallback = (error: (Error|null), response?: google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse) => void; /** - * Creates an EntityAnnotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns EntityAnnotation + * Callback as used by {@link google.cloud.vision.v1p4beta1.ImageAnnotator#batchAnnotateFiles}. + * @param error Error, if any + * @param [response] BatchAnnotateFilesResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.EntityAnnotation; + type BatchAnnotateFilesCallback = (error: (Error|null), response?: google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse) => void; /** - * Creates a plain object from an EntityAnnotation message. Also converts values to other types if specified. - * @param message EntityAnnotation - * @param [options] Conversion options - * @returns Plain object + * Callback as used by {@link google.cloud.vision.v1p4beta1.ImageAnnotator#asyncBatchAnnotateImages}. + * @param error Error, if any + * @param [response] Operation */ - public static toObject(message: google.cloud.vision.v1p4beta1.EntityAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + type AsyncBatchAnnotateImagesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Converts this EntityAnnotation to JSON. - * @returns JSON object + * Callback as used by {@link google.cloud.vision.v1p4beta1.ImageAnnotator#asyncBatchAnnotateFiles}. + * @param error Error, if any + * @param [response] Operation */ - public toJSON(): { [k: string]: any }; + type AsyncBatchAnnotateFilesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; } - /** Properties of a LocalizedObjectAnnotation. */ - interface ILocalizedObjectAnnotation { - - /** LocalizedObjectAnnotation mid */ - mid?: (string|null); - - /** LocalizedObjectAnnotation languageCode */ - languageCode?: (string|null); + /** Properties of a Feature. */ + interface IFeature { - /** LocalizedObjectAnnotation name */ - name?: (string|null); + /** Feature type */ + type?: (google.cloud.vision.v1p4beta1.Feature.Type|keyof typeof google.cloud.vision.v1p4beta1.Feature.Type|null); - /** LocalizedObjectAnnotation score */ - score?: (number|null); + /** Feature maxResults */ + maxResults?: (number|null); - /** LocalizedObjectAnnotation boundingPoly */ - boundingPoly?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); + /** Feature model */ + model?: (string|null); } - /** Represents a LocalizedObjectAnnotation. */ - class LocalizedObjectAnnotation implements ILocalizedObjectAnnotation { + /** Represents a Feature. */ + class Feature implements IFeature { /** - * Constructs a new LocalizedObjectAnnotation. + * Constructs a new Feature. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.ILocalizedObjectAnnotation); - - /** LocalizedObjectAnnotation mid. */ - public mid: string; - - /** LocalizedObjectAnnotation languageCode. */ - public languageCode: string; + constructor(properties?: google.cloud.vision.v1p4beta1.IFeature); - /** LocalizedObjectAnnotation name. */ - public name: string; + /** Feature type. */ + public type: (google.cloud.vision.v1p4beta1.Feature.Type|keyof typeof google.cloud.vision.v1p4beta1.Feature.Type); - /** LocalizedObjectAnnotation score. */ - public score: number; + /** Feature maxResults. */ + public maxResults: number; - /** LocalizedObjectAnnotation boundingPoly. */ - public boundingPoly?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); + /** Feature model. */ + public model: string; /** - * Creates a new LocalizedObjectAnnotation instance using the specified properties. + * Creates a new Feature instance using the specified properties. * @param [properties] Properties to set - * @returns LocalizedObjectAnnotation instance + * @returns Feature instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.ILocalizedObjectAnnotation): google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation; + public static create(properties?: google.cloud.vision.v1p4beta1.IFeature): google.cloud.vision.v1p4beta1.Feature; /** - * Encodes the specified LocalizedObjectAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation.verify|verify} messages. - * @param message LocalizedObjectAnnotation message or plain object to encode + * Encodes the specified Feature message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Feature.verify|verify} messages. + * @param message Feature message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.ILocalizedObjectAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IFeature, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified LocalizedObjectAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation.verify|verify} messages. - * @param message LocalizedObjectAnnotation message or plain object to encode + * Encodes the specified Feature message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Feature.verify|verify} messages. + * @param message Feature message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ILocalizedObjectAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IFeature, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a LocalizedObjectAnnotation message from the specified reader or buffer. + * Decodes a Feature message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns LocalizedObjectAnnotation + * @returns Feature * @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.vision.v1p4beta1.LocalizedObjectAnnotation; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.Feature; /** - * Decodes a LocalizedObjectAnnotation message from the specified reader or buffer, length delimited. + * Decodes a Feature message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns LocalizedObjectAnnotation + * @returns Feature * @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.vision.v1p4beta1.LocalizedObjectAnnotation; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.Feature; /** - * Verifies a LocalizedObjectAnnotation message. + * Verifies a Feature 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 LocalizedObjectAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates a Feature message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns LocalizedObjectAnnotation + * @returns Feature */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.Feature; /** - * Creates a plain object from a LocalizedObjectAnnotation message. Also converts values to other types if specified. - * @param message LocalizedObjectAnnotation + * Creates a plain object from a Feature message. Also converts values to other types if specified. + * @param message Feature * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.Feature, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this LocalizedObjectAnnotation to JSON. + * Converts this Feature to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a SafeSearchAnnotation. */ - interface ISafeSearchAnnotation { - - /** SafeSearchAnnotation adult */ - adult?: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood|null); + namespace Feature { - /** SafeSearchAnnotation spoof */ - spoof?: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood|null); + /** Type enum. */ + enum Type { + TYPE_UNSPECIFIED = 0, + FACE_DETECTION = 1, + LANDMARK_DETECTION = 2, + LOGO_DETECTION = 3, + LABEL_DETECTION = 4, + TEXT_DETECTION = 5, + DOCUMENT_TEXT_DETECTION = 11, + SAFE_SEARCH_DETECTION = 6, + IMAGE_PROPERTIES = 7, + CROP_HINTS = 9, + WEB_DETECTION = 10, + PRODUCT_SEARCH = 12, + OBJECT_LOCALIZATION = 19 + } + } - /** SafeSearchAnnotation medical */ - medical?: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood|null); + /** Properties of an ImageSource. */ + interface IImageSource { - /** SafeSearchAnnotation violence */ - violence?: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood|null); + /** ImageSource gcsImageUri */ + gcsImageUri?: (string|null); - /** SafeSearchAnnotation racy */ - racy?: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood|null); + /** ImageSource imageUri */ + imageUri?: (string|null); } - /** Represents a SafeSearchAnnotation. */ - class SafeSearchAnnotation implements ISafeSearchAnnotation { + /** Represents an ImageSource. */ + class ImageSource implements IImageSource { /** - * Constructs a new SafeSearchAnnotation. + * Constructs a new ImageSource. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.ISafeSearchAnnotation); - - /** SafeSearchAnnotation adult. */ - public adult: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood); - - /** SafeSearchAnnotation spoof. */ - public spoof: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood); - - /** SafeSearchAnnotation medical. */ - public medical: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood); + constructor(properties?: google.cloud.vision.v1p4beta1.IImageSource); - /** SafeSearchAnnotation violence. */ - public violence: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood); + /** ImageSource gcsImageUri. */ + public gcsImageUri: string; - /** SafeSearchAnnotation racy. */ - public racy: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood); + /** ImageSource imageUri. */ + public imageUri: string; /** - * Creates a new SafeSearchAnnotation instance using the specified properties. + * Creates a new ImageSource instance using the specified properties. * @param [properties] Properties to set - * @returns SafeSearchAnnotation instance + * @returns ImageSource instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.ISafeSearchAnnotation): google.cloud.vision.v1p4beta1.SafeSearchAnnotation; + public static create(properties?: google.cloud.vision.v1p4beta1.IImageSource): google.cloud.vision.v1p4beta1.ImageSource; /** - * Encodes the specified SafeSearchAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.SafeSearchAnnotation.verify|verify} messages. - * @param message SafeSearchAnnotation message or plain object to encode + * Encodes the specified ImageSource message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageSource.verify|verify} messages. + * @param message ImageSource message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.ISafeSearchAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IImageSource, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified SafeSearchAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.SafeSearchAnnotation.verify|verify} messages. - * @param message SafeSearchAnnotation message or plain object to encode + * Encodes the specified ImageSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageSource.verify|verify} messages. + * @param message ImageSource message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ISafeSearchAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IImageSource, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a SafeSearchAnnotation message from the specified reader or buffer. + * Decodes an ImageSource message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns SafeSearchAnnotation + * @returns ImageSource * @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.vision.v1p4beta1.SafeSearchAnnotation; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.ImageSource; /** - * Decodes a SafeSearchAnnotation message from the specified reader or buffer, length delimited. + * Decodes an ImageSource message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns SafeSearchAnnotation + * @returns ImageSource * @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.vision.v1p4beta1.SafeSearchAnnotation; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.ImageSource; /** - * Verifies a SafeSearchAnnotation message. + * Verifies an ImageSource 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 SafeSearchAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates an ImageSource message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns SafeSearchAnnotation + * @returns ImageSource */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.SafeSearchAnnotation; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ImageSource; /** - * Creates a plain object from a SafeSearchAnnotation message. Also converts values to other types if specified. - * @param message SafeSearchAnnotation + * Creates a plain object from an ImageSource message. Also converts values to other types if specified. + * @param message ImageSource * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.SafeSearchAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.ImageSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this SafeSearchAnnotation to JSON. + * Converts this ImageSource to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a LatLongRect. */ - interface ILatLongRect { + /** Properties of an Image. */ + interface IImage { - /** LatLongRect minLatLng */ - minLatLng?: (google.type.ILatLng|null); + /** Image content */ + content?: (Uint8Array|string|null); - /** LatLongRect maxLatLng */ - maxLatLng?: (google.type.ILatLng|null); + /** Image source */ + source?: (google.cloud.vision.v1p4beta1.IImageSource|null); } - /** Represents a LatLongRect. */ - class LatLongRect implements ILatLongRect { + /** Represents an Image. */ + class Image implements IImage { /** - * Constructs a new LatLongRect. + * Constructs a new Image. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.ILatLongRect); + constructor(properties?: google.cloud.vision.v1p4beta1.IImage); - /** LatLongRect minLatLng. */ - public minLatLng?: (google.type.ILatLng|null); + /** Image content. */ + public content: (Uint8Array|string); - /** LatLongRect maxLatLng. */ - public maxLatLng?: (google.type.ILatLng|null); + /** Image source. */ + public source?: (google.cloud.vision.v1p4beta1.IImageSource|null); /** - * Creates a new LatLongRect instance using the specified properties. + * Creates a new Image instance using the specified properties. * @param [properties] Properties to set - * @returns LatLongRect instance + * @returns Image instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.ILatLongRect): google.cloud.vision.v1p4beta1.LatLongRect; + public static create(properties?: google.cloud.vision.v1p4beta1.IImage): google.cloud.vision.v1p4beta1.Image; /** - * Encodes the specified LatLongRect message. Does not implicitly {@link google.cloud.vision.v1p4beta1.LatLongRect.verify|verify} messages. - * @param message LatLongRect message or plain object to encode + * Encodes the specified Image message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Image.verify|verify} messages. + * @param message Image message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.ILatLongRect, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IImage, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified LatLongRect message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.LatLongRect.verify|verify} messages. - * @param message LatLongRect message or plain object to encode + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Image.verify|verify} messages. + * @param message Image message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ILatLongRect, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IImage, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a LatLongRect message from the specified reader or buffer. + * Decodes an Image message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns LatLongRect + * @returns Image * @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.vision.v1p4beta1.LatLongRect; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.Image; /** - * Decodes a LatLongRect message from the specified reader or buffer, length delimited. + * Decodes an Image message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns LatLongRect + * @returns Image * @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.vision.v1p4beta1.LatLongRect; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.Image; /** - * Verifies a LatLongRect message. + * Verifies an Image 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 LatLongRect message from a plain object. Also converts values to their respective internal types. + * Creates an Image message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns LatLongRect + * @returns Image */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.LatLongRect; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.Image; /** - * Creates a plain object from a LatLongRect message. Also converts values to other types if specified. - * @param message LatLongRect + * Creates a plain object from an Image message. Also converts values to other types if specified. + * @param message Image * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.LatLongRect, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.Image, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this LatLongRect to JSON. + * Converts this Image to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a ColorInfo. */ - interface IColorInfo { + /** Likelihood enum. */ + enum Likelihood { + UNKNOWN = 0, + VERY_UNLIKELY = 1, + UNLIKELY = 2, + POSSIBLE = 3, + LIKELY = 4, + VERY_LIKELY = 5 + } - /** ColorInfo color */ - color?: (google.type.IColor|null); + /** Properties of a FaceAnnotation. */ + interface IFaceAnnotation { - /** ColorInfo score */ - score?: (number|null); + /** FaceAnnotation boundingPoly */ + boundingPoly?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); - /** ColorInfo pixelFraction */ - pixelFraction?: (number|null); + /** FaceAnnotation fdBoundingPoly */ + fdBoundingPoly?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); + + /** FaceAnnotation landmarks */ + landmarks?: (google.cloud.vision.v1p4beta1.FaceAnnotation.ILandmark[]|null); + + /** FaceAnnotation rollAngle */ + rollAngle?: (number|null); + + /** FaceAnnotation panAngle */ + panAngle?: (number|null); + + /** FaceAnnotation tiltAngle */ + tiltAngle?: (number|null); + + /** FaceAnnotation detectionConfidence */ + detectionConfidence?: (number|null); + + /** FaceAnnotation landmarkingConfidence */ + landmarkingConfidence?: (number|null); + + /** FaceAnnotation joyLikelihood */ + joyLikelihood?: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood|null); + + /** FaceAnnotation sorrowLikelihood */ + sorrowLikelihood?: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood|null); + + /** FaceAnnotation angerLikelihood */ + angerLikelihood?: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood|null); + + /** FaceAnnotation surpriseLikelihood */ + surpriseLikelihood?: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood|null); + + /** FaceAnnotation underExposedLikelihood */ + underExposedLikelihood?: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood|null); + + /** FaceAnnotation blurredLikelihood */ + blurredLikelihood?: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood|null); + + /** FaceAnnotation headwearLikelihood */ + headwearLikelihood?: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood|null); + + /** FaceAnnotation recognitionResult */ + recognitionResult?: (google.cloud.vision.v1p4beta1.IFaceRecognitionResult[]|null); } - /** Represents a ColorInfo. */ - class ColorInfo implements IColorInfo { + /** Represents a FaceAnnotation. */ + class FaceAnnotation implements IFaceAnnotation { /** - * Constructs a new ColorInfo. + * Constructs a new FaceAnnotation. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IColorInfo); + constructor(properties?: google.cloud.vision.v1p4beta1.IFaceAnnotation); + + /** FaceAnnotation boundingPoly. */ + public boundingPoly?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); + + /** FaceAnnotation fdBoundingPoly. */ + public fdBoundingPoly?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); + + /** FaceAnnotation landmarks. */ + public landmarks: google.cloud.vision.v1p4beta1.FaceAnnotation.ILandmark[]; + + /** FaceAnnotation rollAngle. */ + public rollAngle: number; + + /** FaceAnnotation panAngle. */ + public panAngle: number; + + /** FaceAnnotation tiltAngle. */ + public tiltAngle: number; + + /** FaceAnnotation detectionConfidence. */ + public detectionConfidence: number; + + /** FaceAnnotation landmarkingConfidence. */ + public landmarkingConfidence: number; + + /** FaceAnnotation joyLikelihood. */ + public joyLikelihood: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood); + + /** FaceAnnotation sorrowLikelihood. */ + public sorrowLikelihood: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood); + + /** FaceAnnotation angerLikelihood. */ + public angerLikelihood: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood); + + /** FaceAnnotation surpriseLikelihood. */ + public surpriseLikelihood: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood); + + /** FaceAnnotation underExposedLikelihood. */ + public underExposedLikelihood: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood); - /** ColorInfo color. */ - public color?: (google.type.IColor|null); + /** FaceAnnotation blurredLikelihood. */ + public blurredLikelihood: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood); - /** ColorInfo score. */ - public score: number; + /** FaceAnnotation headwearLikelihood. */ + public headwearLikelihood: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood); - /** ColorInfo pixelFraction. */ - public pixelFraction: number; + /** FaceAnnotation recognitionResult. */ + public recognitionResult: google.cloud.vision.v1p4beta1.IFaceRecognitionResult[]; /** - * Creates a new ColorInfo instance using the specified properties. + * Creates a new FaceAnnotation instance using the specified properties. * @param [properties] Properties to set - * @returns ColorInfo instance + * @returns FaceAnnotation instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IColorInfo): google.cloud.vision.v1p4beta1.ColorInfo; + public static create(properties?: google.cloud.vision.v1p4beta1.IFaceAnnotation): google.cloud.vision.v1p4beta1.FaceAnnotation; /** - * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ColorInfo.verify|verify} messages. - * @param message ColorInfo message or plain object to encode + * Encodes the specified FaceAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceAnnotation.verify|verify} messages. + * @param message FaceAnnotation message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IFaceAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ColorInfo.verify|verify} messages. - * @param message ColorInfo message or plain object to encode + * Encodes the specified FaceAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceAnnotation.verify|verify} messages. + * @param message FaceAnnotation message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IFaceAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a ColorInfo message from the specified reader or buffer. + * Decodes a FaceAnnotation message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ColorInfo + * @returns FaceAnnotation * @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.vision.v1p4beta1.ColorInfo; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.FaceAnnotation; /** - * Decodes a ColorInfo message from the specified reader or buffer, length delimited. + * Decodes a FaceAnnotation message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ColorInfo + * @returns FaceAnnotation * @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.vision.v1p4beta1.ColorInfo; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.FaceAnnotation; /** - * Verifies a ColorInfo message. + * Verifies a FaceAnnotation 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 ColorInfo message from a plain object. Also converts values to their respective internal types. + * Creates a FaceAnnotation message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ColorInfo + * @returns FaceAnnotation */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ColorInfo; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.FaceAnnotation; /** - * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. - * @param message ColorInfo + * Creates a plain object from a FaceAnnotation message. Also converts values to other types if specified. + * @param message FaceAnnotation * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.ColorInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.FaceAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ColorInfo to JSON. + * Converts this FaceAnnotation to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a DominantColorsAnnotation. */ - interface IDominantColorsAnnotation { + namespace FaceAnnotation { - /** DominantColorsAnnotation colors */ - colors?: (google.cloud.vision.v1p4beta1.IColorInfo[]|null); + /** Properties of a Landmark. */ + interface ILandmark { + + /** Landmark type */ + type?: (google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.Type|keyof typeof google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.Type|null); + + /** Landmark position */ + position?: (google.cloud.vision.v1p4beta1.IPosition|null); + } + + /** Represents a Landmark. */ + class Landmark implements ILandmark { + + /** + * Constructs a new Landmark. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.vision.v1p4beta1.FaceAnnotation.ILandmark); + + /** Landmark type. */ + public type: (google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.Type|keyof typeof google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.Type); + + /** Landmark position. */ + public position?: (google.cloud.vision.v1p4beta1.IPosition|null); + + /** + * Creates a new Landmark instance using the specified properties. + * @param [properties] Properties to set + * @returns Landmark instance + */ + public static create(properties?: google.cloud.vision.v1p4beta1.FaceAnnotation.ILandmark): google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark; + + /** + * Encodes the specified Landmark message. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.verify|verify} messages. + * @param message Landmark message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.vision.v1p4beta1.FaceAnnotation.ILandmark, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Landmark message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.verify|verify} messages. + * @param message Landmark message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.FaceAnnotation.ILandmark, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Landmark message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Landmark + * @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.vision.v1p4beta1.FaceAnnotation.Landmark; + + /** + * Decodes a Landmark message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Landmark + * @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.vision.v1p4beta1.FaceAnnotation.Landmark; + + /** + * Verifies a Landmark 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 Landmark message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Landmark + */ + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark; + + /** + * Creates a plain object from a Landmark message. Also converts values to other types if specified. + * @param message Landmark + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Landmark to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } + + namespace Landmark { + + /** Type enum. */ + enum Type { + UNKNOWN_LANDMARK = 0, + LEFT_EYE = 1, + RIGHT_EYE = 2, + LEFT_OF_LEFT_EYEBROW = 3, + RIGHT_OF_LEFT_EYEBROW = 4, + LEFT_OF_RIGHT_EYEBROW = 5, + RIGHT_OF_RIGHT_EYEBROW = 6, + MIDPOINT_BETWEEN_EYES = 7, + NOSE_TIP = 8, + UPPER_LIP = 9, + LOWER_LIP = 10, + MOUTH_LEFT = 11, + MOUTH_RIGHT = 12, + MOUTH_CENTER = 13, + NOSE_BOTTOM_RIGHT = 14, + NOSE_BOTTOM_LEFT = 15, + NOSE_BOTTOM_CENTER = 16, + LEFT_EYE_TOP_BOUNDARY = 17, + LEFT_EYE_RIGHT_CORNER = 18, + LEFT_EYE_BOTTOM_BOUNDARY = 19, + LEFT_EYE_LEFT_CORNER = 20, + RIGHT_EYE_TOP_BOUNDARY = 21, + RIGHT_EYE_RIGHT_CORNER = 22, + RIGHT_EYE_BOTTOM_BOUNDARY = 23, + RIGHT_EYE_LEFT_CORNER = 24, + LEFT_EYEBROW_UPPER_MIDPOINT = 25, + RIGHT_EYEBROW_UPPER_MIDPOINT = 26, + LEFT_EAR_TRAGION = 27, + RIGHT_EAR_TRAGION = 28, + LEFT_EYE_PUPIL = 29, + RIGHT_EYE_PUPIL = 30, + FOREHEAD_GLABELLA = 31, + CHIN_GNATHION = 32, + CHIN_LEFT_GONION = 33, + CHIN_RIGHT_GONION = 34 + } + } } - /** Represents a DominantColorsAnnotation. */ - class DominantColorsAnnotation implements IDominantColorsAnnotation { + /** Properties of a LocationInfo. */ + interface ILocationInfo { + + /** LocationInfo latLng */ + latLng?: (google.type.ILatLng|null); + } + + /** Represents a LocationInfo. */ + class LocationInfo implements ILocationInfo { /** - * Constructs a new DominantColorsAnnotation. + * Constructs a new LocationInfo. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IDominantColorsAnnotation); + constructor(properties?: google.cloud.vision.v1p4beta1.ILocationInfo); - /** DominantColorsAnnotation colors. */ - public colors: google.cloud.vision.v1p4beta1.IColorInfo[]; + /** LocationInfo latLng. */ + public latLng?: (google.type.ILatLng|null); /** - * Creates a new DominantColorsAnnotation instance using the specified properties. + * Creates a new LocationInfo instance using the specified properties. * @param [properties] Properties to set - * @returns DominantColorsAnnotation instance + * @returns LocationInfo instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IDominantColorsAnnotation): google.cloud.vision.v1p4beta1.DominantColorsAnnotation; + public static create(properties?: google.cloud.vision.v1p4beta1.ILocationInfo): google.cloud.vision.v1p4beta1.LocationInfo; /** - * Encodes the specified DominantColorsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.DominantColorsAnnotation.verify|verify} messages. - * @param message DominantColorsAnnotation message or plain object to encode + * Encodes the specified LocationInfo message. Does not implicitly {@link google.cloud.vision.v1p4beta1.LocationInfo.verify|verify} messages. + * @param message LocationInfo message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IDominantColorsAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.ILocationInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified DominantColorsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.DominantColorsAnnotation.verify|verify} messages. - * @param message DominantColorsAnnotation message or plain object to encode + * Encodes the specified LocationInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.LocationInfo.verify|verify} messages. + * @param message LocationInfo message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IDominantColorsAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ILocationInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a DominantColorsAnnotation message from the specified reader or buffer. + * Decodes a LocationInfo message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns DominantColorsAnnotation + * @returns LocationInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.DominantColorsAnnotation; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.LocationInfo; /** - * Decodes a DominantColorsAnnotation message from the specified reader or buffer, length delimited. + * Decodes a LocationInfo message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns DominantColorsAnnotation + * @returns LocationInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.DominantColorsAnnotation; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.LocationInfo; /** - * Verifies a DominantColorsAnnotation message. + * Verifies a LocationInfo message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a DominantColorsAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates a LocationInfo message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns DominantColorsAnnotation + * @returns LocationInfo */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.DominantColorsAnnotation; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.LocationInfo; /** - * Creates a plain object from a DominantColorsAnnotation message. Also converts values to other types if specified. - * @param message DominantColorsAnnotation + * Creates a plain object from a LocationInfo message. Also converts values to other types if specified. + * @param message LocationInfo * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.DominantColorsAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.LocationInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this DominantColorsAnnotation to JSON. + * Converts this LocationInfo to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an ImageProperties. */ - interface IImageProperties { + /** Properties of a Property. */ + interface IProperty { - /** ImageProperties dominantColors */ - dominantColors?: (google.cloud.vision.v1p4beta1.IDominantColorsAnnotation|null); + /** Property name */ + name?: (string|null); + + /** Property value */ + value?: (string|null); + + /** Property uint64Value */ + uint64Value?: (number|Long|string|null); } - /** Represents an ImageProperties. */ - class ImageProperties implements IImageProperties { + /** Represents a Property. */ + class Property implements IProperty { /** - * Constructs a new ImageProperties. + * Constructs a new Property. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IImageProperties); + constructor(properties?: google.cloud.vision.v1p4beta1.IProperty); - /** ImageProperties dominantColors. */ - public dominantColors?: (google.cloud.vision.v1p4beta1.IDominantColorsAnnotation|null); + /** Property name. */ + public name: string; + + /** Property value. */ + public value: string; + + /** Property uint64Value. */ + public uint64Value: (number|Long|string); /** - * Creates a new ImageProperties instance using the specified properties. + * Creates a new Property instance using the specified properties. * @param [properties] Properties to set - * @returns ImageProperties instance + * @returns Property instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IImageProperties): google.cloud.vision.v1p4beta1.ImageProperties; + public static create(properties?: google.cloud.vision.v1p4beta1.IProperty): google.cloud.vision.v1p4beta1.Property; /** - * Encodes the specified ImageProperties message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageProperties.verify|verify} messages. - * @param message ImageProperties message or plain object to encode + * Encodes the specified Property message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Property.verify|verify} messages. + * @param message Property message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IImageProperties, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IProperty, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImageProperties message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageProperties.verify|verify} messages. - * @param message ImageProperties message or plain object to encode + * Encodes the specified Property message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Property.verify|verify} messages. + * @param message Property message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IImageProperties, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IProperty, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImageProperties message from the specified reader or buffer. + * Decodes a Property message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImageProperties + * @returns Property * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.ImageProperties; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.Property; /** - * Decodes an ImageProperties message from the specified reader or buffer, length delimited. + * Decodes a Property message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImageProperties + * @returns Property * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.ImageProperties; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.Property; /** - * Verifies an ImageProperties message. + * Verifies a Property message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImageProperties message from a plain object. Also converts values to their respective internal types. + * Creates a Property message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImageProperties + * @returns Property */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ImageProperties; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.Property; /** - * Creates a plain object from an ImageProperties message. Also converts values to other types if specified. - * @param message ImageProperties + * Creates a plain object from a Property message. Also converts values to other types if specified. + * @param message Property * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.ImageProperties, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.Property, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImageProperties to JSON. + * Converts this Property to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a CropHint. */ - interface ICropHint { + /** Properties of an EntityAnnotation. */ + interface IEntityAnnotation { - /** CropHint boundingPoly */ - boundingPoly?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); + /** EntityAnnotation mid */ + mid?: (string|null); - /** CropHint confidence */ + /** EntityAnnotation locale */ + locale?: (string|null); + + /** EntityAnnotation description */ + description?: (string|null); + + /** EntityAnnotation score */ + score?: (number|null); + + /** EntityAnnotation confidence */ confidence?: (number|null); - /** CropHint importanceFraction */ - importanceFraction?: (number|null); + /** EntityAnnotation topicality */ + topicality?: (number|null); + + /** EntityAnnotation boundingPoly */ + boundingPoly?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); + + /** EntityAnnotation locations */ + locations?: (google.cloud.vision.v1p4beta1.ILocationInfo[]|null); + + /** EntityAnnotation properties */ + properties?: (google.cloud.vision.v1p4beta1.IProperty[]|null); } - /** Represents a CropHint. */ - class CropHint implements ICropHint { + /** Represents an EntityAnnotation. */ + class EntityAnnotation implements IEntityAnnotation { /** - * Constructs a new CropHint. + * Constructs a new EntityAnnotation. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.ICropHint); + constructor(properties?: google.cloud.vision.v1p4beta1.IEntityAnnotation); - /** CropHint boundingPoly. */ - public boundingPoly?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); + /** EntityAnnotation mid. */ + public mid: string; - /** CropHint confidence. */ + /** EntityAnnotation locale. */ + public locale: string; + + /** EntityAnnotation description. */ + public description: string; + + /** EntityAnnotation score. */ + public score: number; + + /** EntityAnnotation confidence. */ public confidence: number; - /** CropHint importanceFraction. */ - public importanceFraction: number; + /** EntityAnnotation topicality. */ + public topicality: number; + + /** EntityAnnotation boundingPoly. */ + public boundingPoly?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); + + /** EntityAnnotation locations. */ + public locations: google.cloud.vision.v1p4beta1.ILocationInfo[]; + + /** EntityAnnotation properties. */ + public properties: google.cloud.vision.v1p4beta1.IProperty[]; /** - * Creates a new CropHint instance using the specified properties. + * Creates a new EntityAnnotation instance using the specified properties. * @param [properties] Properties to set - * @returns CropHint instance + * @returns EntityAnnotation instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.ICropHint): google.cloud.vision.v1p4beta1.CropHint; + public static create(properties?: google.cloud.vision.v1p4beta1.IEntityAnnotation): google.cloud.vision.v1p4beta1.EntityAnnotation; /** - * Encodes the specified CropHint message. Does not implicitly {@link google.cloud.vision.v1p4beta1.CropHint.verify|verify} messages. - * @param message CropHint message or plain object to encode + * Encodes the specified EntityAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.EntityAnnotation.verify|verify} messages. + * @param message EntityAnnotation message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.ICropHint, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IEntityAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CropHint message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.CropHint.verify|verify} messages. - * @param message CropHint message or plain object to encode + * Encodes the specified EntityAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.EntityAnnotation.verify|verify} messages. + * @param message EntityAnnotation message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ICropHint, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IEntityAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CropHint message from the specified reader or buffer. + * Decodes an EntityAnnotation message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CropHint + * @returns EntityAnnotation * @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.vision.v1p4beta1.CropHint; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.EntityAnnotation; /** - * Decodes a CropHint message from the specified reader or buffer, length delimited. + * Decodes an EntityAnnotation message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CropHint + * @returns EntityAnnotation * @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.vision.v1p4beta1.CropHint; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.EntityAnnotation; /** - * Verifies a CropHint message. + * Verifies an EntityAnnotation 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 CropHint message from a plain object. Also converts values to their respective internal types. + * Creates an EntityAnnotation message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CropHint + * @returns EntityAnnotation */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.CropHint; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.EntityAnnotation; /** - * Creates a plain object from a CropHint message. Also converts values to other types if specified. - * @param message CropHint + * Creates a plain object from an EntityAnnotation message. Also converts values to other types if specified. + * @param message EntityAnnotation * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.CropHint, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.EntityAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CropHint to JSON. + * Converts this EntityAnnotation to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a CropHintsAnnotation. */ - interface ICropHintsAnnotation { + /** Properties of a LocalizedObjectAnnotation. */ + interface ILocalizedObjectAnnotation { - /** CropHintsAnnotation cropHints */ - cropHints?: (google.cloud.vision.v1p4beta1.ICropHint[]|null); + /** LocalizedObjectAnnotation mid */ + mid?: (string|null); + + /** LocalizedObjectAnnotation languageCode */ + languageCode?: (string|null); + + /** LocalizedObjectAnnotation name */ + name?: (string|null); + + /** LocalizedObjectAnnotation score */ + score?: (number|null); + + /** LocalizedObjectAnnotation boundingPoly */ + boundingPoly?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); } - /** Represents a CropHintsAnnotation. */ - class CropHintsAnnotation implements ICropHintsAnnotation { + /** Represents a LocalizedObjectAnnotation. */ + class LocalizedObjectAnnotation implements ILocalizedObjectAnnotation { /** - * Constructs a new CropHintsAnnotation. + * Constructs a new LocalizedObjectAnnotation. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.ICropHintsAnnotation); + constructor(properties?: google.cloud.vision.v1p4beta1.ILocalizedObjectAnnotation); - /** CropHintsAnnotation cropHints. */ - public cropHints: google.cloud.vision.v1p4beta1.ICropHint[]; + /** LocalizedObjectAnnotation mid. */ + public mid: string; + + /** LocalizedObjectAnnotation languageCode. */ + public languageCode: string; + + /** LocalizedObjectAnnotation name. */ + public name: string; + + /** LocalizedObjectAnnotation score. */ + public score: number; + + /** LocalizedObjectAnnotation boundingPoly. */ + public boundingPoly?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); /** - * Creates a new CropHintsAnnotation instance using the specified properties. + * Creates a new LocalizedObjectAnnotation instance using the specified properties. * @param [properties] Properties to set - * @returns CropHintsAnnotation instance + * @returns LocalizedObjectAnnotation instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.ICropHintsAnnotation): google.cloud.vision.v1p4beta1.CropHintsAnnotation; + public static create(properties?: google.cloud.vision.v1p4beta1.ILocalizedObjectAnnotation): google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation; /** - * Encodes the specified CropHintsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.CropHintsAnnotation.verify|verify} messages. - * @param message CropHintsAnnotation message or plain object to encode + * Encodes the specified LocalizedObjectAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation.verify|verify} messages. + * @param message LocalizedObjectAnnotation message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.ICropHintsAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.ILocalizedObjectAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CropHintsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.CropHintsAnnotation.verify|verify} messages. - * @param message CropHintsAnnotation message or plain object to encode + * Encodes the specified LocalizedObjectAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation.verify|verify} messages. + * @param message LocalizedObjectAnnotation message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ICropHintsAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ILocalizedObjectAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CropHintsAnnotation message from the specified reader or buffer. + * Decodes a LocalizedObjectAnnotation message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CropHintsAnnotation + * @returns LocalizedObjectAnnotation * @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.vision.v1p4beta1.CropHintsAnnotation; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation; /** - * Decodes a CropHintsAnnotation message from the specified reader or buffer, length delimited. + * Decodes a LocalizedObjectAnnotation message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CropHintsAnnotation + * @returns LocalizedObjectAnnotation * @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.vision.v1p4beta1.CropHintsAnnotation; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation; /** - * Verifies a CropHintsAnnotation message. + * Verifies a LocalizedObjectAnnotation 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 CropHintsAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates a LocalizedObjectAnnotation message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CropHintsAnnotation + * @returns LocalizedObjectAnnotation */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.CropHintsAnnotation; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation; /** - * Creates a plain object from a CropHintsAnnotation message. Also converts values to other types if specified. - * @param message CropHintsAnnotation + * Creates a plain object from a LocalizedObjectAnnotation message. Also converts values to other types if specified. + * @param message LocalizedObjectAnnotation * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.CropHintsAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CropHintsAnnotation to JSON. + * Converts this LocalizedObjectAnnotation to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a CropHintsParams. */ - interface ICropHintsParams { + /** Properties of a SafeSearchAnnotation. */ + interface ISafeSearchAnnotation { - /** CropHintsParams aspectRatios */ - aspectRatios?: (number[]|null); + /** SafeSearchAnnotation adult */ + adult?: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood|null); + + /** SafeSearchAnnotation spoof */ + spoof?: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood|null); + + /** SafeSearchAnnotation medical */ + medical?: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood|null); + + /** SafeSearchAnnotation violence */ + violence?: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood|null); + + /** SafeSearchAnnotation racy */ + racy?: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood|null); } - /** Represents a CropHintsParams. */ - class CropHintsParams implements ICropHintsParams { + /** Represents a SafeSearchAnnotation. */ + class SafeSearchAnnotation implements ISafeSearchAnnotation { /** - * Constructs a new CropHintsParams. + * Constructs a new SafeSearchAnnotation. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.ICropHintsParams); + constructor(properties?: google.cloud.vision.v1p4beta1.ISafeSearchAnnotation); - /** CropHintsParams aspectRatios. */ - public aspectRatios: number[]; + /** SafeSearchAnnotation adult. */ + public adult: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood); + + /** SafeSearchAnnotation spoof. */ + public spoof: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood); + + /** SafeSearchAnnotation medical. */ + public medical: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood); + + /** SafeSearchAnnotation violence. */ + public violence: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood); + + /** SafeSearchAnnotation racy. */ + public racy: (google.cloud.vision.v1p4beta1.Likelihood|keyof typeof google.cloud.vision.v1p4beta1.Likelihood); /** - * Creates a new CropHintsParams instance using the specified properties. + * Creates a new SafeSearchAnnotation instance using the specified properties. * @param [properties] Properties to set - * @returns CropHintsParams instance + * @returns SafeSearchAnnotation instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.ICropHintsParams): google.cloud.vision.v1p4beta1.CropHintsParams; + public static create(properties?: google.cloud.vision.v1p4beta1.ISafeSearchAnnotation): google.cloud.vision.v1p4beta1.SafeSearchAnnotation; /** - * Encodes the specified CropHintsParams message. Does not implicitly {@link google.cloud.vision.v1p4beta1.CropHintsParams.verify|verify} messages. - * @param message CropHintsParams message or plain object to encode + * Encodes the specified SafeSearchAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.SafeSearchAnnotation.verify|verify} messages. + * @param message SafeSearchAnnotation message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.ICropHintsParams, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.ISafeSearchAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified CropHintsParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.CropHintsParams.verify|verify} messages. - * @param message CropHintsParams message or plain object to encode + * Encodes the specified SafeSearchAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.SafeSearchAnnotation.verify|verify} messages. + * @param message SafeSearchAnnotation message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ICropHintsParams, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ISafeSearchAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a CropHintsParams message from the specified reader or buffer. + * Decodes a SafeSearchAnnotation message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns CropHintsParams + * @returns SafeSearchAnnotation * @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.vision.v1p4beta1.CropHintsParams; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.SafeSearchAnnotation; /** - * Decodes a CropHintsParams message from the specified reader or buffer, length delimited. + * Decodes a SafeSearchAnnotation message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns CropHintsParams + * @returns SafeSearchAnnotation * @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.vision.v1p4beta1.CropHintsParams; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.SafeSearchAnnotation; /** - * Verifies a CropHintsParams message. + * Verifies a SafeSearchAnnotation 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 CropHintsParams message from a plain object. Also converts values to their respective internal types. + * Creates a SafeSearchAnnotation message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns CropHintsParams + * @returns SafeSearchAnnotation */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.CropHintsParams; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.SafeSearchAnnotation; /** - * Creates a plain object from a CropHintsParams message. Also converts values to other types if specified. - * @param message CropHintsParams + * Creates a plain object from a SafeSearchAnnotation message. Also converts values to other types if specified. + * @param message SafeSearchAnnotation * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.CropHintsParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.SafeSearchAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this CropHintsParams to JSON. + * Converts this SafeSearchAnnotation to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a WebDetectionParams. */ - interface IWebDetectionParams { + /** Properties of a LatLongRect. */ + interface ILatLongRect { - /** WebDetectionParams includeGeoResults */ - includeGeoResults?: (boolean|null); + /** LatLongRect minLatLng */ + minLatLng?: (google.type.ILatLng|null); + + /** LatLongRect maxLatLng */ + maxLatLng?: (google.type.ILatLng|null); } - /** Represents a WebDetectionParams. */ - class WebDetectionParams implements IWebDetectionParams { + /** Represents a LatLongRect. */ + class LatLongRect implements ILatLongRect { /** - * Constructs a new WebDetectionParams. + * Constructs a new LatLongRect. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IWebDetectionParams); + constructor(properties?: google.cloud.vision.v1p4beta1.ILatLongRect); - /** WebDetectionParams includeGeoResults. */ - public includeGeoResults: boolean; + /** LatLongRect minLatLng. */ + public minLatLng?: (google.type.ILatLng|null); + + /** LatLongRect maxLatLng. */ + public maxLatLng?: (google.type.ILatLng|null); /** - * Creates a new WebDetectionParams instance using the specified properties. + * Creates a new LatLongRect instance using the specified properties. * @param [properties] Properties to set - * @returns WebDetectionParams instance + * @returns LatLongRect instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IWebDetectionParams): google.cloud.vision.v1p4beta1.WebDetectionParams; + public static create(properties?: google.cloud.vision.v1p4beta1.ILatLongRect): google.cloud.vision.v1p4beta1.LatLongRect; /** - * Encodes the specified WebDetectionParams message. Does not implicitly {@link google.cloud.vision.v1p4beta1.WebDetectionParams.verify|verify} messages. - * @param message WebDetectionParams message or plain object to encode + * Encodes the specified LatLongRect message. Does not implicitly {@link google.cloud.vision.v1p4beta1.LatLongRect.verify|verify} messages. + * @param message LatLongRect message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IWebDetectionParams, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.ILatLongRect, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified WebDetectionParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.WebDetectionParams.verify|verify} messages. - * @param message WebDetectionParams message or plain object to encode + * Encodes the specified LatLongRect message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.LatLongRect.verify|verify} messages. + * @param message LatLongRect message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IWebDetectionParams, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ILatLongRect, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a WebDetectionParams message from the specified reader or buffer. + * Decodes a LatLongRect message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns WebDetectionParams + * @returns LatLongRect * @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.vision.v1p4beta1.WebDetectionParams; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.LatLongRect; /** - * Decodes a WebDetectionParams message from the specified reader or buffer, length delimited. + * Decodes a LatLongRect message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns WebDetectionParams + * @returns LatLongRect * @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.vision.v1p4beta1.WebDetectionParams; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.LatLongRect; /** - * Verifies a WebDetectionParams message. + * Verifies a LatLongRect 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 WebDetectionParams message from a plain object. Also converts values to their respective internal types. + * Creates a LatLongRect message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns WebDetectionParams + * @returns LatLongRect */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.WebDetectionParams; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.LatLongRect; /** - * Creates a plain object from a WebDetectionParams message. Also converts values to other types if specified. - * @param message WebDetectionParams + * Creates a plain object from a LatLongRect message. Also converts values to other types if specified. + * @param message LatLongRect * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.WebDetectionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.LatLongRect, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this WebDetectionParams to JSON. + * Converts this LatLongRect to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an ImageContext. */ - interface IImageContext { - - /** ImageContext latLongRect */ - latLongRect?: (google.cloud.vision.v1p4beta1.ILatLongRect|null); - - /** ImageContext languageHints */ - languageHints?: (string[]|null); - - /** ImageContext cropHintsParams */ - cropHintsParams?: (google.cloud.vision.v1p4beta1.ICropHintsParams|null); + /** Properties of a ColorInfo. */ + interface IColorInfo { - /** ImageContext faceRecognitionParams */ - faceRecognitionParams?: (google.cloud.vision.v1p4beta1.IFaceRecognitionParams|null); + /** ColorInfo color */ + color?: (google.type.IColor|null); - /** ImageContext productSearchParams */ - productSearchParams?: (google.cloud.vision.v1p4beta1.IProductSearchParams|null); + /** ColorInfo score */ + score?: (number|null); - /** ImageContext webDetectionParams */ - webDetectionParams?: (google.cloud.vision.v1p4beta1.IWebDetectionParams|null); + /** ColorInfo pixelFraction */ + pixelFraction?: (number|null); } - /** Represents an ImageContext. */ - class ImageContext implements IImageContext { + /** Represents a ColorInfo. */ + class ColorInfo implements IColorInfo { /** - * Constructs a new ImageContext. + * Constructs a new ColorInfo. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IImageContext); - - /** ImageContext latLongRect. */ - public latLongRect?: (google.cloud.vision.v1p4beta1.ILatLongRect|null); - - /** ImageContext languageHints. */ - public languageHints: string[]; - - /** ImageContext cropHintsParams. */ - public cropHintsParams?: (google.cloud.vision.v1p4beta1.ICropHintsParams|null); + constructor(properties?: google.cloud.vision.v1p4beta1.IColorInfo); - /** ImageContext faceRecognitionParams. */ - public faceRecognitionParams?: (google.cloud.vision.v1p4beta1.IFaceRecognitionParams|null); + /** ColorInfo color. */ + public color?: (google.type.IColor|null); - /** ImageContext productSearchParams. */ - public productSearchParams?: (google.cloud.vision.v1p4beta1.IProductSearchParams|null); + /** ColorInfo score. */ + public score: number; - /** ImageContext webDetectionParams. */ - public webDetectionParams?: (google.cloud.vision.v1p4beta1.IWebDetectionParams|null); + /** ColorInfo pixelFraction. */ + public pixelFraction: number; /** - * Creates a new ImageContext instance using the specified properties. + * Creates a new ColorInfo instance using the specified properties. * @param [properties] Properties to set - * @returns ImageContext instance + * @returns ColorInfo instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IImageContext): google.cloud.vision.v1p4beta1.ImageContext; + public static create(properties?: google.cloud.vision.v1p4beta1.IColorInfo): google.cloud.vision.v1p4beta1.ColorInfo; /** - * Encodes the specified ImageContext message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageContext.verify|verify} messages. - * @param message ImageContext message or plain object to encode + * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ColorInfo.verify|verify} messages. + * @param message ColorInfo message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IImageContext, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImageContext message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageContext.verify|verify} messages. - * @param message ImageContext message or plain object to encode + * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ColorInfo.verify|verify} messages. + * @param message ColorInfo message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IImageContext, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IColorInfo, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImageContext message from the specified reader or buffer. + * Decodes a ColorInfo message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImageContext + * @returns ColorInfo * @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.vision.v1p4beta1.ImageContext; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.ColorInfo; /** - * Decodes an ImageContext message from the specified reader or buffer, length delimited. + * Decodes a ColorInfo message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns ImageContext + * @returns ColorInfo * @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.vision.v1p4beta1.ImageContext; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.ColorInfo; /** - * Verifies an ImageContext message. + * Verifies a ColorInfo message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an ImageContext message from a plain object. Also converts values to their respective internal types. + * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns ImageContext + * @returns ColorInfo */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ImageContext; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ColorInfo; /** - * Creates a plain object from an ImageContext message. Also converts values to other types if specified. - * @param message ImageContext + * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. + * @param message ColorInfo * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.ImageContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.ColorInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this ImageContext to JSON. + * Converts this ColorInfo to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an AnnotateImageRequest. */ - interface IAnnotateImageRequest { - - /** AnnotateImageRequest image */ - image?: (google.cloud.vision.v1p4beta1.IImage|null); - - /** AnnotateImageRequest features */ - features?: (google.cloud.vision.v1p4beta1.IFeature[]|null); + /** Properties of a DominantColorsAnnotation. */ + interface IDominantColorsAnnotation { - /** AnnotateImageRequest imageContext */ - imageContext?: (google.cloud.vision.v1p4beta1.IImageContext|null); + /** DominantColorsAnnotation colors */ + colors?: (google.cloud.vision.v1p4beta1.IColorInfo[]|null); } - /** Represents an AnnotateImageRequest. */ - class AnnotateImageRequest implements IAnnotateImageRequest { + /** Represents a DominantColorsAnnotation. */ + class DominantColorsAnnotation implements IDominantColorsAnnotation { /** - * Constructs a new AnnotateImageRequest. + * Constructs a new DominantColorsAnnotation. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IAnnotateImageRequest); - - /** AnnotateImageRequest image. */ - public image?: (google.cloud.vision.v1p4beta1.IImage|null); - - /** AnnotateImageRequest features. */ - public features: google.cloud.vision.v1p4beta1.IFeature[]; + constructor(properties?: google.cloud.vision.v1p4beta1.IDominantColorsAnnotation); - /** AnnotateImageRequest imageContext. */ - public imageContext?: (google.cloud.vision.v1p4beta1.IImageContext|null); + /** DominantColorsAnnotation colors. */ + public colors: google.cloud.vision.v1p4beta1.IColorInfo[]; /** - * Creates a new AnnotateImageRequest instance using the specified properties. + * Creates a new DominantColorsAnnotation instance using the specified properties. * @param [properties] Properties to set - * @returns AnnotateImageRequest instance + * @returns DominantColorsAnnotation instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IAnnotateImageRequest): google.cloud.vision.v1p4beta1.AnnotateImageRequest; + public static create(properties?: google.cloud.vision.v1p4beta1.IDominantColorsAnnotation): google.cloud.vision.v1p4beta1.DominantColorsAnnotation; /** - * Encodes the specified AnnotateImageRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateImageRequest.verify|verify} messages. - * @param message AnnotateImageRequest message or plain object to encode + * Encodes the specified DominantColorsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.DominantColorsAnnotation.verify|verify} messages. + * @param message DominantColorsAnnotation message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IAnnotateImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IDominantColorsAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified AnnotateImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateImageRequest.verify|verify} messages. - * @param message AnnotateImageRequest message or plain object to encode + * Encodes the specified DominantColorsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.DominantColorsAnnotation.verify|verify} messages. + * @param message DominantColorsAnnotation message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAnnotateImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IDominantColorsAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an AnnotateImageRequest message from the specified reader or buffer. + * Decodes a DominantColorsAnnotation message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns AnnotateImageRequest + * @returns DominantColorsAnnotation * @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.vision.v1p4beta1.AnnotateImageRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.DominantColorsAnnotation; /** - * Decodes an AnnotateImageRequest message from the specified reader or buffer, length delimited. + * Decodes a DominantColorsAnnotation message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns AnnotateImageRequest + * @returns DominantColorsAnnotation * @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.vision.v1p4beta1.AnnotateImageRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.DominantColorsAnnotation; /** - * Verifies an AnnotateImageRequest message. + * Verifies a DominantColorsAnnotation message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an AnnotateImageRequest message from a plain object. Also converts values to their respective internal types. + * Creates a DominantColorsAnnotation message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns AnnotateImageRequest + * @returns DominantColorsAnnotation */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AnnotateImageRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.DominantColorsAnnotation; /** - * Creates a plain object from an AnnotateImageRequest message. Also converts values to other types if specified. - * @param message AnnotateImageRequest + * Creates a plain object from a DominantColorsAnnotation message. Also converts values to other types if specified. + * @param message DominantColorsAnnotation * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.AnnotateImageRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.DominantColorsAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this AnnotateImageRequest to JSON. + * Converts this DominantColorsAnnotation to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an ImageAnnotationContext. */ - interface IImageAnnotationContext { - - /** ImageAnnotationContext uri */ - uri?: (string|null); + /** Properties of an ImageProperties. */ + interface IImageProperties { - /** ImageAnnotationContext pageNumber */ - pageNumber?: (number|null); + /** ImageProperties dominantColors */ + dominantColors?: (google.cloud.vision.v1p4beta1.IDominantColorsAnnotation|null); } - /** Represents an ImageAnnotationContext. */ - class ImageAnnotationContext implements IImageAnnotationContext { + /** Represents an ImageProperties. */ + class ImageProperties implements IImageProperties { /** - * Constructs a new ImageAnnotationContext. + * Constructs a new ImageProperties. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IImageAnnotationContext); - - /** ImageAnnotationContext uri. */ - public uri: string; + constructor(properties?: google.cloud.vision.v1p4beta1.IImageProperties); - /** ImageAnnotationContext pageNumber. */ - public pageNumber: number; + /** ImageProperties dominantColors. */ + public dominantColors?: (google.cloud.vision.v1p4beta1.IDominantColorsAnnotation|null); /** - * Creates a new ImageAnnotationContext instance using the specified properties. + * Creates a new ImageProperties instance using the specified properties. * @param [properties] Properties to set - * @returns ImageAnnotationContext instance + * @returns ImageProperties instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IImageAnnotationContext): google.cloud.vision.v1p4beta1.ImageAnnotationContext; + public static create(properties?: google.cloud.vision.v1p4beta1.IImageProperties): google.cloud.vision.v1p4beta1.ImageProperties; /** - * Encodes the specified ImageAnnotationContext message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageAnnotationContext.verify|verify} messages. - * @param message ImageAnnotationContext message or plain object to encode + * Encodes the specified ImageProperties message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageProperties.verify|verify} messages. + * @param message ImageProperties message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IImageAnnotationContext, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IImageProperties, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified ImageAnnotationContext message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageAnnotationContext.verify|verify} messages. - * @param message ImageAnnotationContext message or plain object to encode + * Encodes the specified ImageProperties message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageProperties.verify|verify} messages. + * @param message ImageProperties message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IImageAnnotationContext, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IImageProperties, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an ImageAnnotationContext message from the specified reader or buffer. + * Decodes an ImageProperties message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns ImageAnnotationContext - * @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.vision.v1p4beta1.ImageAnnotationContext; - - /** - * Decodes an ImageAnnotationContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ImageAnnotationContext + * @returns ImageProperties * @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.vision.v1p4beta1.ImageAnnotationContext; - - /** - * Verifies an ImageAnnotationContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an ImageAnnotationContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImageAnnotationContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ImageAnnotationContext; - - /** - * Creates a plain object from an ImageAnnotationContext message. Also converts values to other types if specified. - * @param message ImageAnnotationContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.vision.v1p4beta1.ImageAnnotationContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.ImageProperties; /** - * Converts this ImageAnnotationContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - } - - /** Properties of an AnnotateImageResponse. */ - interface IAnnotateImageResponse { - - /** AnnotateImageResponse faceAnnotations */ - faceAnnotations?: (google.cloud.vision.v1p4beta1.IFaceAnnotation[]|null); - - /** AnnotateImageResponse landmarkAnnotations */ - landmarkAnnotations?: (google.cloud.vision.v1p4beta1.IEntityAnnotation[]|null); - - /** AnnotateImageResponse logoAnnotations */ - logoAnnotations?: (google.cloud.vision.v1p4beta1.IEntityAnnotation[]|null); - - /** AnnotateImageResponse labelAnnotations */ - labelAnnotations?: (google.cloud.vision.v1p4beta1.IEntityAnnotation[]|null); - - /** AnnotateImageResponse localizedObjectAnnotations */ - localizedObjectAnnotations?: (google.cloud.vision.v1p4beta1.ILocalizedObjectAnnotation[]|null); - - /** AnnotateImageResponse textAnnotations */ - textAnnotations?: (google.cloud.vision.v1p4beta1.IEntityAnnotation[]|null); - - /** AnnotateImageResponse fullTextAnnotation */ - fullTextAnnotation?: (google.cloud.vision.v1p4beta1.ITextAnnotation|null); - - /** AnnotateImageResponse safeSearchAnnotation */ - safeSearchAnnotation?: (google.cloud.vision.v1p4beta1.ISafeSearchAnnotation|null); - - /** AnnotateImageResponse imagePropertiesAnnotation */ - imagePropertiesAnnotation?: (google.cloud.vision.v1p4beta1.IImageProperties|null); - - /** AnnotateImageResponse cropHintsAnnotation */ - cropHintsAnnotation?: (google.cloud.vision.v1p4beta1.ICropHintsAnnotation|null); - - /** AnnotateImageResponse webDetection */ - webDetection?: (google.cloud.vision.v1p4beta1.IWebDetection|null); - - /** AnnotateImageResponse productSearchResults */ - productSearchResults?: (google.cloud.vision.v1p4beta1.IProductSearchResults|null); - - /** AnnotateImageResponse error */ - error?: (google.rpc.IStatus|null); - - /** AnnotateImageResponse context */ - context?: (google.cloud.vision.v1p4beta1.IImageAnnotationContext|null); - } - - /** Represents an AnnotateImageResponse. */ - class AnnotateImageResponse implements IAnnotateImageResponse { + * Decodes an ImageProperties message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImageProperties + * @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.vision.v1p4beta1.ImageProperties; /** - * Constructs a new AnnotateImageResponse. - * @param [properties] Properties to set + * Verifies an ImageProperties message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not */ - constructor(properties?: google.cloud.vision.v1p4beta1.IAnnotateImageResponse); - - /** AnnotateImageResponse faceAnnotations. */ - public faceAnnotations: google.cloud.vision.v1p4beta1.IFaceAnnotation[]; - - /** AnnotateImageResponse landmarkAnnotations. */ - public landmarkAnnotations: google.cloud.vision.v1p4beta1.IEntityAnnotation[]; + public static verify(message: { [k: string]: any }): (string|null); - /** AnnotateImageResponse logoAnnotations. */ - public logoAnnotations: google.cloud.vision.v1p4beta1.IEntityAnnotation[]; + /** + * Creates an ImageProperties message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImageProperties + */ + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ImageProperties; - /** AnnotateImageResponse labelAnnotations. */ - public labelAnnotations: google.cloud.vision.v1p4beta1.IEntityAnnotation[]; + /** + * Creates a plain object from an ImageProperties message. Also converts values to other types if specified. + * @param message ImageProperties + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.vision.v1p4beta1.ImageProperties, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** AnnotateImageResponse localizedObjectAnnotations. */ - public localizedObjectAnnotations: google.cloud.vision.v1p4beta1.ILocalizedObjectAnnotation[]; + /** + * Converts this ImageProperties to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + } - /** AnnotateImageResponse textAnnotations. */ - public textAnnotations: google.cloud.vision.v1p4beta1.IEntityAnnotation[]; + /** Properties of a CropHint. */ + interface ICropHint { - /** AnnotateImageResponse fullTextAnnotation. */ - public fullTextAnnotation?: (google.cloud.vision.v1p4beta1.ITextAnnotation|null); + /** CropHint boundingPoly */ + boundingPoly?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); - /** AnnotateImageResponse safeSearchAnnotation. */ - public safeSearchAnnotation?: (google.cloud.vision.v1p4beta1.ISafeSearchAnnotation|null); + /** CropHint confidence */ + confidence?: (number|null); - /** AnnotateImageResponse imagePropertiesAnnotation. */ - public imagePropertiesAnnotation?: (google.cloud.vision.v1p4beta1.IImageProperties|null); + /** CropHint importanceFraction */ + importanceFraction?: (number|null); + } - /** AnnotateImageResponse cropHintsAnnotation. */ - public cropHintsAnnotation?: (google.cloud.vision.v1p4beta1.ICropHintsAnnotation|null); + /** Represents a CropHint. */ + class CropHint implements ICropHint { - /** AnnotateImageResponse webDetection. */ - public webDetection?: (google.cloud.vision.v1p4beta1.IWebDetection|null); + /** + * Constructs a new CropHint. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.vision.v1p4beta1.ICropHint); - /** AnnotateImageResponse productSearchResults. */ - public productSearchResults?: (google.cloud.vision.v1p4beta1.IProductSearchResults|null); + /** CropHint boundingPoly. */ + public boundingPoly?: (google.cloud.vision.v1p4beta1.IBoundingPoly|null); - /** AnnotateImageResponse error. */ - public error?: (google.rpc.IStatus|null); + /** CropHint confidence. */ + public confidence: number; - /** AnnotateImageResponse context. */ - public context?: (google.cloud.vision.v1p4beta1.IImageAnnotationContext|null); + /** CropHint importanceFraction. */ + public importanceFraction: number; /** - * Creates a new AnnotateImageResponse instance using the specified properties. + * Creates a new CropHint instance using the specified properties. * @param [properties] Properties to set - * @returns AnnotateImageResponse instance + * @returns CropHint instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IAnnotateImageResponse): google.cloud.vision.v1p4beta1.AnnotateImageResponse; + public static create(properties?: google.cloud.vision.v1p4beta1.ICropHint): google.cloud.vision.v1p4beta1.CropHint; /** - * Encodes the specified AnnotateImageResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateImageResponse.verify|verify} messages. - * @param message AnnotateImageResponse message or plain object to encode + * Encodes the specified CropHint message. Does not implicitly {@link google.cloud.vision.v1p4beta1.CropHint.verify|verify} messages. + * @param message CropHint message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IAnnotateImageResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.ICropHint, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified AnnotateImageResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateImageResponse.verify|verify} messages. - * @param message AnnotateImageResponse message or plain object to encode + * Encodes the specified CropHint message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.CropHint.verify|verify} messages. + * @param message CropHint message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAnnotateImageResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ICropHint, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an AnnotateImageResponse message from the specified reader or buffer. + * Decodes a CropHint message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns AnnotateImageResponse + * @returns CropHint * @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.vision.v1p4beta1.AnnotateImageResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.CropHint; /** - * Decodes an AnnotateImageResponse message from the specified reader or buffer, length delimited. + * Decodes a CropHint message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns AnnotateImageResponse + * @returns CropHint * @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.vision.v1p4beta1.AnnotateImageResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.CropHint; /** - * Verifies an AnnotateImageResponse message. + * Verifies a CropHint message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an AnnotateImageResponse message from a plain object. Also converts values to their respective internal types. + * Creates a CropHint message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns AnnotateImageResponse + * @returns CropHint */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AnnotateImageResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.CropHint; /** - * Creates a plain object from an AnnotateImageResponse message. Also converts values to other types if specified. - * @param message AnnotateImageResponse + * Creates a plain object from a CropHint message. Also converts values to other types if specified. + * @param message CropHint * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.AnnotateImageResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.CropHint, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this AnnotateImageResponse to JSON. + * Converts this CropHint to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a BatchAnnotateImagesRequest. */ - interface IBatchAnnotateImagesRequest { + /** Properties of a CropHintsAnnotation. */ + interface ICropHintsAnnotation { - /** BatchAnnotateImagesRequest requests */ - requests?: (google.cloud.vision.v1p4beta1.IAnnotateImageRequest[]|null); + /** CropHintsAnnotation cropHints */ + cropHints?: (google.cloud.vision.v1p4beta1.ICropHint[]|null); } - /** Represents a BatchAnnotateImagesRequest. */ - class BatchAnnotateImagesRequest implements IBatchAnnotateImagesRequest { + /** Represents a CropHintsAnnotation. */ + class CropHintsAnnotation implements ICropHintsAnnotation { /** - * Constructs a new BatchAnnotateImagesRequest. + * Constructs a new CropHintsAnnotation. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest); + constructor(properties?: google.cloud.vision.v1p4beta1.ICropHintsAnnotation); - /** BatchAnnotateImagesRequest requests. */ - public requests: google.cloud.vision.v1p4beta1.IAnnotateImageRequest[]; + /** CropHintsAnnotation cropHints. */ + public cropHints: google.cloud.vision.v1p4beta1.ICropHint[]; /** - * Creates a new BatchAnnotateImagesRequest instance using the specified properties. + * Creates a new CropHintsAnnotation instance using the specified properties. * @param [properties] Properties to set - * @returns BatchAnnotateImagesRequest instance + * @returns CropHintsAnnotation instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest): google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest; + public static create(properties?: google.cloud.vision.v1p4beta1.ICropHintsAnnotation): google.cloud.vision.v1p4beta1.CropHintsAnnotation; /** - * Encodes the specified BatchAnnotateImagesRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest.verify|verify} messages. - * @param message BatchAnnotateImagesRequest message or plain object to encode + * Encodes the specified CropHintsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.CropHintsAnnotation.verify|verify} messages. + * @param message CropHintsAnnotation message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.ICropHintsAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified BatchAnnotateImagesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest.verify|verify} messages. - * @param message BatchAnnotateImagesRequest message or plain object to encode + * Encodes the specified CropHintsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.CropHintsAnnotation.verify|verify} messages. + * @param message CropHintsAnnotation message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ICropHintsAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer. + * Decodes a CropHintsAnnotation message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns BatchAnnotateImagesRequest + * @returns CropHintsAnnotation * @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.vision.v1p4beta1.BatchAnnotateImagesRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.CropHintsAnnotation; /** - * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. + * Decodes a CropHintsAnnotation message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns BatchAnnotateImagesRequest + * @returns CropHintsAnnotation * @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.vision.v1p4beta1.BatchAnnotateImagesRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.CropHintsAnnotation; /** - * Verifies a BatchAnnotateImagesRequest message. + * Verifies a CropHintsAnnotation 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 BatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CropHintsAnnotation message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns BatchAnnotateImagesRequest + * @returns CropHintsAnnotation */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.CropHintsAnnotation; /** - * Creates a plain object from a BatchAnnotateImagesRequest message. Also converts values to other types if specified. - * @param message BatchAnnotateImagesRequest + * Creates a plain object from a CropHintsAnnotation message. Also converts values to other types if specified. + * @param message CropHintsAnnotation * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.CropHintsAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this BatchAnnotateImagesRequest to JSON. + * Converts this CropHintsAnnotation to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a BatchAnnotateImagesResponse. */ - interface IBatchAnnotateImagesResponse { + /** Properties of a CropHintsParams. */ + interface ICropHintsParams { - /** BatchAnnotateImagesResponse responses */ - responses?: (google.cloud.vision.v1p4beta1.IAnnotateImageResponse[]|null); + /** CropHintsParams aspectRatios */ + aspectRatios?: (number[]|null); } - /** Represents a BatchAnnotateImagesResponse. */ - class BatchAnnotateImagesResponse implements IBatchAnnotateImagesResponse { + /** Represents a CropHintsParams. */ + class CropHintsParams implements ICropHintsParams { /** - * Constructs a new BatchAnnotateImagesResponse. + * Constructs a new CropHintsParams. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse); + constructor(properties?: google.cloud.vision.v1p4beta1.ICropHintsParams); - /** BatchAnnotateImagesResponse responses. */ - public responses: google.cloud.vision.v1p4beta1.IAnnotateImageResponse[]; + /** CropHintsParams aspectRatios. */ + public aspectRatios: number[]; /** - * Creates a new BatchAnnotateImagesResponse instance using the specified properties. + * Creates a new CropHintsParams instance using the specified properties. * @param [properties] Properties to set - * @returns BatchAnnotateImagesResponse instance + * @returns CropHintsParams instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse): google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse; + public static create(properties?: google.cloud.vision.v1p4beta1.ICropHintsParams): google.cloud.vision.v1p4beta1.CropHintsParams; /** - * Encodes the specified BatchAnnotateImagesResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse.verify|verify} messages. - * @param message BatchAnnotateImagesResponse message or plain object to encode + * Encodes the specified CropHintsParams message. Does not implicitly {@link google.cloud.vision.v1p4beta1.CropHintsParams.verify|verify} messages. + * @param message CropHintsParams message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.ICropHintsParams, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified BatchAnnotateImagesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse.verify|verify} messages. - * @param message BatchAnnotateImagesResponse message or plain object to encode + * Encodes the specified CropHintsParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.CropHintsParams.verify|verify} messages. + * @param message CropHintsParams message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ICropHintsParams, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a BatchAnnotateImagesResponse message from the specified reader or buffer. + * Decodes a CropHintsParams message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns BatchAnnotateImagesResponse + * @returns CropHintsParams * @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.vision.v1p4beta1.BatchAnnotateImagesResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.CropHintsParams; /** - * Decodes a BatchAnnotateImagesResponse message from the specified reader or buffer, length delimited. + * Decodes a CropHintsParams message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns BatchAnnotateImagesResponse + * @returns CropHintsParams * @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.vision.v1p4beta1.BatchAnnotateImagesResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.CropHintsParams; /** - * Verifies a BatchAnnotateImagesResponse message. + * Verifies a CropHintsParams 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 BatchAnnotateImagesResponse message from a plain object. Also converts values to their respective internal types. + * Creates a CropHintsParams message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns BatchAnnotateImagesResponse + * @returns CropHintsParams */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.CropHintsParams; /** - * Creates a plain object from a BatchAnnotateImagesResponse message. Also converts values to other types if specified. - * @param message BatchAnnotateImagesResponse + * Creates a plain object from a CropHintsParams message. Also converts values to other types if specified. + * @param message CropHintsParams * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.CropHintsParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this BatchAnnotateImagesResponse to JSON. + * Converts this CropHintsParams to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an AnnotateFileRequest. */ - interface IAnnotateFileRequest { - - /** AnnotateFileRequest inputConfig */ - inputConfig?: (google.cloud.vision.v1p4beta1.IInputConfig|null); - - /** AnnotateFileRequest features */ - features?: (google.cloud.vision.v1p4beta1.IFeature[]|null); - - /** AnnotateFileRequest imageContext */ - imageContext?: (google.cloud.vision.v1p4beta1.IImageContext|null); + /** Properties of a WebDetectionParams. */ + interface IWebDetectionParams { - /** AnnotateFileRequest pages */ - pages?: (number[]|null); + /** WebDetectionParams includeGeoResults */ + includeGeoResults?: (boolean|null); } - /** Represents an AnnotateFileRequest. */ - class AnnotateFileRequest implements IAnnotateFileRequest { + /** Represents a WebDetectionParams. */ + class WebDetectionParams implements IWebDetectionParams { /** - * Constructs a new AnnotateFileRequest. + * Constructs a new WebDetectionParams. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IAnnotateFileRequest); - - /** AnnotateFileRequest inputConfig. */ - public inputConfig?: (google.cloud.vision.v1p4beta1.IInputConfig|null); - - /** AnnotateFileRequest features. */ - public features: google.cloud.vision.v1p4beta1.IFeature[]; - - /** AnnotateFileRequest imageContext. */ - public imageContext?: (google.cloud.vision.v1p4beta1.IImageContext|null); + constructor(properties?: google.cloud.vision.v1p4beta1.IWebDetectionParams); - /** AnnotateFileRequest pages. */ - public pages: number[]; + /** WebDetectionParams includeGeoResults. */ + public includeGeoResults: boolean; /** - * Creates a new AnnotateFileRequest instance using the specified properties. + * Creates a new WebDetectionParams instance using the specified properties. * @param [properties] Properties to set - * @returns AnnotateFileRequest instance + * @returns WebDetectionParams instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IAnnotateFileRequest): google.cloud.vision.v1p4beta1.AnnotateFileRequest; + public static create(properties?: google.cloud.vision.v1p4beta1.IWebDetectionParams): google.cloud.vision.v1p4beta1.WebDetectionParams; /** - * Encodes the specified AnnotateFileRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateFileRequest.verify|verify} messages. - * @param message AnnotateFileRequest message or plain object to encode + * Encodes the specified WebDetectionParams message. Does not implicitly {@link google.cloud.vision.v1p4beta1.WebDetectionParams.verify|verify} messages. + * @param message WebDetectionParams message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IAnnotateFileRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IWebDetectionParams, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified AnnotateFileRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateFileRequest.verify|verify} messages. - * @param message AnnotateFileRequest message or plain object to encode + * Encodes the specified WebDetectionParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.WebDetectionParams.verify|verify} messages. + * @param message WebDetectionParams message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAnnotateFileRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IWebDetectionParams, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an AnnotateFileRequest message from the specified reader or buffer. + * Decodes a WebDetectionParams message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns AnnotateFileRequest + * @returns WebDetectionParams * @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.vision.v1p4beta1.AnnotateFileRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.WebDetectionParams; /** - * Decodes an AnnotateFileRequest message from the specified reader or buffer, length delimited. + * Decodes a WebDetectionParams message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns AnnotateFileRequest + * @returns WebDetectionParams * @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.vision.v1p4beta1.AnnotateFileRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.WebDetectionParams; /** - * Verifies an AnnotateFileRequest message. + * Verifies a WebDetectionParams message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an AnnotateFileRequest message from a plain object. Also converts values to their respective internal types. + * Creates a WebDetectionParams message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns AnnotateFileRequest + * @returns WebDetectionParams */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AnnotateFileRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.WebDetectionParams; /** - * Creates a plain object from an AnnotateFileRequest message. Also converts values to other types if specified. - * @param message AnnotateFileRequest + * Creates a plain object from a WebDetectionParams message. Also converts values to other types if specified. + * @param message WebDetectionParams * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.AnnotateFileRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.WebDetectionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this AnnotateFileRequest to JSON. + * Converts this WebDetectionParams to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an AnnotateFileResponse. */ - interface IAnnotateFileResponse { + /** Properties of an ImageContext. */ + interface IImageContext { - /** AnnotateFileResponse inputConfig */ - inputConfig?: (google.cloud.vision.v1p4beta1.IInputConfig|null); + /** ImageContext latLongRect */ + latLongRect?: (google.cloud.vision.v1p4beta1.ILatLongRect|null); - /** AnnotateFileResponse responses */ - responses?: (google.cloud.vision.v1p4beta1.IAnnotateImageResponse[]|null); + /** ImageContext languageHints */ + languageHints?: (string[]|null); - /** AnnotateFileResponse totalPages */ - totalPages?: (number|null); + /** ImageContext cropHintsParams */ + cropHintsParams?: (google.cloud.vision.v1p4beta1.ICropHintsParams|null); - /** AnnotateFileResponse error */ - error?: (google.rpc.IStatus|null); + /** ImageContext faceRecognitionParams */ + faceRecognitionParams?: (google.cloud.vision.v1p4beta1.IFaceRecognitionParams|null); + + /** ImageContext productSearchParams */ + productSearchParams?: (google.cloud.vision.v1p4beta1.IProductSearchParams|null); + + /** ImageContext webDetectionParams */ + webDetectionParams?: (google.cloud.vision.v1p4beta1.IWebDetectionParams|null); } - /** Represents an AnnotateFileResponse. */ - class AnnotateFileResponse implements IAnnotateFileResponse { + /** Represents an ImageContext. */ + class ImageContext implements IImageContext { /** - * Constructs a new AnnotateFileResponse. + * Constructs a new ImageContext. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IAnnotateFileResponse); + constructor(properties?: google.cloud.vision.v1p4beta1.IImageContext); - /** AnnotateFileResponse inputConfig. */ - public inputConfig?: (google.cloud.vision.v1p4beta1.IInputConfig|null); + /** ImageContext latLongRect. */ + public latLongRect?: (google.cloud.vision.v1p4beta1.ILatLongRect|null); - /** AnnotateFileResponse responses. */ - public responses: google.cloud.vision.v1p4beta1.IAnnotateImageResponse[]; + /** ImageContext languageHints. */ + public languageHints: string[]; - /** AnnotateFileResponse totalPages. */ - public totalPages: number; + /** ImageContext cropHintsParams. */ + public cropHintsParams?: (google.cloud.vision.v1p4beta1.ICropHintsParams|null); - /** AnnotateFileResponse error. */ - public error?: (google.rpc.IStatus|null); + /** ImageContext faceRecognitionParams. */ + public faceRecognitionParams?: (google.cloud.vision.v1p4beta1.IFaceRecognitionParams|null); + + /** ImageContext productSearchParams. */ + public productSearchParams?: (google.cloud.vision.v1p4beta1.IProductSearchParams|null); + + /** ImageContext webDetectionParams. */ + public webDetectionParams?: (google.cloud.vision.v1p4beta1.IWebDetectionParams|null); /** - * Creates a new AnnotateFileResponse instance using the specified properties. + * Creates a new ImageContext instance using the specified properties. * @param [properties] Properties to set - * @returns AnnotateFileResponse instance + * @returns ImageContext instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IAnnotateFileResponse): google.cloud.vision.v1p4beta1.AnnotateFileResponse; + public static create(properties?: google.cloud.vision.v1p4beta1.IImageContext): google.cloud.vision.v1p4beta1.ImageContext; /** - * Encodes the specified AnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateFileResponse.verify|verify} messages. - * @param message AnnotateFileResponse message or plain object to encode + * Encodes the specified ImageContext message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageContext.verify|verify} messages. + * @param message ImageContext message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IAnnotateFileResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IImageContext, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified AnnotateFileResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateFileResponse.verify|verify} messages. - * @param message AnnotateFileResponse message or plain object to encode + * Encodes the specified ImageContext message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageContext.verify|verify} messages. + * @param message ImageContext message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAnnotateFileResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IImageContext, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an AnnotateFileResponse message from the specified reader or buffer. + * Decodes an ImageContext message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns AnnotateFileResponse + * @returns ImageContext * @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.vision.v1p4beta1.AnnotateFileResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.ImageContext; /** - * Decodes an AnnotateFileResponse message from the specified reader or buffer, length delimited. + * Decodes an ImageContext message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns AnnotateFileResponse + * @returns ImageContext * @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.vision.v1p4beta1.AnnotateFileResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.ImageContext; /** - * Verifies an AnnotateFileResponse message. + * Verifies an ImageContext message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an AnnotateFileResponse message from a plain object. Also converts values to their respective internal types. + * Creates an ImageContext message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns AnnotateFileResponse + * @returns ImageContext */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AnnotateFileResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ImageContext; /** - * Creates a plain object from an AnnotateFileResponse message. Also converts values to other types if specified. - * @param message AnnotateFileResponse + * Creates a plain object from an ImageContext message. Also converts values to other types if specified. + * @param message ImageContext * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.AnnotateFileResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.ImageContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this AnnotateFileResponse to JSON. + * Converts this ImageContext to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a BatchAnnotateFilesRequest. */ - interface IBatchAnnotateFilesRequest { + /** Properties of an AnnotateImageRequest. */ + interface IAnnotateImageRequest { - /** BatchAnnotateFilesRequest requests */ - requests?: (google.cloud.vision.v1p4beta1.IAnnotateFileRequest[]|null); + /** AnnotateImageRequest image */ + image?: (google.cloud.vision.v1p4beta1.IImage|null); + + /** AnnotateImageRequest features */ + features?: (google.cloud.vision.v1p4beta1.IFeature[]|null); + + /** AnnotateImageRequest imageContext */ + imageContext?: (google.cloud.vision.v1p4beta1.IImageContext|null); } - /** Represents a BatchAnnotateFilesRequest. */ - class BatchAnnotateFilesRequest implements IBatchAnnotateFilesRequest { + /** Represents an AnnotateImageRequest. */ + class AnnotateImageRequest implements IAnnotateImageRequest { /** - * Constructs a new BatchAnnotateFilesRequest. + * Constructs a new AnnotateImageRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest); + constructor(properties?: google.cloud.vision.v1p4beta1.IAnnotateImageRequest); - /** BatchAnnotateFilesRequest requests. */ - public requests: google.cloud.vision.v1p4beta1.IAnnotateFileRequest[]; + /** AnnotateImageRequest image. */ + public image?: (google.cloud.vision.v1p4beta1.IImage|null); + + /** AnnotateImageRequest features. */ + public features: google.cloud.vision.v1p4beta1.IFeature[]; + + /** AnnotateImageRequest imageContext. */ + public imageContext?: (google.cloud.vision.v1p4beta1.IImageContext|null); /** - * Creates a new BatchAnnotateFilesRequest instance using the specified properties. + * Creates a new AnnotateImageRequest instance using the specified properties. * @param [properties] Properties to set - * @returns BatchAnnotateFilesRequest instance + * @returns AnnotateImageRequest instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest): google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest; + public static create(properties?: google.cloud.vision.v1p4beta1.IAnnotateImageRequest): google.cloud.vision.v1p4beta1.AnnotateImageRequest; /** - * Encodes the specified BatchAnnotateFilesRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest.verify|verify} messages. - * @param message BatchAnnotateFilesRequest message or plain object to encode + * Encodes the specified AnnotateImageRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateImageRequest.verify|verify} messages. + * @param message AnnotateImageRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IAnnotateImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified BatchAnnotateFilesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest.verify|verify} messages. - * @param message BatchAnnotateFilesRequest message or plain object to encode + * Encodes the specified AnnotateImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateImageRequest.verify|verify} messages. + * @param message AnnotateImageRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAnnotateImageRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a BatchAnnotateFilesRequest message from the specified reader or buffer. + * Decodes an AnnotateImageRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns BatchAnnotateFilesRequest + * @returns AnnotateImageRequest * @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.vision.v1p4beta1.BatchAnnotateFilesRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.AnnotateImageRequest; /** - * Decodes a BatchAnnotateFilesRequest message from the specified reader or buffer, length delimited. + * Decodes an AnnotateImageRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns BatchAnnotateFilesRequest + * @returns AnnotateImageRequest * @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.vision.v1p4beta1.BatchAnnotateFilesRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.AnnotateImageRequest; /** - * Verifies a BatchAnnotateFilesRequest message. + * Verifies an AnnotateImageRequest 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 BatchAnnotateFilesRequest message from a plain object. Also converts values to their respective internal types. + * Creates an AnnotateImageRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns BatchAnnotateFilesRequest + * @returns AnnotateImageRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AnnotateImageRequest; /** - * Creates a plain object from a BatchAnnotateFilesRequest message. Also converts values to other types if specified. - * @param message BatchAnnotateFilesRequest + * Creates a plain object from an AnnotateImageRequest message. Also converts values to other types if specified. + * @param message AnnotateImageRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.AnnotateImageRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this BatchAnnotateFilesRequest to JSON. + * Converts this AnnotateImageRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a BatchAnnotateFilesResponse. */ - interface IBatchAnnotateFilesResponse { + /** Properties of an ImageAnnotationContext. */ + interface IImageAnnotationContext { - /** BatchAnnotateFilesResponse responses */ - responses?: (google.cloud.vision.v1p4beta1.IAnnotateFileResponse[]|null); + /** ImageAnnotationContext uri */ + uri?: (string|null); + + /** ImageAnnotationContext pageNumber */ + pageNumber?: (number|null); } - /** Represents a BatchAnnotateFilesResponse. */ - class BatchAnnotateFilesResponse implements IBatchAnnotateFilesResponse { + /** Represents an ImageAnnotationContext. */ + class ImageAnnotationContext implements IImageAnnotationContext { /** - * Constructs a new BatchAnnotateFilesResponse. + * Constructs a new ImageAnnotationContext. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse); + constructor(properties?: google.cloud.vision.v1p4beta1.IImageAnnotationContext); - /** BatchAnnotateFilesResponse responses. */ - public responses: google.cloud.vision.v1p4beta1.IAnnotateFileResponse[]; + /** ImageAnnotationContext uri. */ + public uri: string; + + /** ImageAnnotationContext pageNumber. */ + public pageNumber: number; /** - * Creates a new BatchAnnotateFilesResponse instance using the specified properties. + * Creates a new ImageAnnotationContext instance using the specified properties. * @param [properties] Properties to set - * @returns BatchAnnotateFilesResponse instance + * @returns ImageAnnotationContext instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse): google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse; + public static create(properties?: google.cloud.vision.v1p4beta1.IImageAnnotationContext): google.cloud.vision.v1p4beta1.ImageAnnotationContext; /** - * Encodes the specified BatchAnnotateFilesResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse.verify|verify} messages. - * @param message BatchAnnotateFilesResponse message or plain object to encode + * Encodes the specified ImageAnnotationContext message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageAnnotationContext.verify|verify} messages. + * @param message ImageAnnotationContext message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IImageAnnotationContext, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified BatchAnnotateFilesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse.verify|verify} messages. - * @param message BatchAnnotateFilesResponse message or plain object to encode + * Encodes the specified ImageAnnotationContext message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageAnnotationContext.verify|verify} messages. + * @param message ImageAnnotationContext message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IImageAnnotationContext, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a BatchAnnotateFilesResponse message from the specified reader or buffer. + * Decodes an ImageAnnotationContext message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns BatchAnnotateFilesResponse + * @returns ImageAnnotationContext * @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.vision.v1p4beta1.BatchAnnotateFilesResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.ImageAnnotationContext; /** - * Decodes a BatchAnnotateFilesResponse message from the specified reader or buffer, length delimited. + * Decodes an ImageAnnotationContext message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns BatchAnnotateFilesResponse + * @returns ImageAnnotationContext * @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.vision.v1p4beta1.BatchAnnotateFilesResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.ImageAnnotationContext; /** - * Verifies a BatchAnnotateFilesResponse message. + * Verifies an ImageAnnotationContext 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 BatchAnnotateFilesResponse message from a plain object. Also converts values to their respective internal types. + * Creates an ImageAnnotationContext message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns BatchAnnotateFilesResponse + * @returns ImageAnnotationContext */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.ImageAnnotationContext; /** - * Creates a plain object from a BatchAnnotateFilesResponse message. Also converts values to other types if specified. - * @param message BatchAnnotateFilesResponse + * Creates a plain object from an ImageAnnotationContext message. Also converts values to other types if specified. + * @param message ImageAnnotationContext * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.ImageAnnotationContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this BatchAnnotateFilesResponse to JSON. + * Converts this ImageAnnotationContext to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an AsyncAnnotateFileRequest. */ - interface IAsyncAnnotateFileRequest { + /** Properties of an AnnotateImageResponse. */ + interface IAnnotateImageResponse { - /** AsyncAnnotateFileRequest inputConfig */ - inputConfig?: (google.cloud.vision.v1p4beta1.IInputConfig|null); + /** AnnotateImageResponse faceAnnotations */ + faceAnnotations?: (google.cloud.vision.v1p4beta1.IFaceAnnotation[]|null); - /** AsyncAnnotateFileRequest features */ - features?: (google.cloud.vision.v1p4beta1.IFeature[]|null); + /** AnnotateImageResponse landmarkAnnotations */ + landmarkAnnotations?: (google.cloud.vision.v1p4beta1.IEntityAnnotation[]|null); - /** AsyncAnnotateFileRequest imageContext */ - imageContext?: (google.cloud.vision.v1p4beta1.IImageContext|null); + /** AnnotateImageResponse logoAnnotations */ + logoAnnotations?: (google.cloud.vision.v1p4beta1.IEntityAnnotation[]|null); - /** AsyncAnnotateFileRequest outputConfig */ - outputConfig?: (google.cloud.vision.v1p4beta1.IOutputConfig|null); + /** AnnotateImageResponse labelAnnotations */ + labelAnnotations?: (google.cloud.vision.v1p4beta1.IEntityAnnotation[]|null); + + /** AnnotateImageResponse localizedObjectAnnotations */ + localizedObjectAnnotations?: (google.cloud.vision.v1p4beta1.ILocalizedObjectAnnotation[]|null); + + /** AnnotateImageResponse textAnnotations */ + textAnnotations?: (google.cloud.vision.v1p4beta1.IEntityAnnotation[]|null); + + /** AnnotateImageResponse fullTextAnnotation */ + fullTextAnnotation?: (google.cloud.vision.v1p4beta1.ITextAnnotation|null); + + /** AnnotateImageResponse safeSearchAnnotation */ + safeSearchAnnotation?: (google.cloud.vision.v1p4beta1.ISafeSearchAnnotation|null); + + /** AnnotateImageResponse imagePropertiesAnnotation */ + imagePropertiesAnnotation?: (google.cloud.vision.v1p4beta1.IImageProperties|null); + + /** AnnotateImageResponse cropHintsAnnotation */ + cropHintsAnnotation?: (google.cloud.vision.v1p4beta1.ICropHintsAnnotation|null); + + /** AnnotateImageResponse webDetection */ + webDetection?: (google.cloud.vision.v1p4beta1.IWebDetection|null); + + /** AnnotateImageResponse productSearchResults */ + productSearchResults?: (google.cloud.vision.v1p4beta1.IProductSearchResults|null); + + /** AnnotateImageResponse error */ + error?: (google.rpc.IStatus|null); + + /** AnnotateImageResponse context */ + context?: (google.cloud.vision.v1p4beta1.IImageAnnotationContext|null); } - /** Represents an AsyncAnnotateFileRequest. */ - class AsyncAnnotateFileRequest implements IAsyncAnnotateFileRequest { + /** Represents an AnnotateImageResponse. */ + class AnnotateImageResponse implements IAnnotateImageResponse { /** - * Constructs a new AsyncAnnotateFileRequest. + * Constructs a new AnnotateImageResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IAsyncAnnotateFileRequest); + constructor(properties?: google.cloud.vision.v1p4beta1.IAnnotateImageResponse); - /** AsyncAnnotateFileRequest inputConfig. */ - public inputConfig?: (google.cloud.vision.v1p4beta1.IInputConfig|null); + /** AnnotateImageResponse faceAnnotations. */ + public faceAnnotations: google.cloud.vision.v1p4beta1.IFaceAnnotation[]; - /** AsyncAnnotateFileRequest features. */ - public features: google.cloud.vision.v1p4beta1.IFeature[]; + /** AnnotateImageResponse landmarkAnnotations. */ + public landmarkAnnotations: google.cloud.vision.v1p4beta1.IEntityAnnotation[]; - /** AsyncAnnotateFileRequest imageContext. */ - public imageContext?: (google.cloud.vision.v1p4beta1.IImageContext|null); + /** AnnotateImageResponse logoAnnotations. */ + public logoAnnotations: google.cloud.vision.v1p4beta1.IEntityAnnotation[]; - /** AsyncAnnotateFileRequest outputConfig. */ - public outputConfig?: (google.cloud.vision.v1p4beta1.IOutputConfig|null); + /** AnnotateImageResponse labelAnnotations. */ + public labelAnnotations: google.cloud.vision.v1p4beta1.IEntityAnnotation[]; + + /** AnnotateImageResponse localizedObjectAnnotations. */ + public localizedObjectAnnotations: google.cloud.vision.v1p4beta1.ILocalizedObjectAnnotation[]; + + /** AnnotateImageResponse textAnnotations. */ + public textAnnotations: google.cloud.vision.v1p4beta1.IEntityAnnotation[]; + + /** AnnotateImageResponse fullTextAnnotation. */ + public fullTextAnnotation?: (google.cloud.vision.v1p4beta1.ITextAnnotation|null); + + /** AnnotateImageResponse safeSearchAnnotation. */ + public safeSearchAnnotation?: (google.cloud.vision.v1p4beta1.ISafeSearchAnnotation|null); + + /** AnnotateImageResponse imagePropertiesAnnotation. */ + public imagePropertiesAnnotation?: (google.cloud.vision.v1p4beta1.IImageProperties|null); + + /** AnnotateImageResponse cropHintsAnnotation. */ + public cropHintsAnnotation?: (google.cloud.vision.v1p4beta1.ICropHintsAnnotation|null); + + /** AnnotateImageResponse webDetection. */ + public webDetection?: (google.cloud.vision.v1p4beta1.IWebDetection|null); + + /** AnnotateImageResponse productSearchResults. */ + public productSearchResults?: (google.cloud.vision.v1p4beta1.IProductSearchResults|null); + + /** AnnotateImageResponse error. */ + public error?: (google.rpc.IStatus|null); + + /** AnnotateImageResponse context. */ + public context?: (google.cloud.vision.v1p4beta1.IImageAnnotationContext|null); /** - * Creates a new AsyncAnnotateFileRequest instance using the specified properties. + * Creates a new AnnotateImageResponse instance using the specified properties. * @param [properties] Properties to set - * @returns AsyncAnnotateFileRequest instance + * @returns AnnotateImageResponse instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IAsyncAnnotateFileRequest): google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest; + public static create(properties?: google.cloud.vision.v1p4beta1.IAnnotateImageResponse): google.cloud.vision.v1p4beta1.AnnotateImageResponse; /** - * Encodes the specified AsyncAnnotateFileRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest.verify|verify} messages. - * @param message AsyncAnnotateFileRequest message or plain object to encode + * Encodes the specified AnnotateImageResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateImageResponse.verify|verify} messages. + * @param message AnnotateImageResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IAsyncAnnotateFileRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IAnnotateImageResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified AsyncAnnotateFileRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest.verify|verify} messages. - * @param message AsyncAnnotateFileRequest message or plain object to encode + * Encodes the specified AnnotateImageResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateImageResponse.verify|verify} messages. + * @param message AnnotateImageResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAsyncAnnotateFileRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAnnotateImageResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer. + * Decodes an AnnotateImageResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns AsyncAnnotateFileRequest + * @returns AnnotateImageResponse * @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.vision.v1p4beta1.AsyncAnnotateFileRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.AnnotateImageResponse; /** - * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer, length delimited. + * Decodes an AnnotateImageResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns AsyncAnnotateFileRequest + * @returns AnnotateImageResponse * @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.vision.v1p4beta1.AsyncAnnotateFileRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.AnnotateImageResponse; /** - * Verifies an AsyncAnnotateFileRequest message. + * Verifies an AnnotateImageResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an AsyncAnnotateFileRequest message from a plain object. Also converts values to their respective internal types. + * Creates an AnnotateImageResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns AsyncAnnotateFileRequest + * @returns AnnotateImageResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AnnotateImageResponse; /** - * Creates a plain object from an AsyncAnnotateFileRequest message. Also converts values to other types if specified. - * @param message AsyncAnnotateFileRequest + * Creates a plain object from an AnnotateImageResponse message. Also converts values to other types if specified. + * @param message AnnotateImageResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.AnnotateImageResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this AsyncAnnotateFileRequest to JSON. + * Converts this AnnotateImageResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an AsyncAnnotateFileResponse. */ - interface IAsyncAnnotateFileResponse { + /** Properties of a BatchAnnotateImagesRequest. */ + interface IBatchAnnotateImagesRequest { - /** AsyncAnnotateFileResponse outputConfig */ - outputConfig?: (google.cloud.vision.v1p4beta1.IOutputConfig|null); + /** BatchAnnotateImagesRequest requests */ + requests?: (google.cloud.vision.v1p4beta1.IAnnotateImageRequest[]|null); } - /** Represents an AsyncAnnotateFileResponse. */ - class AsyncAnnotateFileResponse implements IAsyncAnnotateFileResponse { + /** Represents a BatchAnnotateImagesRequest. */ + class BatchAnnotateImagesRequest implements IBatchAnnotateImagesRequest { /** - * Constructs a new AsyncAnnotateFileResponse. + * Constructs a new BatchAnnotateImagesRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IAsyncAnnotateFileResponse); + constructor(properties?: google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest); - /** AsyncAnnotateFileResponse outputConfig. */ - public outputConfig?: (google.cloud.vision.v1p4beta1.IOutputConfig|null); + /** BatchAnnotateImagesRequest requests. */ + public requests: google.cloud.vision.v1p4beta1.IAnnotateImageRequest[]; /** - * Creates a new AsyncAnnotateFileResponse instance using the specified properties. + * Creates a new BatchAnnotateImagesRequest instance using the specified properties. * @param [properties] Properties to set - * @returns AsyncAnnotateFileResponse instance + * @returns BatchAnnotateImagesRequest instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IAsyncAnnotateFileResponse): google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse; + public static create(properties?: google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest): google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest; /** - * Encodes the specified AsyncAnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse.verify|verify} messages. - * @param message AsyncAnnotateFileResponse message or plain object to encode + * Encodes the specified BatchAnnotateImagesRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest.verify|verify} messages. + * @param message BatchAnnotateImagesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IAsyncAnnotateFileResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified AsyncAnnotateFileResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse.verify|verify} messages. - * @param message AsyncAnnotateFileResponse message or plain object to encode + * Encodes the specified BatchAnnotateImagesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest.verify|verify} messages. + * @param message BatchAnnotateImagesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAsyncAnnotateFileResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer. + * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns AsyncAnnotateFileResponse + * @returns BatchAnnotateImagesRequest * @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.vision.v1p4beta1.AsyncAnnotateFileResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest; /** - * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer, length delimited. + * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns AsyncAnnotateFileResponse + * @returns BatchAnnotateImagesRequest * @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.vision.v1p4beta1.AsyncAnnotateFileResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest; /** - * Verifies an AsyncAnnotateFileResponse message. + * Verifies a BatchAnnotateImagesRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an AsyncAnnotateFileResponse message from a plain object. Also converts values to their respective internal types. + * Creates a BatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns AsyncAnnotateFileResponse + * @returns BatchAnnotateImagesRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest; /** - * Creates a plain object from an AsyncAnnotateFileResponse message. Also converts values to other types if specified. - * @param message AsyncAnnotateFileResponse + * Creates a plain object from a BatchAnnotateImagesRequest message. Also converts values to other types if specified. + * @param message BatchAnnotateImagesRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this AsyncAnnotateFileResponse to JSON. + * Converts this BatchAnnotateImagesRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an AsyncBatchAnnotateImagesRequest. */ - interface IAsyncBatchAnnotateImagesRequest { - - /** AsyncBatchAnnotateImagesRequest requests */ - requests?: (google.cloud.vision.v1p4beta1.IAnnotateImageRequest[]|null); + /** Properties of a BatchAnnotateImagesResponse. */ + interface IBatchAnnotateImagesResponse { - /** AsyncBatchAnnotateImagesRequest outputConfig */ - outputConfig?: (google.cloud.vision.v1p4beta1.IOutputConfig|null); + /** BatchAnnotateImagesResponse responses */ + responses?: (google.cloud.vision.v1p4beta1.IAnnotateImageResponse[]|null); } - /** Represents an AsyncBatchAnnotateImagesRequest. */ - class AsyncBatchAnnotateImagesRequest implements IAsyncBatchAnnotateImagesRequest { + /** Represents a BatchAnnotateImagesResponse. */ + class BatchAnnotateImagesResponse implements IBatchAnnotateImagesResponse { /** - * Constructs a new AsyncBatchAnnotateImagesRequest. + * Constructs a new BatchAnnotateImagesResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest); - - /** AsyncBatchAnnotateImagesRequest requests. */ - public requests: google.cloud.vision.v1p4beta1.IAnnotateImageRequest[]; + constructor(properties?: google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse); - /** AsyncBatchAnnotateImagesRequest outputConfig. */ - public outputConfig?: (google.cloud.vision.v1p4beta1.IOutputConfig|null); + /** BatchAnnotateImagesResponse responses. */ + public responses: google.cloud.vision.v1p4beta1.IAnnotateImageResponse[]; /** - * Creates a new AsyncBatchAnnotateImagesRequest instance using the specified properties. + * Creates a new BatchAnnotateImagesResponse instance using the specified properties. * @param [properties] Properties to set - * @returns AsyncBatchAnnotateImagesRequest instance + * @returns BatchAnnotateImagesResponse instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest; + public static create(properties?: google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse): google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse; /** - * Encodes the specified AsyncBatchAnnotateImagesRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest.verify|verify} messages. - * @param message AsyncBatchAnnotateImagesRequest message or plain object to encode + * Encodes the specified BatchAnnotateImagesResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse.verify|verify} messages. + * @param message BatchAnnotateImagesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified AsyncBatchAnnotateImagesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest.verify|verify} messages. - * @param message AsyncBatchAnnotateImagesRequest message or plain object to encode + * Encodes the specified BatchAnnotateImagesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse.verify|verify} messages. + * @param message BatchAnnotateImagesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an AsyncBatchAnnotateImagesRequest message from the specified reader or buffer. + * Decodes a BatchAnnotateImagesResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns AsyncBatchAnnotateImagesRequest + * @returns BatchAnnotateImagesResponse * @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.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse; /** - * Decodes an AsyncBatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. + * Decodes a BatchAnnotateImagesResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns AsyncBatchAnnotateImagesRequest + * @returns BatchAnnotateImagesResponse * @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.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse; /** - * Verifies an AsyncBatchAnnotateImagesRequest message. + * Verifies a BatchAnnotateImagesResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an AsyncBatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. + * Creates a BatchAnnotateImagesResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns AsyncBatchAnnotateImagesRequest + * @returns BatchAnnotateImagesResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse; /** - * Creates a plain object from an AsyncBatchAnnotateImagesRequest message. Also converts values to other types if specified. - * @param message AsyncBatchAnnotateImagesRequest + * Creates a plain object from a BatchAnnotateImagesResponse message. Also converts values to other types if specified. + * @param message BatchAnnotateImagesResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this AsyncBatchAnnotateImagesRequest to JSON. + * Converts this BatchAnnotateImagesResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an AsyncBatchAnnotateImagesResponse. */ - interface IAsyncBatchAnnotateImagesResponse { + /** Properties of an AnnotateFileRequest. */ + interface IAnnotateFileRequest { - /** AsyncBatchAnnotateImagesResponse outputConfig */ - outputConfig?: (google.cloud.vision.v1p4beta1.IOutputConfig|null); + /** AnnotateFileRequest inputConfig */ + inputConfig?: (google.cloud.vision.v1p4beta1.IInputConfig|null); + + /** AnnotateFileRequest features */ + features?: (google.cloud.vision.v1p4beta1.IFeature[]|null); + + /** AnnotateFileRequest imageContext */ + imageContext?: (google.cloud.vision.v1p4beta1.IImageContext|null); + + /** AnnotateFileRequest pages */ + pages?: (number[]|null); } - /** Represents an AsyncBatchAnnotateImagesResponse. */ - class AsyncBatchAnnotateImagesResponse implements IAsyncBatchAnnotateImagesResponse { + /** Represents an AnnotateFileRequest. */ + class AnnotateFileRequest implements IAnnotateFileRequest { /** - * Constructs a new AsyncBatchAnnotateImagesResponse. + * Constructs a new AnnotateFileRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse); + constructor(properties?: google.cloud.vision.v1p4beta1.IAnnotateFileRequest); - /** AsyncBatchAnnotateImagesResponse outputConfig. */ - public outputConfig?: (google.cloud.vision.v1p4beta1.IOutputConfig|null); + /** AnnotateFileRequest inputConfig. */ + public inputConfig?: (google.cloud.vision.v1p4beta1.IInputConfig|null); + + /** AnnotateFileRequest features. */ + public features: google.cloud.vision.v1p4beta1.IFeature[]; + + /** AnnotateFileRequest imageContext. */ + public imageContext?: (google.cloud.vision.v1p4beta1.IImageContext|null); + + /** AnnotateFileRequest pages. */ + public pages: number[]; /** - * Creates a new AsyncBatchAnnotateImagesResponse instance using the specified properties. + * Creates a new AnnotateFileRequest instance using the specified properties. * @param [properties] Properties to set - * @returns AsyncBatchAnnotateImagesResponse instance + * @returns AnnotateFileRequest instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse; + public static create(properties?: google.cloud.vision.v1p4beta1.IAnnotateFileRequest): google.cloud.vision.v1p4beta1.AnnotateFileRequest; /** - * Encodes the specified AsyncBatchAnnotateImagesResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse.verify|verify} messages. - * @param message AsyncBatchAnnotateImagesResponse message or plain object to encode + * Encodes the specified AnnotateFileRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateFileRequest.verify|verify} messages. + * @param message AnnotateFileRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IAnnotateFileRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified AsyncBatchAnnotateImagesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse.verify|verify} messages. - * @param message AsyncBatchAnnotateImagesResponse message or plain object to encode + * Encodes the specified AnnotateFileRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateFileRequest.verify|verify} messages. + * @param message AnnotateFileRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAnnotateFileRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an AsyncBatchAnnotateImagesResponse message from the specified reader or buffer. + * Decodes an AnnotateFileRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns AsyncBatchAnnotateImagesResponse + * @returns AnnotateFileRequest * @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.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.AnnotateFileRequest; /** - * Decodes an AsyncBatchAnnotateImagesResponse message from the specified reader or buffer, length delimited. + * Decodes an AnnotateFileRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns AsyncBatchAnnotateImagesResponse + * @returns AnnotateFileRequest * @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.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.AnnotateFileRequest; /** - * Verifies an AsyncBatchAnnotateImagesResponse message. + * Verifies an AnnotateFileRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an AsyncBatchAnnotateImagesResponse message from a plain object. Also converts values to their respective internal types. + * Creates an AnnotateFileRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns AsyncBatchAnnotateImagesResponse + * @returns AnnotateFileRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AnnotateFileRequest; /** - * Creates a plain object from an AsyncBatchAnnotateImagesResponse message. Also converts values to other types if specified. - * @param message AsyncBatchAnnotateImagesResponse + * Creates a plain object from an AnnotateFileRequest message. Also converts values to other types if specified. + * @param message AnnotateFileRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.AnnotateFileRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this AsyncBatchAnnotateImagesResponse to JSON. + * Converts this AnnotateFileRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an AsyncBatchAnnotateFilesRequest. */ - interface IAsyncBatchAnnotateFilesRequest { + /** Properties of an AnnotateFileResponse. */ + interface IAnnotateFileResponse { - /** AsyncBatchAnnotateFilesRequest requests */ - requests?: (google.cloud.vision.v1p4beta1.IAsyncAnnotateFileRequest[]|null); + /** AnnotateFileResponse inputConfig */ + inputConfig?: (google.cloud.vision.v1p4beta1.IInputConfig|null); + + /** AnnotateFileResponse responses */ + responses?: (google.cloud.vision.v1p4beta1.IAnnotateImageResponse[]|null); + + /** AnnotateFileResponse totalPages */ + totalPages?: (number|null); + + /** AnnotateFileResponse error */ + error?: (google.rpc.IStatus|null); } - /** Represents an AsyncBatchAnnotateFilesRequest. */ - class AsyncBatchAnnotateFilesRequest implements IAsyncBatchAnnotateFilesRequest { + /** Represents an AnnotateFileResponse. */ + class AnnotateFileResponse implements IAnnotateFileResponse { /** - * Constructs a new AsyncBatchAnnotateFilesRequest. + * Constructs a new AnnotateFileResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest); + constructor(properties?: google.cloud.vision.v1p4beta1.IAnnotateFileResponse); - /** AsyncBatchAnnotateFilesRequest requests. */ - public requests: google.cloud.vision.v1p4beta1.IAsyncAnnotateFileRequest[]; + /** AnnotateFileResponse inputConfig. */ + public inputConfig?: (google.cloud.vision.v1p4beta1.IInputConfig|null); + + /** AnnotateFileResponse responses. */ + public responses: google.cloud.vision.v1p4beta1.IAnnotateImageResponse[]; + + /** AnnotateFileResponse totalPages. */ + public totalPages: number; + + /** AnnotateFileResponse error. */ + public error?: (google.rpc.IStatus|null); /** - * Creates a new AsyncBatchAnnotateFilesRequest instance using the specified properties. + * Creates a new AnnotateFileResponse instance using the specified properties. * @param [properties] Properties to set - * @returns AsyncBatchAnnotateFilesRequest instance + * @returns AnnotateFileResponse instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest; + public static create(properties?: google.cloud.vision.v1p4beta1.IAnnotateFileResponse): google.cloud.vision.v1p4beta1.AnnotateFileResponse; /** - * Encodes the specified AsyncBatchAnnotateFilesRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest.verify|verify} messages. - * @param message AsyncBatchAnnotateFilesRequest message or plain object to encode + * Encodes the specified AnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateFileResponse.verify|verify} messages. + * @param message AnnotateFileResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IAnnotateFileResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified AsyncBatchAnnotateFilesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest.verify|verify} messages. - * @param message AsyncBatchAnnotateFilesRequest message or plain object to encode + * Encodes the specified AnnotateFileResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateFileResponse.verify|verify} messages. + * @param message AnnotateFileResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAnnotateFileResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an AsyncBatchAnnotateFilesRequest message from the specified reader or buffer. + * Decodes an AnnotateFileResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns AsyncBatchAnnotateFilesRequest + * @returns AnnotateFileResponse * @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.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.AnnotateFileResponse; /** - * Decodes an AsyncBatchAnnotateFilesRequest message from the specified reader or buffer, length delimited. + * Decodes an AnnotateFileResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns AsyncBatchAnnotateFilesRequest + * @returns AnnotateFileResponse * @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.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.AnnotateFileResponse; /** - * Verifies an AsyncBatchAnnotateFilesRequest message. + * Verifies an AnnotateFileResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an AsyncBatchAnnotateFilesRequest message from a plain object. Also converts values to their respective internal types. + * Creates an AnnotateFileResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns AsyncBatchAnnotateFilesRequest + * @returns AnnotateFileResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AnnotateFileResponse; /** - * Creates a plain object from an AsyncBatchAnnotateFilesRequest message. Also converts values to other types if specified. - * @param message AsyncBatchAnnotateFilesRequest + * Creates a plain object from an AnnotateFileResponse message. Also converts values to other types if specified. + * @param message AnnotateFileResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.AnnotateFileResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this AsyncBatchAnnotateFilesRequest to JSON. + * Converts this AnnotateFileResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an AsyncBatchAnnotateFilesResponse. */ - interface IAsyncBatchAnnotateFilesResponse { + /** Properties of a BatchAnnotateFilesRequest. */ + interface IBatchAnnotateFilesRequest { - /** AsyncBatchAnnotateFilesResponse responses */ - responses?: (google.cloud.vision.v1p4beta1.IAsyncAnnotateFileResponse[]|null); + /** BatchAnnotateFilesRequest requests */ + requests?: (google.cloud.vision.v1p4beta1.IAnnotateFileRequest[]|null); } - /** Represents an AsyncBatchAnnotateFilesResponse. */ - class AsyncBatchAnnotateFilesResponse implements IAsyncBatchAnnotateFilesResponse { + /** Represents a BatchAnnotateFilesRequest. */ + class BatchAnnotateFilesRequest implements IBatchAnnotateFilesRequest { /** - * Constructs a new AsyncBatchAnnotateFilesResponse. + * Constructs a new BatchAnnotateFilesRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse); + constructor(properties?: google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest); - /** AsyncBatchAnnotateFilesResponse responses. */ - public responses: google.cloud.vision.v1p4beta1.IAsyncAnnotateFileResponse[]; + /** BatchAnnotateFilesRequest requests. */ + public requests: google.cloud.vision.v1p4beta1.IAnnotateFileRequest[]; /** - * Creates a new AsyncBatchAnnotateFilesResponse instance using the specified properties. + * Creates a new BatchAnnotateFilesRequest instance using the specified properties. * @param [properties] Properties to set - * @returns AsyncBatchAnnotateFilesResponse instance + * @returns BatchAnnotateFilesRequest instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse; + public static create(properties?: google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest): google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest; /** - * Encodes the specified AsyncBatchAnnotateFilesResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse.verify|verify} messages. - * @param message AsyncBatchAnnotateFilesResponse message or plain object to encode + * Encodes the specified BatchAnnotateFilesRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest.verify|verify} messages. + * @param message BatchAnnotateFilesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified AsyncBatchAnnotateFilesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse.verify|verify} messages. - * @param message AsyncBatchAnnotateFilesResponse message or plain object to encode + * Encodes the specified BatchAnnotateFilesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest.verify|verify} messages. + * @param message BatchAnnotateFilesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an AsyncBatchAnnotateFilesResponse message from the specified reader or buffer. + * Decodes a BatchAnnotateFilesRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns AsyncBatchAnnotateFilesResponse + * @returns BatchAnnotateFilesRequest * @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.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest; /** - * Decodes an AsyncBatchAnnotateFilesResponse message from the specified reader or buffer, length delimited. + * Decodes a BatchAnnotateFilesRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns AsyncBatchAnnotateFilesResponse + * @returns BatchAnnotateFilesRequest * @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.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest; /** - * Verifies an AsyncBatchAnnotateFilesResponse message. + * Verifies a BatchAnnotateFilesRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an AsyncBatchAnnotateFilesResponse message from a plain object. Also converts values to their respective internal types. + * Creates a BatchAnnotateFilesRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns AsyncBatchAnnotateFilesResponse + * @returns BatchAnnotateFilesRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest; /** - * Creates a plain object from an AsyncBatchAnnotateFilesResponse message. Also converts values to other types if specified. - * @param message AsyncBatchAnnotateFilesResponse + * Creates a plain object from a BatchAnnotateFilesRequest message. Also converts values to other types if specified. + * @param message BatchAnnotateFilesRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this AsyncBatchAnnotateFilesResponse to JSON. + * Converts this BatchAnnotateFilesRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an InputConfig. */ - interface IInputConfig { - - /** InputConfig gcsSource */ - gcsSource?: (google.cloud.vision.v1p4beta1.IGcsSource|null); - - /** InputConfig content */ - content?: (Uint8Array|string|null); + /** Properties of a BatchAnnotateFilesResponse. */ + interface IBatchAnnotateFilesResponse { - /** InputConfig mimeType */ - mimeType?: (string|null); + /** BatchAnnotateFilesResponse responses */ + responses?: (google.cloud.vision.v1p4beta1.IAnnotateFileResponse[]|null); } - /** Represents an InputConfig. */ - class InputConfig implements IInputConfig { + /** Represents a BatchAnnotateFilesResponse. */ + class BatchAnnotateFilesResponse implements IBatchAnnotateFilesResponse { /** - * Constructs a new InputConfig. + * Constructs a new BatchAnnotateFilesResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IInputConfig); - - /** InputConfig gcsSource. */ - public gcsSource?: (google.cloud.vision.v1p4beta1.IGcsSource|null); - - /** InputConfig content. */ - public content: (Uint8Array|string); + constructor(properties?: google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse); - /** InputConfig mimeType. */ - public mimeType: string; + /** BatchAnnotateFilesResponse responses. */ + public responses: google.cloud.vision.v1p4beta1.IAnnotateFileResponse[]; /** - * Creates a new InputConfig instance using the specified properties. + * Creates a new BatchAnnotateFilesResponse instance using the specified properties. * @param [properties] Properties to set - * @returns InputConfig instance + * @returns BatchAnnotateFilesResponse instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IInputConfig): google.cloud.vision.v1p4beta1.InputConfig; + public static create(properties?: google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse): google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse; /** - * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.vision.v1p4beta1.InputConfig.verify|verify} messages. - * @param message InputConfig message or plain object to encode + * Encodes the specified BatchAnnotateFilesResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse.verify|verify} messages. + * @param message BatchAnnotateFilesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified InputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.InputConfig.verify|verify} messages. - * @param message InputConfig message or plain object to encode + * Encodes the specified BatchAnnotateFilesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse.verify|verify} messages. + * @param message BatchAnnotateFilesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an InputConfig message from the specified reader or buffer. + * Decodes a BatchAnnotateFilesResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns InputConfig + * @returns BatchAnnotateFilesResponse * @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.vision.v1p4beta1.InputConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse; /** - * Decodes an InputConfig message from the specified reader or buffer, length delimited. + * Decodes a BatchAnnotateFilesResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns InputConfig + * @returns BatchAnnotateFilesResponse * @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.vision.v1p4beta1.InputConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse; /** - * Verifies an InputConfig message. + * Verifies a BatchAnnotateFilesResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an InputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a BatchAnnotateFilesResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns InputConfig + * @returns BatchAnnotateFilesResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.InputConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse; /** - * Creates a plain object from an InputConfig message. Also converts values to other types if specified. - * @param message InputConfig + * Creates a plain object from a BatchAnnotateFilesResponse message. Also converts values to other types if specified. + * @param message BatchAnnotateFilesResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.InputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this InputConfig to JSON. + * Converts this BatchAnnotateFilesResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an OutputConfig. */ - interface IOutputConfig { + /** Properties of an AsyncAnnotateFileRequest. */ + interface IAsyncAnnotateFileRequest { - /** OutputConfig gcsDestination */ - gcsDestination?: (google.cloud.vision.v1p4beta1.IGcsDestination|null); + /** AsyncAnnotateFileRequest inputConfig */ + inputConfig?: (google.cloud.vision.v1p4beta1.IInputConfig|null); - /** OutputConfig batchSize */ - batchSize?: (number|null); + /** AsyncAnnotateFileRequest features */ + features?: (google.cloud.vision.v1p4beta1.IFeature[]|null); + + /** AsyncAnnotateFileRequest imageContext */ + imageContext?: (google.cloud.vision.v1p4beta1.IImageContext|null); + + /** AsyncAnnotateFileRequest outputConfig */ + outputConfig?: (google.cloud.vision.v1p4beta1.IOutputConfig|null); } - /** Represents an OutputConfig. */ - class OutputConfig implements IOutputConfig { + /** Represents an AsyncAnnotateFileRequest. */ + class AsyncAnnotateFileRequest implements IAsyncAnnotateFileRequest { /** - * Constructs a new OutputConfig. + * Constructs a new AsyncAnnotateFileRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IOutputConfig); + constructor(properties?: google.cloud.vision.v1p4beta1.IAsyncAnnotateFileRequest); - /** OutputConfig gcsDestination. */ - public gcsDestination?: (google.cloud.vision.v1p4beta1.IGcsDestination|null); + /** AsyncAnnotateFileRequest inputConfig. */ + public inputConfig?: (google.cloud.vision.v1p4beta1.IInputConfig|null); - /** OutputConfig batchSize. */ - public batchSize: number; + /** AsyncAnnotateFileRequest features. */ + public features: google.cloud.vision.v1p4beta1.IFeature[]; + + /** AsyncAnnotateFileRequest imageContext. */ + public imageContext?: (google.cloud.vision.v1p4beta1.IImageContext|null); + + /** AsyncAnnotateFileRequest outputConfig. */ + public outputConfig?: (google.cloud.vision.v1p4beta1.IOutputConfig|null); /** - * Creates a new OutputConfig instance using the specified properties. + * Creates a new AsyncAnnotateFileRequest instance using the specified properties. * @param [properties] Properties to set - * @returns OutputConfig instance + * @returns AsyncAnnotateFileRequest instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IOutputConfig): google.cloud.vision.v1p4beta1.OutputConfig; + public static create(properties?: google.cloud.vision.v1p4beta1.IAsyncAnnotateFileRequest): google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest; /** - * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.vision.v1p4beta1.OutputConfig.verify|verify} messages. - * @param message OutputConfig message or plain object to encode + * Encodes the specified AsyncAnnotateFileRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest.verify|verify} messages. + * @param message AsyncAnnotateFileRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IAsyncAnnotateFileRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified OutputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.OutputConfig.verify|verify} messages. - * @param message OutputConfig message or plain object to encode + * Encodes the specified AsyncAnnotateFileRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest.verify|verify} messages. + * @param message AsyncAnnotateFileRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAsyncAnnotateFileRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an OutputConfig message from the specified reader or buffer. + * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns OutputConfig + * @returns AsyncAnnotateFileRequest * @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.vision.v1p4beta1.OutputConfig; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest; /** - * Decodes an OutputConfig message from the specified reader or buffer, length delimited. + * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns OutputConfig + * @returns AsyncAnnotateFileRequest * @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.vision.v1p4beta1.OutputConfig; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest; /** - * Verifies an OutputConfig message. + * Verifies an AsyncAnnotateFileRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an OutputConfig message from a plain object. Also converts values to their respective internal types. + * Creates an AsyncAnnotateFileRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns OutputConfig + * @returns AsyncAnnotateFileRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.OutputConfig; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest; /** - * Creates a plain object from an OutputConfig message. Also converts values to other types if specified. - * @param message OutputConfig + * Creates a plain object from an AsyncAnnotateFileRequest message. Also converts values to other types if specified. + * @param message AsyncAnnotateFileRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.OutputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this OutputConfig to JSON. + * Converts this AsyncAnnotateFileRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a GcsSource. */ - interface IGcsSource { + /** Properties of an AsyncAnnotateFileResponse. */ + interface IAsyncAnnotateFileResponse { - /** GcsSource uri */ - uri?: (string|null); + /** AsyncAnnotateFileResponse outputConfig */ + outputConfig?: (google.cloud.vision.v1p4beta1.IOutputConfig|null); } - /** Represents a GcsSource. */ - class GcsSource implements IGcsSource { + /** Represents an AsyncAnnotateFileResponse. */ + class AsyncAnnotateFileResponse implements IAsyncAnnotateFileResponse { /** - * Constructs a new GcsSource. + * Constructs a new AsyncAnnotateFileResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IGcsSource); + constructor(properties?: google.cloud.vision.v1p4beta1.IAsyncAnnotateFileResponse); - /** GcsSource uri. */ - public uri: string; + /** AsyncAnnotateFileResponse outputConfig. */ + public outputConfig?: (google.cloud.vision.v1p4beta1.IOutputConfig|null); /** - * Creates a new GcsSource instance using the specified properties. + * Creates a new AsyncAnnotateFileResponse instance using the specified properties. * @param [properties] Properties to set - * @returns GcsSource instance + * @returns AsyncAnnotateFileResponse instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IGcsSource): google.cloud.vision.v1p4beta1.GcsSource; + public static create(properties?: google.cloud.vision.v1p4beta1.IAsyncAnnotateFileResponse): google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse; /** - * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.vision.v1p4beta1.GcsSource.verify|verify} messages. - * @param message GcsSource message or plain object to encode + * Encodes the specified AsyncAnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse.verify|verify} messages. + * @param message AsyncAnnotateFileResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IAsyncAnnotateFileResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.GcsSource.verify|verify} messages. - * @param message GcsSource message or plain object to encode + * Encodes the specified AsyncAnnotateFileResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse.verify|verify} messages. + * @param message AsyncAnnotateFileResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAsyncAnnotateFileResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a GcsSource message from the specified reader or buffer. + * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns GcsSource + * @returns AsyncAnnotateFileResponse * @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.vision.v1p4beta1.GcsSource; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse; /** - * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns GcsSource + * @returns AsyncAnnotateFileResponse * @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.vision.v1p4beta1.GcsSource; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse; /** - * Verifies a GcsSource message. + * Verifies an AsyncAnnotateFileResponse 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 GcsSource message from a plain object. Also converts values to their respective internal types. + * Creates an AsyncAnnotateFileResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns GcsSource + * @returns AsyncAnnotateFileResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.GcsSource; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse; /** - * Creates a plain object from a GcsSource message. Also converts values to other types if specified. - * @param message GcsSource + * Creates a plain object from an AsyncAnnotateFileResponse message. Also converts values to other types if specified. + * @param message AsyncAnnotateFileResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.GcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this GcsSource to JSON. + * Converts this AsyncAnnotateFileResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a GcsDestination. */ - interface IGcsDestination { + /** Properties of an AsyncBatchAnnotateImagesRequest. */ + interface IAsyncBatchAnnotateImagesRequest { - /** GcsDestination uri */ - uri?: (string|null); + /** AsyncBatchAnnotateImagesRequest requests */ + requests?: (google.cloud.vision.v1p4beta1.IAnnotateImageRequest[]|null); + + /** AsyncBatchAnnotateImagesRequest outputConfig */ + outputConfig?: (google.cloud.vision.v1p4beta1.IOutputConfig|null); } - /** Represents a GcsDestination. */ - class GcsDestination implements IGcsDestination { + /** Represents an AsyncBatchAnnotateImagesRequest. */ + class AsyncBatchAnnotateImagesRequest implements IAsyncBatchAnnotateImagesRequest { /** - * Constructs a new GcsDestination. + * Constructs a new AsyncBatchAnnotateImagesRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IGcsDestination); + constructor(properties?: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest); - /** GcsDestination uri. */ - public uri: string; + /** AsyncBatchAnnotateImagesRequest requests. */ + public requests: google.cloud.vision.v1p4beta1.IAnnotateImageRequest[]; + + /** AsyncBatchAnnotateImagesRequest outputConfig. */ + public outputConfig?: (google.cloud.vision.v1p4beta1.IOutputConfig|null); /** - * Creates a new GcsDestination instance using the specified properties. + * Creates a new AsyncBatchAnnotateImagesRequest instance using the specified properties. * @param [properties] Properties to set - * @returns GcsDestination instance + * @returns AsyncBatchAnnotateImagesRequest instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IGcsDestination): google.cloud.vision.v1p4beta1.GcsDestination; + public static create(properties?: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest; /** - * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.vision.v1p4beta1.GcsDestination.verify|verify} messages. - * @param message GcsDestination message or plain object to encode + * Encodes the specified AsyncBatchAnnotateImagesRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest.verify|verify} messages. + * @param message AsyncBatchAnnotateImagesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IGcsDestination, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.GcsDestination.verify|verify} messages. - * @param message GcsDestination message or plain object to encode + * Encodes the specified AsyncBatchAnnotateImagesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest.verify|verify} messages. + * @param message AsyncBatchAnnotateImagesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IGcsDestination, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a GcsDestination message from the specified reader or buffer. + * Decodes an AsyncBatchAnnotateImagesRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns GcsDestination + * @returns AsyncBatchAnnotateImagesRequest * @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.vision.v1p4beta1.GcsDestination; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest; /** - * Decodes a GcsDestination message from the specified reader or buffer, length delimited. + * Decodes an AsyncBatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns GcsDestination + * @returns AsyncBatchAnnotateImagesRequest * @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.vision.v1p4beta1.GcsDestination; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest; /** - * Verifies a GcsDestination message. + * Verifies an AsyncBatchAnnotateImagesRequest 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 GcsDestination message from a plain object. Also converts values to their respective internal types. + * Creates an AsyncBatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns GcsDestination + * @returns AsyncBatchAnnotateImagesRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.GcsDestination; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest; /** - * Creates a plain object from a GcsDestination message. Also converts values to other types if specified. - * @param message GcsDestination + * Creates a plain object from an AsyncBatchAnnotateImagesRequest message. Also converts values to other types if specified. + * @param message AsyncBatchAnnotateImagesRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.GcsDestination, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this GcsDestination to JSON. + * Converts this AsyncBatchAnnotateImagesRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of an OperationMetadata. */ - interface IOperationMetadata { - - /** OperationMetadata state */ - state?: (google.cloud.vision.v1p4beta1.OperationMetadata.State|keyof typeof google.cloud.vision.v1p4beta1.OperationMetadata.State|null); - - /** OperationMetadata createTime */ - createTime?: (google.protobuf.ITimestamp|null); + /** Properties of an AsyncBatchAnnotateImagesResponse. */ + interface IAsyncBatchAnnotateImagesResponse { - /** OperationMetadata updateTime */ - updateTime?: (google.protobuf.ITimestamp|null); + /** AsyncBatchAnnotateImagesResponse outputConfig */ + outputConfig?: (google.cloud.vision.v1p4beta1.IOutputConfig|null); } - /** Represents an OperationMetadata. */ - class OperationMetadata implements IOperationMetadata { + /** Represents an AsyncBatchAnnotateImagesResponse. */ + class AsyncBatchAnnotateImagesResponse implements IAsyncBatchAnnotateImagesResponse { /** - * Constructs a new OperationMetadata. + * Constructs a new AsyncBatchAnnotateImagesResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IOperationMetadata); - - /** OperationMetadata state. */ - public state: (google.cloud.vision.v1p4beta1.OperationMetadata.State|keyof typeof google.cloud.vision.v1p4beta1.OperationMetadata.State); - - /** OperationMetadata createTime. */ - public createTime?: (google.protobuf.ITimestamp|null); + constructor(properties?: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse); - /** OperationMetadata updateTime. */ - public updateTime?: (google.protobuf.ITimestamp|null); + /** AsyncBatchAnnotateImagesResponse outputConfig. */ + public outputConfig?: (google.cloud.vision.v1p4beta1.IOutputConfig|null); /** - * Creates a new OperationMetadata instance using the specified properties. + * Creates a new AsyncBatchAnnotateImagesResponse instance using the specified properties. * @param [properties] Properties to set - * @returns OperationMetadata instance + * @returns AsyncBatchAnnotateImagesResponse instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IOperationMetadata): google.cloud.vision.v1p4beta1.OperationMetadata; + public static create(properties?: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse; /** - * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.vision.v1p4beta1.OperationMetadata.verify|verify} messages. - * @param message OperationMetadata message or plain object to encode + * Encodes the specified AsyncBatchAnnotateImagesResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse.verify|verify} messages. + * @param message AsyncBatchAnnotateImagesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.OperationMetadata.verify|verify} messages. - * @param message OperationMetadata message or plain object to encode + * Encodes the specified AsyncBatchAnnotateImagesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse.verify|verify} messages. + * @param message AsyncBatchAnnotateImagesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes an OperationMetadata message from the specified reader or buffer. + * Decodes an AsyncBatchAnnotateImagesResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns OperationMetadata + * @returns AsyncBatchAnnotateImagesResponse * @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.vision.v1p4beta1.OperationMetadata; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse; /** - * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. + * Decodes an AsyncBatchAnnotateImagesResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns OperationMetadata + * @returns AsyncBatchAnnotateImagesResponse * @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.vision.v1p4beta1.OperationMetadata; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse; /** - * Verifies an OperationMetadata message. + * Verifies an AsyncBatchAnnotateImagesResponse message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. + * Creates an AsyncBatchAnnotateImagesResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns OperationMetadata + * @returns AsyncBatchAnnotateImagesResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.OperationMetadata; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse; /** - * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. - * @param message OperationMetadata + * Creates a plain object from an AsyncBatchAnnotateImagesResponse message. Also converts values to other types if specified. + * @param message AsyncBatchAnnotateImagesResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.OperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this OperationMetadata to JSON. + * Converts this AsyncBatchAnnotateImagesResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - namespace OperationMetadata { - - /** State enum. */ - enum State { - STATE_UNSPECIFIED = 0, - CREATED = 1, - RUNNING = 2, - DONE = 3, - CANCELLED = 4 - } - } - - /** Properties of a FaceRecognitionParams. */ - interface IFaceRecognitionParams { + /** Properties of an AsyncBatchAnnotateFilesRequest. */ + interface IAsyncBatchAnnotateFilesRequest { - /** FaceRecognitionParams celebritySet */ - celebritySet?: (string[]|null); + /** AsyncBatchAnnotateFilesRequest requests */ + requests?: (google.cloud.vision.v1p4beta1.IAsyncAnnotateFileRequest[]|null); } - /** Represents a FaceRecognitionParams. */ - class FaceRecognitionParams implements IFaceRecognitionParams { + /** Represents an AsyncBatchAnnotateFilesRequest. */ + class AsyncBatchAnnotateFilesRequest implements IAsyncBatchAnnotateFilesRequest { /** - * Constructs a new FaceRecognitionParams. + * Constructs a new AsyncBatchAnnotateFilesRequest. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IFaceRecognitionParams); + constructor(properties?: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest); - /** FaceRecognitionParams celebritySet. */ - public celebritySet: string[]; + /** AsyncBatchAnnotateFilesRequest requests. */ + public requests: google.cloud.vision.v1p4beta1.IAsyncAnnotateFileRequest[]; /** - * Creates a new FaceRecognitionParams instance using the specified properties. + * Creates a new AsyncBatchAnnotateFilesRequest instance using the specified properties. * @param [properties] Properties to set - * @returns FaceRecognitionParams instance + * @returns AsyncBatchAnnotateFilesRequest instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IFaceRecognitionParams): google.cloud.vision.v1p4beta1.FaceRecognitionParams; + public static create(properties?: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest; /** - * Encodes the specified FaceRecognitionParams message. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceRecognitionParams.verify|verify} messages. - * @param message FaceRecognitionParams message or plain object to encode + * Encodes the specified AsyncBatchAnnotateFilesRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest.verify|verify} messages. + * @param message AsyncBatchAnnotateFilesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IFaceRecognitionParams, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified FaceRecognitionParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceRecognitionParams.verify|verify} messages. - * @param message FaceRecognitionParams message or plain object to encode + * Encodes the specified AsyncBatchAnnotateFilesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest.verify|verify} messages. + * @param message AsyncBatchAnnotateFilesRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IFaceRecognitionParams, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a FaceRecognitionParams message from the specified reader or buffer. + * Decodes an AsyncBatchAnnotateFilesRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns FaceRecognitionParams + * @returns AsyncBatchAnnotateFilesRequest * @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.vision.v1p4beta1.FaceRecognitionParams; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest; /** - * Decodes a FaceRecognitionParams message from the specified reader or buffer, length delimited. + * Decodes an AsyncBatchAnnotateFilesRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns FaceRecognitionParams + * @returns AsyncBatchAnnotateFilesRequest * @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.vision.v1p4beta1.FaceRecognitionParams; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest; /** - * Verifies a FaceRecognitionParams message. + * Verifies an AsyncBatchAnnotateFilesRequest 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 FaceRecognitionParams message from a plain object. Also converts values to their respective internal types. + * Creates an AsyncBatchAnnotateFilesRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns FaceRecognitionParams + * @returns AsyncBatchAnnotateFilesRequest */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.FaceRecognitionParams; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest; /** - * Creates a plain object from a FaceRecognitionParams message. Also converts values to other types if specified. - * @param message FaceRecognitionParams + * Creates a plain object from an AsyncBatchAnnotateFilesRequest message. Also converts values to other types if specified. + * @param message AsyncBatchAnnotateFilesRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.FaceRecognitionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this FaceRecognitionParams to JSON. + * Converts this AsyncBatchAnnotateFilesRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a Celebrity. */ - interface ICelebrity { - - /** Celebrity name */ - name?: (string|null); - - /** Celebrity displayName */ - displayName?: (string|null); + /** Properties of an AsyncBatchAnnotateFilesResponse. */ + interface IAsyncBatchAnnotateFilesResponse { - /** Celebrity description */ - description?: (string|null); + /** AsyncBatchAnnotateFilesResponse responses */ + responses?: (google.cloud.vision.v1p4beta1.IAsyncAnnotateFileResponse[]|null); } - /** Represents a Celebrity. */ - class Celebrity implements ICelebrity { + /** Represents an AsyncBatchAnnotateFilesResponse. */ + class AsyncBatchAnnotateFilesResponse implements IAsyncBatchAnnotateFilesResponse { /** - * Constructs a new Celebrity. + * Constructs a new AsyncBatchAnnotateFilesResponse. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.ICelebrity); - - /** Celebrity name. */ - public name: string; - - /** Celebrity displayName. */ - public displayName: string; + constructor(properties?: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse); - /** Celebrity description. */ - public description: string; + /** AsyncBatchAnnotateFilesResponse responses. */ + public responses: google.cloud.vision.v1p4beta1.IAsyncAnnotateFileResponse[]; /** - * Creates a new Celebrity instance using the specified properties. + * Creates a new AsyncBatchAnnotateFilesResponse instance using the specified properties. * @param [properties] Properties to set - * @returns Celebrity instance + * @returns AsyncBatchAnnotateFilesResponse instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.ICelebrity): google.cloud.vision.v1p4beta1.Celebrity; + public static create(properties?: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse; /** - * Encodes the specified Celebrity message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Celebrity.verify|verify} messages. - * @param message Celebrity message or plain object to encode + * Encodes the specified AsyncBatchAnnotateFilesResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse.verify|verify} messages. + * @param message AsyncBatchAnnotateFilesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.ICelebrity, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Celebrity message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Celebrity.verify|verify} messages. - * @param message Celebrity message or plain object to encode + * Encodes the specified AsyncBatchAnnotateFilesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse.verify|verify} messages. + * @param message AsyncBatchAnnotateFilesResponse message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.ICelebrity, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Celebrity message from the specified reader or buffer. + * Decodes an AsyncBatchAnnotateFilesResponse message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Celebrity + * @returns AsyncBatchAnnotateFilesResponse * @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.vision.v1p4beta1.Celebrity; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse; /** - * Decodes a Celebrity message from the specified reader or buffer, length delimited. + * Decodes an AsyncBatchAnnotateFilesResponse message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Celebrity + * @returns AsyncBatchAnnotateFilesResponse * @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.vision.v1p4beta1.Celebrity; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse; /** - * Verifies a Celebrity message. + * Verifies an AsyncBatchAnnotateFilesResponse 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 Celebrity message from a plain object. Also converts values to their respective internal types. + * Creates an AsyncBatchAnnotateFilesResponse message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Celebrity + * @returns AsyncBatchAnnotateFilesResponse */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.Celebrity; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse; /** - * Creates a plain object from a Celebrity message. Also converts values to other types if specified. - * @param message Celebrity + * Creates a plain object from an AsyncBatchAnnotateFilesResponse message. Also converts values to other types if specified. + * @param message AsyncBatchAnnotateFilesResponse * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.Celebrity, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Celebrity to JSON. + * Converts this AsyncBatchAnnotateFilesResponse to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a FaceRecognitionResult. */ - interface IFaceRecognitionResult { + /** Properties of an InputConfig. */ + interface IInputConfig { - /** FaceRecognitionResult celebrity */ - celebrity?: (google.cloud.vision.v1p4beta1.ICelebrity|null); + /** InputConfig gcsSource */ + gcsSource?: (google.cloud.vision.v1p4beta1.IGcsSource|null); - /** FaceRecognitionResult confidence */ - confidence?: (number|null); + /** InputConfig content */ + content?: (Uint8Array|string|null); + + /** InputConfig mimeType */ + mimeType?: (string|null); } - /** Represents a FaceRecognitionResult. */ - class FaceRecognitionResult implements IFaceRecognitionResult { + /** Represents an InputConfig. */ + class InputConfig implements IInputConfig { /** - * Constructs a new FaceRecognitionResult. + * Constructs a new InputConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IFaceRecognitionResult); + constructor(properties?: google.cloud.vision.v1p4beta1.IInputConfig); - /** FaceRecognitionResult celebrity. */ - public celebrity?: (google.cloud.vision.v1p4beta1.ICelebrity|null); + /** InputConfig gcsSource. */ + public gcsSource?: (google.cloud.vision.v1p4beta1.IGcsSource|null); - /** FaceRecognitionResult confidence. */ - public confidence: number; + /** InputConfig content. */ + public content: (Uint8Array|string); + + /** InputConfig mimeType. */ + public mimeType: string; /** - * Creates a new FaceRecognitionResult instance using the specified properties. + * Creates a new InputConfig instance using the specified properties. * @param [properties] Properties to set - * @returns FaceRecognitionResult instance + * @returns InputConfig instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IFaceRecognitionResult): google.cloud.vision.v1p4beta1.FaceRecognitionResult; + public static create(properties?: google.cloud.vision.v1p4beta1.IInputConfig): google.cloud.vision.v1p4beta1.InputConfig; /** - * Encodes the specified FaceRecognitionResult message. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceRecognitionResult.verify|verify} messages. - * @param message FaceRecognitionResult message or plain object to encode + * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.vision.v1p4beta1.InputConfig.verify|verify} messages. + * @param message InputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IFaceRecognitionResult, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified FaceRecognitionResult message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceRecognitionResult.verify|verify} messages. - * @param message FaceRecognitionResult message or plain object to encode + * Encodes the specified InputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.InputConfig.verify|verify} messages. + * @param message InputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IFaceRecognitionResult, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a FaceRecognitionResult message from the specified reader or buffer. + * Decodes an InputConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns FaceRecognitionResult + * @returns InputConfig * @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.vision.v1p4beta1.FaceRecognitionResult; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.InputConfig; /** - * Decodes a FaceRecognitionResult message from the specified reader or buffer, length delimited. + * Decodes an InputConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns FaceRecognitionResult + * @returns InputConfig * @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.vision.v1p4beta1.FaceRecognitionResult; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.InputConfig; /** - * Verifies a FaceRecognitionResult message. + * Verifies an InputConfig 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 FaceRecognitionResult message from a plain object. Also converts values to their respective internal types. + * Creates an InputConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns FaceRecognitionResult + * @returns InputConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.FaceRecognitionResult; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.InputConfig; /** - * Creates a plain object from a FaceRecognitionResult message. Also converts values to other types if specified. - * @param message FaceRecognitionResult + * Creates a plain object from an InputConfig message. Also converts values to other types if specified. + * @param message InputConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.FaceRecognitionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.InputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this FaceRecognitionResult to JSON. + * Converts this InputConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a Vertex. */ - interface IVertex { + /** Properties of an OutputConfig. */ + interface IOutputConfig { - /** Vertex x */ - x?: (number|null); + /** OutputConfig gcsDestination */ + gcsDestination?: (google.cloud.vision.v1p4beta1.IGcsDestination|null); - /** Vertex y */ - y?: (number|null); + /** OutputConfig batchSize */ + batchSize?: (number|null); } - /** Represents a Vertex. */ - class Vertex implements IVertex { + /** Represents an OutputConfig. */ + class OutputConfig implements IOutputConfig { /** - * Constructs a new Vertex. + * Constructs a new OutputConfig. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IVertex); + constructor(properties?: google.cloud.vision.v1p4beta1.IOutputConfig); - /** Vertex x. */ - public x: number; + /** OutputConfig gcsDestination. */ + public gcsDestination?: (google.cloud.vision.v1p4beta1.IGcsDestination|null); - /** Vertex y. */ - public y: number; + /** OutputConfig batchSize. */ + public batchSize: number; /** - * Creates a new Vertex instance using the specified properties. + * Creates a new OutputConfig instance using the specified properties. * @param [properties] Properties to set - * @returns Vertex instance + * @returns OutputConfig instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IVertex): google.cloud.vision.v1p4beta1.Vertex; + public static create(properties?: google.cloud.vision.v1p4beta1.IOutputConfig): google.cloud.vision.v1p4beta1.OutputConfig; /** - * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Vertex.verify|verify} messages. - * @param message Vertex message or plain object to encode + * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.vision.v1p4beta1.OutputConfig.verify|verify} messages. + * @param message OutputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Vertex.verify|verify} messages. - * @param message Vertex message or plain object to encode + * Encodes the specified OutputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.OutputConfig.verify|verify} messages. + * @param message OutputConfig message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IVertex, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IOutputConfig, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Vertex message from the specified reader or buffer. + * Decodes an OutputConfig message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Vertex + * @returns OutputConfig * @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.vision.v1p4beta1.Vertex; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.OutputConfig; /** - * Decodes a Vertex message from the specified reader or buffer, length delimited. + * Decodes an OutputConfig message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Vertex + * @returns OutputConfig * @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.vision.v1p4beta1.Vertex; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.OutputConfig; /** - * Verifies a Vertex message. + * Verifies an OutputConfig 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 Vertex message from a plain object. Also converts values to their respective internal types. + * Creates an OutputConfig message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Vertex + * @returns OutputConfig */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.Vertex; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.OutputConfig; /** - * Creates a plain object from a Vertex message. Also converts values to other types if specified. - * @param message Vertex + * Creates a plain object from an OutputConfig message. Also converts values to other types if specified. + * @param message OutputConfig * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.Vertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.OutputConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Vertex to JSON. + * Converts this OutputConfig to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a NormalizedVertex. */ - interface INormalizedVertex { - - /** NormalizedVertex x */ - x?: (number|null); + /** Properties of a GcsSource. */ + interface IGcsSource { - /** NormalizedVertex y */ - y?: (number|null); + /** GcsSource uri */ + uri?: (string|null); } - /** Represents a NormalizedVertex. */ - class NormalizedVertex implements INormalizedVertex { + /** Represents a GcsSource. */ + class GcsSource implements IGcsSource { /** - * Constructs a new NormalizedVertex. + * Constructs a new GcsSource. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.INormalizedVertex); - - /** NormalizedVertex x. */ - public x: number; + constructor(properties?: google.cloud.vision.v1p4beta1.IGcsSource); - /** NormalizedVertex y. */ - public y: number; + /** GcsSource uri. */ + public uri: string; /** - * Creates a new NormalizedVertex instance using the specified properties. + * Creates a new GcsSource instance using the specified properties. * @param [properties] Properties to set - * @returns NormalizedVertex instance + * @returns GcsSource instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.INormalizedVertex): google.cloud.vision.v1p4beta1.NormalizedVertex; + public static create(properties?: google.cloud.vision.v1p4beta1.IGcsSource): google.cloud.vision.v1p4beta1.GcsSource; /** - * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.vision.v1p4beta1.NormalizedVertex.verify|verify} messages. - * @param message NormalizedVertex message or plain object to encode + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.vision.v1p4beta1.GcsSource.verify|verify} messages. + * @param message GcsSource message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.INormalizedVertex, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified NormalizedVertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.NormalizedVertex.verify|verify} messages. - * @param message NormalizedVertex message or plain object to encode + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.GcsSource.verify|verify} messages. + * @param message GcsSource message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.INormalizedVertex, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a NormalizedVertex message from the specified reader or buffer. + * Decodes a GcsSource message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns NormalizedVertex + * @returns GcsSource * @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.vision.v1p4beta1.NormalizedVertex; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.GcsSource; /** - * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. + * Decodes a GcsSource message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns NormalizedVertex + * @returns GcsSource * @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.vision.v1p4beta1.NormalizedVertex; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.GcsSource; /** - * Verifies a NormalizedVertex message. + * Verifies a GcsSource 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 NormalizedVertex message from a plain object. Also converts values to their respective internal types. + * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns NormalizedVertex + * @returns GcsSource */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.NormalizedVertex; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.GcsSource; /** - * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. - * @param message NormalizedVertex + * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * @param message GcsSource * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.NormalizedVertex, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.GcsSource, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this NormalizedVertex to JSON. + * Converts this GcsSource to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a BoundingPoly. */ - interface IBoundingPoly { - - /** BoundingPoly vertices */ - vertices?: (google.cloud.vision.v1p4beta1.IVertex[]|null); + /** Properties of a GcsDestination. */ + interface IGcsDestination { - /** BoundingPoly normalizedVertices */ - normalizedVertices?: (google.cloud.vision.v1p4beta1.INormalizedVertex[]|null); + /** GcsDestination uri */ + uri?: (string|null); } - /** Represents a BoundingPoly. */ - class BoundingPoly implements IBoundingPoly { + /** Represents a GcsDestination. */ + class GcsDestination implements IGcsDestination { /** - * Constructs a new BoundingPoly. + * Constructs a new GcsDestination. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IBoundingPoly); - - /** BoundingPoly vertices. */ - public vertices: google.cloud.vision.v1p4beta1.IVertex[]; + constructor(properties?: google.cloud.vision.v1p4beta1.IGcsDestination); - /** BoundingPoly normalizedVertices. */ - public normalizedVertices: google.cloud.vision.v1p4beta1.INormalizedVertex[]; + /** GcsDestination uri. */ + public uri: string; /** - * Creates a new BoundingPoly instance using the specified properties. + * Creates a new GcsDestination instance using the specified properties. * @param [properties] Properties to set - * @returns BoundingPoly instance + * @returns GcsDestination instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IBoundingPoly): google.cloud.vision.v1p4beta1.BoundingPoly; + public static create(properties?: google.cloud.vision.v1p4beta1.IGcsDestination): google.cloud.vision.v1p4beta1.GcsDestination; /** - * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.vision.v1p4beta1.BoundingPoly.verify|verify} messages. - * @param message BoundingPoly message or plain object to encode + * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.vision.v1p4beta1.GcsDestination.verify|verify} messages. + * @param message GcsDestination message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IGcsDestination, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.BoundingPoly.verify|verify} messages. - * @param message BoundingPoly message or plain object to encode + * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.GcsDestination.verify|verify} messages. + * @param message GcsDestination message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IBoundingPoly, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IGcsDestination, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a BoundingPoly message from the specified reader or buffer. + * Decodes a GcsDestination message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns BoundingPoly + * @returns GcsDestination * @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.vision.v1p4beta1.BoundingPoly; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.GcsDestination; /** - * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. + * Decodes a GcsDestination message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns BoundingPoly + * @returns GcsDestination * @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.vision.v1p4beta1.BoundingPoly; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.GcsDestination; /** - * Verifies a BoundingPoly message. + * Verifies a GcsDestination 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 BoundingPoly message from a plain object. Also converts values to their respective internal types. + * Creates a GcsDestination message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns BoundingPoly + * @returns GcsDestination */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.BoundingPoly; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.GcsDestination; /** - * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. - * @param message BoundingPoly + * Creates a plain object from a GcsDestination message. Also converts values to other types if specified. + * @param message GcsDestination * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.BoundingPoly, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.GcsDestination, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this BoundingPoly to JSON. + * Converts this GcsDestination to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } - /** Properties of a Position. */ - interface IPosition { + /** Properties of an OperationMetadata. */ + interface IOperationMetadata { - /** Position x */ - x?: (number|null); + /** OperationMetadata state */ + state?: (google.cloud.vision.v1p4beta1.OperationMetadata.State|keyof typeof google.cloud.vision.v1p4beta1.OperationMetadata.State|null); - /** Position y */ - y?: (number|null); + /** OperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); - /** Position z */ - z?: (number|null); + /** OperationMetadata updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); } - /** Represents a Position. */ - class Position implements IPosition { + /** Represents an OperationMetadata. */ + class OperationMetadata implements IOperationMetadata { /** - * Constructs a new Position. + * Constructs a new OperationMetadata. * @param [properties] Properties to set */ - constructor(properties?: google.cloud.vision.v1p4beta1.IPosition); + constructor(properties?: google.cloud.vision.v1p4beta1.IOperationMetadata); - /** Position x. */ - public x: number; + /** OperationMetadata state. */ + public state: (google.cloud.vision.v1p4beta1.OperationMetadata.State|keyof typeof google.cloud.vision.v1p4beta1.OperationMetadata.State); - /** Position y. */ - public y: number; + /** OperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); - /** Position z. */ - public z: number; + /** OperationMetadata updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); /** - * Creates a new Position instance using the specified properties. + * Creates a new OperationMetadata instance using the specified properties. * @param [properties] Properties to set - * @returns Position instance + * @returns OperationMetadata instance */ - public static create(properties?: google.cloud.vision.v1p4beta1.IPosition): google.cloud.vision.v1p4beta1.Position; + public static create(properties?: google.cloud.vision.v1p4beta1.IOperationMetadata): google.cloud.vision.v1p4beta1.OperationMetadata; /** - * Encodes the specified Position message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Position.verify|verify} messages. - * @param message Position message or plain object to encode + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.vision.v1p4beta1.OperationMetadata.verify|verify} messages. + * @param message OperationMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.cloud.vision.v1p4beta1.IPosition, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.cloud.vision.v1p4beta1.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Position message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Position.verify|verify} messages. - * @param message Position message or plain object to encode + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.OperationMetadata.verify|verify} messages. + * @param message OperationMetadata message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IPosition, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.cloud.vision.v1p4beta1.IOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Position message from the specified reader or buffer. + * Decodes an OperationMetadata message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Position + * @returns OperationMetadata * @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.vision.v1p4beta1.Position; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.vision.v1p4beta1.OperationMetadata; /** - * Decodes a Position message from the specified reader or buffer, length delimited. + * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Position + * @returns OperationMetadata * @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.vision.v1p4beta1.Position; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.vision.v1p4beta1.OperationMetadata; /** - * Verifies a Position message. + * Verifies an OperationMetadata 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 Position message from a plain object. Also converts values to their respective internal types. + * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Position + * @returns OperationMetadata */ - public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.Position; + public static fromObject(object: { [k: string]: any }): google.cloud.vision.v1p4beta1.OperationMetadata; /** - * Creates a plain object from a Position message. Also converts values to other types if specified. - * @param message Position + * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. + * @param message OperationMetadata * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.cloud.vision.v1p4beta1.Position, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.cloud.vision.v1p4beta1.OperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Position to JSON. + * Converts this OperationMetadata to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; } + namespace OperationMetadata { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + CREATED = 1, + RUNNING = 2, + DONE = 3, + CANCELLED = 4 + } + } + /** Properties of a ProductSearchParams. */ interface IProductSearchParams { diff --git a/packages/google-cloud-vision/protos/protos.js b/packages/google-cloud-vision/protos/protos.js index 2f9b3fb1ef2..b963f78c69a 100644 --- a/packages/google-cloud-vision/protos/protos.js +++ b/packages/google-cloud-vision/protos/protos.js @@ -66,193 +66,25 @@ */ var v1 = {}; - v1.ImageAnnotator = (function() { - - /** - * Constructs a new ImageAnnotator service. - * @memberof google.cloud.vision.v1 - * @classdesc Represents an ImageAnnotator - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function ImageAnnotator(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (ImageAnnotator.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ImageAnnotator; - - /** - * Creates new ImageAnnotator service using the specified rpc implementation. - * @function create - * @memberof google.cloud.vision.v1.ImageAnnotator - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {ImageAnnotator} RPC service. Useful where requests and/or responses are streamed. - */ - ImageAnnotator.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.vision.v1.ImageAnnotator#batchAnnotateImages}. - * @memberof google.cloud.vision.v1.ImageAnnotator - * @typedef BatchAnnotateImagesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1.BatchAnnotateImagesResponse} [response] BatchAnnotateImagesResponse - */ - - /** - * Calls BatchAnnotateImages. - * @function batchAnnotateImages - * @memberof google.cloud.vision.v1.ImageAnnotator - * @instance - * @param {google.cloud.vision.v1.IBatchAnnotateImagesRequest} request BatchAnnotateImagesRequest message or plain object - * @param {google.cloud.vision.v1.ImageAnnotator.BatchAnnotateImagesCallback} callback Node-style callback called with the error, if any, and BatchAnnotateImagesResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ImageAnnotator.prototype.batchAnnotateImages = function batchAnnotateImages(request, callback) { - return this.rpcCall(batchAnnotateImages, $root.google.cloud.vision.v1.BatchAnnotateImagesRequest, $root.google.cloud.vision.v1.BatchAnnotateImagesResponse, request, callback); - }, "name", { value: "BatchAnnotateImages" }); - - /** - * Calls BatchAnnotateImages. - * @function batchAnnotateImages - * @memberof google.cloud.vision.v1.ImageAnnotator - * @instance - * @param {google.cloud.vision.v1.IBatchAnnotateImagesRequest} request BatchAnnotateImagesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1.ImageAnnotator#batchAnnotateFiles}. - * @memberof google.cloud.vision.v1.ImageAnnotator - * @typedef BatchAnnotateFilesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1.BatchAnnotateFilesResponse} [response] BatchAnnotateFilesResponse - */ - - /** - * Calls BatchAnnotateFiles. - * @function batchAnnotateFiles - * @memberof google.cloud.vision.v1.ImageAnnotator - * @instance - * @param {google.cloud.vision.v1.IBatchAnnotateFilesRequest} request BatchAnnotateFilesRequest message or plain object - * @param {google.cloud.vision.v1.ImageAnnotator.BatchAnnotateFilesCallback} callback Node-style callback called with the error, if any, and BatchAnnotateFilesResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ImageAnnotator.prototype.batchAnnotateFiles = function batchAnnotateFiles(request, callback) { - return this.rpcCall(batchAnnotateFiles, $root.google.cloud.vision.v1.BatchAnnotateFilesRequest, $root.google.cloud.vision.v1.BatchAnnotateFilesResponse, request, callback); - }, "name", { value: "BatchAnnotateFiles" }); - - /** - * Calls BatchAnnotateFiles. - * @function batchAnnotateFiles - * @memberof google.cloud.vision.v1.ImageAnnotator - * @instance - * @param {google.cloud.vision.v1.IBatchAnnotateFilesRequest} request BatchAnnotateFilesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1.ImageAnnotator#asyncBatchAnnotateImages}. - * @memberof google.cloud.vision.v1.ImageAnnotator - * @typedef AsyncBatchAnnotateImagesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls AsyncBatchAnnotateImages. - * @function asyncBatchAnnotateImages - * @memberof google.cloud.vision.v1.ImageAnnotator - * @instance - * @param {google.cloud.vision.v1.IAsyncBatchAnnotateImagesRequest} request AsyncBatchAnnotateImagesRequest message or plain object - * @param {google.cloud.vision.v1.ImageAnnotator.AsyncBatchAnnotateImagesCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ImageAnnotator.prototype.asyncBatchAnnotateImages = function asyncBatchAnnotateImages(request, callback) { - return this.rpcCall(asyncBatchAnnotateImages, $root.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "AsyncBatchAnnotateImages" }); - - /** - * Calls AsyncBatchAnnotateImages. - * @function asyncBatchAnnotateImages - * @memberof google.cloud.vision.v1.ImageAnnotator - * @instance - * @param {google.cloud.vision.v1.IAsyncBatchAnnotateImagesRequest} request AsyncBatchAnnotateImagesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1.ImageAnnotator#asyncBatchAnnotateFiles}. - * @memberof google.cloud.vision.v1.ImageAnnotator - * @typedef AsyncBatchAnnotateFilesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls AsyncBatchAnnotateFiles. - * @function asyncBatchAnnotateFiles - * @memberof google.cloud.vision.v1.ImageAnnotator - * @instance - * @param {google.cloud.vision.v1.IAsyncBatchAnnotateFilesRequest} request AsyncBatchAnnotateFilesRequest message or plain object - * @param {google.cloud.vision.v1.ImageAnnotator.AsyncBatchAnnotateFilesCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ImageAnnotator.prototype.asyncBatchAnnotateFiles = function asyncBatchAnnotateFiles(request, callback) { - return this.rpcCall(asyncBatchAnnotateFiles, $root.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "AsyncBatchAnnotateFiles" }); - - /** - * Calls AsyncBatchAnnotateFiles. - * @function asyncBatchAnnotateFiles - * @memberof google.cloud.vision.v1.ImageAnnotator - * @instance - * @param {google.cloud.vision.v1.IAsyncBatchAnnotateFilesRequest} request AsyncBatchAnnotateFilesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return ImageAnnotator; - })(); - - v1.Feature = (function() { + v1.Vertex = (function() { /** - * Properties of a Feature. + * Properties of a Vertex. * @memberof google.cloud.vision.v1 - * @interface IFeature - * @property {google.cloud.vision.v1.Feature.Type|null} [type] Feature type - * @property {number|null} [maxResults] Feature maxResults - * @property {string|null} [model] Feature model + * @interface IVertex + * @property {number|null} [x] Vertex x + * @property {number|null} [y] Vertex y */ /** - * Constructs a new Feature. + * Constructs a new Vertex. * @memberof google.cloud.vision.v1 - * @classdesc Represents a Feature. - * @implements IFeature + * @classdesc Represents a Vertex. + * @implements IVertex * @constructor - * @param {google.cloud.vision.v1.IFeature=} [properties] Properties to set + * @param {google.cloud.vision.v1.IVertex=} [properties] Properties to set */ - function Feature(properties) { + function Vertex(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -260,101 +92,88 @@ } /** - * Feature type. - * @member {google.cloud.vision.v1.Feature.Type} type - * @memberof google.cloud.vision.v1.Feature - * @instance - */ - Feature.prototype.type = 0; - - /** - * Feature maxResults. - * @member {number} maxResults - * @memberof google.cloud.vision.v1.Feature + * Vertex x. + * @member {number} x + * @memberof google.cloud.vision.v1.Vertex * @instance */ - Feature.prototype.maxResults = 0; + Vertex.prototype.x = 0; /** - * Feature model. - * @member {string} model - * @memberof google.cloud.vision.v1.Feature + * Vertex y. + * @member {number} y + * @memberof google.cloud.vision.v1.Vertex * @instance */ - Feature.prototype.model = ""; + Vertex.prototype.y = 0; /** - * Creates a new Feature instance using the specified properties. + * Creates a new Vertex instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.Feature + * @memberof google.cloud.vision.v1.Vertex * @static - * @param {google.cloud.vision.v1.IFeature=} [properties] Properties to set - * @returns {google.cloud.vision.v1.Feature} Feature instance + * @param {google.cloud.vision.v1.IVertex=} [properties] Properties to set + * @returns {google.cloud.vision.v1.Vertex} Vertex instance */ - Feature.create = function create(properties) { - return new Feature(properties); + Vertex.create = function create(properties) { + return new Vertex(properties); }; /** - * Encodes the specified Feature message. Does not implicitly {@link google.cloud.vision.v1.Feature.verify|verify} messages. + * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.vision.v1.Vertex.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.Feature + * @memberof google.cloud.vision.v1.Vertex * @static - * @param {google.cloud.vision.v1.IFeature} message Feature message or plain object to encode + * @param {google.cloud.vision.v1.IVertex} message Vertex message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Feature.encode = function encode(message, writer) { + Vertex.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.type != null && message.hasOwnProperty("type")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); - if (message.maxResults != null && message.hasOwnProperty("maxResults")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.maxResults); - if (message.model != null && message.hasOwnProperty("model")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.model); + if (message.x != null && message.hasOwnProperty("x")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.x); + if (message.y != null && message.hasOwnProperty("y")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.y); return writer; }; /** - * Encodes the specified Feature message, length delimited. Does not implicitly {@link google.cloud.vision.v1.Feature.verify|verify} messages. + * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1.Vertex.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.Feature + * @memberof google.cloud.vision.v1.Vertex * @static - * @param {google.cloud.vision.v1.IFeature} message Feature message or plain object to encode + * @param {google.cloud.vision.v1.IVertex} message Vertex message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Feature.encodeDelimited = function encodeDelimited(message, writer) { + Vertex.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Feature message from the specified reader or buffer. + * Decodes a Vertex message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.Feature + * @memberof google.cloud.vision.v1.Vertex * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.Feature} Feature + * @returns {google.cloud.vision.v1.Vertex} Vertex * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Feature.decode = function decode(reader, length) { + Vertex.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.vision.v1.Feature(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.Vertex(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.type = reader.int32(); + message.x = reader.int32(); break; case 2: - message.maxResults = reader.int32(); - break; - case 3: - message.model = reader.string(); + message.y = reader.int32(); break; default: reader.skipType(tag & 7); @@ -365,229 +184,117 @@ }; /** - * Decodes a Feature message from the specified reader or buffer, length delimited. + * Decodes a Vertex message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.Feature + * @memberof google.cloud.vision.v1.Vertex * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.Feature} Feature + * @returns {google.cloud.vision.v1.Vertex} Vertex * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Feature.decodeDelimited = function decodeDelimited(reader) { + Vertex.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Feature message. + * Verifies a Vertex message. * @function verify - * @memberof google.cloud.vision.v1.Feature + * @memberof google.cloud.vision.v1.Vertex * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Feature.verify = function verify(message) { + Vertex.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 11: - case 6: - case 7: - case 9: - case 10: - case 12: - case 19: - break; - } - if (message.maxResults != null && message.hasOwnProperty("maxResults")) - if (!$util.isInteger(message.maxResults)) - return "maxResults: integer expected"; - if (message.model != null && message.hasOwnProperty("model")) - if (!$util.isString(message.model)) - return "model: string expected"; + if (message.x != null && message.hasOwnProperty("x")) + if (!$util.isInteger(message.x)) + return "x: integer expected"; + if (message.y != null && message.hasOwnProperty("y")) + if (!$util.isInteger(message.y)) + return "y: integer expected"; return null; }; /** - * Creates a Feature message from a plain object. Also converts values to their respective internal types. + * Creates a Vertex message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.Feature + * @memberof google.cloud.vision.v1.Vertex * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.Feature} Feature + * @returns {google.cloud.vision.v1.Vertex} Vertex */ - Feature.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.Feature) + Vertex.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.Vertex) return object; - var message = new $root.google.cloud.vision.v1.Feature(); - switch (object.type) { - case "TYPE_UNSPECIFIED": - case 0: - message.type = 0; - break; - case "FACE_DETECTION": - case 1: - message.type = 1; - break; - case "LANDMARK_DETECTION": - case 2: - message.type = 2; - break; - case "LOGO_DETECTION": - case 3: - message.type = 3; - break; - case "LABEL_DETECTION": - case 4: - message.type = 4; - break; - case "TEXT_DETECTION": - case 5: - message.type = 5; - break; - case "DOCUMENT_TEXT_DETECTION": - case 11: - message.type = 11; - break; - case "SAFE_SEARCH_DETECTION": - case 6: - message.type = 6; - break; - case "IMAGE_PROPERTIES": - case 7: - message.type = 7; - break; - case "CROP_HINTS": - case 9: - message.type = 9; - break; - case "WEB_DETECTION": - case 10: - message.type = 10; - break; - case "PRODUCT_SEARCH": - case 12: - message.type = 12; - break; - case "OBJECT_LOCALIZATION": - case 19: - message.type = 19; - break; - } - if (object.maxResults != null) - message.maxResults = object.maxResults | 0; - if (object.model != null) - message.model = String(object.model); + var message = new $root.google.cloud.vision.v1.Vertex(); + if (object.x != null) + message.x = object.x | 0; + if (object.y != null) + message.y = object.y | 0; return message; }; /** - * Creates a plain object from a Feature message. Also converts values to other types if specified. + * Creates a plain object from a Vertex message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.Feature + * @memberof google.cloud.vision.v1.Vertex * @static - * @param {google.cloud.vision.v1.Feature} message Feature + * @param {google.cloud.vision.v1.Vertex} message Vertex * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Feature.toObject = function toObject(message, options) { + Vertex.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; - object.maxResults = 0; - object.model = ""; + object.x = 0; + object.y = 0; } - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.vision.v1.Feature.Type[message.type] : message.type; - if (message.maxResults != null && message.hasOwnProperty("maxResults")) - object.maxResults = message.maxResults; - if (message.model != null && message.hasOwnProperty("model")) - object.model = message.model; + if (message.x != null && message.hasOwnProperty("x")) + object.x = message.x; + if (message.y != null && message.hasOwnProperty("y")) + object.y = message.y; return object; }; /** - * Converts this Feature to JSON. + * Converts this Vertex to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.Feature + * @memberof google.cloud.vision.v1.Vertex * @instance * @returns {Object.} JSON object */ - Feature.prototype.toJSON = function toJSON() { + Vertex.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * Type enum. - * @name google.cloud.vision.v1.Feature.Type - * @enum {string} - * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value - * @property {number} FACE_DETECTION=1 FACE_DETECTION value - * @property {number} LANDMARK_DETECTION=2 LANDMARK_DETECTION value - * @property {number} LOGO_DETECTION=3 LOGO_DETECTION value - * @property {number} LABEL_DETECTION=4 LABEL_DETECTION value - * @property {number} TEXT_DETECTION=5 TEXT_DETECTION value - * @property {number} DOCUMENT_TEXT_DETECTION=11 DOCUMENT_TEXT_DETECTION value - * @property {number} SAFE_SEARCH_DETECTION=6 SAFE_SEARCH_DETECTION value - * @property {number} IMAGE_PROPERTIES=7 IMAGE_PROPERTIES value - * @property {number} CROP_HINTS=9 CROP_HINTS value - * @property {number} WEB_DETECTION=10 WEB_DETECTION value - * @property {number} PRODUCT_SEARCH=12 PRODUCT_SEARCH value - * @property {number} OBJECT_LOCALIZATION=19 OBJECT_LOCALIZATION value - */ - Feature.Type = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "FACE_DETECTION"] = 1; - values[valuesById[2] = "LANDMARK_DETECTION"] = 2; - values[valuesById[3] = "LOGO_DETECTION"] = 3; - values[valuesById[4] = "LABEL_DETECTION"] = 4; - values[valuesById[5] = "TEXT_DETECTION"] = 5; - values[valuesById[11] = "DOCUMENT_TEXT_DETECTION"] = 11; - values[valuesById[6] = "SAFE_SEARCH_DETECTION"] = 6; - values[valuesById[7] = "IMAGE_PROPERTIES"] = 7; - values[valuesById[9] = "CROP_HINTS"] = 9; - values[valuesById[10] = "WEB_DETECTION"] = 10; - values[valuesById[12] = "PRODUCT_SEARCH"] = 12; - values[valuesById[19] = "OBJECT_LOCALIZATION"] = 19; - return values; - })(); - - return Feature; + return Vertex; })(); - v1.ImageSource = (function() { + v1.NormalizedVertex = (function() { /** - * Properties of an ImageSource. + * Properties of a NormalizedVertex. * @memberof google.cloud.vision.v1 - * @interface IImageSource - * @property {string|null} [gcsImageUri] ImageSource gcsImageUri - * @property {string|null} [imageUri] ImageSource imageUri + * @interface INormalizedVertex + * @property {number|null} [x] NormalizedVertex x + * @property {number|null} [y] NormalizedVertex y */ /** - * Constructs a new ImageSource. + * Constructs a new NormalizedVertex. * @memberof google.cloud.vision.v1 - * @classdesc Represents an ImageSource. - * @implements IImageSource + * @classdesc Represents a NormalizedVertex. + * @implements INormalizedVertex * @constructor - * @param {google.cloud.vision.v1.IImageSource=} [properties] Properties to set + * @param {google.cloud.vision.v1.INormalizedVertex=} [properties] Properties to set */ - function ImageSource(properties) { + function NormalizedVertex(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -595,88 +302,88 @@ } /** - * ImageSource gcsImageUri. - * @member {string} gcsImageUri - * @memberof google.cloud.vision.v1.ImageSource + * NormalizedVertex x. + * @member {number} x + * @memberof google.cloud.vision.v1.NormalizedVertex * @instance */ - ImageSource.prototype.gcsImageUri = ""; + NormalizedVertex.prototype.x = 0; /** - * ImageSource imageUri. - * @member {string} imageUri - * @memberof google.cloud.vision.v1.ImageSource + * NormalizedVertex y. + * @member {number} y + * @memberof google.cloud.vision.v1.NormalizedVertex * @instance */ - ImageSource.prototype.imageUri = ""; + NormalizedVertex.prototype.y = 0; /** - * Creates a new ImageSource instance using the specified properties. + * Creates a new NormalizedVertex instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.ImageSource + * @memberof google.cloud.vision.v1.NormalizedVertex * @static - * @param {google.cloud.vision.v1.IImageSource=} [properties] Properties to set - * @returns {google.cloud.vision.v1.ImageSource} ImageSource instance + * @param {google.cloud.vision.v1.INormalizedVertex=} [properties] Properties to set + * @returns {google.cloud.vision.v1.NormalizedVertex} NormalizedVertex instance */ - ImageSource.create = function create(properties) { - return new ImageSource(properties); + NormalizedVertex.create = function create(properties) { + return new NormalizedVertex(properties); }; /** - * Encodes the specified ImageSource message. Does not implicitly {@link google.cloud.vision.v1.ImageSource.verify|verify} messages. + * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.vision.v1.NormalizedVertex.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.ImageSource + * @memberof google.cloud.vision.v1.NormalizedVertex * @static - * @param {google.cloud.vision.v1.IImageSource} message ImageSource message or plain object to encode + * @param {google.cloud.vision.v1.INormalizedVertex} message NormalizedVertex message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageSource.encode = function encode(message, writer) { + NormalizedVertex.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.gcsImageUri != null && message.hasOwnProperty("gcsImageUri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsImageUri); - if (message.imageUri != null && message.hasOwnProperty("imageUri")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.imageUri); + if (message.x != null && message.hasOwnProperty("x")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); + if (message.y != null && message.hasOwnProperty("y")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); return writer; }; /** - * Encodes the specified ImageSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ImageSource.verify|verify} messages. + * Encodes the specified NormalizedVertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1.NormalizedVertex.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.ImageSource + * @memberof google.cloud.vision.v1.NormalizedVertex * @static - * @param {google.cloud.vision.v1.IImageSource} message ImageSource message or plain object to encode + * @param {google.cloud.vision.v1.INormalizedVertex} message NormalizedVertex message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageSource.encodeDelimited = function encodeDelimited(message, writer) { + NormalizedVertex.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImageSource message from the specified reader or buffer. + * Decodes a NormalizedVertex message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.ImageSource + * @memberof google.cloud.vision.v1.NormalizedVertex * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.ImageSource} ImageSource + * @returns {google.cloud.vision.v1.NormalizedVertex} NormalizedVertex * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageSource.decode = function decode(reader, length) { + NormalizedVertex.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.vision.v1.ImageSource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.NormalizedVertex(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.gcsImageUri = reader.string(); + message.x = reader.float(); break; case 2: - message.imageUri = reader.string(); + message.y = reader.float(); break; default: reader.skipType(tag & 7); @@ -687,117 +394,119 @@ }; /** - * Decodes an ImageSource message from the specified reader or buffer, length delimited. + * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.ImageSource + * @memberof google.cloud.vision.v1.NormalizedVertex * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.ImageSource} ImageSource + * @returns {google.cloud.vision.v1.NormalizedVertex} NormalizedVertex * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageSource.decodeDelimited = function decodeDelimited(reader) { + NormalizedVertex.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImageSource message. + * Verifies a NormalizedVertex message. * @function verify - * @memberof google.cloud.vision.v1.ImageSource + * @memberof google.cloud.vision.v1.NormalizedVertex * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImageSource.verify = function verify(message) { + NormalizedVertex.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.gcsImageUri != null && message.hasOwnProperty("gcsImageUri")) - if (!$util.isString(message.gcsImageUri)) - return "gcsImageUri: string expected"; - if (message.imageUri != null && message.hasOwnProperty("imageUri")) - if (!$util.isString(message.imageUri)) - return "imageUri: string expected"; + if (message.x != null && message.hasOwnProperty("x")) + if (typeof message.x !== "number") + return "x: number expected"; + if (message.y != null && message.hasOwnProperty("y")) + if (typeof message.y !== "number") + return "y: number expected"; return null; }; /** - * Creates an ImageSource message from a plain object. Also converts values to their respective internal types. + * Creates a NormalizedVertex message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.ImageSource + * @memberof google.cloud.vision.v1.NormalizedVertex * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.ImageSource} ImageSource + * @returns {google.cloud.vision.v1.NormalizedVertex} NormalizedVertex */ - ImageSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.ImageSource) + NormalizedVertex.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.NormalizedVertex) return object; - var message = new $root.google.cloud.vision.v1.ImageSource(); - if (object.gcsImageUri != null) - message.gcsImageUri = String(object.gcsImageUri); - if (object.imageUri != null) - message.imageUri = String(object.imageUri); + var message = new $root.google.cloud.vision.v1.NormalizedVertex(); + if (object.x != null) + message.x = Number(object.x); + if (object.y != null) + message.y = Number(object.y); return message; }; /** - * Creates a plain object from an ImageSource message. Also converts values to other types if specified. + * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.ImageSource + * @memberof google.cloud.vision.v1.NormalizedVertex * @static - * @param {google.cloud.vision.v1.ImageSource} message ImageSource + * @param {google.cloud.vision.v1.NormalizedVertex} message NormalizedVertex * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImageSource.toObject = function toObject(message, options) { + NormalizedVertex.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.gcsImageUri = ""; - object.imageUri = ""; + object.x = 0; + object.y = 0; } - if (message.gcsImageUri != null && message.hasOwnProperty("gcsImageUri")) - object.gcsImageUri = message.gcsImageUri; - if (message.imageUri != null && message.hasOwnProperty("imageUri")) - object.imageUri = message.imageUri; + if (message.x != null && message.hasOwnProperty("x")) + object.x = options.json && !isFinite(message.x) ? String(message.x) : message.x; + if (message.y != null && message.hasOwnProperty("y")) + object.y = options.json && !isFinite(message.y) ? String(message.y) : message.y; return object; }; /** - * Converts this ImageSource to JSON. + * Converts this NormalizedVertex to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.ImageSource + * @memberof google.cloud.vision.v1.NormalizedVertex * @instance * @returns {Object.} JSON object */ - ImageSource.prototype.toJSON = function toJSON() { + NormalizedVertex.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImageSource; + return NormalizedVertex; })(); - v1.Image = (function() { + v1.BoundingPoly = (function() { /** - * Properties of an Image. + * Properties of a BoundingPoly. * @memberof google.cloud.vision.v1 - * @interface IImage - * @property {Uint8Array|null} [content] Image content - * @property {google.cloud.vision.v1.IImageSource|null} [source] Image source + * @interface IBoundingPoly + * @property {Array.|null} [vertices] BoundingPoly vertices + * @property {Array.|null} [normalizedVertices] BoundingPoly normalizedVertices */ /** - * Constructs a new Image. + * Constructs a new BoundingPoly. * @memberof google.cloud.vision.v1 - * @classdesc Represents an Image. - * @implements IImage + * @classdesc Represents a BoundingPoly. + * @implements IBoundingPoly * @constructor - * @param {google.cloud.vision.v1.IImage=} [properties] Properties to set + * @param {google.cloud.vision.v1.IBoundingPoly=} [properties] Properties to set */ - function Image(properties) { + function BoundingPoly(properties) { + this.vertices = []; + this.normalizedVertices = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -805,88 +514,94 @@ } /** - * Image content. - * @member {Uint8Array} content - * @memberof google.cloud.vision.v1.Image + * BoundingPoly vertices. + * @member {Array.} vertices + * @memberof google.cloud.vision.v1.BoundingPoly * @instance */ - Image.prototype.content = $util.newBuffer([]); + BoundingPoly.prototype.vertices = $util.emptyArray; /** - * Image source. - * @member {google.cloud.vision.v1.IImageSource|null|undefined} source - * @memberof google.cloud.vision.v1.Image + * BoundingPoly normalizedVertices. + * @member {Array.} normalizedVertices + * @memberof google.cloud.vision.v1.BoundingPoly * @instance */ - Image.prototype.source = null; + BoundingPoly.prototype.normalizedVertices = $util.emptyArray; /** - * Creates a new Image instance using the specified properties. + * Creates a new BoundingPoly instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.Image + * @memberof google.cloud.vision.v1.BoundingPoly * @static - * @param {google.cloud.vision.v1.IImage=} [properties] Properties to set - * @returns {google.cloud.vision.v1.Image} Image instance + * @param {google.cloud.vision.v1.IBoundingPoly=} [properties] Properties to set + * @returns {google.cloud.vision.v1.BoundingPoly} BoundingPoly instance */ - Image.create = function create(properties) { - return new Image(properties); + BoundingPoly.create = function create(properties) { + return new BoundingPoly(properties); }; /** - * Encodes the specified Image message. Does not implicitly {@link google.cloud.vision.v1.Image.verify|verify} messages. + * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.vision.v1.BoundingPoly.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.Image + * @memberof google.cloud.vision.v1.BoundingPoly * @static - * @param {google.cloud.vision.v1.IImage} message Image message or plain object to encode + * @param {google.cloud.vision.v1.IBoundingPoly} message BoundingPoly message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Image.encode = function encode(message, writer) { + BoundingPoly.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.content != null && message.hasOwnProperty("content")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.content); - if (message.source != null && message.hasOwnProperty("source")) - $root.google.cloud.vision.v1.ImageSource.encode(message.source, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.vertices != null && message.vertices.length) + for (var i = 0; i < message.vertices.length; ++i) + $root.google.cloud.vision.v1.Vertex.encode(message.vertices[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.normalizedVertices != null && message.normalizedVertices.length) + for (var i = 0; i < message.normalizedVertices.length; ++i) + $root.google.cloud.vision.v1.NormalizedVertex.encode(message.normalizedVertices[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.vision.v1.Image.verify|verify} messages. + * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.vision.v1.BoundingPoly.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.Image + * @memberof google.cloud.vision.v1.BoundingPoly * @static - * @param {google.cloud.vision.v1.IImage} message Image message or plain object to encode + * @param {google.cloud.vision.v1.IBoundingPoly} message BoundingPoly message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Image.encodeDelimited = function encodeDelimited(message, writer) { + BoundingPoly.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Image message from the specified reader or buffer. + * Decodes a BoundingPoly message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.Image + * @memberof google.cloud.vision.v1.BoundingPoly * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.Image} Image + * @returns {google.cloud.vision.v1.BoundingPoly} BoundingPoly * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Image.decode = function decode(reader, length) { + BoundingPoly.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.vision.v1.Image(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.BoundingPoly(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.content = reader.bytes(); + if (!(message.vertices && message.vertices.length)) + message.vertices = []; + message.vertices.push($root.google.cloud.vision.v1.Vertex.decode(reader, reader.uint32())); break; case 2: - message.source = $root.google.cloud.vision.v1.ImageSource.decode(reader, reader.uint32()); + if (!(message.normalizedVertices && message.normalizedVertices.length)) + message.normalizedVertices = []; + message.normalizedVertices.push($root.google.cloud.vision.v1.NormalizedVertex.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -897,167 +612,152 @@ }; /** - * Decodes an Image message from the specified reader or buffer, length delimited. + * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.Image + * @memberof google.cloud.vision.v1.BoundingPoly * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.Image} Image + * @returns {google.cloud.vision.v1.BoundingPoly} BoundingPoly * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Image.decodeDelimited = function decodeDelimited(reader) { + BoundingPoly.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Image message. + * Verifies a BoundingPoly message. * @function verify - * @memberof google.cloud.vision.v1.Image + * @memberof google.cloud.vision.v1.BoundingPoly * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Image.verify = function verify(message) { + BoundingPoly.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.content != null && message.hasOwnProperty("content")) - if (!(message.content && typeof message.content.length === "number" || $util.isString(message.content))) - return "content: buffer expected"; - if (message.source != null && message.hasOwnProperty("source")) { - var error = $root.google.cloud.vision.v1.ImageSource.verify(message.source); - if (error) - return "source." + error; + if (message.vertices != null && message.hasOwnProperty("vertices")) { + if (!Array.isArray(message.vertices)) + return "vertices: array expected"; + for (var i = 0; i < message.vertices.length; ++i) { + var error = $root.google.cloud.vision.v1.Vertex.verify(message.vertices[i]); + if (error) + return "vertices." + error; + } + } + if (message.normalizedVertices != null && message.hasOwnProperty("normalizedVertices")) { + if (!Array.isArray(message.normalizedVertices)) + return "normalizedVertices: array expected"; + for (var i = 0; i < message.normalizedVertices.length; ++i) { + var error = $root.google.cloud.vision.v1.NormalizedVertex.verify(message.normalizedVertices[i]); + if (error) + return "normalizedVertices." + error; + } } return null; }; /** - * Creates an Image message from a plain object. Also converts values to their respective internal types. + * Creates a BoundingPoly message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.Image + * @memberof google.cloud.vision.v1.BoundingPoly * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.Image} Image + * @returns {google.cloud.vision.v1.BoundingPoly} BoundingPoly */ - Image.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.Image) + BoundingPoly.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.BoundingPoly) return object; - var message = new $root.google.cloud.vision.v1.Image(); - if (object.content != null) - if (typeof object.content === "string") - $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); - else if (object.content.length) - message.content = object.content; - if (object.source != null) { - if (typeof object.source !== "object") - throw TypeError(".google.cloud.vision.v1.Image.source: object expected"); - message.source = $root.google.cloud.vision.v1.ImageSource.fromObject(object.source); + var message = new $root.google.cloud.vision.v1.BoundingPoly(); + if (object.vertices) { + if (!Array.isArray(object.vertices)) + throw TypeError(".google.cloud.vision.v1.BoundingPoly.vertices: array expected"); + message.vertices = []; + for (var i = 0; i < object.vertices.length; ++i) { + if (typeof object.vertices[i] !== "object") + throw TypeError(".google.cloud.vision.v1.BoundingPoly.vertices: object expected"); + message.vertices[i] = $root.google.cloud.vision.v1.Vertex.fromObject(object.vertices[i]); + } + } + if (object.normalizedVertices) { + if (!Array.isArray(object.normalizedVertices)) + throw TypeError(".google.cloud.vision.v1.BoundingPoly.normalizedVertices: array expected"); + message.normalizedVertices = []; + for (var i = 0; i < object.normalizedVertices.length; ++i) { + if (typeof object.normalizedVertices[i] !== "object") + throw TypeError(".google.cloud.vision.v1.BoundingPoly.normalizedVertices: object expected"); + message.normalizedVertices[i] = $root.google.cloud.vision.v1.NormalizedVertex.fromObject(object.normalizedVertices[i]); + } } return message; }; /** - * Creates a plain object from an Image message. Also converts values to other types if specified. + * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.Image + * @memberof google.cloud.vision.v1.BoundingPoly * @static - * @param {google.cloud.vision.v1.Image} message Image + * @param {google.cloud.vision.v1.BoundingPoly} message BoundingPoly * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Image.toObject = function toObject(message, options) { + BoundingPoly.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - if (options.bytes === String) - object.content = ""; - else { - object.content = []; - if (options.bytes !== Array) - object.content = $util.newBuffer(object.content); - } - object.source = null; + if (options.arrays || options.defaults) { + object.vertices = []; + object.normalizedVertices = []; + } + if (message.vertices && message.vertices.length) { + object.vertices = []; + for (var j = 0; j < message.vertices.length; ++j) + object.vertices[j] = $root.google.cloud.vision.v1.Vertex.toObject(message.vertices[j], options); + } + if (message.normalizedVertices && message.normalizedVertices.length) { + object.normalizedVertices = []; + for (var j = 0; j < message.normalizedVertices.length; ++j) + object.normalizedVertices[j] = $root.google.cloud.vision.v1.NormalizedVertex.toObject(message.normalizedVertices[j], options); } - if (message.content != null && message.hasOwnProperty("content")) - object.content = options.bytes === String ? $util.base64.encode(message.content, 0, message.content.length) : options.bytes === Array ? Array.prototype.slice.call(message.content) : message.content; - if (message.source != null && message.hasOwnProperty("source")) - object.source = $root.google.cloud.vision.v1.ImageSource.toObject(message.source, options); return object; }; /** - * Converts this Image to JSON. + * Converts this BoundingPoly to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.Image + * @memberof google.cloud.vision.v1.BoundingPoly * @instance * @returns {Object.} JSON object */ - Image.prototype.toJSON = function toJSON() { + BoundingPoly.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Image; - })(); - - /** - * Likelihood enum. - * @name google.cloud.vision.v1.Likelihood - * @enum {string} - * @property {number} UNKNOWN=0 UNKNOWN value - * @property {number} VERY_UNLIKELY=1 VERY_UNLIKELY value - * @property {number} UNLIKELY=2 UNLIKELY value - * @property {number} POSSIBLE=3 POSSIBLE value - * @property {number} LIKELY=4 LIKELY value - * @property {number} VERY_LIKELY=5 VERY_LIKELY value - */ - v1.Likelihood = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "UNKNOWN"] = 0; - values[valuesById[1] = "VERY_UNLIKELY"] = 1; - values[valuesById[2] = "UNLIKELY"] = 2; - values[valuesById[3] = "POSSIBLE"] = 3; - values[valuesById[4] = "LIKELY"] = 4; - values[valuesById[5] = "VERY_LIKELY"] = 5; - return values; + return BoundingPoly; })(); - v1.FaceAnnotation = (function() { + v1.Position = (function() { /** - * Properties of a FaceAnnotation. + * Properties of a Position. * @memberof google.cloud.vision.v1 - * @interface IFaceAnnotation - * @property {google.cloud.vision.v1.IBoundingPoly|null} [boundingPoly] FaceAnnotation boundingPoly - * @property {google.cloud.vision.v1.IBoundingPoly|null} [fdBoundingPoly] FaceAnnotation fdBoundingPoly - * @property {Array.|null} [landmarks] FaceAnnotation landmarks - * @property {number|null} [rollAngle] FaceAnnotation rollAngle - * @property {number|null} [panAngle] FaceAnnotation panAngle - * @property {number|null} [tiltAngle] FaceAnnotation tiltAngle - * @property {number|null} [detectionConfidence] FaceAnnotation detectionConfidence - * @property {number|null} [landmarkingConfidence] FaceAnnotation landmarkingConfidence - * @property {google.cloud.vision.v1.Likelihood|null} [joyLikelihood] FaceAnnotation joyLikelihood - * @property {google.cloud.vision.v1.Likelihood|null} [sorrowLikelihood] FaceAnnotation sorrowLikelihood - * @property {google.cloud.vision.v1.Likelihood|null} [angerLikelihood] FaceAnnotation angerLikelihood - * @property {google.cloud.vision.v1.Likelihood|null} [surpriseLikelihood] FaceAnnotation surpriseLikelihood - * @property {google.cloud.vision.v1.Likelihood|null} [underExposedLikelihood] FaceAnnotation underExposedLikelihood - * @property {google.cloud.vision.v1.Likelihood|null} [blurredLikelihood] FaceAnnotation blurredLikelihood - * @property {google.cloud.vision.v1.Likelihood|null} [headwearLikelihood] FaceAnnotation headwearLikelihood + * @interface IPosition + * @property {number|null} [x] Position x + * @property {number|null} [y] Position y + * @property {number|null} [z] Position z */ /** - * Constructs a new FaceAnnotation. + * Constructs a new Position. * @memberof google.cloud.vision.v1 - * @classdesc Represents a FaceAnnotation. - * @implements IFaceAnnotation + * @classdesc Represents a Position. + * @implements IPosition * @constructor - * @param {google.cloud.vision.v1.IFaceAnnotation=} [properties] Properties to set + * @param {google.cloud.vision.v1.IPosition=} [properties] Properties to set */ - function FaceAnnotation(properties) { - this.landmarks = []; + function Position(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -1065,260 +765,500 @@ } /** - * FaceAnnotation boundingPoly. - * @member {google.cloud.vision.v1.IBoundingPoly|null|undefined} boundingPoly - * @memberof google.cloud.vision.v1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.boundingPoly = null; - - /** - * FaceAnnotation fdBoundingPoly. - * @member {google.cloud.vision.v1.IBoundingPoly|null|undefined} fdBoundingPoly - * @memberof google.cloud.vision.v1.FaceAnnotation + * Position x. + * @member {number} x + * @memberof google.cloud.vision.v1.Position * @instance */ - FaceAnnotation.prototype.fdBoundingPoly = null; + Position.prototype.x = 0; /** - * FaceAnnotation landmarks. - * @member {Array.} landmarks - * @memberof google.cloud.vision.v1.FaceAnnotation + * Position y. + * @member {number} y + * @memberof google.cloud.vision.v1.Position * @instance */ - FaceAnnotation.prototype.landmarks = $util.emptyArray; + Position.prototype.y = 0; /** - * FaceAnnotation rollAngle. - * @member {number} rollAngle - * @memberof google.cloud.vision.v1.FaceAnnotation + * Position z. + * @member {number} z + * @memberof google.cloud.vision.v1.Position * @instance */ - FaceAnnotation.prototype.rollAngle = 0; + Position.prototype.z = 0; /** - * FaceAnnotation panAngle. - * @member {number} panAngle - * @memberof google.cloud.vision.v1.FaceAnnotation - * @instance + * Creates a new Position instance using the specified properties. + * @function create + * @memberof google.cloud.vision.v1.Position + * @static + * @param {google.cloud.vision.v1.IPosition=} [properties] Properties to set + * @returns {google.cloud.vision.v1.Position} Position instance */ - FaceAnnotation.prototype.panAngle = 0; + Position.create = function create(properties) { + return new Position(properties); + }; /** - * FaceAnnotation tiltAngle. - * @member {number} tiltAngle - * @memberof google.cloud.vision.v1.FaceAnnotation - * @instance + * Encodes the specified Position message. Does not implicitly {@link google.cloud.vision.v1.Position.verify|verify} messages. + * @function encode + * @memberof google.cloud.vision.v1.Position + * @static + * @param {google.cloud.vision.v1.IPosition} message Position message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - FaceAnnotation.prototype.tiltAngle = 0; + Position.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.x != null && message.hasOwnProperty("x")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); + if (message.y != null && message.hasOwnProperty("y")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); + if (message.z != null && message.hasOwnProperty("z")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.z); + return writer; + }; /** - * FaceAnnotation detectionConfidence. - * @member {number} detectionConfidence - * @memberof google.cloud.vision.v1.FaceAnnotation - * @instance + * Encodes the specified Position message, length delimited. Does not implicitly {@link google.cloud.vision.v1.Position.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.vision.v1.Position + * @static + * @param {google.cloud.vision.v1.IPosition} message Position message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - FaceAnnotation.prototype.detectionConfidence = 0; + Position.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * FaceAnnotation landmarkingConfidence. - * @member {number} landmarkingConfidence - * @memberof google.cloud.vision.v1.FaceAnnotation - * @instance + * Decodes a Position message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.vision.v1.Position + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.vision.v1.Position} Position + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FaceAnnotation.prototype.landmarkingConfidence = 0; + Position.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.vision.v1.Position(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.x = reader.float(); + break; + case 2: + message.y = reader.float(); + break; + case 3: + message.z = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * FaceAnnotation joyLikelihood. - * @member {google.cloud.vision.v1.Likelihood} joyLikelihood - * @memberof google.cloud.vision.v1.FaceAnnotation - * @instance + * Decodes a Position message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.vision.v1.Position + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.vision.v1.Position} Position + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FaceAnnotation.prototype.joyLikelihood = 0; + Position.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * FaceAnnotation sorrowLikelihood. - * @member {google.cloud.vision.v1.Likelihood} sorrowLikelihood - * @memberof google.cloud.vision.v1.FaceAnnotation + * Verifies a Position message. + * @function verify + * @memberof google.cloud.vision.v1.Position + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Position.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.x != null && message.hasOwnProperty("x")) + if (typeof message.x !== "number") + return "x: number expected"; + if (message.y != null && message.hasOwnProperty("y")) + if (typeof message.y !== "number") + return "y: number expected"; + if (message.z != null && message.hasOwnProperty("z")) + if (typeof message.z !== "number") + return "z: number expected"; + return null; + }; + + /** + * Creates a Position message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.vision.v1.Position + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.vision.v1.Position} Position + */ + Position.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.Position) + return object; + var message = new $root.google.cloud.vision.v1.Position(); + if (object.x != null) + message.x = Number(object.x); + if (object.y != null) + message.y = Number(object.y); + if (object.z != null) + message.z = Number(object.z); + return message; + }; + + /** + * Creates a plain object from a Position message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.vision.v1.Position + * @static + * @param {google.cloud.vision.v1.Position} message Position + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Position.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.x = 0; + object.y = 0; + object.z = 0; + } + if (message.x != null && message.hasOwnProperty("x")) + object.x = options.json && !isFinite(message.x) ? String(message.x) : message.x; + if (message.y != null && message.hasOwnProperty("y")) + object.y = options.json && !isFinite(message.y) ? String(message.y) : message.y; + if (message.z != null && message.hasOwnProperty("z")) + object.z = options.json && !isFinite(message.z) ? String(message.z) : message.z; + return object; + }; + + /** + * Converts this Position to JSON. + * @function toJSON + * @memberof google.cloud.vision.v1.Position * @instance + * @returns {Object.} JSON object */ - FaceAnnotation.prototype.sorrowLikelihood = 0; + Position.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Position; + })(); + + v1.ImageAnnotator = (function() { /** - * FaceAnnotation angerLikelihood. - * @member {google.cloud.vision.v1.Likelihood} angerLikelihood - * @memberof google.cloud.vision.v1.FaceAnnotation + * Constructs a new ImageAnnotator service. + * @memberof google.cloud.vision.v1 + * @classdesc Represents an ImageAnnotator + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function ImageAnnotator(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (ImageAnnotator.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ImageAnnotator; + + /** + * Creates new ImageAnnotator service using the specified rpc implementation. + * @function create + * @memberof google.cloud.vision.v1.ImageAnnotator + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {ImageAnnotator} RPC service. Useful where requests and/or responses are streamed. + */ + ImageAnnotator.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.vision.v1.ImageAnnotator#batchAnnotateImages}. + * @memberof google.cloud.vision.v1.ImageAnnotator + * @typedef BatchAnnotateImagesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.vision.v1.BatchAnnotateImagesResponse} [response] BatchAnnotateImagesResponse + */ + + /** + * Calls BatchAnnotateImages. + * @function batchAnnotateImages + * @memberof google.cloud.vision.v1.ImageAnnotator * @instance + * @param {google.cloud.vision.v1.IBatchAnnotateImagesRequest} request BatchAnnotateImagesRequest message or plain object + * @param {google.cloud.vision.v1.ImageAnnotator.BatchAnnotateImagesCallback} callback Node-style callback called with the error, if any, and BatchAnnotateImagesResponse + * @returns {undefined} + * @variation 1 */ - FaceAnnotation.prototype.angerLikelihood = 0; + Object.defineProperty(ImageAnnotator.prototype.batchAnnotateImages = function batchAnnotateImages(request, callback) { + return this.rpcCall(batchAnnotateImages, $root.google.cloud.vision.v1.BatchAnnotateImagesRequest, $root.google.cloud.vision.v1.BatchAnnotateImagesResponse, request, callback); + }, "name", { value: "BatchAnnotateImages" }); /** - * FaceAnnotation surpriseLikelihood. - * @member {google.cloud.vision.v1.Likelihood} surpriseLikelihood - * @memberof google.cloud.vision.v1.FaceAnnotation + * Calls BatchAnnotateImages. + * @function batchAnnotateImages + * @memberof google.cloud.vision.v1.ImageAnnotator * @instance + * @param {google.cloud.vision.v1.IBatchAnnotateImagesRequest} request BatchAnnotateImagesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - FaceAnnotation.prototype.surpriseLikelihood = 0; /** - * FaceAnnotation underExposedLikelihood. - * @member {google.cloud.vision.v1.Likelihood} underExposedLikelihood - * @memberof google.cloud.vision.v1.FaceAnnotation + * Callback as used by {@link google.cloud.vision.v1.ImageAnnotator#batchAnnotateFiles}. + * @memberof google.cloud.vision.v1.ImageAnnotator + * @typedef BatchAnnotateFilesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.vision.v1.BatchAnnotateFilesResponse} [response] BatchAnnotateFilesResponse + */ + + /** + * Calls BatchAnnotateFiles. + * @function batchAnnotateFiles + * @memberof google.cloud.vision.v1.ImageAnnotator * @instance + * @param {google.cloud.vision.v1.IBatchAnnotateFilesRequest} request BatchAnnotateFilesRequest message or plain object + * @param {google.cloud.vision.v1.ImageAnnotator.BatchAnnotateFilesCallback} callback Node-style callback called with the error, if any, and BatchAnnotateFilesResponse + * @returns {undefined} + * @variation 1 */ - FaceAnnotation.prototype.underExposedLikelihood = 0; + Object.defineProperty(ImageAnnotator.prototype.batchAnnotateFiles = function batchAnnotateFiles(request, callback) { + return this.rpcCall(batchAnnotateFiles, $root.google.cloud.vision.v1.BatchAnnotateFilesRequest, $root.google.cloud.vision.v1.BatchAnnotateFilesResponse, request, callback); + }, "name", { value: "BatchAnnotateFiles" }); /** - * FaceAnnotation blurredLikelihood. - * @member {google.cloud.vision.v1.Likelihood} blurredLikelihood - * @memberof google.cloud.vision.v1.FaceAnnotation + * Calls BatchAnnotateFiles. + * @function batchAnnotateFiles + * @memberof google.cloud.vision.v1.ImageAnnotator * @instance + * @param {google.cloud.vision.v1.IBatchAnnotateFilesRequest} request BatchAnnotateFilesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - FaceAnnotation.prototype.blurredLikelihood = 0; /** - * FaceAnnotation headwearLikelihood. - * @member {google.cloud.vision.v1.Likelihood} headwearLikelihood - * @memberof google.cloud.vision.v1.FaceAnnotation + * Callback as used by {@link google.cloud.vision.v1.ImageAnnotator#asyncBatchAnnotateImages}. + * @memberof google.cloud.vision.v1.ImageAnnotator + * @typedef AsyncBatchAnnotateImagesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls AsyncBatchAnnotateImages. + * @function asyncBatchAnnotateImages + * @memberof google.cloud.vision.v1.ImageAnnotator * @instance + * @param {google.cloud.vision.v1.IAsyncBatchAnnotateImagesRequest} request AsyncBatchAnnotateImagesRequest message or plain object + * @param {google.cloud.vision.v1.ImageAnnotator.AsyncBatchAnnotateImagesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 */ - FaceAnnotation.prototype.headwearLikelihood = 0; + Object.defineProperty(ImageAnnotator.prototype.asyncBatchAnnotateImages = function asyncBatchAnnotateImages(request, callback) { + return this.rpcCall(asyncBatchAnnotateImages, $root.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "AsyncBatchAnnotateImages" }); /** - * Creates a new FaceAnnotation instance using the specified properties. + * Calls AsyncBatchAnnotateImages. + * @function asyncBatchAnnotateImages + * @memberof google.cloud.vision.v1.ImageAnnotator + * @instance + * @param {google.cloud.vision.v1.IAsyncBatchAnnotateImagesRequest} request AsyncBatchAnnotateImagesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.vision.v1.ImageAnnotator#asyncBatchAnnotateFiles}. + * @memberof google.cloud.vision.v1.ImageAnnotator + * @typedef AsyncBatchAnnotateFilesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls AsyncBatchAnnotateFiles. + * @function asyncBatchAnnotateFiles + * @memberof google.cloud.vision.v1.ImageAnnotator + * @instance + * @param {google.cloud.vision.v1.IAsyncBatchAnnotateFilesRequest} request AsyncBatchAnnotateFilesRequest message or plain object + * @param {google.cloud.vision.v1.ImageAnnotator.AsyncBatchAnnotateFilesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ImageAnnotator.prototype.asyncBatchAnnotateFiles = function asyncBatchAnnotateFiles(request, callback) { + return this.rpcCall(asyncBatchAnnotateFiles, $root.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "AsyncBatchAnnotateFiles" }); + + /** + * Calls AsyncBatchAnnotateFiles. + * @function asyncBatchAnnotateFiles + * @memberof google.cloud.vision.v1.ImageAnnotator + * @instance + * @param {google.cloud.vision.v1.IAsyncBatchAnnotateFilesRequest} request AsyncBatchAnnotateFilesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return ImageAnnotator; + })(); + + v1.Feature = (function() { + + /** + * Properties of a Feature. + * @memberof google.cloud.vision.v1 + * @interface IFeature + * @property {google.cloud.vision.v1.Feature.Type|null} [type] Feature type + * @property {number|null} [maxResults] Feature maxResults + * @property {string|null} [model] Feature model + */ + + /** + * Constructs a new Feature. + * @memberof google.cloud.vision.v1 + * @classdesc Represents a Feature. + * @implements IFeature + * @constructor + * @param {google.cloud.vision.v1.IFeature=} [properties] Properties to set + */ + function Feature(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]]; + } + + /** + * Feature type. + * @member {google.cloud.vision.v1.Feature.Type} type + * @memberof google.cloud.vision.v1.Feature + * @instance + */ + Feature.prototype.type = 0; + + /** + * Feature maxResults. + * @member {number} maxResults + * @memberof google.cloud.vision.v1.Feature + * @instance + */ + Feature.prototype.maxResults = 0; + + /** + * Feature model. + * @member {string} model + * @memberof google.cloud.vision.v1.Feature + * @instance + */ + Feature.prototype.model = ""; + + /** + * Creates a new Feature instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.FaceAnnotation + * @memberof google.cloud.vision.v1.Feature * @static - * @param {google.cloud.vision.v1.IFaceAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1.FaceAnnotation} FaceAnnotation instance + * @param {google.cloud.vision.v1.IFeature=} [properties] Properties to set + * @returns {google.cloud.vision.v1.Feature} Feature instance */ - FaceAnnotation.create = function create(properties) { - return new FaceAnnotation(properties); + Feature.create = function create(properties) { + return new Feature(properties); }; /** - * Encodes the specified FaceAnnotation message. Does not implicitly {@link google.cloud.vision.v1.FaceAnnotation.verify|verify} messages. + * Encodes the specified Feature message. Does not implicitly {@link google.cloud.vision.v1.Feature.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.FaceAnnotation + * @memberof google.cloud.vision.v1.Feature * @static - * @param {google.cloud.vision.v1.IFaceAnnotation} message FaceAnnotation message or plain object to encode + * @param {google.cloud.vision.v1.IFeature} message Feature message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FaceAnnotation.encode = function encode(message, writer) { + Feature.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - $root.google.cloud.vision.v1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.fdBoundingPoly != null && message.hasOwnProperty("fdBoundingPoly")) - $root.google.cloud.vision.v1.BoundingPoly.encode(message.fdBoundingPoly, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.landmarks != null && message.landmarks.length) - for (var i = 0; i < message.landmarks.length; ++i) - $root.google.cloud.vision.v1.FaceAnnotation.Landmark.encode(message.landmarks[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.rollAngle != null && message.hasOwnProperty("rollAngle")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.rollAngle); - if (message.panAngle != null && message.hasOwnProperty("panAngle")) - writer.uint32(/* id 5, wireType 5 =*/45).float(message.panAngle); - if (message.tiltAngle != null && message.hasOwnProperty("tiltAngle")) - writer.uint32(/* id 6, wireType 5 =*/53).float(message.tiltAngle); - if (message.detectionConfidence != null && message.hasOwnProperty("detectionConfidence")) - writer.uint32(/* id 7, wireType 5 =*/61).float(message.detectionConfidence); - if (message.landmarkingConfidence != null && message.hasOwnProperty("landmarkingConfidence")) - writer.uint32(/* id 8, wireType 5 =*/69).float(message.landmarkingConfidence); - if (message.joyLikelihood != null && message.hasOwnProperty("joyLikelihood")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.joyLikelihood); - if (message.sorrowLikelihood != null && message.hasOwnProperty("sorrowLikelihood")) - writer.uint32(/* id 10, wireType 0 =*/80).int32(message.sorrowLikelihood); - if (message.angerLikelihood != null && message.hasOwnProperty("angerLikelihood")) - writer.uint32(/* id 11, wireType 0 =*/88).int32(message.angerLikelihood); - if (message.surpriseLikelihood != null && message.hasOwnProperty("surpriseLikelihood")) - writer.uint32(/* id 12, wireType 0 =*/96).int32(message.surpriseLikelihood); - if (message.underExposedLikelihood != null && message.hasOwnProperty("underExposedLikelihood")) - writer.uint32(/* id 13, wireType 0 =*/104).int32(message.underExposedLikelihood); - if (message.blurredLikelihood != null && message.hasOwnProperty("blurredLikelihood")) - writer.uint32(/* id 14, wireType 0 =*/112).int32(message.blurredLikelihood); - if (message.headwearLikelihood != null && message.hasOwnProperty("headwearLikelihood")) - writer.uint32(/* id 15, wireType 0 =*/120).int32(message.headwearLikelihood); + if (message.type != null && message.hasOwnProperty("type")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.maxResults); + if (message.model != null && message.hasOwnProperty("model")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.model); return writer; }; /** - * Encodes the specified FaceAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1.FaceAnnotation.verify|verify} messages. + * Encodes the specified Feature message, length delimited. Does not implicitly {@link google.cloud.vision.v1.Feature.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.FaceAnnotation + * @memberof google.cloud.vision.v1.Feature * @static - * @param {google.cloud.vision.v1.IFaceAnnotation} message FaceAnnotation message or plain object to encode + * @param {google.cloud.vision.v1.IFeature} message Feature message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FaceAnnotation.encodeDelimited = function encodeDelimited(message, writer) { + Feature.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FaceAnnotation message from the specified reader or buffer. + * Decodes a Feature message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.FaceAnnotation + * @memberof google.cloud.vision.v1.Feature * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.FaceAnnotation} FaceAnnotation + * @returns {google.cloud.vision.v1.Feature} Feature * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FaceAnnotation.decode = function decode(reader, length) { + Feature.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.vision.v1.FaceAnnotation(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.Feature(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.boundingPoly = $root.google.cloud.vision.v1.BoundingPoly.decode(reader, reader.uint32()); + message.type = reader.int32(); break; case 2: - message.fdBoundingPoly = $root.google.cloud.vision.v1.BoundingPoly.decode(reader, reader.uint32()); + message.maxResults = reader.int32(); break; case 3: - if (!(message.landmarks && message.landmarks.length)) - message.landmarks = []; - message.landmarks.push($root.google.cloud.vision.v1.FaceAnnotation.Landmark.decode(reader, reader.uint32())); - break; - case 4: - message.rollAngle = reader.float(); - break; - case 5: - message.panAngle = reader.float(); - break; - case 6: - message.tiltAngle = reader.float(); - break; - case 7: - message.detectionConfidence = reader.float(); - break; - case 8: - message.landmarkingConfidence = reader.float(); - break; - case 9: - message.joyLikelihood = reader.int32(); - break; - case 10: - message.sorrowLikelihood = reader.int32(); - break; - case 11: - message.angerLikelihood = reader.int32(); - break; - case 12: - message.surpriseLikelihood = reader.int32(); - break; - case 13: - message.underExposedLikelihood = reader.int32(); - break; - case 14: - message.blurredLikelihood = reader.int32(); - break; - case 15: - message.headwearLikelihood = reader.int32(); + message.model = reader.string(); break; default: reader.skipType(tag & 7); @@ -1329,1028 +1269,318 @@ }; /** - * Decodes a FaceAnnotation message from the specified reader or buffer, length delimited. + * Decodes a Feature message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.FaceAnnotation + * @memberof google.cloud.vision.v1.Feature * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.FaceAnnotation} FaceAnnotation + * @returns {google.cloud.vision.v1.Feature} Feature * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FaceAnnotation.decodeDelimited = function decodeDelimited(reader) { + Feature.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FaceAnnotation message. + * Verifies a Feature message. * @function verify - * @memberof google.cloud.vision.v1.FaceAnnotation + * @memberof google.cloud.vision.v1.Feature * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FaceAnnotation.verify = function verify(message) { + Feature.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { - var error = $root.google.cloud.vision.v1.BoundingPoly.verify(message.boundingPoly); - if (error) - return "boundingPoly." + error; - } - if (message.fdBoundingPoly != null && message.hasOwnProperty("fdBoundingPoly")) { - var error = $root.google.cloud.vision.v1.BoundingPoly.verify(message.fdBoundingPoly); - if (error) - return "fdBoundingPoly." + error; - } - if (message.landmarks != null && message.hasOwnProperty("landmarks")) { - if (!Array.isArray(message.landmarks)) - return "landmarks: array expected"; - for (var i = 0; i < message.landmarks.length; ++i) { - var error = $root.google.cloud.vision.v1.FaceAnnotation.Landmark.verify(message.landmarks[i]); - if (error) - return "landmarks." + error; - } - } - if (message.rollAngle != null && message.hasOwnProperty("rollAngle")) - if (typeof message.rollAngle !== "number") - return "rollAngle: number expected"; - if (message.panAngle != null && message.hasOwnProperty("panAngle")) - if (typeof message.panAngle !== "number") - return "panAngle: number expected"; - if (message.tiltAngle != null && message.hasOwnProperty("tiltAngle")) - if (typeof message.tiltAngle !== "number") - return "tiltAngle: number expected"; - if (message.detectionConfidence != null && message.hasOwnProperty("detectionConfidence")) - if (typeof message.detectionConfidence !== "number") - return "detectionConfidence: number expected"; - if (message.landmarkingConfidence != null && message.hasOwnProperty("landmarkingConfidence")) - if (typeof message.landmarkingConfidence !== "number") - return "landmarkingConfidence: number expected"; - if (message.joyLikelihood != null && message.hasOwnProperty("joyLikelihood")) - switch (message.joyLikelihood) { - default: - return "joyLikelihood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.sorrowLikelihood != null && message.hasOwnProperty("sorrowLikelihood")) - switch (message.sorrowLikelihood) { - default: - return "sorrowLikelihood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.angerLikelihood != null && message.hasOwnProperty("angerLikelihood")) - switch (message.angerLikelihood) { + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { default: - return "angerLikelihood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.surpriseLikelihood != null && message.hasOwnProperty("surpriseLikelihood")) - switch (message.surpriseLikelihood) { - default: - return "surpriseLikelihood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.underExposedLikelihood != null && message.hasOwnProperty("underExposedLikelihood")) - switch (message.underExposedLikelihood) { - default: - return "underExposedLikelihood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.blurredLikelihood != null && message.hasOwnProperty("blurredLikelihood")) - switch (message.blurredLikelihood) { - default: - return "blurredLikelihood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.headwearLikelihood != null && message.hasOwnProperty("headwearLikelihood")) - switch (message.headwearLikelihood) { - default: - return "headwearLikelihood: enum value expected"; + return "type: enum value expected"; case 0: case 1: case 2: case 3: case 4: case 5: + case 11: + case 6: + case 7: + case 9: + case 10: + case 12: + case 19: break; } + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + if (!$util.isInteger(message.maxResults)) + return "maxResults: integer expected"; + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; return null; }; /** - * Creates a FaceAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates a Feature message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.FaceAnnotation + * @memberof google.cloud.vision.v1.Feature * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.FaceAnnotation} FaceAnnotation + * @returns {google.cloud.vision.v1.Feature} Feature */ - FaceAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.FaceAnnotation) + Feature.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.Feature) return object; - var message = new $root.google.cloud.vision.v1.FaceAnnotation(); - if (object.boundingPoly != null) { - if (typeof object.boundingPoly !== "object") - throw TypeError(".google.cloud.vision.v1.FaceAnnotation.boundingPoly: object expected"); - message.boundingPoly = $root.google.cloud.vision.v1.BoundingPoly.fromObject(object.boundingPoly); - } - if (object.fdBoundingPoly != null) { - if (typeof object.fdBoundingPoly !== "object") - throw TypeError(".google.cloud.vision.v1.FaceAnnotation.fdBoundingPoly: object expected"); - message.fdBoundingPoly = $root.google.cloud.vision.v1.BoundingPoly.fromObject(object.fdBoundingPoly); - } - if (object.landmarks) { - if (!Array.isArray(object.landmarks)) - throw TypeError(".google.cloud.vision.v1.FaceAnnotation.landmarks: array expected"); - message.landmarks = []; - for (var i = 0; i < object.landmarks.length; ++i) { - if (typeof object.landmarks[i] !== "object") - throw TypeError(".google.cloud.vision.v1.FaceAnnotation.landmarks: object expected"); - message.landmarks[i] = $root.google.cloud.vision.v1.FaceAnnotation.Landmark.fromObject(object.landmarks[i]); - } - } - if (object.rollAngle != null) - message.rollAngle = Number(object.rollAngle); - if (object.panAngle != null) - message.panAngle = Number(object.panAngle); - if (object.tiltAngle != null) - message.tiltAngle = Number(object.tiltAngle); - if (object.detectionConfidence != null) - message.detectionConfidence = Number(object.detectionConfidence); - if (object.landmarkingConfidence != null) - message.landmarkingConfidence = Number(object.landmarkingConfidence); - switch (object.joyLikelihood) { - case "UNKNOWN": - case 0: - message.joyLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.joyLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.joyLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.joyLikelihood = 3; - break; - case "LIKELY": - case 4: - message.joyLikelihood = 4; - break; - case "VERY_LIKELY": - case 5: - message.joyLikelihood = 5; - break; - } - switch (object.sorrowLikelihood) { - case "UNKNOWN": - case 0: - message.sorrowLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.sorrowLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.sorrowLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.sorrowLikelihood = 3; - break; - case "LIKELY": - case 4: - message.sorrowLikelihood = 4; - break; - case "VERY_LIKELY": - case 5: - message.sorrowLikelihood = 5; - break; - } - switch (object.angerLikelihood) { - case "UNKNOWN": - case 0: - message.angerLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.angerLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.angerLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.angerLikelihood = 3; - break; - case "LIKELY": - case 4: - message.angerLikelihood = 4; - break; - case "VERY_LIKELY": - case 5: - message.angerLikelihood = 5; - break; - } - switch (object.surpriseLikelihood) { - case "UNKNOWN": - case 0: - message.surpriseLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.surpriseLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.surpriseLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.surpriseLikelihood = 3; - break; - case "LIKELY": - case 4: - message.surpriseLikelihood = 4; - break; - case "VERY_LIKELY": - case 5: - message.surpriseLikelihood = 5; - break; - } - switch (object.underExposedLikelihood) { - case "UNKNOWN": + var message = new $root.google.cloud.vision.v1.Feature(); + switch (object.type) { + case "TYPE_UNSPECIFIED": case 0: - message.underExposedLikelihood = 0; + message.type = 0; break; - case "VERY_UNLIKELY": + case "FACE_DETECTION": case 1: - message.underExposedLikelihood = 1; + message.type = 1; break; - case "UNLIKELY": + case "LANDMARK_DETECTION": case 2: - message.underExposedLikelihood = 2; + message.type = 2; break; - case "POSSIBLE": + case "LOGO_DETECTION": case 3: - message.underExposedLikelihood = 3; + message.type = 3; break; - case "LIKELY": + case "LABEL_DETECTION": case 4: - message.underExposedLikelihood = 4; + message.type = 4; break; - case "VERY_LIKELY": + case "TEXT_DETECTION": case 5: - message.underExposedLikelihood = 5; - break; - } - switch (object.blurredLikelihood) { - case "UNKNOWN": - case 0: - message.blurredLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.blurredLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.blurredLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.blurredLikelihood = 3; - break; - case "LIKELY": - case 4: - message.blurredLikelihood = 4; + message.type = 5; break; - case "VERY_LIKELY": - case 5: - message.blurredLikelihood = 5; + case "DOCUMENT_TEXT_DETECTION": + case 11: + message.type = 11; break; - } - switch (object.headwearLikelihood) { - case "UNKNOWN": - case 0: - message.headwearLikelihood = 0; + case "SAFE_SEARCH_DETECTION": + case 6: + message.type = 6; break; - case "VERY_UNLIKELY": - case 1: - message.headwearLikelihood = 1; + case "IMAGE_PROPERTIES": + case 7: + message.type = 7; break; - case "UNLIKELY": - case 2: - message.headwearLikelihood = 2; + case "CROP_HINTS": + case 9: + message.type = 9; break; - case "POSSIBLE": - case 3: - message.headwearLikelihood = 3; + case "WEB_DETECTION": + case 10: + message.type = 10; break; - case "LIKELY": - case 4: - message.headwearLikelihood = 4; + case "PRODUCT_SEARCH": + case 12: + message.type = 12; break; - case "VERY_LIKELY": - case 5: - message.headwearLikelihood = 5; + case "OBJECT_LOCALIZATION": + case 19: + message.type = 19; break; } + if (object.maxResults != null) + message.maxResults = object.maxResults | 0; + if (object.model != null) + message.model = String(object.model); return message; }; /** - * Creates a plain object from a FaceAnnotation message. Also converts values to other types if specified. + * Creates a plain object from a Feature message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.FaceAnnotation + * @memberof google.cloud.vision.v1.Feature * @static - * @param {google.cloud.vision.v1.FaceAnnotation} message FaceAnnotation + * @param {google.cloud.vision.v1.Feature} message Feature * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FaceAnnotation.toObject = function toObject(message, options) { + Feature.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.landmarks = []; if (options.defaults) { - object.boundingPoly = null; - object.fdBoundingPoly = null; - object.rollAngle = 0; - object.panAngle = 0; - object.tiltAngle = 0; - object.detectionConfidence = 0; - object.landmarkingConfidence = 0; - object.joyLikelihood = options.enums === String ? "UNKNOWN" : 0; - object.sorrowLikelihood = options.enums === String ? "UNKNOWN" : 0; - object.angerLikelihood = options.enums === String ? "UNKNOWN" : 0; - object.surpriseLikelihood = options.enums === String ? "UNKNOWN" : 0; - object.underExposedLikelihood = options.enums === String ? "UNKNOWN" : 0; - object.blurredLikelihood = options.enums === String ? "UNKNOWN" : 0; - object.headwearLikelihood = options.enums === String ? "UNKNOWN" : 0; - } - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - object.boundingPoly = $root.google.cloud.vision.v1.BoundingPoly.toObject(message.boundingPoly, options); - if (message.fdBoundingPoly != null && message.hasOwnProperty("fdBoundingPoly")) - object.fdBoundingPoly = $root.google.cloud.vision.v1.BoundingPoly.toObject(message.fdBoundingPoly, options); - if (message.landmarks && message.landmarks.length) { - object.landmarks = []; - for (var j = 0; j < message.landmarks.length; ++j) - object.landmarks[j] = $root.google.cloud.vision.v1.FaceAnnotation.Landmark.toObject(message.landmarks[j], options); + object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + object.maxResults = 0; + object.model = ""; } - if (message.rollAngle != null && message.hasOwnProperty("rollAngle")) - object.rollAngle = options.json && !isFinite(message.rollAngle) ? String(message.rollAngle) : message.rollAngle; - if (message.panAngle != null && message.hasOwnProperty("panAngle")) - object.panAngle = options.json && !isFinite(message.panAngle) ? String(message.panAngle) : message.panAngle; - if (message.tiltAngle != null && message.hasOwnProperty("tiltAngle")) - object.tiltAngle = options.json && !isFinite(message.tiltAngle) ? String(message.tiltAngle) : message.tiltAngle; - if (message.detectionConfidence != null && message.hasOwnProperty("detectionConfidence")) - object.detectionConfidence = options.json && !isFinite(message.detectionConfidence) ? String(message.detectionConfidence) : message.detectionConfidence; - if (message.landmarkingConfidence != null && message.hasOwnProperty("landmarkingConfidence")) - object.landmarkingConfidence = options.json && !isFinite(message.landmarkingConfidence) ? String(message.landmarkingConfidence) : message.landmarkingConfidence; - if (message.joyLikelihood != null && message.hasOwnProperty("joyLikelihood")) - object.joyLikelihood = options.enums === String ? $root.google.cloud.vision.v1.Likelihood[message.joyLikelihood] : message.joyLikelihood; - if (message.sorrowLikelihood != null && message.hasOwnProperty("sorrowLikelihood")) - object.sorrowLikelihood = options.enums === String ? $root.google.cloud.vision.v1.Likelihood[message.sorrowLikelihood] : message.sorrowLikelihood; - if (message.angerLikelihood != null && message.hasOwnProperty("angerLikelihood")) - object.angerLikelihood = options.enums === String ? $root.google.cloud.vision.v1.Likelihood[message.angerLikelihood] : message.angerLikelihood; - if (message.surpriseLikelihood != null && message.hasOwnProperty("surpriseLikelihood")) - object.surpriseLikelihood = options.enums === String ? $root.google.cloud.vision.v1.Likelihood[message.surpriseLikelihood] : message.surpriseLikelihood; - if (message.underExposedLikelihood != null && message.hasOwnProperty("underExposedLikelihood")) - object.underExposedLikelihood = options.enums === String ? $root.google.cloud.vision.v1.Likelihood[message.underExposedLikelihood] : message.underExposedLikelihood; - if (message.blurredLikelihood != null && message.hasOwnProperty("blurredLikelihood")) - object.blurredLikelihood = options.enums === String ? $root.google.cloud.vision.v1.Likelihood[message.blurredLikelihood] : message.blurredLikelihood; - if (message.headwearLikelihood != null && message.hasOwnProperty("headwearLikelihood")) - object.headwearLikelihood = options.enums === String ? $root.google.cloud.vision.v1.Likelihood[message.headwearLikelihood] : message.headwearLikelihood; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.vision.v1.Feature.Type[message.type] : message.type; + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + object.maxResults = message.maxResults; + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; return object; }; /** - * Converts this FaceAnnotation to JSON. + * Converts this Feature to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.FaceAnnotation + * @memberof google.cloud.vision.v1.Feature * @instance * @returns {Object.} JSON object */ - FaceAnnotation.prototype.toJSON = function toJSON() { + Feature.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - FaceAnnotation.Landmark = (function() { - - /** - * Properties of a Landmark. - * @memberof google.cloud.vision.v1.FaceAnnotation - * @interface ILandmark - * @property {google.cloud.vision.v1.FaceAnnotation.Landmark.Type|null} [type] Landmark type - * @property {google.cloud.vision.v1.IPosition|null} [position] Landmark position - */ + /** + * Type enum. + * @name google.cloud.vision.v1.Feature.Type + * @enum {string} + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} FACE_DETECTION=1 FACE_DETECTION value + * @property {number} LANDMARK_DETECTION=2 LANDMARK_DETECTION value + * @property {number} LOGO_DETECTION=3 LOGO_DETECTION value + * @property {number} LABEL_DETECTION=4 LABEL_DETECTION value + * @property {number} TEXT_DETECTION=5 TEXT_DETECTION value + * @property {number} DOCUMENT_TEXT_DETECTION=11 DOCUMENT_TEXT_DETECTION value + * @property {number} SAFE_SEARCH_DETECTION=6 SAFE_SEARCH_DETECTION value + * @property {number} IMAGE_PROPERTIES=7 IMAGE_PROPERTIES value + * @property {number} CROP_HINTS=9 CROP_HINTS value + * @property {number} WEB_DETECTION=10 WEB_DETECTION value + * @property {number} PRODUCT_SEARCH=12 PRODUCT_SEARCH value + * @property {number} OBJECT_LOCALIZATION=19 OBJECT_LOCALIZATION value + */ + Feature.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "FACE_DETECTION"] = 1; + values[valuesById[2] = "LANDMARK_DETECTION"] = 2; + values[valuesById[3] = "LOGO_DETECTION"] = 3; + values[valuesById[4] = "LABEL_DETECTION"] = 4; + values[valuesById[5] = "TEXT_DETECTION"] = 5; + values[valuesById[11] = "DOCUMENT_TEXT_DETECTION"] = 11; + values[valuesById[6] = "SAFE_SEARCH_DETECTION"] = 6; + values[valuesById[7] = "IMAGE_PROPERTIES"] = 7; + values[valuesById[9] = "CROP_HINTS"] = 9; + values[valuesById[10] = "WEB_DETECTION"] = 10; + values[valuesById[12] = "PRODUCT_SEARCH"] = 12; + values[valuesById[19] = "OBJECT_LOCALIZATION"] = 19; + return values; + })(); - /** - * Constructs a new Landmark. - * @memberof google.cloud.vision.v1.FaceAnnotation - * @classdesc Represents a Landmark. - * @implements ILandmark - * @constructor - * @param {google.cloud.vision.v1.FaceAnnotation.ILandmark=} [properties] Properties to set - */ - function Landmark(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]]; - } + return Feature; + })(); - /** - * Landmark type. - * @member {google.cloud.vision.v1.FaceAnnotation.Landmark.Type} type - * @memberof google.cloud.vision.v1.FaceAnnotation.Landmark - * @instance - */ - Landmark.prototype.type = 0; + v1.ImageSource = (function() { - /** - * Landmark position. - * @member {google.cloud.vision.v1.IPosition|null|undefined} position - * @memberof google.cloud.vision.v1.FaceAnnotation.Landmark - * @instance - */ - Landmark.prototype.position = null; + /** + * Properties of an ImageSource. + * @memberof google.cloud.vision.v1 + * @interface IImageSource + * @property {string|null} [gcsImageUri] ImageSource gcsImageUri + * @property {string|null} [imageUri] ImageSource imageUri + */ - /** - * Creates a new Landmark instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.FaceAnnotation.Landmark - * @static - * @param {google.cloud.vision.v1.FaceAnnotation.ILandmark=} [properties] Properties to set - * @returns {google.cloud.vision.v1.FaceAnnotation.Landmark} Landmark instance - */ - Landmark.create = function create(properties) { - return new Landmark(properties); - }; + /** + * Constructs a new ImageSource. + * @memberof google.cloud.vision.v1 + * @classdesc Represents an ImageSource. + * @implements IImageSource + * @constructor + * @param {google.cloud.vision.v1.IImageSource=} [properties] Properties to set + */ + function ImageSource(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Encodes the specified Landmark message. Does not implicitly {@link google.cloud.vision.v1.FaceAnnotation.Landmark.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.FaceAnnotation.Landmark - * @static - * @param {google.cloud.vision.v1.FaceAnnotation.ILandmark} message Landmark message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Landmark.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.type != null && message.hasOwnProperty("type")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); - if (message.position != null && message.hasOwnProperty("position")) - $root.google.cloud.vision.v1.Position.encode(message.position, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; + /** + * ImageSource gcsImageUri. + * @member {string} gcsImageUri + * @memberof google.cloud.vision.v1.ImageSource + * @instance + */ + ImageSource.prototype.gcsImageUri = ""; - /** - * Encodes the specified Landmark message, length delimited. Does not implicitly {@link google.cloud.vision.v1.FaceAnnotation.Landmark.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.FaceAnnotation.Landmark - * @static - * @param {google.cloud.vision.v1.FaceAnnotation.ILandmark} message Landmark message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Landmark.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Landmark message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.FaceAnnotation.Landmark - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.FaceAnnotation.Landmark} Landmark - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Landmark.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.vision.v1.FaceAnnotation.Landmark(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 3: - message.type = reader.int32(); - break; - case 4: - message.position = $root.google.cloud.vision.v1.Position.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Landmark message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.FaceAnnotation.Landmark - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.FaceAnnotation.Landmark} Landmark - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Landmark.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Landmark message. - * @function verify - * @memberof google.cloud.vision.v1.FaceAnnotation.Landmark - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Landmark.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - case 30: - case 31: - case 32: - case 33: - case 34: - break; - } - if (message.position != null && message.hasOwnProperty("position")) { - var error = $root.google.cloud.vision.v1.Position.verify(message.position); - if (error) - return "position." + error; - } - return null; - }; - - /** - * Creates a Landmark message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.FaceAnnotation.Landmark - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.FaceAnnotation.Landmark} Landmark - */ - Landmark.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.FaceAnnotation.Landmark) - return object; - var message = new $root.google.cloud.vision.v1.FaceAnnotation.Landmark(); - switch (object.type) { - case "UNKNOWN_LANDMARK": - case 0: - message.type = 0; - break; - case "LEFT_EYE": - case 1: - message.type = 1; - break; - case "RIGHT_EYE": - case 2: - message.type = 2; - break; - case "LEFT_OF_LEFT_EYEBROW": - case 3: - message.type = 3; - break; - case "RIGHT_OF_LEFT_EYEBROW": - case 4: - message.type = 4; - break; - case "LEFT_OF_RIGHT_EYEBROW": - case 5: - message.type = 5; - break; - case "RIGHT_OF_RIGHT_EYEBROW": - case 6: - message.type = 6; - break; - case "MIDPOINT_BETWEEN_EYES": - case 7: - message.type = 7; - break; - case "NOSE_TIP": - case 8: - message.type = 8; - break; - case "UPPER_LIP": - case 9: - message.type = 9; - break; - case "LOWER_LIP": - case 10: - message.type = 10; - break; - case "MOUTH_LEFT": - case 11: - message.type = 11; - break; - case "MOUTH_RIGHT": - case 12: - message.type = 12; - break; - case "MOUTH_CENTER": - case 13: - message.type = 13; - break; - case "NOSE_BOTTOM_RIGHT": - case 14: - message.type = 14; - break; - case "NOSE_BOTTOM_LEFT": - case 15: - message.type = 15; - break; - case "NOSE_BOTTOM_CENTER": - case 16: - message.type = 16; - break; - case "LEFT_EYE_TOP_BOUNDARY": - case 17: - message.type = 17; - break; - case "LEFT_EYE_RIGHT_CORNER": - case 18: - message.type = 18; - break; - case "LEFT_EYE_BOTTOM_BOUNDARY": - case 19: - message.type = 19; - break; - case "LEFT_EYE_LEFT_CORNER": - case 20: - message.type = 20; - break; - case "RIGHT_EYE_TOP_BOUNDARY": - case 21: - message.type = 21; - break; - case "RIGHT_EYE_RIGHT_CORNER": - case 22: - message.type = 22; - break; - case "RIGHT_EYE_BOTTOM_BOUNDARY": - case 23: - message.type = 23; - break; - case "RIGHT_EYE_LEFT_CORNER": - case 24: - message.type = 24; - break; - case "LEFT_EYEBROW_UPPER_MIDPOINT": - case 25: - message.type = 25; - break; - case "RIGHT_EYEBROW_UPPER_MIDPOINT": - case 26: - message.type = 26; - break; - case "LEFT_EAR_TRAGION": - case 27: - message.type = 27; - break; - case "RIGHT_EAR_TRAGION": - case 28: - message.type = 28; - break; - case "LEFT_EYE_PUPIL": - case 29: - message.type = 29; - break; - case "RIGHT_EYE_PUPIL": - case 30: - message.type = 30; - break; - case "FOREHEAD_GLABELLA": - case 31: - message.type = 31; - break; - case "CHIN_GNATHION": - case 32: - message.type = 32; - break; - case "CHIN_LEFT_GONION": - case 33: - message.type = 33; - break; - case "CHIN_RIGHT_GONION": - case 34: - message.type = 34; - break; - } - if (object.position != null) { - if (typeof object.position !== "object") - throw TypeError(".google.cloud.vision.v1.FaceAnnotation.Landmark.position: object expected"); - message.position = $root.google.cloud.vision.v1.Position.fromObject(object.position); - } - return message; - }; - - /** - * Creates a plain object from a Landmark message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.FaceAnnotation.Landmark - * @static - * @param {google.cloud.vision.v1.FaceAnnotation.Landmark} message Landmark - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Landmark.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.type = options.enums === String ? "UNKNOWN_LANDMARK" : 0; - object.position = null; - } - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.vision.v1.FaceAnnotation.Landmark.Type[message.type] : message.type; - if (message.position != null && message.hasOwnProperty("position")) - object.position = $root.google.cloud.vision.v1.Position.toObject(message.position, options); - return object; - }; - - /** - * Converts this Landmark to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.FaceAnnotation.Landmark - * @instance - * @returns {Object.} JSON object - */ - Landmark.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Type enum. - * @name google.cloud.vision.v1.FaceAnnotation.Landmark.Type - * @enum {string} - * @property {number} UNKNOWN_LANDMARK=0 UNKNOWN_LANDMARK value - * @property {number} LEFT_EYE=1 LEFT_EYE value - * @property {number} RIGHT_EYE=2 RIGHT_EYE value - * @property {number} LEFT_OF_LEFT_EYEBROW=3 LEFT_OF_LEFT_EYEBROW value - * @property {number} RIGHT_OF_LEFT_EYEBROW=4 RIGHT_OF_LEFT_EYEBROW value - * @property {number} LEFT_OF_RIGHT_EYEBROW=5 LEFT_OF_RIGHT_EYEBROW value - * @property {number} RIGHT_OF_RIGHT_EYEBROW=6 RIGHT_OF_RIGHT_EYEBROW value - * @property {number} MIDPOINT_BETWEEN_EYES=7 MIDPOINT_BETWEEN_EYES value - * @property {number} NOSE_TIP=8 NOSE_TIP value - * @property {number} UPPER_LIP=9 UPPER_LIP value - * @property {number} LOWER_LIP=10 LOWER_LIP value - * @property {number} MOUTH_LEFT=11 MOUTH_LEFT value - * @property {number} MOUTH_RIGHT=12 MOUTH_RIGHT value - * @property {number} MOUTH_CENTER=13 MOUTH_CENTER value - * @property {number} NOSE_BOTTOM_RIGHT=14 NOSE_BOTTOM_RIGHT value - * @property {number} NOSE_BOTTOM_LEFT=15 NOSE_BOTTOM_LEFT value - * @property {number} NOSE_BOTTOM_CENTER=16 NOSE_BOTTOM_CENTER value - * @property {number} LEFT_EYE_TOP_BOUNDARY=17 LEFT_EYE_TOP_BOUNDARY value - * @property {number} LEFT_EYE_RIGHT_CORNER=18 LEFT_EYE_RIGHT_CORNER value - * @property {number} LEFT_EYE_BOTTOM_BOUNDARY=19 LEFT_EYE_BOTTOM_BOUNDARY value - * @property {number} LEFT_EYE_LEFT_CORNER=20 LEFT_EYE_LEFT_CORNER value - * @property {number} RIGHT_EYE_TOP_BOUNDARY=21 RIGHT_EYE_TOP_BOUNDARY value - * @property {number} RIGHT_EYE_RIGHT_CORNER=22 RIGHT_EYE_RIGHT_CORNER value - * @property {number} RIGHT_EYE_BOTTOM_BOUNDARY=23 RIGHT_EYE_BOTTOM_BOUNDARY value - * @property {number} RIGHT_EYE_LEFT_CORNER=24 RIGHT_EYE_LEFT_CORNER value - * @property {number} LEFT_EYEBROW_UPPER_MIDPOINT=25 LEFT_EYEBROW_UPPER_MIDPOINT value - * @property {number} RIGHT_EYEBROW_UPPER_MIDPOINT=26 RIGHT_EYEBROW_UPPER_MIDPOINT value - * @property {number} LEFT_EAR_TRAGION=27 LEFT_EAR_TRAGION value - * @property {number} RIGHT_EAR_TRAGION=28 RIGHT_EAR_TRAGION value - * @property {number} LEFT_EYE_PUPIL=29 LEFT_EYE_PUPIL value - * @property {number} RIGHT_EYE_PUPIL=30 RIGHT_EYE_PUPIL value - * @property {number} FOREHEAD_GLABELLA=31 FOREHEAD_GLABELLA value - * @property {number} CHIN_GNATHION=32 CHIN_GNATHION value - * @property {number} CHIN_LEFT_GONION=33 CHIN_LEFT_GONION value - * @property {number} CHIN_RIGHT_GONION=34 CHIN_RIGHT_GONION value - */ - Landmark.Type = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "UNKNOWN_LANDMARK"] = 0; - values[valuesById[1] = "LEFT_EYE"] = 1; - values[valuesById[2] = "RIGHT_EYE"] = 2; - values[valuesById[3] = "LEFT_OF_LEFT_EYEBROW"] = 3; - values[valuesById[4] = "RIGHT_OF_LEFT_EYEBROW"] = 4; - values[valuesById[5] = "LEFT_OF_RIGHT_EYEBROW"] = 5; - values[valuesById[6] = "RIGHT_OF_RIGHT_EYEBROW"] = 6; - values[valuesById[7] = "MIDPOINT_BETWEEN_EYES"] = 7; - values[valuesById[8] = "NOSE_TIP"] = 8; - values[valuesById[9] = "UPPER_LIP"] = 9; - values[valuesById[10] = "LOWER_LIP"] = 10; - values[valuesById[11] = "MOUTH_LEFT"] = 11; - values[valuesById[12] = "MOUTH_RIGHT"] = 12; - values[valuesById[13] = "MOUTH_CENTER"] = 13; - values[valuesById[14] = "NOSE_BOTTOM_RIGHT"] = 14; - values[valuesById[15] = "NOSE_BOTTOM_LEFT"] = 15; - values[valuesById[16] = "NOSE_BOTTOM_CENTER"] = 16; - values[valuesById[17] = "LEFT_EYE_TOP_BOUNDARY"] = 17; - values[valuesById[18] = "LEFT_EYE_RIGHT_CORNER"] = 18; - values[valuesById[19] = "LEFT_EYE_BOTTOM_BOUNDARY"] = 19; - values[valuesById[20] = "LEFT_EYE_LEFT_CORNER"] = 20; - values[valuesById[21] = "RIGHT_EYE_TOP_BOUNDARY"] = 21; - values[valuesById[22] = "RIGHT_EYE_RIGHT_CORNER"] = 22; - values[valuesById[23] = "RIGHT_EYE_BOTTOM_BOUNDARY"] = 23; - values[valuesById[24] = "RIGHT_EYE_LEFT_CORNER"] = 24; - values[valuesById[25] = "LEFT_EYEBROW_UPPER_MIDPOINT"] = 25; - values[valuesById[26] = "RIGHT_EYEBROW_UPPER_MIDPOINT"] = 26; - values[valuesById[27] = "LEFT_EAR_TRAGION"] = 27; - values[valuesById[28] = "RIGHT_EAR_TRAGION"] = 28; - values[valuesById[29] = "LEFT_EYE_PUPIL"] = 29; - values[valuesById[30] = "RIGHT_EYE_PUPIL"] = 30; - values[valuesById[31] = "FOREHEAD_GLABELLA"] = 31; - values[valuesById[32] = "CHIN_GNATHION"] = 32; - values[valuesById[33] = "CHIN_LEFT_GONION"] = 33; - values[valuesById[34] = "CHIN_RIGHT_GONION"] = 34; - return values; - })(); - - return Landmark; - })(); - - return FaceAnnotation; - })(); - - v1.LocationInfo = (function() { - - /** - * Properties of a LocationInfo. - * @memberof google.cloud.vision.v1 - * @interface ILocationInfo - * @property {google.type.ILatLng|null} [latLng] LocationInfo latLng - */ - - /** - * Constructs a new LocationInfo. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a LocationInfo. - * @implements ILocationInfo - * @constructor - * @param {google.cloud.vision.v1.ILocationInfo=} [properties] Properties to set - */ - function LocationInfo(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * LocationInfo latLng. - * @member {google.type.ILatLng|null|undefined} latLng - * @memberof google.cloud.vision.v1.LocationInfo - * @instance - */ - LocationInfo.prototype.latLng = null; + /** + * ImageSource imageUri. + * @member {string} imageUri + * @memberof google.cloud.vision.v1.ImageSource + * @instance + */ + ImageSource.prototype.imageUri = ""; /** - * Creates a new LocationInfo instance using the specified properties. + * Creates a new ImageSource instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.LocationInfo + * @memberof google.cloud.vision.v1.ImageSource * @static - * @param {google.cloud.vision.v1.ILocationInfo=} [properties] Properties to set - * @returns {google.cloud.vision.v1.LocationInfo} LocationInfo instance + * @param {google.cloud.vision.v1.IImageSource=} [properties] Properties to set + * @returns {google.cloud.vision.v1.ImageSource} ImageSource instance */ - LocationInfo.create = function create(properties) { - return new LocationInfo(properties); + ImageSource.create = function create(properties) { + return new ImageSource(properties); }; /** - * Encodes the specified LocationInfo message. Does not implicitly {@link google.cloud.vision.v1.LocationInfo.verify|verify} messages. + * Encodes the specified ImageSource message. Does not implicitly {@link google.cloud.vision.v1.ImageSource.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.LocationInfo + * @memberof google.cloud.vision.v1.ImageSource * @static - * @param {google.cloud.vision.v1.ILocationInfo} message LocationInfo message or plain object to encode + * @param {google.cloud.vision.v1.IImageSource} message ImageSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - LocationInfo.encode = function encode(message, writer) { + ImageSource.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.latLng != null && message.hasOwnProperty("latLng")) - $root.google.type.LatLng.encode(message.latLng, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.gcsImageUri != null && message.hasOwnProperty("gcsImageUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsImageUri); + if (message.imageUri != null && message.hasOwnProperty("imageUri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.imageUri); return writer; }; /** - * Encodes the specified LocationInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1.LocationInfo.verify|verify} messages. + * Encodes the specified ImageSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ImageSource.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.LocationInfo + * @memberof google.cloud.vision.v1.ImageSource * @static - * @param {google.cloud.vision.v1.ILocationInfo} message LocationInfo message or plain object to encode + * @param {google.cloud.vision.v1.IImageSource} message ImageSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - LocationInfo.encodeDelimited = function encodeDelimited(message, writer) { + ImageSource.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a LocationInfo message from the specified reader or buffer. + * Decodes an ImageSource message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.LocationInfo + * @memberof google.cloud.vision.v1.ImageSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.LocationInfo} LocationInfo + * @returns {google.cloud.vision.v1.ImageSource} ImageSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - LocationInfo.decode = function decode(reader, length) { + ImageSource.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.vision.v1.LocationInfo(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.ImageSource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.latLng = $root.google.type.LatLng.decode(reader, reader.uint32()); + message.gcsImageUri = reader.string(); + break; + case 2: + message.imageUri = reader.string(); break; default: reader.skipType(tag & 7); @@ -2361,114 +1591,117 @@ }; /** - * Decodes a LocationInfo message from the specified reader or buffer, length delimited. + * Decodes an ImageSource message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.LocationInfo + * @memberof google.cloud.vision.v1.ImageSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.LocationInfo} LocationInfo + * @returns {google.cloud.vision.v1.ImageSource} ImageSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - LocationInfo.decodeDelimited = function decodeDelimited(reader) { + ImageSource.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a LocationInfo message. + * Verifies an ImageSource message. * @function verify - * @memberof google.cloud.vision.v1.LocationInfo + * @memberof google.cloud.vision.v1.ImageSource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - LocationInfo.verify = function verify(message) { + ImageSource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.latLng != null && message.hasOwnProperty("latLng")) { - var error = $root.google.type.LatLng.verify(message.latLng); - if (error) - return "latLng." + error; - } + if (message.gcsImageUri != null && message.hasOwnProperty("gcsImageUri")) + if (!$util.isString(message.gcsImageUri)) + return "gcsImageUri: string expected"; + if (message.imageUri != null && message.hasOwnProperty("imageUri")) + if (!$util.isString(message.imageUri)) + return "imageUri: string expected"; return null; }; /** - * Creates a LocationInfo message from a plain object. Also converts values to their respective internal types. + * Creates an ImageSource message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.LocationInfo + * @memberof google.cloud.vision.v1.ImageSource * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.LocationInfo} LocationInfo + * @returns {google.cloud.vision.v1.ImageSource} ImageSource */ - LocationInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.LocationInfo) + ImageSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.ImageSource) return object; - var message = new $root.google.cloud.vision.v1.LocationInfo(); - if (object.latLng != null) { - if (typeof object.latLng !== "object") - throw TypeError(".google.cloud.vision.v1.LocationInfo.latLng: object expected"); - message.latLng = $root.google.type.LatLng.fromObject(object.latLng); - } + var message = new $root.google.cloud.vision.v1.ImageSource(); + if (object.gcsImageUri != null) + message.gcsImageUri = String(object.gcsImageUri); + if (object.imageUri != null) + message.imageUri = String(object.imageUri); return message; }; /** - * Creates a plain object from a LocationInfo message. Also converts values to other types if specified. + * Creates a plain object from an ImageSource message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.LocationInfo + * @memberof google.cloud.vision.v1.ImageSource * @static - * @param {google.cloud.vision.v1.LocationInfo} message LocationInfo + * @param {google.cloud.vision.v1.ImageSource} message ImageSource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - LocationInfo.toObject = function toObject(message, options) { + ImageSource.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.latLng = null; - if (message.latLng != null && message.hasOwnProperty("latLng")) - object.latLng = $root.google.type.LatLng.toObject(message.latLng, options); + if (options.defaults) { + object.gcsImageUri = ""; + object.imageUri = ""; + } + if (message.gcsImageUri != null && message.hasOwnProperty("gcsImageUri")) + object.gcsImageUri = message.gcsImageUri; + if (message.imageUri != null && message.hasOwnProperty("imageUri")) + object.imageUri = message.imageUri; return object; }; /** - * Converts this LocationInfo to JSON. + * Converts this ImageSource to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.LocationInfo + * @memberof google.cloud.vision.v1.ImageSource * @instance * @returns {Object.} JSON object */ - LocationInfo.prototype.toJSON = function toJSON() { + ImageSource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return LocationInfo; + return ImageSource; })(); - v1.Property = (function() { + v1.Image = (function() { /** - * Properties of a Property. + * Properties of an Image. * @memberof google.cloud.vision.v1 - * @interface IProperty - * @property {string|null} [name] Property name - * @property {string|null} [value] Property value - * @property {number|Long|null} [uint64Value] Property uint64Value + * @interface IImage + * @property {Uint8Array|null} [content] Image content + * @property {google.cloud.vision.v1.IImageSource|null} [source] Image source */ /** - * Constructs a new Property. + * Constructs a new Image. * @memberof google.cloud.vision.v1 - * @classdesc Represents a Property. - * @implements IProperty + * @classdesc Represents an Image. + * @implements IImage * @constructor - * @param {google.cloud.vision.v1.IProperty=} [properties] Properties to set + * @param {google.cloud.vision.v1.IImage=} [properties] Properties to set */ - function Property(properties) { + function Image(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2476,101 +1709,88 @@ } /** - * Property name. - * @member {string} name - * @memberof google.cloud.vision.v1.Property - * @instance - */ - Property.prototype.name = ""; - - /** - * Property value. - * @member {string} value - * @memberof google.cloud.vision.v1.Property + * Image content. + * @member {Uint8Array} content + * @memberof google.cloud.vision.v1.Image * @instance */ - Property.prototype.value = ""; + Image.prototype.content = $util.newBuffer([]); /** - * Property uint64Value. - * @member {number|Long} uint64Value - * @memberof google.cloud.vision.v1.Property + * Image source. + * @member {google.cloud.vision.v1.IImageSource|null|undefined} source + * @memberof google.cloud.vision.v1.Image * @instance */ - Property.prototype.uint64Value = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + Image.prototype.source = null; /** - * Creates a new Property instance using the specified properties. + * Creates a new Image instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.Property + * @memberof google.cloud.vision.v1.Image * @static - * @param {google.cloud.vision.v1.IProperty=} [properties] Properties to set - * @returns {google.cloud.vision.v1.Property} Property instance + * @param {google.cloud.vision.v1.IImage=} [properties] Properties to set + * @returns {google.cloud.vision.v1.Image} Image instance */ - Property.create = function create(properties) { - return new Property(properties); + Image.create = function create(properties) { + return new Image(properties); }; /** - * Encodes the specified Property message. Does not implicitly {@link google.cloud.vision.v1.Property.verify|verify} messages. + * Encodes the specified Image message. Does not implicitly {@link google.cloud.vision.v1.Image.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.Property + * @memberof google.cloud.vision.v1.Image * @static - * @param {google.cloud.vision.v1.IProperty} message Property message or plain object to encode + * @param {google.cloud.vision.v1.IImage} message Image message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Property.encode = function encode(message, writer) { + Image.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.value != null && message.hasOwnProperty("value")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); - if (message.uint64Value != null && message.hasOwnProperty("uint64Value")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.uint64Value); + if (message.content != null && message.hasOwnProperty("content")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.content); + if (message.source != null && message.hasOwnProperty("source")) + $root.google.cloud.vision.v1.ImageSource.encode(message.source, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified Property message, length delimited. Does not implicitly {@link google.cloud.vision.v1.Property.verify|verify} messages. + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.vision.v1.Image.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.Property + * @memberof google.cloud.vision.v1.Image * @static - * @param {google.cloud.vision.v1.IProperty} message Property message or plain object to encode + * @param {google.cloud.vision.v1.IImage} message Image message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Property.encodeDelimited = function encodeDelimited(message, writer) { + Image.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Property message from the specified reader or buffer. + * Decodes an Image message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.Property + * @memberof google.cloud.vision.v1.Image * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.Property} Property + * @returns {google.cloud.vision.v1.Image} Image * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Property.decode = function decode(reader, length) { + Image.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.vision.v1.Property(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.Image(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.name = reader.string(); + message.content = reader.bytes(); break; case 2: - message.value = reader.string(); - break; - case 3: - message.uint64Value = reader.uint64(); + message.source = $root.google.cloud.vision.v1.ImageSource.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -2581,148 +1801,167 @@ }; /** - * Decodes a Property message from the specified reader or buffer, length delimited. + * Decodes an Image message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.Property + * @memberof google.cloud.vision.v1.Image * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.Property} Property + * @returns {google.cloud.vision.v1.Image} Image * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Property.decodeDelimited = function decodeDelimited(reader) { + Image.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Property message. + * Verifies an Image message. * @function verify - * @memberof google.cloud.vision.v1.Property + * @memberof google.cloud.vision.v1.Image * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Property.verify = function verify(message) { + Image.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isString(message.value)) - return "value: string expected"; - if (message.uint64Value != null && message.hasOwnProperty("uint64Value")) - if (!$util.isInteger(message.uint64Value) && !(message.uint64Value && $util.isInteger(message.uint64Value.low) && $util.isInteger(message.uint64Value.high))) - return "uint64Value: integer|Long expected"; + if (message.content != null && message.hasOwnProperty("content")) + if (!(message.content && typeof message.content.length === "number" || $util.isString(message.content))) + return "content: buffer expected"; + if (message.source != null && message.hasOwnProperty("source")) { + var error = $root.google.cloud.vision.v1.ImageSource.verify(message.source); + if (error) + return "source." + error; + } return null; }; /** - * Creates a Property message from a plain object. Also converts values to their respective internal types. + * Creates an Image message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.Property + * @memberof google.cloud.vision.v1.Image * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.Property} Property + * @returns {google.cloud.vision.v1.Image} Image */ - Property.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.Property) + Image.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.Image) return object; - var message = new $root.google.cloud.vision.v1.Property(); - if (object.name != null) - message.name = String(object.name); - if (object.value != null) - message.value = String(object.value); - if (object.uint64Value != null) - if ($util.Long) - (message.uint64Value = $util.Long.fromValue(object.uint64Value)).unsigned = true; - else if (typeof object.uint64Value === "string") - message.uint64Value = parseInt(object.uint64Value, 10); - else if (typeof object.uint64Value === "number") - message.uint64Value = object.uint64Value; - else if (typeof object.uint64Value === "object") - message.uint64Value = new $util.LongBits(object.uint64Value.low >>> 0, object.uint64Value.high >>> 0).toNumber(true); + var message = new $root.google.cloud.vision.v1.Image(); + if (object.content != null) + if (typeof object.content === "string") + $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); + else if (object.content.length) + message.content = object.content; + if (object.source != null) { + if (typeof object.source !== "object") + throw TypeError(".google.cloud.vision.v1.Image.source: object expected"); + message.source = $root.google.cloud.vision.v1.ImageSource.fromObject(object.source); + } return message; }; /** - * Creates a plain object from a Property message. Also converts values to other types if specified. + * Creates a plain object from an Image message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.Property + * @memberof google.cloud.vision.v1.Image * @static - * @param {google.cloud.vision.v1.Property} message Property + * @param {google.cloud.vision.v1.Image} message Image * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Property.toObject = function toObject(message, options) { + Image.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.name = ""; - object.value = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, true); - object.uint64Value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.uint64Value = options.longs === String ? "0" : 0; + if (options.bytes === String) + object.content = ""; + else { + object.content = []; + if (options.bytes !== Array) + object.content = $util.newBuffer(object.content); + } + object.source = null; } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - if (message.uint64Value != null && message.hasOwnProperty("uint64Value")) - if (typeof message.uint64Value === "number") - object.uint64Value = options.longs === String ? String(message.uint64Value) : message.uint64Value; - else - object.uint64Value = options.longs === String ? $util.Long.prototype.toString.call(message.uint64Value) : options.longs === Number ? new $util.LongBits(message.uint64Value.low >>> 0, message.uint64Value.high >>> 0).toNumber(true) : message.uint64Value; + if (message.content != null && message.hasOwnProperty("content")) + object.content = options.bytes === String ? $util.base64.encode(message.content, 0, message.content.length) : options.bytes === Array ? Array.prototype.slice.call(message.content) : message.content; + if (message.source != null && message.hasOwnProperty("source")) + object.source = $root.google.cloud.vision.v1.ImageSource.toObject(message.source, options); return object; }; /** - * Converts this Property to JSON. + * Converts this Image to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.Property + * @memberof google.cloud.vision.v1.Image * @instance * @returns {Object.} JSON object */ - Property.prototype.toJSON = function toJSON() { + Image.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Property; + return Image; })(); - v1.EntityAnnotation = (function() { + /** + * Likelihood enum. + * @name google.cloud.vision.v1.Likelihood + * @enum {string} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} VERY_UNLIKELY=1 VERY_UNLIKELY value + * @property {number} UNLIKELY=2 UNLIKELY value + * @property {number} POSSIBLE=3 POSSIBLE value + * @property {number} LIKELY=4 LIKELY value + * @property {number} VERY_LIKELY=5 VERY_LIKELY value + */ + v1.Likelihood = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "VERY_UNLIKELY"] = 1; + values[valuesById[2] = "UNLIKELY"] = 2; + values[valuesById[3] = "POSSIBLE"] = 3; + values[valuesById[4] = "LIKELY"] = 4; + values[valuesById[5] = "VERY_LIKELY"] = 5; + return values; + })(); + + v1.FaceAnnotation = (function() { /** - * Properties of an EntityAnnotation. + * Properties of a FaceAnnotation. * @memberof google.cloud.vision.v1 - * @interface IEntityAnnotation - * @property {string|null} [mid] EntityAnnotation mid - * @property {string|null} [locale] EntityAnnotation locale - * @property {string|null} [description] EntityAnnotation description - * @property {number|null} [score] EntityAnnotation score - * @property {number|null} [confidence] EntityAnnotation confidence - * @property {number|null} [topicality] EntityAnnotation topicality - * @property {google.cloud.vision.v1.IBoundingPoly|null} [boundingPoly] EntityAnnotation boundingPoly - * @property {Array.|null} [locations] EntityAnnotation locations - * @property {Array.|null} [properties] EntityAnnotation properties + * @interface IFaceAnnotation + * @property {google.cloud.vision.v1.IBoundingPoly|null} [boundingPoly] FaceAnnotation boundingPoly + * @property {google.cloud.vision.v1.IBoundingPoly|null} [fdBoundingPoly] FaceAnnotation fdBoundingPoly + * @property {Array.|null} [landmarks] FaceAnnotation landmarks + * @property {number|null} [rollAngle] FaceAnnotation rollAngle + * @property {number|null} [panAngle] FaceAnnotation panAngle + * @property {number|null} [tiltAngle] FaceAnnotation tiltAngle + * @property {number|null} [detectionConfidence] FaceAnnotation detectionConfidence + * @property {number|null} [landmarkingConfidence] FaceAnnotation landmarkingConfidence + * @property {google.cloud.vision.v1.Likelihood|null} [joyLikelihood] FaceAnnotation joyLikelihood + * @property {google.cloud.vision.v1.Likelihood|null} [sorrowLikelihood] FaceAnnotation sorrowLikelihood + * @property {google.cloud.vision.v1.Likelihood|null} [angerLikelihood] FaceAnnotation angerLikelihood + * @property {google.cloud.vision.v1.Likelihood|null} [surpriseLikelihood] FaceAnnotation surpriseLikelihood + * @property {google.cloud.vision.v1.Likelihood|null} [underExposedLikelihood] FaceAnnotation underExposedLikelihood + * @property {google.cloud.vision.v1.Likelihood|null} [blurredLikelihood] FaceAnnotation blurredLikelihood + * @property {google.cloud.vision.v1.Likelihood|null} [headwearLikelihood] FaceAnnotation headwearLikelihood */ /** - * Constructs a new EntityAnnotation. + * Constructs a new FaceAnnotation. * @memberof google.cloud.vision.v1 - * @classdesc Represents an EntityAnnotation. - * @implements IEntityAnnotation + * @classdesc Represents a FaceAnnotation. + * @implements IFaceAnnotation * @constructor - * @param {google.cloud.vision.v1.IEntityAnnotation=} [properties] Properties to set + * @param {google.cloud.vision.v1.IFaceAnnotation=} [properties] Properties to set */ - function EntityAnnotation(properties) { - this.locations = []; - this.properties = []; + function FaceAnnotation(properties) { + this.landmarks = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2730,185 +1969,260 @@ } /** - * EntityAnnotation mid. - * @member {string} mid - * @memberof google.cloud.vision.v1.EntityAnnotation + * FaceAnnotation boundingPoly. + * @member {google.cloud.vision.v1.IBoundingPoly|null|undefined} boundingPoly + * @memberof google.cloud.vision.v1.FaceAnnotation * @instance */ - EntityAnnotation.prototype.mid = ""; + FaceAnnotation.prototype.boundingPoly = null; /** - * EntityAnnotation locale. - * @member {string} locale - * @memberof google.cloud.vision.v1.EntityAnnotation + * FaceAnnotation fdBoundingPoly. + * @member {google.cloud.vision.v1.IBoundingPoly|null|undefined} fdBoundingPoly + * @memberof google.cloud.vision.v1.FaceAnnotation * @instance */ - EntityAnnotation.prototype.locale = ""; + FaceAnnotation.prototype.fdBoundingPoly = null; /** - * EntityAnnotation description. - * @member {string} description - * @memberof google.cloud.vision.v1.EntityAnnotation + * FaceAnnotation landmarks. + * @member {Array.} landmarks + * @memberof google.cloud.vision.v1.FaceAnnotation * @instance */ - EntityAnnotation.prototype.description = ""; + FaceAnnotation.prototype.landmarks = $util.emptyArray; /** - * EntityAnnotation score. - * @member {number} score - * @memberof google.cloud.vision.v1.EntityAnnotation + * FaceAnnotation rollAngle. + * @member {number} rollAngle + * @memberof google.cloud.vision.v1.FaceAnnotation * @instance */ - EntityAnnotation.prototype.score = 0; + FaceAnnotation.prototype.rollAngle = 0; /** - * EntityAnnotation confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1.EntityAnnotation + * FaceAnnotation panAngle. + * @member {number} panAngle + * @memberof google.cloud.vision.v1.FaceAnnotation * @instance */ - EntityAnnotation.prototype.confidence = 0; + FaceAnnotation.prototype.panAngle = 0; /** - * EntityAnnotation topicality. - * @member {number} topicality - * @memberof google.cloud.vision.v1.EntityAnnotation + * FaceAnnotation tiltAngle. + * @member {number} tiltAngle + * @memberof google.cloud.vision.v1.FaceAnnotation * @instance */ - EntityAnnotation.prototype.topicality = 0; + FaceAnnotation.prototype.tiltAngle = 0; /** - * EntityAnnotation boundingPoly. - * @member {google.cloud.vision.v1.IBoundingPoly|null|undefined} boundingPoly - * @memberof google.cloud.vision.v1.EntityAnnotation + * FaceAnnotation detectionConfidence. + * @member {number} detectionConfidence + * @memberof google.cloud.vision.v1.FaceAnnotation * @instance */ - EntityAnnotation.prototype.boundingPoly = null; + FaceAnnotation.prototype.detectionConfidence = 0; /** - * EntityAnnotation locations. - * @member {Array.} locations - * @memberof google.cloud.vision.v1.EntityAnnotation + * FaceAnnotation landmarkingConfidence. + * @member {number} landmarkingConfidence + * @memberof google.cloud.vision.v1.FaceAnnotation * @instance */ - EntityAnnotation.prototype.locations = $util.emptyArray; + FaceAnnotation.prototype.landmarkingConfidence = 0; /** - * EntityAnnotation properties. - * @member {Array.} properties - * @memberof google.cloud.vision.v1.EntityAnnotation + * FaceAnnotation joyLikelihood. + * @member {google.cloud.vision.v1.Likelihood} joyLikelihood + * @memberof google.cloud.vision.v1.FaceAnnotation * @instance */ - EntityAnnotation.prototype.properties = $util.emptyArray; + FaceAnnotation.prototype.joyLikelihood = 0; /** - * Creates a new EntityAnnotation instance using the specified properties. + * FaceAnnotation sorrowLikelihood. + * @member {google.cloud.vision.v1.Likelihood} sorrowLikelihood + * @memberof google.cloud.vision.v1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.sorrowLikelihood = 0; + + /** + * FaceAnnotation angerLikelihood. + * @member {google.cloud.vision.v1.Likelihood} angerLikelihood + * @memberof google.cloud.vision.v1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.angerLikelihood = 0; + + /** + * FaceAnnotation surpriseLikelihood. + * @member {google.cloud.vision.v1.Likelihood} surpriseLikelihood + * @memberof google.cloud.vision.v1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.surpriseLikelihood = 0; + + /** + * FaceAnnotation underExposedLikelihood. + * @member {google.cloud.vision.v1.Likelihood} underExposedLikelihood + * @memberof google.cloud.vision.v1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.underExposedLikelihood = 0; + + /** + * FaceAnnotation blurredLikelihood. + * @member {google.cloud.vision.v1.Likelihood} blurredLikelihood + * @memberof google.cloud.vision.v1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.blurredLikelihood = 0; + + /** + * FaceAnnotation headwearLikelihood. + * @member {google.cloud.vision.v1.Likelihood} headwearLikelihood + * @memberof google.cloud.vision.v1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.headwearLikelihood = 0; + + /** + * Creates a new FaceAnnotation instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.EntityAnnotation + * @memberof google.cloud.vision.v1.FaceAnnotation * @static - * @param {google.cloud.vision.v1.IEntityAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1.EntityAnnotation} EntityAnnotation instance + * @param {google.cloud.vision.v1.IFaceAnnotation=} [properties] Properties to set + * @returns {google.cloud.vision.v1.FaceAnnotation} FaceAnnotation instance */ - EntityAnnotation.create = function create(properties) { - return new EntityAnnotation(properties); + FaceAnnotation.create = function create(properties) { + return new FaceAnnotation(properties); }; /** - * Encodes the specified EntityAnnotation message. Does not implicitly {@link google.cloud.vision.v1.EntityAnnotation.verify|verify} messages. + * Encodes the specified FaceAnnotation message. Does not implicitly {@link google.cloud.vision.v1.FaceAnnotation.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.EntityAnnotation + * @memberof google.cloud.vision.v1.FaceAnnotation * @static - * @param {google.cloud.vision.v1.IEntityAnnotation} message EntityAnnotation message or plain object to encode + * @param {google.cloud.vision.v1.IFaceAnnotation} message FaceAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EntityAnnotation.encode = function encode(message, writer) { + FaceAnnotation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.mid != null && message.hasOwnProperty("mid")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.mid); - if (message.locale != null && message.hasOwnProperty("locale")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.locale); - if (message.description != null && message.hasOwnProperty("description")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); - if (message.score != null && message.hasOwnProperty("score")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.score); - if (message.confidence != null && message.hasOwnProperty("confidence")) - writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); - if (message.topicality != null && message.hasOwnProperty("topicality")) - writer.uint32(/* id 6, wireType 5 =*/53).float(message.topicality); if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - $root.google.cloud.vision.v1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.locations != null && message.locations.length) - for (var i = 0; i < message.locations.length; ++i) - $root.google.cloud.vision.v1.LocationInfo.encode(message.locations[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.properties != null && message.properties.length) - for (var i = 0; i < message.properties.length; ++i) - $root.google.cloud.vision.v1.Property.encode(message.properties[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + $root.google.cloud.vision.v1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.fdBoundingPoly != null && message.hasOwnProperty("fdBoundingPoly")) + $root.google.cloud.vision.v1.BoundingPoly.encode(message.fdBoundingPoly, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.landmarks != null && message.landmarks.length) + for (var i = 0; i < message.landmarks.length; ++i) + $root.google.cloud.vision.v1.FaceAnnotation.Landmark.encode(message.landmarks[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.rollAngle != null && message.hasOwnProperty("rollAngle")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.rollAngle); + if (message.panAngle != null && message.hasOwnProperty("panAngle")) + writer.uint32(/* id 5, wireType 5 =*/45).float(message.panAngle); + if (message.tiltAngle != null && message.hasOwnProperty("tiltAngle")) + writer.uint32(/* id 6, wireType 5 =*/53).float(message.tiltAngle); + if (message.detectionConfidence != null && message.hasOwnProperty("detectionConfidence")) + writer.uint32(/* id 7, wireType 5 =*/61).float(message.detectionConfidence); + if (message.landmarkingConfidence != null && message.hasOwnProperty("landmarkingConfidence")) + writer.uint32(/* id 8, wireType 5 =*/69).float(message.landmarkingConfidence); + if (message.joyLikelihood != null && message.hasOwnProperty("joyLikelihood")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.joyLikelihood); + if (message.sorrowLikelihood != null && message.hasOwnProperty("sorrowLikelihood")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.sorrowLikelihood); + if (message.angerLikelihood != null && message.hasOwnProperty("angerLikelihood")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.angerLikelihood); + if (message.surpriseLikelihood != null && message.hasOwnProperty("surpriseLikelihood")) + writer.uint32(/* id 12, wireType 0 =*/96).int32(message.surpriseLikelihood); + if (message.underExposedLikelihood != null && message.hasOwnProperty("underExposedLikelihood")) + writer.uint32(/* id 13, wireType 0 =*/104).int32(message.underExposedLikelihood); + if (message.blurredLikelihood != null && message.hasOwnProperty("blurredLikelihood")) + writer.uint32(/* id 14, wireType 0 =*/112).int32(message.blurredLikelihood); + if (message.headwearLikelihood != null && message.hasOwnProperty("headwearLikelihood")) + writer.uint32(/* id 15, wireType 0 =*/120).int32(message.headwearLikelihood); return writer; }; /** - * Encodes the specified EntityAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1.EntityAnnotation.verify|verify} messages. + * Encodes the specified FaceAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1.FaceAnnotation.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.EntityAnnotation + * @memberof google.cloud.vision.v1.FaceAnnotation * @static - * @param {google.cloud.vision.v1.IEntityAnnotation} message EntityAnnotation message or plain object to encode + * @param {google.cloud.vision.v1.IFaceAnnotation} message FaceAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EntityAnnotation.encodeDelimited = function encodeDelimited(message, writer) { + FaceAnnotation.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an EntityAnnotation message from the specified reader or buffer. + * Decodes a FaceAnnotation message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.EntityAnnotation + * @memberof google.cloud.vision.v1.FaceAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.EntityAnnotation} EntityAnnotation + * @returns {google.cloud.vision.v1.FaceAnnotation} FaceAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EntityAnnotation.decode = function decode(reader, length) { + FaceAnnotation.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.vision.v1.EntityAnnotation(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.FaceAnnotation(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.mid = reader.string(); + message.boundingPoly = $root.google.cloud.vision.v1.BoundingPoly.decode(reader, reader.uint32()); break; case 2: - message.locale = reader.string(); + message.fdBoundingPoly = $root.google.cloud.vision.v1.BoundingPoly.decode(reader, reader.uint32()); break; case 3: - message.description = reader.string(); + if (!(message.landmarks && message.landmarks.length)) + message.landmarks = []; + message.landmarks.push($root.google.cloud.vision.v1.FaceAnnotation.Landmark.decode(reader, reader.uint32())); break; case 4: - message.score = reader.float(); + message.rollAngle = reader.float(); break; case 5: - message.confidence = reader.float(); + message.panAngle = reader.float(); break; case 6: - message.topicality = reader.float(); + message.tiltAngle = reader.float(); break; case 7: - message.boundingPoly = $root.google.cloud.vision.v1.BoundingPoly.decode(reader, reader.uint32()); + message.detectionConfidence = reader.float(); break; case 8: - if (!(message.locations && message.locations.length)) - message.locations = []; - message.locations.push($root.google.cloud.vision.v1.LocationInfo.decode(reader, reader.uint32())); + message.landmarkingConfidence = reader.float(); break; case 9: - if (!(message.properties && message.properties.length)) - message.properties = []; - message.properties.push($root.google.cloud.vision.v1.Property.decode(reader, reader.uint32())); + message.joyLikelihood = reader.int32(); + break; + case 10: + message.sorrowLikelihood = reader.int32(); + break; + case 11: + message.angerLikelihood = reader.int32(); + break; + case 12: + message.surpriseLikelihood = reader.int32(); + break; + case 13: + message.underExposedLikelihood = reader.int32(); + break; + case 14: + message.blurredLikelihood = reader.int32(); + break; + case 15: + message.headwearLikelihood = reader.int32(); break; default: reader.skipType(tag & 7); @@ -2919,504 +2233,1146 @@ }; /** - * Decodes an EntityAnnotation message from the specified reader or buffer, length delimited. + * Decodes a FaceAnnotation message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.EntityAnnotation + * @memberof google.cloud.vision.v1.FaceAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.EntityAnnotation} EntityAnnotation + * @returns {google.cloud.vision.v1.FaceAnnotation} FaceAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EntityAnnotation.decodeDelimited = function decodeDelimited(reader) { + FaceAnnotation.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an EntityAnnotation message. + * Verifies a FaceAnnotation message. * @function verify - * @memberof google.cloud.vision.v1.EntityAnnotation + * @memberof google.cloud.vision.v1.FaceAnnotation * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - EntityAnnotation.verify = function verify(message) { + FaceAnnotation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.mid != null && message.hasOwnProperty("mid")) - if (!$util.isString(message.mid)) - return "mid: string expected"; - if (message.locale != null && message.hasOwnProperty("locale")) - if (!$util.isString(message.locale)) - return "locale: string expected"; - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; - if (message.confidence != null && message.hasOwnProperty("confidence")) - if (typeof message.confidence !== "number") - return "confidence: number expected"; - if (message.topicality != null && message.hasOwnProperty("topicality")) - if (typeof message.topicality !== "number") - return "topicality: number expected"; if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { var error = $root.google.cloud.vision.v1.BoundingPoly.verify(message.boundingPoly); if (error) return "boundingPoly." + error; } - if (message.locations != null && message.hasOwnProperty("locations")) { - if (!Array.isArray(message.locations)) - return "locations: array expected"; - for (var i = 0; i < message.locations.length; ++i) { - var error = $root.google.cloud.vision.v1.LocationInfo.verify(message.locations[i]); - if (error) - return "locations." + error; - } + if (message.fdBoundingPoly != null && message.hasOwnProperty("fdBoundingPoly")) { + var error = $root.google.cloud.vision.v1.BoundingPoly.verify(message.fdBoundingPoly); + if (error) + return "fdBoundingPoly." + error; } - if (message.properties != null && message.hasOwnProperty("properties")) { - if (!Array.isArray(message.properties)) - return "properties: array expected"; - for (var i = 0; i < message.properties.length; ++i) { - var error = $root.google.cloud.vision.v1.Property.verify(message.properties[i]); + if (message.landmarks != null && message.hasOwnProperty("landmarks")) { + if (!Array.isArray(message.landmarks)) + return "landmarks: array expected"; + for (var i = 0; i < message.landmarks.length; ++i) { + var error = $root.google.cloud.vision.v1.FaceAnnotation.Landmark.verify(message.landmarks[i]); if (error) - return "properties." + error; + return "landmarks." + error; } } + if (message.rollAngle != null && message.hasOwnProperty("rollAngle")) + if (typeof message.rollAngle !== "number") + return "rollAngle: number expected"; + if (message.panAngle != null && message.hasOwnProperty("panAngle")) + if (typeof message.panAngle !== "number") + return "panAngle: number expected"; + if (message.tiltAngle != null && message.hasOwnProperty("tiltAngle")) + if (typeof message.tiltAngle !== "number") + return "tiltAngle: number expected"; + if (message.detectionConfidence != null && message.hasOwnProperty("detectionConfidence")) + if (typeof message.detectionConfidence !== "number") + return "detectionConfidence: number expected"; + if (message.landmarkingConfidence != null && message.hasOwnProperty("landmarkingConfidence")) + if (typeof message.landmarkingConfidence !== "number") + return "landmarkingConfidence: number expected"; + if (message.joyLikelihood != null && message.hasOwnProperty("joyLikelihood")) + switch (message.joyLikelihood) { + default: + return "joyLikelihood: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.sorrowLikelihood != null && message.hasOwnProperty("sorrowLikelihood")) + switch (message.sorrowLikelihood) { + default: + return "sorrowLikelihood: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.angerLikelihood != null && message.hasOwnProperty("angerLikelihood")) + switch (message.angerLikelihood) { + default: + return "angerLikelihood: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.surpriseLikelihood != null && message.hasOwnProperty("surpriseLikelihood")) + switch (message.surpriseLikelihood) { + default: + return "surpriseLikelihood: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.underExposedLikelihood != null && message.hasOwnProperty("underExposedLikelihood")) + switch (message.underExposedLikelihood) { + default: + return "underExposedLikelihood: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.blurredLikelihood != null && message.hasOwnProperty("blurredLikelihood")) + switch (message.blurredLikelihood) { + default: + return "blurredLikelihood: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.headwearLikelihood != null && message.hasOwnProperty("headwearLikelihood")) + switch (message.headwearLikelihood) { + default: + return "headwearLikelihood: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } return null; }; /** - * Creates an EntityAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates a FaceAnnotation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.EntityAnnotation + * @memberof google.cloud.vision.v1.FaceAnnotation * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.EntityAnnotation} EntityAnnotation + * @returns {google.cloud.vision.v1.FaceAnnotation} FaceAnnotation */ - EntityAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.EntityAnnotation) + FaceAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.FaceAnnotation) return object; - var message = new $root.google.cloud.vision.v1.EntityAnnotation(); - if (object.mid != null) - message.mid = String(object.mid); - if (object.locale != null) - message.locale = String(object.locale); - if (object.description != null) - message.description = String(object.description); - if (object.score != null) - message.score = Number(object.score); - if (object.confidence != null) - message.confidence = Number(object.confidence); - if (object.topicality != null) - message.topicality = Number(object.topicality); + var message = new $root.google.cloud.vision.v1.FaceAnnotation(); if (object.boundingPoly != null) { if (typeof object.boundingPoly !== "object") - throw TypeError(".google.cloud.vision.v1.EntityAnnotation.boundingPoly: object expected"); + throw TypeError(".google.cloud.vision.v1.FaceAnnotation.boundingPoly: object expected"); message.boundingPoly = $root.google.cloud.vision.v1.BoundingPoly.fromObject(object.boundingPoly); } - if (object.locations) { - if (!Array.isArray(object.locations)) - throw TypeError(".google.cloud.vision.v1.EntityAnnotation.locations: array expected"); - message.locations = []; - for (var i = 0; i < object.locations.length; ++i) { - if (typeof object.locations[i] !== "object") - throw TypeError(".google.cloud.vision.v1.EntityAnnotation.locations: object expected"); - message.locations[i] = $root.google.cloud.vision.v1.LocationInfo.fromObject(object.locations[i]); - } + if (object.fdBoundingPoly != null) { + if (typeof object.fdBoundingPoly !== "object") + throw TypeError(".google.cloud.vision.v1.FaceAnnotation.fdBoundingPoly: object expected"); + message.fdBoundingPoly = $root.google.cloud.vision.v1.BoundingPoly.fromObject(object.fdBoundingPoly); } - if (object.properties) { - if (!Array.isArray(object.properties)) - throw TypeError(".google.cloud.vision.v1.EntityAnnotation.properties: array expected"); - message.properties = []; - for (var i = 0; i < object.properties.length; ++i) { - if (typeof object.properties[i] !== "object") - throw TypeError(".google.cloud.vision.v1.EntityAnnotation.properties: object expected"); - message.properties[i] = $root.google.cloud.vision.v1.Property.fromObject(object.properties[i]); + if (object.landmarks) { + if (!Array.isArray(object.landmarks)) + throw TypeError(".google.cloud.vision.v1.FaceAnnotation.landmarks: array expected"); + message.landmarks = []; + for (var i = 0; i < object.landmarks.length; ++i) { + if (typeof object.landmarks[i] !== "object") + throw TypeError(".google.cloud.vision.v1.FaceAnnotation.landmarks: object expected"); + message.landmarks[i] = $root.google.cloud.vision.v1.FaceAnnotation.Landmark.fromObject(object.landmarks[i]); } } + if (object.rollAngle != null) + message.rollAngle = Number(object.rollAngle); + if (object.panAngle != null) + message.panAngle = Number(object.panAngle); + if (object.tiltAngle != null) + message.tiltAngle = Number(object.tiltAngle); + if (object.detectionConfidence != null) + message.detectionConfidence = Number(object.detectionConfidence); + if (object.landmarkingConfidence != null) + message.landmarkingConfidence = Number(object.landmarkingConfidence); + switch (object.joyLikelihood) { + case "UNKNOWN": + case 0: + message.joyLikelihood = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.joyLikelihood = 1; + break; + case "UNLIKELY": + case 2: + message.joyLikelihood = 2; + break; + case "POSSIBLE": + case 3: + message.joyLikelihood = 3; + break; + case "LIKELY": + case 4: + message.joyLikelihood = 4; + break; + case "VERY_LIKELY": + case 5: + message.joyLikelihood = 5; + break; + } + switch (object.sorrowLikelihood) { + case "UNKNOWN": + case 0: + message.sorrowLikelihood = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.sorrowLikelihood = 1; + break; + case "UNLIKELY": + case 2: + message.sorrowLikelihood = 2; + break; + case "POSSIBLE": + case 3: + message.sorrowLikelihood = 3; + break; + case "LIKELY": + case 4: + message.sorrowLikelihood = 4; + break; + case "VERY_LIKELY": + case 5: + message.sorrowLikelihood = 5; + break; + } + switch (object.angerLikelihood) { + case "UNKNOWN": + case 0: + message.angerLikelihood = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.angerLikelihood = 1; + break; + case "UNLIKELY": + case 2: + message.angerLikelihood = 2; + break; + case "POSSIBLE": + case 3: + message.angerLikelihood = 3; + break; + case "LIKELY": + case 4: + message.angerLikelihood = 4; + break; + case "VERY_LIKELY": + case 5: + message.angerLikelihood = 5; + break; + } + switch (object.surpriseLikelihood) { + case "UNKNOWN": + case 0: + message.surpriseLikelihood = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.surpriseLikelihood = 1; + break; + case "UNLIKELY": + case 2: + message.surpriseLikelihood = 2; + break; + case "POSSIBLE": + case 3: + message.surpriseLikelihood = 3; + break; + case "LIKELY": + case 4: + message.surpriseLikelihood = 4; + break; + case "VERY_LIKELY": + case 5: + message.surpriseLikelihood = 5; + break; + } + switch (object.underExposedLikelihood) { + case "UNKNOWN": + case 0: + message.underExposedLikelihood = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.underExposedLikelihood = 1; + break; + case "UNLIKELY": + case 2: + message.underExposedLikelihood = 2; + break; + case "POSSIBLE": + case 3: + message.underExposedLikelihood = 3; + break; + case "LIKELY": + case 4: + message.underExposedLikelihood = 4; + break; + case "VERY_LIKELY": + case 5: + message.underExposedLikelihood = 5; + break; + } + switch (object.blurredLikelihood) { + case "UNKNOWN": + case 0: + message.blurredLikelihood = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.blurredLikelihood = 1; + break; + case "UNLIKELY": + case 2: + message.blurredLikelihood = 2; + break; + case "POSSIBLE": + case 3: + message.blurredLikelihood = 3; + break; + case "LIKELY": + case 4: + message.blurredLikelihood = 4; + break; + case "VERY_LIKELY": + case 5: + message.blurredLikelihood = 5; + break; + } + switch (object.headwearLikelihood) { + case "UNKNOWN": + case 0: + message.headwearLikelihood = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.headwearLikelihood = 1; + break; + case "UNLIKELY": + case 2: + message.headwearLikelihood = 2; + break; + case "POSSIBLE": + case 3: + message.headwearLikelihood = 3; + break; + case "LIKELY": + case 4: + message.headwearLikelihood = 4; + break; + case "VERY_LIKELY": + case 5: + message.headwearLikelihood = 5; + break; + } return message; }; /** - * Creates a plain object from an EntityAnnotation message. Also converts values to other types if specified. + * Creates a plain object from a FaceAnnotation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.EntityAnnotation + * @memberof google.cloud.vision.v1.FaceAnnotation * @static - * @param {google.cloud.vision.v1.EntityAnnotation} message EntityAnnotation + * @param {google.cloud.vision.v1.FaceAnnotation} message FaceAnnotation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EntityAnnotation.toObject = function toObject(message, options) { + FaceAnnotation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.locations = []; - object.properties = []; - } + if (options.arrays || options.defaults) + object.landmarks = []; if (options.defaults) { - object.mid = ""; - object.locale = ""; - object.description = ""; - object.score = 0; - object.confidence = 0; - object.topicality = 0; object.boundingPoly = null; + object.fdBoundingPoly = null; + object.rollAngle = 0; + object.panAngle = 0; + object.tiltAngle = 0; + object.detectionConfidence = 0; + object.landmarkingConfidence = 0; + object.joyLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.sorrowLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.angerLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.surpriseLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.underExposedLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.blurredLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.headwearLikelihood = options.enums === String ? "UNKNOWN" : 0; } - if (message.mid != null && message.hasOwnProperty("mid")) - object.mid = message.mid; - if (message.locale != null && message.hasOwnProperty("locale")) - object.locale = message.locale; - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - if (message.confidence != null && message.hasOwnProperty("confidence")) - object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; - if (message.topicality != null && message.hasOwnProperty("topicality")) - object.topicality = options.json && !isFinite(message.topicality) ? String(message.topicality) : message.topicality; if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) object.boundingPoly = $root.google.cloud.vision.v1.BoundingPoly.toObject(message.boundingPoly, options); - if (message.locations && message.locations.length) { - object.locations = []; - for (var j = 0; j < message.locations.length; ++j) - object.locations[j] = $root.google.cloud.vision.v1.LocationInfo.toObject(message.locations[j], options); - } - if (message.properties && message.properties.length) { - object.properties = []; - for (var j = 0; j < message.properties.length; ++j) - object.properties[j] = $root.google.cloud.vision.v1.Property.toObject(message.properties[j], options); + if (message.fdBoundingPoly != null && message.hasOwnProperty("fdBoundingPoly")) + object.fdBoundingPoly = $root.google.cloud.vision.v1.BoundingPoly.toObject(message.fdBoundingPoly, options); + if (message.landmarks && message.landmarks.length) { + object.landmarks = []; + for (var j = 0; j < message.landmarks.length; ++j) + object.landmarks[j] = $root.google.cloud.vision.v1.FaceAnnotation.Landmark.toObject(message.landmarks[j], options); } - return object; - }; - - /** - * Converts this EntityAnnotation to JSON. + if (message.rollAngle != null && message.hasOwnProperty("rollAngle")) + object.rollAngle = options.json && !isFinite(message.rollAngle) ? String(message.rollAngle) : message.rollAngle; + if (message.panAngle != null && message.hasOwnProperty("panAngle")) + object.panAngle = options.json && !isFinite(message.panAngle) ? String(message.panAngle) : message.panAngle; + if (message.tiltAngle != null && message.hasOwnProperty("tiltAngle")) + object.tiltAngle = options.json && !isFinite(message.tiltAngle) ? String(message.tiltAngle) : message.tiltAngle; + if (message.detectionConfidence != null && message.hasOwnProperty("detectionConfidence")) + object.detectionConfidence = options.json && !isFinite(message.detectionConfidence) ? String(message.detectionConfidence) : message.detectionConfidence; + if (message.landmarkingConfidence != null && message.hasOwnProperty("landmarkingConfidence")) + object.landmarkingConfidence = options.json && !isFinite(message.landmarkingConfidence) ? String(message.landmarkingConfidence) : message.landmarkingConfidence; + if (message.joyLikelihood != null && message.hasOwnProperty("joyLikelihood")) + object.joyLikelihood = options.enums === String ? $root.google.cloud.vision.v1.Likelihood[message.joyLikelihood] : message.joyLikelihood; + if (message.sorrowLikelihood != null && message.hasOwnProperty("sorrowLikelihood")) + object.sorrowLikelihood = options.enums === String ? $root.google.cloud.vision.v1.Likelihood[message.sorrowLikelihood] : message.sorrowLikelihood; + if (message.angerLikelihood != null && message.hasOwnProperty("angerLikelihood")) + object.angerLikelihood = options.enums === String ? $root.google.cloud.vision.v1.Likelihood[message.angerLikelihood] : message.angerLikelihood; + if (message.surpriseLikelihood != null && message.hasOwnProperty("surpriseLikelihood")) + object.surpriseLikelihood = options.enums === String ? $root.google.cloud.vision.v1.Likelihood[message.surpriseLikelihood] : message.surpriseLikelihood; + if (message.underExposedLikelihood != null && message.hasOwnProperty("underExposedLikelihood")) + object.underExposedLikelihood = options.enums === String ? $root.google.cloud.vision.v1.Likelihood[message.underExposedLikelihood] : message.underExposedLikelihood; + if (message.blurredLikelihood != null && message.hasOwnProperty("blurredLikelihood")) + object.blurredLikelihood = options.enums === String ? $root.google.cloud.vision.v1.Likelihood[message.blurredLikelihood] : message.blurredLikelihood; + if (message.headwearLikelihood != null && message.hasOwnProperty("headwearLikelihood")) + object.headwearLikelihood = options.enums === String ? $root.google.cloud.vision.v1.Likelihood[message.headwearLikelihood] : message.headwearLikelihood; + return object; + }; + + /** + * Converts this FaceAnnotation to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.EntityAnnotation + * @memberof google.cloud.vision.v1.FaceAnnotation * @instance * @returns {Object.} JSON object */ - EntityAnnotation.prototype.toJSON = function toJSON() { + FaceAnnotation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return EntityAnnotation; - })(); - - v1.LocalizedObjectAnnotation = (function() { + FaceAnnotation.Landmark = (function() { - /** - * Properties of a LocalizedObjectAnnotation. - * @memberof google.cloud.vision.v1 - * @interface ILocalizedObjectAnnotation - * @property {string|null} [mid] LocalizedObjectAnnotation mid - * @property {string|null} [languageCode] LocalizedObjectAnnotation languageCode - * @property {string|null} [name] LocalizedObjectAnnotation name - * @property {number|null} [score] LocalizedObjectAnnotation score - * @property {google.cloud.vision.v1.IBoundingPoly|null} [boundingPoly] LocalizedObjectAnnotation boundingPoly - */ + /** + * Properties of a Landmark. + * @memberof google.cloud.vision.v1.FaceAnnotation + * @interface ILandmark + * @property {google.cloud.vision.v1.FaceAnnotation.Landmark.Type|null} [type] Landmark type + * @property {google.cloud.vision.v1.IPosition|null} [position] Landmark position + */ - /** - * Constructs a new LocalizedObjectAnnotation. - * @memberof google.cloud.vision.v1 - * @classdesc Represents a LocalizedObjectAnnotation. - * @implements ILocalizedObjectAnnotation - * @constructor - * @param {google.cloud.vision.v1.ILocalizedObjectAnnotation=} [properties] Properties to set - */ - function LocalizedObjectAnnotation(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]]; - } + /** + * Constructs a new Landmark. + * @memberof google.cloud.vision.v1.FaceAnnotation + * @classdesc Represents a Landmark. + * @implements ILandmark + * @constructor + * @param {google.cloud.vision.v1.FaceAnnotation.ILandmark=} [properties] Properties to set + */ + function Landmark(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]]; + } - /** - * LocalizedObjectAnnotation mid. - * @member {string} mid - * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation - * @instance - */ - LocalizedObjectAnnotation.prototype.mid = ""; + /** + * Landmark type. + * @member {google.cloud.vision.v1.FaceAnnotation.Landmark.Type} type + * @memberof google.cloud.vision.v1.FaceAnnotation.Landmark + * @instance + */ + Landmark.prototype.type = 0; - /** - * LocalizedObjectAnnotation languageCode. - * @member {string} languageCode - * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation - * @instance - */ - LocalizedObjectAnnotation.prototype.languageCode = ""; + /** + * Landmark position. + * @member {google.cloud.vision.v1.IPosition|null|undefined} position + * @memberof google.cloud.vision.v1.FaceAnnotation.Landmark + * @instance + */ + Landmark.prototype.position = null; - /** - * LocalizedObjectAnnotation name. - * @member {string} name - * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation - * @instance - */ - LocalizedObjectAnnotation.prototype.name = ""; + /** + * Creates a new Landmark instance using the specified properties. + * @function create + * @memberof google.cloud.vision.v1.FaceAnnotation.Landmark + * @static + * @param {google.cloud.vision.v1.FaceAnnotation.ILandmark=} [properties] Properties to set + * @returns {google.cloud.vision.v1.FaceAnnotation.Landmark} Landmark instance + */ + Landmark.create = function create(properties) { + return new Landmark(properties); + }; - /** - * LocalizedObjectAnnotation score. - * @member {number} score - * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation - * @instance - */ - LocalizedObjectAnnotation.prototype.score = 0; + /** + * Encodes the specified Landmark message. Does not implicitly {@link google.cloud.vision.v1.FaceAnnotation.Landmark.verify|verify} messages. + * @function encode + * @memberof google.cloud.vision.v1.FaceAnnotation.Landmark + * @static + * @param {google.cloud.vision.v1.FaceAnnotation.ILandmark} message Landmark message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Landmark.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && message.hasOwnProperty("type")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); + if (message.position != null && message.hasOwnProperty("position")) + $root.google.cloud.vision.v1.Position.encode(message.position, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; - /** - * LocalizedObjectAnnotation boundingPoly. - * @member {google.cloud.vision.v1.IBoundingPoly|null|undefined} boundingPoly - * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation - * @instance - */ - LocalizedObjectAnnotation.prototype.boundingPoly = null; + /** + * Encodes the specified Landmark message, length delimited. Does not implicitly {@link google.cloud.vision.v1.FaceAnnotation.Landmark.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.vision.v1.FaceAnnotation.Landmark + * @static + * @param {google.cloud.vision.v1.FaceAnnotation.ILandmark} message Landmark message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Landmark.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Creates a new LocalizedObjectAnnotation instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation - * @static - * @param {google.cloud.vision.v1.ILocalizedObjectAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1.LocalizedObjectAnnotation} LocalizedObjectAnnotation instance - */ - LocalizedObjectAnnotation.create = function create(properties) { - return new LocalizedObjectAnnotation(properties); - }; + /** + * Decodes a Landmark message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.vision.v1.FaceAnnotation.Landmark + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.vision.v1.FaceAnnotation.Landmark} Landmark + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Landmark.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.vision.v1.FaceAnnotation.Landmark(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + message.type = reader.int32(); + break; + case 4: + message.position = $root.google.cloud.vision.v1.Position.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Encodes the specified LocalizedObjectAnnotation message. Does not implicitly {@link google.cloud.vision.v1.LocalizedObjectAnnotation.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation - * @static - * @param {google.cloud.vision.v1.ILocalizedObjectAnnotation} message LocalizedObjectAnnotation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LocalizedObjectAnnotation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.mid != null && message.hasOwnProperty("mid")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.mid); - if (message.languageCode != null && message.hasOwnProperty("languageCode")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); - if (message.name != null && message.hasOwnProperty("name")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); - if (message.score != null && message.hasOwnProperty("score")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.score); - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - $root.google.cloud.vision.v1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - return writer; - }; + /** + * Decodes a Landmark message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.vision.v1.FaceAnnotation.Landmark + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.vision.v1.FaceAnnotation.Landmark} Landmark + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Landmark.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Encodes the specified LocalizedObjectAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1.LocalizedObjectAnnotation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation - * @static - * @param {google.cloud.vision.v1.ILocalizedObjectAnnotation} message LocalizedObjectAnnotation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LocalizedObjectAnnotation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Verifies a Landmark message. + * @function verify + * @memberof google.cloud.vision.v1.FaceAnnotation.Landmark + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Landmark.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + case 24: + case 25: + case 26: + case 27: + case 28: + case 29: + case 30: + case 31: + case 32: + case 33: + case 34: + break; + } + if (message.position != null && message.hasOwnProperty("position")) { + var error = $root.google.cloud.vision.v1.Position.verify(message.position); + if (error) + return "position." + error; + } + return null; + }; - /** - * Decodes a LocalizedObjectAnnotation message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.LocalizedObjectAnnotation} LocalizedObjectAnnotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LocalizedObjectAnnotation.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.vision.v1.LocalizedObjectAnnotation(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { + /** + * Creates a Landmark message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.vision.v1.FaceAnnotation.Landmark + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.vision.v1.FaceAnnotation.Landmark} Landmark + */ + Landmark.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.FaceAnnotation.Landmark) + return object; + var message = new $root.google.cloud.vision.v1.FaceAnnotation.Landmark(); + switch (object.type) { + case "UNKNOWN_LANDMARK": + case 0: + message.type = 0; + break; + case "LEFT_EYE": case 1: - message.mid = reader.string(); + message.type = 1; break; + case "RIGHT_EYE": case 2: - message.languageCode = reader.string(); + message.type = 2; break; + case "LEFT_OF_LEFT_EYEBROW": case 3: - message.name = reader.string(); + message.type = 3; break; + case "RIGHT_OF_LEFT_EYEBROW": case 4: - message.score = reader.float(); + message.type = 4; break; + case "LEFT_OF_RIGHT_EYEBROW": case 5: - message.boundingPoly = $root.google.cloud.vision.v1.BoundingPoly.decode(reader, reader.uint32()); + message.type = 5; break; - default: - reader.skipType(tag & 7); + case "RIGHT_OF_RIGHT_EYEBROW": + case 6: + message.type = 6; + break; + case "MIDPOINT_BETWEEN_EYES": + case 7: + message.type = 7; + break; + case "NOSE_TIP": + case 8: + message.type = 8; + break; + case "UPPER_LIP": + case 9: + message.type = 9; + break; + case "LOWER_LIP": + case 10: + message.type = 10; + break; + case "MOUTH_LEFT": + case 11: + message.type = 11; + break; + case "MOUTH_RIGHT": + case 12: + message.type = 12; + break; + case "MOUTH_CENTER": + case 13: + message.type = 13; + break; + case "NOSE_BOTTOM_RIGHT": + case 14: + message.type = 14; + break; + case "NOSE_BOTTOM_LEFT": + case 15: + message.type = 15; + break; + case "NOSE_BOTTOM_CENTER": + case 16: + message.type = 16; + break; + case "LEFT_EYE_TOP_BOUNDARY": + case 17: + message.type = 17; + break; + case "LEFT_EYE_RIGHT_CORNER": + case 18: + message.type = 18; + break; + case "LEFT_EYE_BOTTOM_BOUNDARY": + case 19: + message.type = 19; + break; + case "LEFT_EYE_LEFT_CORNER": + case 20: + message.type = 20; + break; + case "RIGHT_EYE_TOP_BOUNDARY": + case 21: + message.type = 21; + break; + case "RIGHT_EYE_RIGHT_CORNER": + case 22: + message.type = 22; + break; + case "RIGHT_EYE_BOTTOM_BOUNDARY": + case 23: + message.type = 23; + break; + case "RIGHT_EYE_LEFT_CORNER": + case 24: + message.type = 24; + break; + case "LEFT_EYEBROW_UPPER_MIDPOINT": + case 25: + message.type = 25; + break; + case "RIGHT_EYEBROW_UPPER_MIDPOINT": + case 26: + message.type = 26; + break; + case "LEFT_EAR_TRAGION": + case 27: + message.type = 27; + break; + case "RIGHT_EAR_TRAGION": + case 28: + message.type = 28; + break; + case "LEFT_EYE_PUPIL": + case 29: + message.type = 29; + break; + case "RIGHT_EYE_PUPIL": + case 30: + message.type = 30; + break; + case "FOREHEAD_GLABELLA": + case 31: + message.type = 31; + break; + case "CHIN_GNATHION": + case 32: + message.type = 32; + break; + case "CHIN_LEFT_GONION": + case 33: + message.type = 33; + break; + case "CHIN_RIGHT_GONION": + case 34: + message.type = 34; break; } - } - return message; - }; + if (object.position != null) { + if (typeof object.position !== "object") + throw TypeError(".google.cloud.vision.v1.FaceAnnotation.Landmark.position: object expected"); + message.position = $root.google.cloud.vision.v1.Position.fromObject(object.position); + } + return message; + }; - /** - * Decodes a LocalizedObjectAnnotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.LocalizedObjectAnnotation} LocalizedObjectAnnotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + /** + * Creates a plain object from a Landmark message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.vision.v1.FaceAnnotation.Landmark + * @static + * @param {google.cloud.vision.v1.FaceAnnotation.Landmark} message Landmark + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Landmark.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.type = options.enums === String ? "UNKNOWN_LANDMARK" : 0; + object.position = null; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.vision.v1.FaceAnnotation.Landmark.Type[message.type] : message.type; + if (message.position != null && message.hasOwnProperty("position")) + object.position = $root.google.cloud.vision.v1.Position.toObject(message.position, options); + return object; + }; + + /** + * Converts this Landmark to JSON. + * @function toJSON + * @memberof google.cloud.vision.v1.FaceAnnotation.Landmark + * @instance + * @returns {Object.} JSON object + */ + Landmark.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Type enum. + * @name google.cloud.vision.v1.FaceAnnotation.Landmark.Type + * @enum {string} + * @property {number} UNKNOWN_LANDMARK=0 UNKNOWN_LANDMARK value + * @property {number} LEFT_EYE=1 LEFT_EYE value + * @property {number} RIGHT_EYE=2 RIGHT_EYE value + * @property {number} LEFT_OF_LEFT_EYEBROW=3 LEFT_OF_LEFT_EYEBROW value + * @property {number} RIGHT_OF_LEFT_EYEBROW=4 RIGHT_OF_LEFT_EYEBROW value + * @property {number} LEFT_OF_RIGHT_EYEBROW=5 LEFT_OF_RIGHT_EYEBROW value + * @property {number} RIGHT_OF_RIGHT_EYEBROW=6 RIGHT_OF_RIGHT_EYEBROW value + * @property {number} MIDPOINT_BETWEEN_EYES=7 MIDPOINT_BETWEEN_EYES value + * @property {number} NOSE_TIP=8 NOSE_TIP value + * @property {number} UPPER_LIP=9 UPPER_LIP value + * @property {number} LOWER_LIP=10 LOWER_LIP value + * @property {number} MOUTH_LEFT=11 MOUTH_LEFT value + * @property {number} MOUTH_RIGHT=12 MOUTH_RIGHT value + * @property {number} MOUTH_CENTER=13 MOUTH_CENTER value + * @property {number} NOSE_BOTTOM_RIGHT=14 NOSE_BOTTOM_RIGHT value + * @property {number} NOSE_BOTTOM_LEFT=15 NOSE_BOTTOM_LEFT value + * @property {number} NOSE_BOTTOM_CENTER=16 NOSE_BOTTOM_CENTER value + * @property {number} LEFT_EYE_TOP_BOUNDARY=17 LEFT_EYE_TOP_BOUNDARY value + * @property {number} LEFT_EYE_RIGHT_CORNER=18 LEFT_EYE_RIGHT_CORNER value + * @property {number} LEFT_EYE_BOTTOM_BOUNDARY=19 LEFT_EYE_BOTTOM_BOUNDARY value + * @property {number} LEFT_EYE_LEFT_CORNER=20 LEFT_EYE_LEFT_CORNER value + * @property {number} RIGHT_EYE_TOP_BOUNDARY=21 RIGHT_EYE_TOP_BOUNDARY value + * @property {number} RIGHT_EYE_RIGHT_CORNER=22 RIGHT_EYE_RIGHT_CORNER value + * @property {number} RIGHT_EYE_BOTTOM_BOUNDARY=23 RIGHT_EYE_BOTTOM_BOUNDARY value + * @property {number} RIGHT_EYE_LEFT_CORNER=24 RIGHT_EYE_LEFT_CORNER value + * @property {number} LEFT_EYEBROW_UPPER_MIDPOINT=25 LEFT_EYEBROW_UPPER_MIDPOINT value + * @property {number} RIGHT_EYEBROW_UPPER_MIDPOINT=26 RIGHT_EYEBROW_UPPER_MIDPOINT value + * @property {number} LEFT_EAR_TRAGION=27 LEFT_EAR_TRAGION value + * @property {number} RIGHT_EAR_TRAGION=28 RIGHT_EAR_TRAGION value + * @property {number} LEFT_EYE_PUPIL=29 LEFT_EYE_PUPIL value + * @property {number} RIGHT_EYE_PUPIL=30 RIGHT_EYE_PUPIL value + * @property {number} FOREHEAD_GLABELLA=31 FOREHEAD_GLABELLA value + * @property {number} CHIN_GNATHION=32 CHIN_GNATHION value + * @property {number} CHIN_LEFT_GONION=33 CHIN_LEFT_GONION value + * @property {number} CHIN_RIGHT_GONION=34 CHIN_RIGHT_GONION value + */ + Landmark.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN_LANDMARK"] = 0; + values[valuesById[1] = "LEFT_EYE"] = 1; + values[valuesById[2] = "RIGHT_EYE"] = 2; + values[valuesById[3] = "LEFT_OF_LEFT_EYEBROW"] = 3; + values[valuesById[4] = "RIGHT_OF_LEFT_EYEBROW"] = 4; + values[valuesById[5] = "LEFT_OF_RIGHT_EYEBROW"] = 5; + values[valuesById[6] = "RIGHT_OF_RIGHT_EYEBROW"] = 6; + values[valuesById[7] = "MIDPOINT_BETWEEN_EYES"] = 7; + values[valuesById[8] = "NOSE_TIP"] = 8; + values[valuesById[9] = "UPPER_LIP"] = 9; + values[valuesById[10] = "LOWER_LIP"] = 10; + values[valuesById[11] = "MOUTH_LEFT"] = 11; + values[valuesById[12] = "MOUTH_RIGHT"] = 12; + values[valuesById[13] = "MOUTH_CENTER"] = 13; + values[valuesById[14] = "NOSE_BOTTOM_RIGHT"] = 14; + values[valuesById[15] = "NOSE_BOTTOM_LEFT"] = 15; + values[valuesById[16] = "NOSE_BOTTOM_CENTER"] = 16; + values[valuesById[17] = "LEFT_EYE_TOP_BOUNDARY"] = 17; + values[valuesById[18] = "LEFT_EYE_RIGHT_CORNER"] = 18; + values[valuesById[19] = "LEFT_EYE_BOTTOM_BOUNDARY"] = 19; + values[valuesById[20] = "LEFT_EYE_LEFT_CORNER"] = 20; + values[valuesById[21] = "RIGHT_EYE_TOP_BOUNDARY"] = 21; + values[valuesById[22] = "RIGHT_EYE_RIGHT_CORNER"] = 22; + values[valuesById[23] = "RIGHT_EYE_BOTTOM_BOUNDARY"] = 23; + values[valuesById[24] = "RIGHT_EYE_LEFT_CORNER"] = 24; + values[valuesById[25] = "LEFT_EYEBROW_UPPER_MIDPOINT"] = 25; + values[valuesById[26] = "RIGHT_EYEBROW_UPPER_MIDPOINT"] = 26; + values[valuesById[27] = "LEFT_EAR_TRAGION"] = 27; + values[valuesById[28] = "RIGHT_EAR_TRAGION"] = 28; + values[valuesById[29] = "LEFT_EYE_PUPIL"] = 29; + values[valuesById[30] = "RIGHT_EYE_PUPIL"] = 30; + values[valuesById[31] = "FOREHEAD_GLABELLA"] = 31; + values[valuesById[32] = "CHIN_GNATHION"] = 32; + values[valuesById[33] = "CHIN_LEFT_GONION"] = 33; + values[valuesById[34] = "CHIN_RIGHT_GONION"] = 34; + return values; + })(); + + return Landmark; + })(); + + return FaceAnnotation; + })(); + + v1.LocationInfo = (function() { + + /** + * Properties of a LocationInfo. + * @memberof google.cloud.vision.v1 + * @interface ILocationInfo + * @property {google.type.ILatLng|null} [latLng] LocationInfo latLng */ - LocalizedObjectAnnotation.decodeDelimited = function decodeDelimited(reader) { + + /** + * Constructs a new LocationInfo. + * @memberof google.cloud.vision.v1 + * @classdesc Represents a LocationInfo. + * @implements ILocationInfo + * @constructor + * @param {google.cloud.vision.v1.ILocationInfo=} [properties] Properties to set + */ + function LocationInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LocationInfo latLng. + * @member {google.type.ILatLng|null|undefined} latLng + * @memberof google.cloud.vision.v1.LocationInfo + * @instance + */ + LocationInfo.prototype.latLng = null; + + /** + * Creates a new LocationInfo instance using the specified properties. + * @function create + * @memberof google.cloud.vision.v1.LocationInfo + * @static + * @param {google.cloud.vision.v1.ILocationInfo=} [properties] Properties to set + * @returns {google.cloud.vision.v1.LocationInfo} LocationInfo instance + */ + LocationInfo.create = function create(properties) { + return new LocationInfo(properties); + }; + + /** + * Encodes the specified LocationInfo message. Does not implicitly {@link google.cloud.vision.v1.LocationInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.vision.v1.LocationInfo + * @static + * @param {google.cloud.vision.v1.ILocationInfo} message LocationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LocationInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.latLng != null && message.hasOwnProperty("latLng")) + $root.google.type.LatLng.encode(message.latLng, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified LocationInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1.LocationInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.vision.v1.LocationInfo + * @static + * @param {google.cloud.vision.v1.ILocationInfo} message LocationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LocationInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LocationInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.vision.v1.LocationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.vision.v1.LocationInfo} LocationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LocationInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.LocationInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.latLng = $root.google.type.LatLng.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LocationInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.vision.v1.LocationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.vision.v1.LocationInfo} LocationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LocationInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a LocalizedObjectAnnotation message. + * Verifies a LocationInfo message. * @function verify - * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation + * @memberof google.cloud.vision.v1.LocationInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - LocalizedObjectAnnotation.verify = function verify(message) { + LocationInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.mid != null && message.hasOwnProperty("mid")) - if (!$util.isString(message.mid)) - return "mid: string expected"; - if (message.languageCode != null && message.hasOwnProperty("languageCode")) - if (!$util.isString(message.languageCode)) - return "languageCode: string expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { - var error = $root.google.cloud.vision.v1.BoundingPoly.verify(message.boundingPoly); + if (message.latLng != null && message.hasOwnProperty("latLng")) { + var error = $root.google.type.LatLng.verify(message.latLng); if (error) - return "boundingPoly." + error; + return "latLng." + error; } return null; }; /** - * Creates a LocalizedObjectAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates a LocationInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation + * @memberof google.cloud.vision.v1.LocationInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.LocalizedObjectAnnotation} LocalizedObjectAnnotation + * @returns {google.cloud.vision.v1.LocationInfo} LocationInfo */ - LocalizedObjectAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.LocalizedObjectAnnotation) + LocationInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.LocationInfo) return object; - var message = new $root.google.cloud.vision.v1.LocalizedObjectAnnotation(); - if (object.mid != null) - message.mid = String(object.mid); - if (object.languageCode != null) - message.languageCode = String(object.languageCode); - if (object.name != null) - message.name = String(object.name); - if (object.score != null) - message.score = Number(object.score); - if (object.boundingPoly != null) { - if (typeof object.boundingPoly !== "object") - throw TypeError(".google.cloud.vision.v1.LocalizedObjectAnnotation.boundingPoly: object expected"); - message.boundingPoly = $root.google.cloud.vision.v1.BoundingPoly.fromObject(object.boundingPoly); + var message = new $root.google.cloud.vision.v1.LocationInfo(); + if (object.latLng != null) { + if (typeof object.latLng !== "object") + throw TypeError(".google.cloud.vision.v1.LocationInfo.latLng: object expected"); + message.latLng = $root.google.type.LatLng.fromObject(object.latLng); } return message; }; /** - * Creates a plain object from a LocalizedObjectAnnotation message. Also converts values to other types if specified. + * Creates a plain object from a LocationInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation + * @memberof google.cloud.vision.v1.LocationInfo * @static - * @param {google.cloud.vision.v1.LocalizedObjectAnnotation} message LocalizedObjectAnnotation + * @param {google.cloud.vision.v1.LocationInfo} message LocationInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - LocalizedObjectAnnotation.toObject = function toObject(message, options) { + LocationInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.mid = ""; - object.languageCode = ""; - object.name = ""; - object.score = 0; - object.boundingPoly = null; - } - if (message.mid != null && message.hasOwnProperty("mid")) - object.mid = message.mid; - if (message.languageCode != null && message.hasOwnProperty("languageCode")) - object.languageCode = message.languageCode; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - object.boundingPoly = $root.google.cloud.vision.v1.BoundingPoly.toObject(message.boundingPoly, options); + if (options.defaults) + object.latLng = null; + if (message.latLng != null && message.hasOwnProperty("latLng")) + object.latLng = $root.google.type.LatLng.toObject(message.latLng, options); return object; }; /** - * Converts this LocalizedObjectAnnotation to JSON. + * Converts this LocationInfo to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation + * @memberof google.cloud.vision.v1.LocationInfo * @instance * @returns {Object.} JSON object */ - LocalizedObjectAnnotation.prototype.toJSON = function toJSON() { + LocationInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return LocalizedObjectAnnotation; + return LocationInfo; })(); - v1.SafeSearchAnnotation = (function() { + v1.Property = (function() { /** - * Properties of a SafeSearchAnnotation. + * Properties of a Property. * @memberof google.cloud.vision.v1 - * @interface ISafeSearchAnnotation - * @property {google.cloud.vision.v1.Likelihood|null} [adult] SafeSearchAnnotation adult - * @property {google.cloud.vision.v1.Likelihood|null} [spoof] SafeSearchAnnotation spoof - * @property {google.cloud.vision.v1.Likelihood|null} [medical] SafeSearchAnnotation medical - * @property {google.cloud.vision.v1.Likelihood|null} [violence] SafeSearchAnnotation violence - * @property {google.cloud.vision.v1.Likelihood|null} [racy] SafeSearchAnnotation racy - * @property {number|null} [adultConfidence] SafeSearchAnnotation adultConfidence - * @property {number|null} [spoofConfidence] SafeSearchAnnotation spoofConfidence - * @property {number|null} [medicalConfidence] SafeSearchAnnotation medicalConfidence - * @property {number|null} [violenceConfidence] SafeSearchAnnotation violenceConfidence - * @property {number|null} [racyConfidence] SafeSearchAnnotation racyConfidence - * @property {number|null} [nsfwConfidence] SafeSearchAnnotation nsfwConfidence + * @interface IProperty + * @property {string|null} [name] Property name + * @property {string|null} [value] Property value + * @property {number|Long|null} [uint64Value] Property uint64Value */ /** - * Constructs a new SafeSearchAnnotation. + * Constructs a new Property. * @memberof google.cloud.vision.v1 - * @classdesc Represents a SafeSearchAnnotation. - * @implements ISafeSearchAnnotation + * @classdesc Represents a Property. + * @implements IProperty * @constructor - * @param {google.cloud.vision.v1.ISafeSearchAnnotation=} [properties] Properties to set + * @param {google.cloud.vision.v1.IProperty=} [properties] Properties to set */ - function SafeSearchAnnotation(properties) { + function Property(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -3424,205 +3380,101 @@ } /** - * SafeSearchAnnotation adult. - * @member {google.cloud.vision.v1.Likelihood} adult - * @memberof google.cloud.vision.v1.SafeSearchAnnotation - * @instance - */ - SafeSearchAnnotation.prototype.adult = 0; - - /** - * SafeSearchAnnotation spoof. - * @member {google.cloud.vision.v1.Likelihood} spoof - * @memberof google.cloud.vision.v1.SafeSearchAnnotation - * @instance - */ - SafeSearchAnnotation.prototype.spoof = 0; - - /** - * SafeSearchAnnotation medical. - * @member {google.cloud.vision.v1.Likelihood} medical - * @memberof google.cloud.vision.v1.SafeSearchAnnotation - * @instance - */ - SafeSearchAnnotation.prototype.medical = 0; - - /** - * SafeSearchAnnotation violence. - * @member {google.cloud.vision.v1.Likelihood} violence - * @memberof google.cloud.vision.v1.SafeSearchAnnotation - * @instance - */ - SafeSearchAnnotation.prototype.violence = 0; - - /** - * SafeSearchAnnotation racy. - * @member {google.cloud.vision.v1.Likelihood} racy - * @memberof google.cloud.vision.v1.SafeSearchAnnotation - * @instance - */ - SafeSearchAnnotation.prototype.racy = 0; - - /** - * SafeSearchAnnotation adultConfidence. - * @member {number} adultConfidence - * @memberof google.cloud.vision.v1.SafeSearchAnnotation - * @instance - */ - SafeSearchAnnotation.prototype.adultConfidence = 0; - - /** - * SafeSearchAnnotation spoofConfidence. - * @member {number} spoofConfidence - * @memberof google.cloud.vision.v1.SafeSearchAnnotation - * @instance - */ - SafeSearchAnnotation.prototype.spoofConfidence = 0; - - /** - * SafeSearchAnnotation medicalConfidence. - * @member {number} medicalConfidence - * @memberof google.cloud.vision.v1.SafeSearchAnnotation - * @instance - */ - SafeSearchAnnotation.prototype.medicalConfidence = 0; - - /** - * SafeSearchAnnotation violenceConfidence. - * @member {number} violenceConfidence - * @memberof google.cloud.vision.v1.SafeSearchAnnotation + * Property name. + * @member {string} name + * @memberof google.cloud.vision.v1.Property * @instance */ - SafeSearchAnnotation.prototype.violenceConfidence = 0; + Property.prototype.name = ""; /** - * SafeSearchAnnotation racyConfidence. - * @member {number} racyConfidence - * @memberof google.cloud.vision.v1.SafeSearchAnnotation + * Property value. + * @member {string} value + * @memberof google.cloud.vision.v1.Property * @instance */ - SafeSearchAnnotation.prototype.racyConfidence = 0; + Property.prototype.value = ""; /** - * SafeSearchAnnotation nsfwConfidence. - * @member {number} nsfwConfidence - * @memberof google.cloud.vision.v1.SafeSearchAnnotation + * Property uint64Value. + * @member {number|Long} uint64Value + * @memberof google.cloud.vision.v1.Property * @instance */ - SafeSearchAnnotation.prototype.nsfwConfidence = 0; + Property.prototype.uint64Value = $util.Long ? $util.Long.fromBits(0,0,true) : 0; /** - * Creates a new SafeSearchAnnotation instance using the specified properties. + * Creates a new Property instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.SafeSearchAnnotation + * @memberof google.cloud.vision.v1.Property * @static - * @param {google.cloud.vision.v1.ISafeSearchAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1.SafeSearchAnnotation} SafeSearchAnnotation instance + * @param {google.cloud.vision.v1.IProperty=} [properties] Properties to set + * @returns {google.cloud.vision.v1.Property} Property instance */ - SafeSearchAnnotation.create = function create(properties) { - return new SafeSearchAnnotation(properties); + Property.create = function create(properties) { + return new Property(properties); }; /** - * Encodes the specified SafeSearchAnnotation message. Does not implicitly {@link google.cloud.vision.v1.SafeSearchAnnotation.verify|verify} messages. + * Encodes the specified Property message. Does not implicitly {@link google.cloud.vision.v1.Property.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.SafeSearchAnnotation + * @memberof google.cloud.vision.v1.Property * @static - * @param {google.cloud.vision.v1.ISafeSearchAnnotation} message SafeSearchAnnotation message or plain object to encode + * @param {google.cloud.vision.v1.IProperty} message Property message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SafeSearchAnnotation.encode = function encode(message, writer) { + Property.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.adult != null && message.hasOwnProperty("adult")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.adult); - if (message.spoof != null && message.hasOwnProperty("spoof")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.spoof); - if (message.medical != null && message.hasOwnProperty("medical")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.medical); - if (message.violence != null && message.hasOwnProperty("violence")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.violence); - if (message.racy != null && message.hasOwnProperty("racy")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.racy); - if (message.adultConfidence != null && message.hasOwnProperty("adultConfidence")) - writer.uint32(/* id 16, wireType 5 =*/133).float(message.adultConfidence); - if (message.spoofConfidence != null && message.hasOwnProperty("spoofConfidence")) - writer.uint32(/* id 18, wireType 5 =*/149).float(message.spoofConfidence); - if (message.medicalConfidence != null && message.hasOwnProperty("medicalConfidence")) - writer.uint32(/* id 20, wireType 5 =*/165).float(message.medicalConfidence); - if (message.violenceConfidence != null && message.hasOwnProperty("violenceConfidence")) - writer.uint32(/* id 22, wireType 5 =*/181).float(message.violenceConfidence); - if (message.racyConfidence != null && message.hasOwnProperty("racyConfidence")) - writer.uint32(/* id 24, wireType 5 =*/197).float(message.racyConfidence); - if (message.nsfwConfidence != null && message.hasOwnProperty("nsfwConfidence")) - writer.uint32(/* id 26, wireType 5 =*/213).float(message.nsfwConfidence); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.value != null && message.hasOwnProperty("value")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); + if (message.uint64Value != null && message.hasOwnProperty("uint64Value")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.uint64Value); return writer; }; /** - * Encodes the specified SafeSearchAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1.SafeSearchAnnotation.verify|verify} messages. + * Encodes the specified Property message, length delimited. Does not implicitly {@link google.cloud.vision.v1.Property.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.SafeSearchAnnotation + * @memberof google.cloud.vision.v1.Property * @static - * @param {google.cloud.vision.v1.ISafeSearchAnnotation} message SafeSearchAnnotation message or plain object to encode + * @param {google.cloud.vision.v1.IProperty} message Property message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SafeSearchAnnotation.encodeDelimited = function encodeDelimited(message, writer) { + Property.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SafeSearchAnnotation message from the specified reader or buffer. + * Decodes a Property message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.SafeSearchAnnotation + * @memberof google.cloud.vision.v1.Property * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.SafeSearchAnnotation} SafeSearchAnnotation + * @returns {google.cloud.vision.v1.Property} Property * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SafeSearchAnnotation.decode = function decode(reader, length) { + Property.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.SafeSearchAnnotation(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.Property(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.adult = reader.int32(); + message.name = reader.string(); break; case 2: - message.spoof = reader.int32(); + message.value = reader.string(); break; case 3: - message.medical = reader.int32(); - break; - case 4: - message.violence = reader.int32(); - break; - case 9: - message.racy = reader.int32(); - break; - case 16: - message.adultConfidence = reader.float(); - break; - case 18: - message.spoofConfidence = reader.float(); - break; - case 20: - message.medicalConfidence = reader.float(); - break; - case 22: - message.violenceConfidence = reader.float(); - break; - case 24: - message.racyConfidence = reader.float(); - break; - case 26: - message.nsfwConfidence = reader.float(); + message.uint64Value = reader.uint64(); break; default: reader.skipType(tag & 7); @@ -3633,354 +3485,148 @@ }; /** - * Decodes a SafeSearchAnnotation message from the specified reader or buffer, length delimited. + * Decodes a Property message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.SafeSearchAnnotation + * @memberof google.cloud.vision.v1.Property * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.SafeSearchAnnotation} SafeSearchAnnotation + * @returns {google.cloud.vision.v1.Property} Property * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SafeSearchAnnotation.decodeDelimited = function decodeDelimited(reader) { + Property.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a SafeSearchAnnotation message. + * Verifies a Property message. * @function verify - * @memberof google.cloud.vision.v1.SafeSearchAnnotation + * @memberof google.cloud.vision.v1.Property * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - SafeSearchAnnotation.verify = function verify(message) { + Property.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.adult != null && message.hasOwnProperty("adult")) - switch (message.adult) { - default: - return "adult: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.spoof != null && message.hasOwnProperty("spoof")) - switch (message.spoof) { - default: - return "spoof: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.medical != null && message.hasOwnProperty("medical")) - switch (message.medical) { - default: - return "medical: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.violence != null && message.hasOwnProperty("violence")) - switch (message.violence) { - default: - return "violence: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.racy != null && message.hasOwnProperty("racy")) - switch (message.racy) { - default: - return "racy: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.adultConfidence != null && message.hasOwnProperty("adultConfidence")) - if (typeof message.adultConfidence !== "number") - return "adultConfidence: number expected"; - if (message.spoofConfidence != null && message.hasOwnProperty("spoofConfidence")) - if (typeof message.spoofConfidence !== "number") - return "spoofConfidence: number expected"; - if (message.medicalConfidence != null && message.hasOwnProperty("medicalConfidence")) - if (typeof message.medicalConfidence !== "number") - return "medicalConfidence: number expected"; - if (message.violenceConfidence != null && message.hasOwnProperty("violenceConfidence")) - if (typeof message.violenceConfidence !== "number") - return "violenceConfidence: number expected"; - if (message.racyConfidence != null && message.hasOwnProperty("racyConfidence")) - if (typeof message.racyConfidence !== "number") - return "racyConfidence: number expected"; - if (message.nsfwConfidence != null && message.hasOwnProperty("nsfwConfidence")) - if (typeof message.nsfwConfidence !== "number") - return "nsfwConfidence: number expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + if (message.uint64Value != null && message.hasOwnProperty("uint64Value")) + if (!$util.isInteger(message.uint64Value) && !(message.uint64Value && $util.isInteger(message.uint64Value.low) && $util.isInteger(message.uint64Value.high))) + return "uint64Value: integer|Long expected"; return null; }; /** - * Creates a SafeSearchAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates a Property message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.SafeSearchAnnotation + * @memberof google.cloud.vision.v1.Property * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.SafeSearchAnnotation} SafeSearchAnnotation + * @returns {google.cloud.vision.v1.Property} Property */ - SafeSearchAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.SafeSearchAnnotation) + Property.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.Property) return object; - var message = new $root.google.cloud.vision.v1.SafeSearchAnnotation(); - switch (object.adult) { - case "UNKNOWN": - case 0: - message.adult = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.adult = 1; - break; - case "UNLIKELY": - case 2: - message.adult = 2; - break; - case "POSSIBLE": - case 3: - message.adult = 3; - break; - case "LIKELY": - case 4: - message.adult = 4; - break; - case "VERY_LIKELY": - case 5: - message.adult = 5; - break; - } - switch (object.spoof) { - case "UNKNOWN": - case 0: - message.spoof = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.spoof = 1; - break; - case "UNLIKELY": - case 2: - message.spoof = 2; - break; - case "POSSIBLE": - case 3: - message.spoof = 3; - break; - case "LIKELY": - case 4: - message.spoof = 4; - break; - case "VERY_LIKELY": - case 5: - message.spoof = 5; - break; - } - switch (object.medical) { - case "UNKNOWN": - case 0: - message.medical = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.medical = 1; - break; - case "UNLIKELY": - case 2: - message.medical = 2; - break; - case "POSSIBLE": - case 3: - message.medical = 3; - break; - case "LIKELY": - case 4: - message.medical = 4; - break; - case "VERY_LIKELY": - case 5: - message.medical = 5; - break; - } - switch (object.violence) { - case "UNKNOWN": - case 0: - message.violence = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.violence = 1; - break; - case "UNLIKELY": - case 2: - message.violence = 2; - break; - case "POSSIBLE": - case 3: - message.violence = 3; - break; - case "LIKELY": - case 4: - message.violence = 4; - break; - case "VERY_LIKELY": - case 5: - message.violence = 5; - break; - } - switch (object.racy) { - case "UNKNOWN": - case 0: - message.racy = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.racy = 1; - break; - case "UNLIKELY": - case 2: - message.racy = 2; - break; - case "POSSIBLE": - case 3: - message.racy = 3; - break; - case "LIKELY": - case 4: - message.racy = 4; - break; - case "VERY_LIKELY": - case 5: - message.racy = 5; - break; - } - if (object.adultConfidence != null) - message.adultConfidence = Number(object.adultConfidence); - if (object.spoofConfidence != null) - message.spoofConfidence = Number(object.spoofConfidence); - if (object.medicalConfidence != null) - message.medicalConfidence = Number(object.medicalConfidence); - if (object.violenceConfidence != null) - message.violenceConfidence = Number(object.violenceConfidence); - if (object.racyConfidence != null) - message.racyConfidence = Number(object.racyConfidence); - if (object.nsfwConfidence != null) - message.nsfwConfidence = Number(object.nsfwConfidence); + var message = new $root.google.cloud.vision.v1.Property(); + if (object.name != null) + message.name = String(object.name); + if (object.value != null) + message.value = String(object.value); + if (object.uint64Value != null) + if ($util.Long) + (message.uint64Value = $util.Long.fromValue(object.uint64Value)).unsigned = true; + else if (typeof object.uint64Value === "string") + message.uint64Value = parseInt(object.uint64Value, 10); + else if (typeof object.uint64Value === "number") + message.uint64Value = object.uint64Value; + else if (typeof object.uint64Value === "object") + message.uint64Value = new $util.LongBits(object.uint64Value.low >>> 0, object.uint64Value.high >>> 0).toNumber(true); return message; }; /** - * Creates a plain object from a SafeSearchAnnotation message. Also converts values to other types if specified. + * Creates a plain object from a Property message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.SafeSearchAnnotation + * @memberof google.cloud.vision.v1.Property * @static - * @param {google.cloud.vision.v1.SafeSearchAnnotation} message SafeSearchAnnotation + * @param {google.cloud.vision.v1.Property} message Property * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SafeSearchAnnotation.toObject = function toObject(message, options) { + Property.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.adult = options.enums === String ? "UNKNOWN" : 0; - object.spoof = options.enums === String ? "UNKNOWN" : 0; - object.medical = options.enums === String ? "UNKNOWN" : 0; - object.violence = options.enums === String ? "UNKNOWN" : 0; - object.racy = options.enums === String ? "UNKNOWN" : 0; - object.adultConfidence = 0; - object.spoofConfidence = 0; - object.medicalConfidence = 0; - object.violenceConfidence = 0; - object.racyConfidence = 0; - object.nsfwConfidence = 0; + object.name = ""; + object.value = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.uint64Value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.uint64Value = options.longs === String ? "0" : 0; } - if (message.adult != null && message.hasOwnProperty("adult")) - object.adult = options.enums === String ? $root.google.cloud.vision.v1.Likelihood[message.adult] : message.adult; - if (message.spoof != null && message.hasOwnProperty("spoof")) - object.spoof = options.enums === String ? $root.google.cloud.vision.v1.Likelihood[message.spoof] : message.spoof; - if (message.medical != null && message.hasOwnProperty("medical")) - object.medical = options.enums === String ? $root.google.cloud.vision.v1.Likelihood[message.medical] : message.medical; - if (message.violence != null && message.hasOwnProperty("violence")) - object.violence = options.enums === String ? $root.google.cloud.vision.v1.Likelihood[message.violence] : message.violence; - if (message.racy != null && message.hasOwnProperty("racy")) - object.racy = options.enums === String ? $root.google.cloud.vision.v1.Likelihood[message.racy] : message.racy; - if (message.adultConfidence != null && message.hasOwnProperty("adultConfidence")) - object.adultConfidence = options.json && !isFinite(message.adultConfidence) ? String(message.adultConfidence) : message.adultConfidence; - if (message.spoofConfidence != null && message.hasOwnProperty("spoofConfidence")) - object.spoofConfidence = options.json && !isFinite(message.spoofConfidence) ? String(message.spoofConfidence) : message.spoofConfidence; - if (message.medicalConfidence != null && message.hasOwnProperty("medicalConfidence")) - object.medicalConfidence = options.json && !isFinite(message.medicalConfidence) ? String(message.medicalConfidence) : message.medicalConfidence; - if (message.violenceConfidence != null && message.hasOwnProperty("violenceConfidence")) - object.violenceConfidence = options.json && !isFinite(message.violenceConfidence) ? String(message.violenceConfidence) : message.violenceConfidence; - if (message.racyConfidence != null && message.hasOwnProperty("racyConfidence")) - object.racyConfidence = options.json && !isFinite(message.racyConfidence) ? String(message.racyConfidence) : message.racyConfidence; - if (message.nsfwConfidence != null && message.hasOwnProperty("nsfwConfidence")) - object.nsfwConfidence = options.json && !isFinite(message.nsfwConfidence) ? String(message.nsfwConfidence) : message.nsfwConfidence; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.uint64Value != null && message.hasOwnProperty("uint64Value")) + if (typeof message.uint64Value === "number") + object.uint64Value = options.longs === String ? String(message.uint64Value) : message.uint64Value; + else + object.uint64Value = options.longs === String ? $util.Long.prototype.toString.call(message.uint64Value) : options.longs === Number ? new $util.LongBits(message.uint64Value.low >>> 0, message.uint64Value.high >>> 0).toNumber(true) : message.uint64Value; return object; }; /** - * Converts this SafeSearchAnnotation to JSON. + * Converts this Property to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.SafeSearchAnnotation + * @memberof google.cloud.vision.v1.Property * @instance * @returns {Object.} JSON object */ - SafeSearchAnnotation.prototype.toJSON = function toJSON() { + Property.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return SafeSearchAnnotation; + return Property; })(); - v1.LatLongRect = (function() { + v1.EntityAnnotation = (function() { /** - * Properties of a LatLongRect. + * Properties of an EntityAnnotation. * @memberof google.cloud.vision.v1 - * @interface ILatLongRect - * @property {google.type.ILatLng|null} [minLatLng] LatLongRect minLatLng - * @property {google.type.ILatLng|null} [maxLatLng] LatLongRect maxLatLng + * @interface IEntityAnnotation + * @property {string|null} [mid] EntityAnnotation mid + * @property {string|null} [locale] EntityAnnotation locale + * @property {string|null} [description] EntityAnnotation description + * @property {number|null} [score] EntityAnnotation score + * @property {number|null} [confidence] EntityAnnotation confidence + * @property {number|null} [topicality] EntityAnnotation topicality + * @property {google.cloud.vision.v1.IBoundingPoly|null} [boundingPoly] EntityAnnotation boundingPoly + * @property {Array.|null} [locations] EntityAnnotation locations + * @property {Array.|null} [properties] EntityAnnotation properties */ /** - * Constructs a new LatLongRect. + * Constructs a new EntityAnnotation. * @memberof google.cloud.vision.v1 - * @classdesc Represents a LatLongRect. - * @implements ILatLongRect + * @classdesc Represents an EntityAnnotation. + * @implements IEntityAnnotation * @constructor - * @param {google.cloud.vision.v1.ILatLongRect=} [properties] Properties to set + * @param {google.cloud.vision.v1.IEntityAnnotation=} [properties] Properties to set */ - function LatLongRect(properties) { + function EntityAnnotation(properties) { + this.locations = []; + this.properties = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -3988,88 +3634,185 @@ } /** - * LatLongRect minLatLng. - * @member {google.type.ILatLng|null|undefined} minLatLng - * @memberof google.cloud.vision.v1.LatLongRect + * EntityAnnotation mid. + * @member {string} mid + * @memberof google.cloud.vision.v1.EntityAnnotation * @instance */ - LatLongRect.prototype.minLatLng = null; + EntityAnnotation.prototype.mid = ""; /** - * LatLongRect maxLatLng. - * @member {google.type.ILatLng|null|undefined} maxLatLng - * @memberof google.cloud.vision.v1.LatLongRect + * EntityAnnotation locale. + * @member {string} locale + * @memberof google.cloud.vision.v1.EntityAnnotation * @instance */ - LatLongRect.prototype.maxLatLng = null; + EntityAnnotation.prototype.locale = ""; /** - * Creates a new LatLongRect instance using the specified properties. + * EntityAnnotation description. + * @member {string} description + * @memberof google.cloud.vision.v1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.description = ""; + + /** + * EntityAnnotation score. + * @member {number} score + * @memberof google.cloud.vision.v1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.score = 0; + + /** + * EntityAnnotation confidence. + * @member {number} confidence + * @memberof google.cloud.vision.v1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.confidence = 0; + + /** + * EntityAnnotation topicality. + * @member {number} topicality + * @memberof google.cloud.vision.v1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.topicality = 0; + + /** + * EntityAnnotation boundingPoly. + * @member {google.cloud.vision.v1.IBoundingPoly|null|undefined} boundingPoly + * @memberof google.cloud.vision.v1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.boundingPoly = null; + + /** + * EntityAnnotation locations. + * @member {Array.} locations + * @memberof google.cloud.vision.v1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.locations = $util.emptyArray; + + /** + * EntityAnnotation properties. + * @member {Array.} properties + * @memberof google.cloud.vision.v1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.properties = $util.emptyArray; + + /** + * Creates a new EntityAnnotation instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.LatLongRect + * @memberof google.cloud.vision.v1.EntityAnnotation * @static - * @param {google.cloud.vision.v1.ILatLongRect=} [properties] Properties to set - * @returns {google.cloud.vision.v1.LatLongRect} LatLongRect instance + * @param {google.cloud.vision.v1.IEntityAnnotation=} [properties] Properties to set + * @returns {google.cloud.vision.v1.EntityAnnotation} EntityAnnotation instance */ - LatLongRect.create = function create(properties) { - return new LatLongRect(properties); + EntityAnnotation.create = function create(properties) { + return new EntityAnnotation(properties); }; /** - * Encodes the specified LatLongRect message. Does not implicitly {@link google.cloud.vision.v1.LatLongRect.verify|verify} messages. + * Encodes the specified EntityAnnotation message. Does not implicitly {@link google.cloud.vision.v1.EntityAnnotation.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.LatLongRect + * @memberof google.cloud.vision.v1.EntityAnnotation * @static - * @param {google.cloud.vision.v1.ILatLongRect} message LatLongRect message or plain object to encode + * @param {google.cloud.vision.v1.IEntityAnnotation} message EntityAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - LatLongRect.encode = function encode(message, writer) { + EntityAnnotation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.minLatLng != null && message.hasOwnProperty("minLatLng")) - $root.google.type.LatLng.encode(message.minLatLng, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.maxLatLng != null && message.hasOwnProperty("maxLatLng")) - $root.google.type.LatLng.encode(message.maxLatLng, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.mid != null && message.hasOwnProperty("mid")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.mid); + if (message.locale != null && message.hasOwnProperty("locale")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.locale); + if (message.description != null && message.hasOwnProperty("description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + if (message.score != null && message.hasOwnProperty("score")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.score); + if (message.confidence != null && message.hasOwnProperty("confidence")) + writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); + if (message.topicality != null && message.hasOwnProperty("topicality")) + writer.uint32(/* id 6, wireType 5 =*/53).float(message.topicality); + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + $root.google.cloud.vision.v1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.locations != null && message.locations.length) + for (var i = 0; i < message.locations.length; ++i) + $root.google.cloud.vision.v1.LocationInfo.encode(message.locations[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.properties != null && message.properties.length) + for (var i = 0; i < message.properties.length; ++i) + $root.google.cloud.vision.v1.Property.encode(message.properties[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); return writer; }; /** - * Encodes the specified LatLongRect message, length delimited. Does not implicitly {@link google.cloud.vision.v1.LatLongRect.verify|verify} messages. + * Encodes the specified EntityAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1.EntityAnnotation.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.LatLongRect + * @memberof google.cloud.vision.v1.EntityAnnotation * @static - * @param {google.cloud.vision.v1.ILatLongRect} message LatLongRect message or plain object to encode + * @param {google.cloud.vision.v1.IEntityAnnotation} message EntityAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - LatLongRect.encodeDelimited = function encodeDelimited(message, writer) { + EntityAnnotation.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a LatLongRect message from the specified reader or buffer. + * Decodes an EntityAnnotation message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.LatLongRect + * @memberof google.cloud.vision.v1.EntityAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.LatLongRect} LatLongRect + * @returns {google.cloud.vision.v1.EntityAnnotation} EntityAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - LatLongRect.decode = function decode(reader, length) { + EntityAnnotation.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.vision.v1.LatLongRect(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.EntityAnnotation(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.minLatLng = $root.google.type.LatLng.decode(reader, reader.uint32()); + message.mid = reader.string(); break; case 2: - message.maxLatLng = $root.google.type.LatLng.decode(reader, reader.uint32()); + message.locale = reader.string(); + break; + case 3: + message.description = reader.string(); + break; + case 4: + message.score = reader.float(); + break; + case 5: + message.confidence = reader.float(); + break; + case 6: + message.topicality = reader.float(); + break; + case 7: + message.boundingPoly = $root.google.cloud.vision.v1.BoundingPoly.decode(reader, reader.uint32()); + break; + case 8: + if (!(message.locations && message.locations.length)) + message.locations = []; + message.locations.push($root.google.cloud.vision.v1.LocationInfo.decode(reader, reader.uint32())); + break; + case 9: + if (!(message.properties && message.properties.length)) + message.properties = []; + message.properties.push($root.google.cloud.vision.v1.Property.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -4080,128 +3823,217 @@ }; /** - * Decodes a LatLongRect message from the specified reader or buffer, length delimited. + * Decodes an EntityAnnotation message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.LatLongRect + * @memberof google.cloud.vision.v1.EntityAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.LatLongRect} LatLongRect + * @returns {google.cloud.vision.v1.EntityAnnotation} EntityAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - LatLongRect.decodeDelimited = function decodeDelimited(reader) { + EntityAnnotation.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a LatLongRect message. + * Verifies an EntityAnnotation message. * @function verify - * @memberof google.cloud.vision.v1.LatLongRect + * @memberof google.cloud.vision.v1.EntityAnnotation * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - LatLongRect.verify = function verify(message) { + EntityAnnotation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.minLatLng != null && message.hasOwnProperty("minLatLng")) { - var error = $root.google.type.LatLng.verify(message.minLatLng); + if (message.mid != null && message.hasOwnProperty("mid")) + if (!$util.isString(message.mid)) + return "mid: string expected"; + if (message.locale != null && message.hasOwnProperty("locale")) + if (!$util.isString(message.locale)) + return "locale: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.score != null && message.hasOwnProperty("score")) + if (typeof message.score !== "number") + return "score: number expected"; + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + if (message.topicality != null && message.hasOwnProperty("topicality")) + if (typeof message.topicality !== "number") + return "topicality: number expected"; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { + var error = $root.google.cloud.vision.v1.BoundingPoly.verify(message.boundingPoly); if (error) - return "minLatLng." + error; + return "boundingPoly." + error; } - if (message.maxLatLng != null && message.hasOwnProperty("maxLatLng")) { - var error = $root.google.type.LatLng.verify(message.maxLatLng); - if (error) - return "maxLatLng." + error; + if (message.locations != null && message.hasOwnProperty("locations")) { + if (!Array.isArray(message.locations)) + return "locations: array expected"; + for (var i = 0; i < message.locations.length; ++i) { + var error = $root.google.cloud.vision.v1.LocationInfo.verify(message.locations[i]); + if (error) + return "locations." + error; + } + } + if (message.properties != null && message.hasOwnProperty("properties")) { + if (!Array.isArray(message.properties)) + return "properties: array expected"; + for (var i = 0; i < message.properties.length; ++i) { + var error = $root.google.cloud.vision.v1.Property.verify(message.properties[i]); + if (error) + return "properties." + error; + } } return null; }; /** - * Creates a LatLongRect message from a plain object. Also converts values to their respective internal types. + * Creates an EntityAnnotation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.LatLongRect + * @memberof google.cloud.vision.v1.EntityAnnotation * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.LatLongRect} LatLongRect + * @returns {google.cloud.vision.v1.EntityAnnotation} EntityAnnotation */ - LatLongRect.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.LatLongRect) + EntityAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.EntityAnnotation) return object; - var message = new $root.google.cloud.vision.v1.LatLongRect(); - if (object.minLatLng != null) { - if (typeof object.minLatLng !== "object") - throw TypeError(".google.cloud.vision.v1.LatLongRect.minLatLng: object expected"); - message.minLatLng = $root.google.type.LatLng.fromObject(object.minLatLng); + var message = new $root.google.cloud.vision.v1.EntityAnnotation(); + if (object.mid != null) + message.mid = String(object.mid); + if (object.locale != null) + message.locale = String(object.locale); + if (object.description != null) + message.description = String(object.description); + if (object.score != null) + message.score = Number(object.score); + if (object.confidence != null) + message.confidence = Number(object.confidence); + if (object.topicality != null) + message.topicality = Number(object.topicality); + if (object.boundingPoly != null) { + if (typeof object.boundingPoly !== "object") + throw TypeError(".google.cloud.vision.v1.EntityAnnotation.boundingPoly: object expected"); + message.boundingPoly = $root.google.cloud.vision.v1.BoundingPoly.fromObject(object.boundingPoly); } - if (object.maxLatLng != null) { - if (typeof object.maxLatLng !== "object") - throw TypeError(".google.cloud.vision.v1.LatLongRect.maxLatLng: object expected"); - message.maxLatLng = $root.google.type.LatLng.fromObject(object.maxLatLng); + if (object.locations) { + if (!Array.isArray(object.locations)) + throw TypeError(".google.cloud.vision.v1.EntityAnnotation.locations: array expected"); + message.locations = []; + for (var i = 0; i < object.locations.length; ++i) { + if (typeof object.locations[i] !== "object") + throw TypeError(".google.cloud.vision.v1.EntityAnnotation.locations: object expected"); + message.locations[i] = $root.google.cloud.vision.v1.LocationInfo.fromObject(object.locations[i]); + } + } + if (object.properties) { + if (!Array.isArray(object.properties)) + throw TypeError(".google.cloud.vision.v1.EntityAnnotation.properties: array expected"); + message.properties = []; + for (var i = 0; i < object.properties.length; ++i) { + if (typeof object.properties[i] !== "object") + throw TypeError(".google.cloud.vision.v1.EntityAnnotation.properties: object expected"); + message.properties[i] = $root.google.cloud.vision.v1.Property.fromObject(object.properties[i]); + } } return message; }; /** - * Creates a plain object from a LatLongRect message. Also converts values to other types if specified. + * Creates a plain object from an EntityAnnotation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.LatLongRect + * @memberof google.cloud.vision.v1.EntityAnnotation * @static - * @param {google.cloud.vision.v1.LatLongRect} message LatLongRect + * @param {google.cloud.vision.v1.EntityAnnotation} message EntityAnnotation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - LatLongRect.toObject = function toObject(message, options) { + EntityAnnotation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) { + object.locations = []; + object.properties = []; + } if (options.defaults) { - object.minLatLng = null; - object.maxLatLng = null; + object.mid = ""; + object.locale = ""; + object.description = ""; + object.score = 0; + object.confidence = 0; + object.topicality = 0; + object.boundingPoly = null; + } + if (message.mid != null && message.hasOwnProperty("mid")) + object.mid = message.mid; + if (message.locale != null && message.hasOwnProperty("locale")) + object.locale = message.locale; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.score != null && message.hasOwnProperty("score")) + object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + if (message.topicality != null && message.hasOwnProperty("topicality")) + object.topicality = options.json && !isFinite(message.topicality) ? String(message.topicality) : message.topicality; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + object.boundingPoly = $root.google.cloud.vision.v1.BoundingPoly.toObject(message.boundingPoly, options); + if (message.locations && message.locations.length) { + object.locations = []; + for (var j = 0; j < message.locations.length; ++j) + object.locations[j] = $root.google.cloud.vision.v1.LocationInfo.toObject(message.locations[j], options); + } + if (message.properties && message.properties.length) { + object.properties = []; + for (var j = 0; j < message.properties.length; ++j) + object.properties[j] = $root.google.cloud.vision.v1.Property.toObject(message.properties[j], options); } - if (message.minLatLng != null && message.hasOwnProperty("minLatLng")) - object.minLatLng = $root.google.type.LatLng.toObject(message.minLatLng, options); - if (message.maxLatLng != null && message.hasOwnProperty("maxLatLng")) - object.maxLatLng = $root.google.type.LatLng.toObject(message.maxLatLng, options); return object; }; /** - * Converts this LatLongRect to JSON. + * Converts this EntityAnnotation to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.LatLongRect + * @memberof google.cloud.vision.v1.EntityAnnotation * @instance * @returns {Object.} JSON object */ - LatLongRect.prototype.toJSON = function toJSON() { + EntityAnnotation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return LatLongRect; + return EntityAnnotation; })(); - v1.ColorInfo = (function() { + v1.LocalizedObjectAnnotation = (function() { /** - * Properties of a ColorInfo. + * Properties of a LocalizedObjectAnnotation. * @memberof google.cloud.vision.v1 - * @interface IColorInfo - * @property {google.type.IColor|null} [color] ColorInfo color - * @property {number|null} [score] ColorInfo score - * @property {number|null} [pixelFraction] ColorInfo pixelFraction + * @interface ILocalizedObjectAnnotation + * @property {string|null} [mid] LocalizedObjectAnnotation mid + * @property {string|null} [languageCode] LocalizedObjectAnnotation languageCode + * @property {string|null} [name] LocalizedObjectAnnotation name + * @property {number|null} [score] LocalizedObjectAnnotation score + * @property {google.cloud.vision.v1.IBoundingPoly|null} [boundingPoly] LocalizedObjectAnnotation boundingPoly */ /** - * Constructs a new ColorInfo. + * Constructs a new LocalizedObjectAnnotation. * @memberof google.cloud.vision.v1 - * @classdesc Represents a ColorInfo. - * @implements IColorInfo + * @classdesc Represents a LocalizedObjectAnnotation. + * @implements ILocalizedObjectAnnotation * @constructor - * @param {google.cloud.vision.v1.IColorInfo=} [properties] Properties to set + * @param {google.cloud.vision.v1.ILocalizedObjectAnnotation=} [properties] Properties to set */ - function ColorInfo(properties) { + function LocalizedObjectAnnotation(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -4209,101 +4041,127 @@ } /** - * ColorInfo color. - * @member {google.type.IColor|null|undefined} color - * @memberof google.cloud.vision.v1.ColorInfo + * LocalizedObjectAnnotation mid. + * @member {string} mid + * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation * @instance */ - ColorInfo.prototype.color = null; + LocalizedObjectAnnotation.prototype.mid = ""; /** - * ColorInfo score. + * LocalizedObjectAnnotation languageCode. + * @member {string} languageCode + * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation + * @instance + */ + LocalizedObjectAnnotation.prototype.languageCode = ""; + + /** + * LocalizedObjectAnnotation name. + * @member {string} name + * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation + * @instance + */ + LocalizedObjectAnnotation.prototype.name = ""; + + /** + * LocalizedObjectAnnotation score. * @member {number} score - * @memberof google.cloud.vision.v1.ColorInfo + * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation * @instance */ - ColorInfo.prototype.score = 0; + LocalizedObjectAnnotation.prototype.score = 0; /** - * ColorInfo pixelFraction. - * @member {number} pixelFraction - * @memberof google.cloud.vision.v1.ColorInfo + * LocalizedObjectAnnotation boundingPoly. + * @member {google.cloud.vision.v1.IBoundingPoly|null|undefined} boundingPoly + * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation * @instance */ - ColorInfo.prototype.pixelFraction = 0; + LocalizedObjectAnnotation.prototype.boundingPoly = null; /** - * Creates a new ColorInfo instance using the specified properties. + * Creates a new LocalizedObjectAnnotation instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.ColorInfo + * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation * @static - * @param {google.cloud.vision.v1.IColorInfo=} [properties] Properties to set - * @returns {google.cloud.vision.v1.ColorInfo} ColorInfo instance + * @param {google.cloud.vision.v1.ILocalizedObjectAnnotation=} [properties] Properties to set + * @returns {google.cloud.vision.v1.LocalizedObjectAnnotation} LocalizedObjectAnnotation instance */ - ColorInfo.create = function create(properties) { - return new ColorInfo(properties); + LocalizedObjectAnnotation.create = function create(properties) { + return new LocalizedObjectAnnotation(properties); }; /** - * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.vision.v1.ColorInfo.verify|verify} messages. + * Encodes the specified LocalizedObjectAnnotation message. Does not implicitly {@link google.cloud.vision.v1.LocalizedObjectAnnotation.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.ColorInfo + * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation * @static - * @param {google.cloud.vision.v1.IColorInfo} message ColorInfo message or plain object to encode + * @param {google.cloud.vision.v1.ILocalizedObjectAnnotation} message LocalizedObjectAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ColorInfo.encode = function encode(message, writer) { + LocalizedObjectAnnotation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.color != null && message.hasOwnProperty("color")) - $root.google.type.Color.encode(message.color, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.mid != null && message.hasOwnProperty("mid")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.mid); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); if (message.score != null && message.hasOwnProperty("score")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); - if (message.pixelFraction != null && message.hasOwnProperty("pixelFraction")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.pixelFraction); + writer.uint32(/* id 4, wireType 5 =*/37).float(message.score); + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + $root.google.cloud.vision.v1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; /** - * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ColorInfo.verify|verify} messages. + * Encodes the specified LocalizedObjectAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1.LocalizedObjectAnnotation.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.ColorInfo + * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation * @static - * @param {google.cloud.vision.v1.IColorInfo} message ColorInfo message or plain object to encode + * @param {google.cloud.vision.v1.ILocalizedObjectAnnotation} message LocalizedObjectAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ColorInfo.encodeDelimited = function encodeDelimited(message, writer) { + LocalizedObjectAnnotation.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ColorInfo message from the specified reader or buffer. + * Decodes a LocalizedObjectAnnotation message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.ColorInfo + * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.ColorInfo} ColorInfo + * @returns {google.cloud.vision.v1.LocalizedObjectAnnotation} LocalizedObjectAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ColorInfo.decode = function decode(reader, length) { + LocalizedObjectAnnotation.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.vision.v1.ColorInfo(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.LocalizedObjectAnnotation(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.color = $root.google.type.Color.decode(reader, reader.uint32()); + message.mid = reader.string(); break; case 2: - message.score = reader.float(); + message.languageCode = reader.string(); break; case 3: - message.pixelFraction = reader.float(); + message.name = reader.string(); + break; + case 4: + message.score = reader.float(); + break; + case 5: + message.boundingPoly = $root.google.cloud.vision.v1.BoundingPoly.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -4314,130 +4172,155 @@ }; /** - * Decodes a ColorInfo message from the specified reader or buffer, length delimited. + * Decodes a LocalizedObjectAnnotation message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.ColorInfo + * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.ColorInfo} ColorInfo + * @returns {google.cloud.vision.v1.LocalizedObjectAnnotation} LocalizedObjectAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ColorInfo.decodeDelimited = function decodeDelimited(reader) { + LocalizedObjectAnnotation.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ColorInfo message. + * Verifies a LocalizedObjectAnnotation message. * @function verify - * @memberof google.cloud.vision.v1.ColorInfo + * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ColorInfo.verify = function verify(message) { + LocalizedObjectAnnotation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.color != null && message.hasOwnProperty("color")) { - var error = $root.google.type.Color.verify(message.color); - if (error) - return "color." + error; - } + if (message.mid != null && message.hasOwnProperty("mid")) + if (!$util.isString(message.mid)) + return "mid: string expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; if (message.score != null && message.hasOwnProperty("score")) if (typeof message.score !== "number") return "score: number expected"; - if (message.pixelFraction != null && message.hasOwnProperty("pixelFraction")) - if (typeof message.pixelFraction !== "number") - return "pixelFraction: number expected"; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { + var error = $root.google.cloud.vision.v1.BoundingPoly.verify(message.boundingPoly); + if (error) + return "boundingPoly." + error; + } return null; }; /** - * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. + * Creates a LocalizedObjectAnnotation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.ColorInfo + * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.ColorInfo} ColorInfo + * @returns {google.cloud.vision.v1.LocalizedObjectAnnotation} LocalizedObjectAnnotation */ - ColorInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.ColorInfo) + LocalizedObjectAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.LocalizedObjectAnnotation) return object; - var message = new $root.google.cloud.vision.v1.ColorInfo(); - if (object.color != null) { - if (typeof object.color !== "object") - throw TypeError(".google.cloud.vision.v1.ColorInfo.color: object expected"); - message.color = $root.google.type.Color.fromObject(object.color); - } + var message = new $root.google.cloud.vision.v1.LocalizedObjectAnnotation(); + if (object.mid != null) + message.mid = String(object.mid); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.name != null) + message.name = String(object.name); if (object.score != null) message.score = Number(object.score); - if (object.pixelFraction != null) - message.pixelFraction = Number(object.pixelFraction); + if (object.boundingPoly != null) { + if (typeof object.boundingPoly !== "object") + throw TypeError(".google.cloud.vision.v1.LocalizedObjectAnnotation.boundingPoly: object expected"); + message.boundingPoly = $root.google.cloud.vision.v1.BoundingPoly.fromObject(object.boundingPoly); + } return message; }; /** - * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. + * Creates a plain object from a LocalizedObjectAnnotation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.ColorInfo + * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation * @static - * @param {google.cloud.vision.v1.ColorInfo} message ColorInfo + * @param {google.cloud.vision.v1.LocalizedObjectAnnotation} message LocalizedObjectAnnotation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ColorInfo.toObject = function toObject(message, options) { + LocalizedObjectAnnotation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.color = null; + object.mid = ""; + object.languageCode = ""; + object.name = ""; object.score = 0; - object.pixelFraction = 0; + object.boundingPoly = null; } - if (message.color != null && message.hasOwnProperty("color")) - object.color = $root.google.type.Color.toObject(message.color, options); + if (message.mid != null && message.hasOwnProperty("mid")) + object.mid = message.mid; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; if (message.score != null && message.hasOwnProperty("score")) object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - if (message.pixelFraction != null && message.hasOwnProperty("pixelFraction")) - object.pixelFraction = options.json && !isFinite(message.pixelFraction) ? String(message.pixelFraction) : message.pixelFraction; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + object.boundingPoly = $root.google.cloud.vision.v1.BoundingPoly.toObject(message.boundingPoly, options); return object; }; /** - * Converts this ColorInfo to JSON. + * Converts this LocalizedObjectAnnotation to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.ColorInfo + * @memberof google.cloud.vision.v1.LocalizedObjectAnnotation * @instance * @returns {Object.} JSON object */ - ColorInfo.prototype.toJSON = function toJSON() { + LocalizedObjectAnnotation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ColorInfo; + return LocalizedObjectAnnotation; })(); - v1.DominantColorsAnnotation = (function() { + v1.SafeSearchAnnotation = (function() { /** - * Properties of a DominantColorsAnnotation. + * Properties of a SafeSearchAnnotation. * @memberof google.cloud.vision.v1 - * @interface IDominantColorsAnnotation - * @property {Array.|null} [colors] DominantColorsAnnotation colors + * @interface ISafeSearchAnnotation + * @property {google.cloud.vision.v1.Likelihood|null} [adult] SafeSearchAnnotation adult + * @property {google.cloud.vision.v1.Likelihood|null} [spoof] SafeSearchAnnotation spoof + * @property {google.cloud.vision.v1.Likelihood|null} [medical] SafeSearchAnnotation medical + * @property {google.cloud.vision.v1.Likelihood|null} [violence] SafeSearchAnnotation violence + * @property {google.cloud.vision.v1.Likelihood|null} [racy] SafeSearchAnnotation racy + * @property {number|null} [adultConfidence] SafeSearchAnnotation adultConfidence + * @property {number|null} [spoofConfidence] SafeSearchAnnotation spoofConfidence + * @property {number|null} [medicalConfidence] SafeSearchAnnotation medicalConfidence + * @property {number|null} [violenceConfidence] SafeSearchAnnotation violenceConfidence + * @property {number|null} [racyConfidence] SafeSearchAnnotation racyConfidence + * @property {number|null} [nsfwConfidence] SafeSearchAnnotation nsfwConfidence */ /** - * Constructs a new DominantColorsAnnotation. + * Constructs a new SafeSearchAnnotation. * @memberof google.cloud.vision.v1 - * @classdesc Represents a DominantColorsAnnotation. - * @implements IDominantColorsAnnotation + * @classdesc Represents a SafeSearchAnnotation. + * @implements ISafeSearchAnnotation * @constructor - * @param {google.cloud.vision.v1.IDominantColorsAnnotation=} [properties] Properties to set + * @param {google.cloud.vision.v1.ISafeSearchAnnotation=} [properties] Properties to set */ - function DominantColorsAnnotation(properties) { - this.colors = []; + function SafeSearchAnnotation(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -4445,78 +4328,205 @@ } /** - * DominantColorsAnnotation colors. - * @member {Array.} colors - * @memberof google.cloud.vision.v1.DominantColorsAnnotation + * SafeSearchAnnotation adult. + * @member {google.cloud.vision.v1.Likelihood} adult + * @memberof google.cloud.vision.v1.SafeSearchAnnotation * @instance */ - DominantColorsAnnotation.prototype.colors = $util.emptyArray; + SafeSearchAnnotation.prototype.adult = 0; /** - * Creates a new DominantColorsAnnotation instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.DominantColorsAnnotation - * @static - * @param {google.cloud.vision.v1.IDominantColorsAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1.DominantColorsAnnotation} DominantColorsAnnotation instance + * SafeSearchAnnotation spoof. + * @member {google.cloud.vision.v1.Likelihood} spoof + * @memberof google.cloud.vision.v1.SafeSearchAnnotation + * @instance */ - DominantColorsAnnotation.create = function create(properties) { - return new DominantColorsAnnotation(properties); - }; + SafeSearchAnnotation.prototype.spoof = 0; /** - * Encodes the specified DominantColorsAnnotation message. Does not implicitly {@link google.cloud.vision.v1.DominantColorsAnnotation.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.DominantColorsAnnotation - * @static - * @param {google.cloud.vision.v1.IDominantColorsAnnotation} message DominantColorsAnnotation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * SafeSearchAnnotation medical. + * @member {google.cloud.vision.v1.Likelihood} medical + * @memberof google.cloud.vision.v1.SafeSearchAnnotation + * @instance */ - DominantColorsAnnotation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.colors != null && message.colors.length) - for (var i = 0; i < message.colors.length; ++i) - $root.google.cloud.vision.v1.ColorInfo.encode(message.colors[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; + SafeSearchAnnotation.prototype.medical = 0; /** - * Encodes the specified DominantColorsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1.DominantColorsAnnotation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.DominantColorsAnnotation - * @static - * @param {google.cloud.vision.v1.IDominantColorsAnnotation} message DominantColorsAnnotation message or plain object to encode + * SafeSearchAnnotation violence. + * @member {google.cloud.vision.v1.Likelihood} violence + * @memberof google.cloud.vision.v1.SafeSearchAnnotation + * @instance + */ + SafeSearchAnnotation.prototype.violence = 0; + + /** + * SafeSearchAnnotation racy. + * @member {google.cloud.vision.v1.Likelihood} racy + * @memberof google.cloud.vision.v1.SafeSearchAnnotation + * @instance + */ + SafeSearchAnnotation.prototype.racy = 0; + + /** + * SafeSearchAnnotation adultConfidence. + * @member {number} adultConfidence + * @memberof google.cloud.vision.v1.SafeSearchAnnotation + * @instance + */ + SafeSearchAnnotation.prototype.adultConfidence = 0; + + /** + * SafeSearchAnnotation spoofConfidence. + * @member {number} spoofConfidence + * @memberof google.cloud.vision.v1.SafeSearchAnnotation + * @instance + */ + SafeSearchAnnotation.prototype.spoofConfidence = 0; + + /** + * SafeSearchAnnotation medicalConfidence. + * @member {number} medicalConfidence + * @memberof google.cloud.vision.v1.SafeSearchAnnotation + * @instance + */ + SafeSearchAnnotation.prototype.medicalConfidence = 0; + + /** + * SafeSearchAnnotation violenceConfidence. + * @member {number} violenceConfidence + * @memberof google.cloud.vision.v1.SafeSearchAnnotation + * @instance + */ + SafeSearchAnnotation.prototype.violenceConfidence = 0; + + /** + * SafeSearchAnnotation racyConfidence. + * @member {number} racyConfidence + * @memberof google.cloud.vision.v1.SafeSearchAnnotation + * @instance + */ + SafeSearchAnnotation.prototype.racyConfidence = 0; + + /** + * SafeSearchAnnotation nsfwConfidence. + * @member {number} nsfwConfidence + * @memberof google.cloud.vision.v1.SafeSearchAnnotation + * @instance + */ + SafeSearchAnnotation.prototype.nsfwConfidence = 0; + + /** + * Creates a new SafeSearchAnnotation instance using the specified properties. + * @function create + * @memberof google.cloud.vision.v1.SafeSearchAnnotation + * @static + * @param {google.cloud.vision.v1.ISafeSearchAnnotation=} [properties] Properties to set + * @returns {google.cloud.vision.v1.SafeSearchAnnotation} SafeSearchAnnotation instance + */ + SafeSearchAnnotation.create = function create(properties) { + return new SafeSearchAnnotation(properties); + }; + + /** + * Encodes the specified SafeSearchAnnotation message. Does not implicitly {@link google.cloud.vision.v1.SafeSearchAnnotation.verify|verify} messages. + * @function encode + * @memberof google.cloud.vision.v1.SafeSearchAnnotation + * @static + * @param {google.cloud.vision.v1.ISafeSearchAnnotation} message SafeSearchAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DominantColorsAnnotation.encodeDelimited = function encodeDelimited(message, writer) { + SafeSearchAnnotation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.adult != null && message.hasOwnProperty("adult")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.adult); + if (message.spoof != null && message.hasOwnProperty("spoof")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.spoof); + if (message.medical != null && message.hasOwnProperty("medical")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.medical); + if (message.violence != null && message.hasOwnProperty("violence")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.violence); + if (message.racy != null && message.hasOwnProperty("racy")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.racy); + if (message.adultConfidence != null && message.hasOwnProperty("adultConfidence")) + writer.uint32(/* id 16, wireType 5 =*/133).float(message.adultConfidence); + if (message.spoofConfidence != null && message.hasOwnProperty("spoofConfidence")) + writer.uint32(/* id 18, wireType 5 =*/149).float(message.spoofConfidence); + if (message.medicalConfidence != null && message.hasOwnProperty("medicalConfidence")) + writer.uint32(/* id 20, wireType 5 =*/165).float(message.medicalConfidence); + if (message.violenceConfidence != null && message.hasOwnProperty("violenceConfidence")) + writer.uint32(/* id 22, wireType 5 =*/181).float(message.violenceConfidence); + if (message.racyConfidence != null && message.hasOwnProperty("racyConfidence")) + writer.uint32(/* id 24, wireType 5 =*/197).float(message.racyConfidence); + if (message.nsfwConfidence != null && message.hasOwnProperty("nsfwConfidence")) + writer.uint32(/* id 26, wireType 5 =*/213).float(message.nsfwConfidence); + return writer; + }; + + /** + * Encodes the specified SafeSearchAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1.SafeSearchAnnotation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.vision.v1.SafeSearchAnnotation + * @static + * @param {google.cloud.vision.v1.ISafeSearchAnnotation} message SafeSearchAnnotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SafeSearchAnnotation.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a DominantColorsAnnotation message from the specified reader or buffer. + * Decodes a SafeSearchAnnotation message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1.SafeSearchAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.DominantColorsAnnotation} DominantColorsAnnotation + * @returns {google.cloud.vision.v1.SafeSearchAnnotation} SafeSearchAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DominantColorsAnnotation.decode = function decode(reader, length) { + SafeSearchAnnotation.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.vision.v1.DominantColorsAnnotation(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.SafeSearchAnnotation(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.colors && message.colors.length)) - message.colors = []; - message.colors.push($root.google.cloud.vision.v1.ColorInfo.decode(reader, reader.uint32())); + message.adult = reader.int32(); + break; + case 2: + message.spoof = reader.int32(); + break; + case 3: + message.medical = reader.int32(); + break; + case 4: + message.violence = reader.int32(); + break; + case 9: + message.racy = reader.int32(); + break; + case 16: + message.adultConfidence = reader.float(); + break; + case 18: + message.spoofConfidence = reader.float(); + break; + case 20: + message.medicalConfidence = reader.float(); + break; + case 22: + message.violenceConfidence = reader.float(); + break; + case 24: + message.racyConfidence = reader.float(); + break; + case 26: + message.nsfwConfidence = reader.float(); break; default: reader.skipType(tag & 7); @@ -4527,124 +4537,354 @@ }; /** - * Decodes a DominantColorsAnnotation message from the specified reader or buffer, length delimited. + * Decodes a SafeSearchAnnotation message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1.SafeSearchAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.DominantColorsAnnotation} DominantColorsAnnotation + * @returns {google.cloud.vision.v1.SafeSearchAnnotation} SafeSearchAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DominantColorsAnnotation.decodeDelimited = function decodeDelimited(reader) { + SafeSearchAnnotation.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a DominantColorsAnnotation message. + * Verifies a SafeSearchAnnotation message. * @function verify - * @memberof google.cloud.vision.v1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1.SafeSearchAnnotation * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DominantColorsAnnotation.verify = function verify(message) { + SafeSearchAnnotation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.colors != null && message.hasOwnProperty("colors")) { - if (!Array.isArray(message.colors)) - return "colors: array expected"; - for (var i = 0; i < message.colors.length; ++i) { - var error = $root.google.cloud.vision.v1.ColorInfo.verify(message.colors[i]); - if (error) - return "colors." + error; + if (message.adult != null && message.hasOwnProperty("adult")) + switch (message.adult) { + default: + return "adult: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; } - } + if (message.spoof != null && message.hasOwnProperty("spoof")) + switch (message.spoof) { + default: + return "spoof: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.medical != null && message.hasOwnProperty("medical")) + switch (message.medical) { + default: + return "medical: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.violence != null && message.hasOwnProperty("violence")) + switch (message.violence) { + default: + return "violence: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.racy != null && message.hasOwnProperty("racy")) + switch (message.racy) { + default: + return "racy: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.adultConfidence != null && message.hasOwnProperty("adultConfidence")) + if (typeof message.adultConfidence !== "number") + return "adultConfidence: number expected"; + if (message.spoofConfidence != null && message.hasOwnProperty("spoofConfidence")) + if (typeof message.spoofConfidence !== "number") + return "spoofConfidence: number expected"; + if (message.medicalConfidence != null && message.hasOwnProperty("medicalConfidence")) + if (typeof message.medicalConfidence !== "number") + return "medicalConfidence: number expected"; + if (message.violenceConfidence != null && message.hasOwnProperty("violenceConfidence")) + if (typeof message.violenceConfidence !== "number") + return "violenceConfidence: number expected"; + if (message.racyConfidence != null && message.hasOwnProperty("racyConfidence")) + if (typeof message.racyConfidence !== "number") + return "racyConfidence: number expected"; + if (message.nsfwConfidence != null && message.hasOwnProperty("nsfwConfidence")) + if (typeof message.nsfwConfidence !== "number") + return "nsfwConfidence: number expected"; return null; }; /** - * Creates a DominantColorsAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates a SafeSearchAnnotation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1.SafeSearchAnnotation * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.DominantColorsAnnotation} DominantColorsAnnotation + * @returns {google.cloud.vision.v1.SafeSearchAnnotation} SafeSearchAnnotation */ - DominantColorsAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.DominantColorsAnnotation) + SafeSearchAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.SafeSearchAnnotation) return object; - var message = new $root.google.cloud.vision.v1.DominantColorsAnnotation(); - if (object.colors) { - if (!Array.isArray(object.colors)) - throw TypeError(".google.cloud.vision.v1.DominantColorsAnnotation.colors: array expected"); - message.colors = []; - for (var i = 0; i < object.colors.length; ++i) { - if (typeof object.colors[i] !== "object") - throw TypeError(".google.cloud.vision.v1.DominantColorsAnnotation.colors: object expected"); - message.colors[i] = $root.google.cloud.vision.v1.ColorInfo.fromObject(object.colors[i]); - } + var message = new $root.google.cloud.vision.v1.SafeSearchAnnotation(); + switch (object.adult) { + case "UNKNOWN": + case 0: + message.adult = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.adult = 1; + break; + case "UNLIKELY": + case 2: + message.adult = 2; + break; + case "POSSIBLE": + case 3: + message.adult = 3; + break; + case "LIKELY": + case 4: + message.adult = 4; + break; + case "VERY_LIKELY": + case 5: + message.adult = 5; + break; + } + switch (object.spoof) { + case "UNKNOWN": + case 0: + message.spoof = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.spoof = 1; + break; + case "UNLIKELY": + case 2: + message.spoof = 2; + break; + case "POSSIBLE": + case 3: + message.spoof = 3; + break; + case "LIKELY": + case 4: + message.spoof = 4; + break; + case "VERY_LIKELY": + case 5: + message.spoof = 5; + break; + } + switch (object.medical) { + case "UNKNOWN": + case 0: + message.medical = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.medical = 1; + break; + case "UNLIKELY": + case 2: + message.medical = 2; + break; + case "POSSIBLE": + case 3: + message.medical = 3; + break; + case "LIKELY": + case 4: + message.medical = 4; + break; + case "VERY_LIKELY": + case 5: + message.medical = 5; + break; + } + switch (object.violence) { + case "UNKNOWN": + case 0: + message.violence = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.violence = 1; + break; + case "UNLIKELY": + case 2: + message.violence = 2; + break; + case "POSSIBLE": + case 3: + message.violence = 3; + break; + case "LIKELY": + case 4: + message.violence = 4; + break; + case "VERY_LIKELY": + case 5: + message.violence = 5; + break; + } + switch (object.racy) { + case "UNKNOWN": + case 0: + message.racy = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.racy = 1; + break; + case "UNLIKELY": + case 2: + message.racy = 2; + break; + case "POSSIBLE": + case 3: + message.racy = 3; + break; + case "LIKELY": + case 4: + message.racy = 4; + break; + case "VERY_LIKELY": + case 5: + message.racy = 5; + break; } + if (object.adultConfidence != null) + message.adultConfidence = Number(object.adultConfidence); + if (object.spoofConfidence != null) + message.spoofConfidence = Number(object.spoofConfidence); + if (object.medicalConfidence != null) + message.medicalConfidence = Number(object.medicalConfidence); + if (object.violenceConfidence != null) + message.violenceConfidence = Number(object.violenceConfidence); + if (object.racyConfidence != null) + message.racyConfidence = Number(object.racyConfidence); + if (object.nsfwConfidence != null) + message.nsfwConfidence = Number(object.nsfwConfidence); return message; }; /** - * Creates a plain object from a DominantColorsAnnotation message. Also converts values to other types if specified. + * Creates a plain object from a SafeSearchAnnotation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1.SafeSearchAnnotation * @static - * @param {google.cloud.vision.v1.DominantColorsAnnotation} message DominantColorsAnnotation + * @param {google.cloud.vision.v1.SafeSearchAnnotation} message SafeSearchAnnotation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DominantColorsAnnotation.toObject = function toObject(message, options) { + SafeSearchAnnotation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.colors = []; - if (message.colors && message.colors.length) { - object.colors = []; - for (var j = 0; j < message.colors.length; ++j) - object.colors[j] = $root.google.cloud.vision.v1.ColorInfo.toObject(message.colors[j], options); + if (options.defaults) { + object.adult = options.enums === String ? "UNKNOWN" : 0; + object.spoof = options.enums === String ? "UNKNOWN" : 0; + object.medical = options.enums === String ? "UNKNOWN" : 0; + object.violence = options.enums === String ? "UNKNOWN" : 0; + object.racy = options.enums === String ? "UNKNOWN" : 0; + object.adultConfidence = 0; + object.spoofConfidence = 0; + object.medicalConfidence = 0; + object.violenceConfidence = 0; + object.racyConfidence = 0; + object.nsfwConfidence = 0; } + if (message.adult != null && message.hasOwnProperty("adult")) + object.adult = options.enums === String ? $root.google.cloud.vision.v1.Likelihood[message.adult] : message.adult; + if (message.spoof != null && message.hasOwnProperty("spoof")) + object.spoof = options.enums === String ? $root.google.cloud.vision.v1.Likelihood[message.spoof] : message.spoof; + if (message.medical != null && message.hasOwnProperty("medical")) + object.medical = options.enums === String ? $root.google.cloud.vision.v1.Likelihood[message.medical] : message.medical; + if (message.violence != null && message.hasOwnProperty("violence")) + object.violence = options.enums === String ? $root.google.cloud.vision.v1.Likelihood[message.violence] : message.violence; + if (message.racy != null && message.hasOwnProperty("racy")) + object.racy = options.enums === String ? $root.google.cloud.vision.v1.Likelihood[message.racy] : message.racy; + if (message.adultConfidence != null && message.hasOwnProperty("adultConfidence")) + object.adultConfidence = options.json && !isFinite(message.adultConfidence) ? String(message.adultConfidence) : message.adultConfidence; + if (message.spoofConfidence != null && message.hasOwnProperty("spoofConfidence")) + object.spoofConfidence = options.json && !isFinite(message.spoofConfidence) ? String(message.spoofConfidence) : message.spoofConfidence; + if (message.medicalConfidence != null && message.hasOwnProperty("medicalConfidence")) + object.medicalConfidence = options.json && !isFinite(message.medicalConfidence) ? String(message.medicalConfidence) : message.medicalConfidence; + if (message.violenceConfidence != null && message.hasOwnProperty("violenceConfidence")) + object.violenceConfidence = options.json && !isFinite(message.violenceConfidence) ? String(message.violenceConfidence) : message.violenceConfidence; + if (message.racyConfidence != null && message.hasOwnProperty("racyConfidence")) + object.racyConfidence = options.json && !isFinite(message.racyConfidence) ? String(message.racyConfidence) : message.racyConfidence; + if (message.nsfwConfidence != null && message.hasOwnProperty("nsfwConfidence")) + object.nsfwConfidence = options.json && !isFinite(message.nsfwConfidence) ? String(message.nsfwConfidence) : message.nsfwConfidence; return object; }; /** - * Converts this DominantColorsAnnotation to JSON. + * Converts this SafeSearchAnnotation to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1.SafeSearchAnnotation * @instance * @returns {Object.} JSON object */ - DominantColorsAnnotation.prototype.toJSON = function toJSON() { + SafeSearchAnnotation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return DominantColorsAnnotation; + return SafeSearchAnnotation; })(); - v1.ImageProperties = (function() { + v1.LatLongRect = (function() { /** - * Properties of an ImageProperties. + * Properties of a LatLongRect. * @memberof google.cloud.vision.v1 - * @interface IImageProperties - * @property {google.cloud.vision.v1.IDominantColorsAnnotation|null} [dominantColors] ImageProperties dominantColors + * @interface ILatLongRect + * @property {google.type.ILatLng|null} [minLatLng] LatLongRect minLatLng + * @property {google.type.ILatLng|null} [maxLatLng] LatLongRect maxLatLng */ /** - * Constructs a new ImageProperties. + * Constructs a new LatLongRect. * @memberof google.cloud.vision.v1 - * @classdesc Represents an ImageProperties. - * @implements IImageProperties + * @classdesc Represents a LatLongRect. + * @implements ILatLongRect * @constructor - * @param {google.cloud.vision.v1.IImageProperties=} [properties] Properties to set + * @param {google.cloud.vision.v1.ILatLongRect=} [properties] Properties to set */ - function ImageProperties(properties) { + function LatLongRect(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -4652,75 +4892,88 @@ } /** - * ImageProperties dominantColors. - * @member {google.cloud.vision.v1.IDominantColorsAnnotation|null|undefined} dominantColors - * @memberof google.cloud.vision.v1.ImageProperties + * LatLongRect minLatLng. + * @member {google.type.ILatLng|null|undefined} minLatLng + * @memberof google.cloud.vision.v1.LatLongRect * @instance */ - ImageProperties.prototype.dominantColors = null; + LatLongRect.prototype.minLatLng = null; /** - * Creates a new ImageProperties instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.ImageProperties - * @static - * @param {google.cloud.vision.v1.IImageProperties=} [properties] Properties to set - * @returns {google.cloud.vision.v1.ImageProperties} ImageProperties instance + * LatLongRect maxLatLng. + * @member {google.type.ILatLng|null|undefined} maxLatLng + * @memberof google.cloud.vision.v1.LatLongRect + * @instance */ - ImageProperties.create = function create(properties) { - return new ImageProperties(properties); + LatLongRect.prototype.maxLatLng = null; + + /** + * Creates a new LatLongRect instance using the specified properties. + * @function create + * @memberof google.cloud.vision.v1.LatLongRect + * @static + * @param {google.cloud.vision.v1.ILatLongRect=} [properties] Properties to set + * @returns {google.cloud.vision.v1.LatLongRect} LatLongRect instance + */ + LatLongRect.create = function create(properties) { + return new LatLongRect(properties); }; /** - * Encodes the specified ImageProperties message. Does not implicitly {@link google.cloud.vision.v1.ImageProperties.verify|verify} messages. + * Encodes the specified LatLongRect message. Does not implicitly {@link google.cloud.vision.v1.LatLongRect.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.ImageProperties + * @memberof google.cloud.vision.v1.LatLongRect * @static - * @param {google.cloud.vision.v1.IImageProperties} message ImageProperties message or plain object to encode + * @param {google.cloud.vision.v1.ILatLongRect} message LatLongRect message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageProperties.encode = function encode(message, writer) { + LatLongRect.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.dominantColors != null && message.hasOwnProperty("dominantColors")) - $root.google.cloud.vision.v1.DominantColorsAnnotation.encode(message.dominantColors, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.minLatLng != null && message.hasOwnProperty("minLatLng")) + $root.google.type.LatLng.encode(message.minLatLng, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.maxLatLng != null && message.hasOwnProperty("maxLatLng")) + $root.google.type.LatLng.encode(message.maxLatLng, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified ImageProperties message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ImageProperties.verify|verify} messages. + * Encodes the specified LatLongRect message, length delimited. Does not implicitly {@link google.cloud.vision.v1.LatLongRect.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.ImageProperties + * @memberof google.cloud.vision.v1.LatLongRect * @static - * @param {google.cloud.vision.v1.IImageProperties} message ImageProperties message or plain object to encode + * @param {google.cloud.vision.v1.ILatLongRect} message LatLongRect message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageProperties.encodeDelimited = function encodeDelimited(message, writer) { + LatLongRect.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImageProperties message from the specified reader or buffer. + * Decodes a LatLongRect message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.ImageProperties + * @memberof google.cloud.vision.v1.LatLongRect * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.ImageProperties} ImageProperties + * @returns {google.cloud.vision.v1.LatLongRect} LatLongRect * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageProperties.decode = function decode(reader, length) { + LatLongRect.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.vision.v1.ImageProperties(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.LatLongRect(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.dominantColors = $root.google.cloud.vision.v1.DominantColorsAnnotation.decode(reader, reader.uint32()); + message.minLatLng = $root.google.type.LatLng.decode(reader, reader.uint32()); + break; + case 2: + message.maxLatLng = $root.google.type.LatLng.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -4731,114 +4984,128 @@ }; /** - * Decodes an ImageProperties message from the specified reader or buffer, length delimited. + * Decodes a LatLongRect message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.ImageProperties + * @memberof google.cloud.vision.v1.LatLongRect * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.ImageProperties} ImageProperties + * @returns {google.cloud.vision.v1.LatLongRect} LatLongRect * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageProperties.decodeDelimited = function decodeDelimited(reader) { + LatLongRect.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImageProperties message. + * Verifies a LatLongRect message. * @function verify - * @memberof google.cloud.vision.v1.ImageProperties + * @memberof google.cloud.vision.v1.LatLongRect * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImageProperties.verify = function verify(message) { + LatLongRect.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.dominantColors != null && message.hasOwnProperty("dominantColors")) { - var error = $root.google.cloud.vision.v1.DominantColorsAnnotation.verify(message.dominantColors); + if (message.minLatLng != null && message.hasOwnProperty("minLatLng")) { + var error = $root.google.type.LatLng.verify(message.minLatLng); if (error) - return "dominantColors." + error; + return "minLatLng." + error; + } + if (message.maxLatLng != null && message.hasOwnProperty("maxLatLng")) { + var error = $root.google.type.LatLng.verify(message.maxLatLng); + if (error) + return "maxLatLng." + error; } return null; }; /** - * Creates an ImageProperties message from a plain object. Also converts values to their respective internal types. + * Creates a LatLongRect message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.ImageProperties + * @memberof google.cloud.vision.v1.LatLongRect * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.ImageProperties} ImageProperties + * @returns {google.cloud.vision.v1.LatLongRect} LatLongRect */ - ImageProperties.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.ImageProperties) + LatLongRect.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.LatLongRect) return object; - var message = new $root.google.cloud.vision.v1.ImageProperties(); - if (object.dominantColors != null) { - if (typeof object.dominantColors !== "object") - throw TypeError(".google.cloud.vision.v1.ImageProperties.dominantColors: object expected"); - message.dominantColors = $root.google.cloud.vision.v1.DominantColorsAnnotation.fromObject(object.dominantColors); + var message = new $root.google.cloud.vision.v1.LatLongRect(); + if (object.minLatLng != null) { + if (typeof object.minLatLng !== "object") + throw TypeError(".google.cloud.vision.v1.LatLongRect.minLatLng: object expected"); + message.minLatLng = $root.google.type.LatLng.fromObject(object.minLatLng); + } + if (object.maxLatLng != null) { + if (typeof object.maxLatLng !== "object") + throw TypeError(".google.cloud.vision.v1.LatLongRect.maxLatLng: object expected"); + message.maxLatLng = $root.google.type.LatLng.fromObject(object.maxLatLng); } return message; }; /** - * Creates a plain object from an ImageProperties message. Also converts values to other types if specified. + * Creates a plain object from a LatLongRect message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.ImageProperties + * @memberof google.cloud.vision.v1.LatLongRect * @static - * @param {google.cloud.vision.v1.ImageProperties} message ImageProperties + * @param {google.cloud.vision.v1.LatLongRect} message LatLongRect * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImageProperties.toObject = function toObject(message, options) { + LatLongRect.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.dominantColors = null; - if (message.dominantColors != null && message.hasOwnProperty("dominantColors")) - object.dominantColors = $root.google.cloud.vision.v1.DominantColorsAnnotation.toObject(message.dominantColors, options); + if (options.defaults) { + object.minLatLng = null; + object.maxLatLng = null; + } + if (message.minLatLng != null && message.hasOwnProperty("minLatLng")) + object.minLatLng = $root.google.type.LatLng.toObject(message.minLatLng, options); + if (message.maxLatLng != null && message.hasOwnProperty("maxLatLng")) + object.maxLatLng = $root.google.type.LatLng.toObject(message.maxLatLng, options); return object; }; /** - * Converts this ImageProperties to JSON. + * Converts this LatLongRect to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.ImageProperties + * @memberof google.cloud.vision.v1.LatLongRect * @instance * @returns {Object.} JSON object */ - ImageProperties.prototype.toJSON = function toJSON() { + LatLongRect.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImageProperties; + return LatLongRect; })(); - v1.CropHint = (function() { + v1.ColorInfo = (function() { /** - * Properties of a CropHint. + * Properties of a ColorInfo. * @memberof google.cloud.vision.v1 - * @interface ICropHint - * @property {google.cloud.vision.v1.IBoundingPoly|null} [boundingPoly] CropHint boundingPoly - * @property {number|null} [confidence] CropHint confidence - * @property {number|null} [importanceFraction] CropHint importanceFraction + * @interface IColorInfo + * @property {google.type.IColor|null} [color] ColorInfo color + * @property {number|null} [score] ColorInfo score + * @property {number|null} [pixelFraction] ColorInfo pixelFraction */ /** - * Constructs a new CropHint. + * Constructs a new ColorInfo. * @memberof google.cloud.vision.v1 - * @classdesc Represents a CropHint. - * @implements ICropHint + * @classdesc Represents a ColorInfo. + * @implements IColorInfo * @constructor - * @param {google.cloud.vision.v1.ICropHint=} [properties] Properties to set + * @param {google.cloud.vision.v1.IColorInfo=} [properties] Properties to set */ - function CropHint(properties) { + function ColorInfo(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -4846,101 +5113,101 @@ } /** - * CropHint boundingPoly. - * @member {google.cloud.vision.v1.IBoundingPoly|null|undefined} boundingPoly - * @memberof google.cloud.vision.v1.CropHint + * ColorInfo color. + * @member {google.type.IColor|null|undefined} color + * @memberof google.cloud.vision.v1.ColorInfo * @instance */ - CropHint.prototype.boundingPoly = null; + ColorInfo.prototype.color = null; /** - * CropHint confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1.CropHint + * ColorInfo score. + * @member {number} score + * @memberof google.cloud.vision.v1.ColorInfo * @instance */ - CropHint.prototype.confidence = 0; + ColorInfo.prototype.score = 0; /** - * CropHint importanceFraction. - * @member {number} importanceFraction - * @memberof google.cloud.vision.v1.CropHint + * ColorInfo pixelFraction. + * @member {number} pixelFraction + * @memberof google.cloud.vision.v1.ColorInfo * @instance */ - CropHint.prototype.importanceFraction = 0; + ColorInfo.prototype.pixelFraction = 0; /** - * Creates a new CropHint instance using the specified properties. + * Creates a new ColorInfo instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.CropHint + * @memberof google.cloud.vision.v1.ColorInfo * @static - * @param {google.cloud.vision.v1.ICropHint=} [properties] Properties to set - * @returns {google.cloud.vision.v1.CropHint} CropHint instance + * @param {google.cloud.vision.v1.IColorInfo=} [properties] Properties to set + * @returns {google.cloud.vision.v1.ColorInfo} ColorInfo instance */ - CropHint.create = function create(properties) { - return new CropHint(properties); + ColorInfo.create = function create(properties) { + return new ColorInfo(properties); }; /** - * Encodes the specified CropHint message. Does not implicitly {@link google.cloud.vision.v1.CropHint.verify|verify} messages. + * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.vision.v1.ColorInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.CropHint + * @memberof google.cloud.vision.v1.ColorInfo * @static - * @param {google.cloud.vision.v1.ICropHint} message CropHint message or plain object to encode + * @param {google.cloud.vision.v1.IColorInfo} message ColorInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CropHint.encode = function encode(message, writer) { + ColorInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - $root.google.cloud.vision.v1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.confidence != null && message.hasOwnProperty("confidence")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); - if (message.importanceFraction != null && message.hasOwnProperty("importanceFraction")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.importanceFraction); + if (message.color != null && message.hasOwnProperty("color")) + $root.google.type.Color.encode(message.color, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.score != null && message.hasOwnProperty("score")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); + if (message.pixelFraction != null && message.hasOwnProperty("pixelFraction")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.pixelFraction); return writer; }; /** - * Encodes the specified CropHint message, length delimited. Does not implicitly {@link google.cloud.vision.v1.CropHint.verify|verify} messages. + * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ColorInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.CropHint + * @memberof google.cloud.vision.v1.ColorInfo * @static - * @param {google.cloud.vision.v1.ICropHint} message CropHint message or plain object to encode + * @param {google.cloud.vision.v1.IColorInfo} message ColorInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CropHint.encodeDelimited = function encodeDelimited(message, writer) { + ColorInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CropHint message from the specified reader or buffer. + * Decodes a ColorInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.CropHint + * @memberof google.cloud.vision.v1.ColorInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.CropHint} CropHint + * @returns {google.cloud.vision.v1.ColorInfo} ColorInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CropHint.decode = function decode(reader, length) { + ColorInfo.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.vision.v1.CropHint(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.ColorInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.boundingPoly = $root.google.cloud.vision.v1.BoundingPoly.decode(reader, reader.uint32()); + message.color = $root.google.type.Color.decode(reader, reader.uint32()); break; case 2: - message.confidence = reader.float(); + message.score = reader.float(); break; case 3: - message.importanceFraction = reader.float(); + message.pixelFraction = reader.float(); break; default: reader.skipType(tag & 7); @@ -4951,130 +5218,130 @@ }; /** - * Decodes a CropHint message from the specified reader or buffer, length delimited. + * Decodes a ColorInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.CropHint + * @memberof google.cloud.vision.v1.ColorInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.CropHint} CropHint + * @returns {google.cloud.vision.v1.ColorInfo} ColorInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CropHint.decodeDelimited = function decodeDelimited(reader) { + ColorInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CropHint message. + * Verifies a ColorInfo message. * @function verify - * @memberof google.cloud.vision.v1.CropHint + * @memberof google.cloud.vision.v1.ColorInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CropHint.verify = function verify(message) { + ColorInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { - var error = $root.google.cloud.vision.v1.BoundingPoly.verify(message.boundingPoly); + if (message.color != null && message.hasOwnProperty("color")) { + var error = $root.google.type.Color.verify(message.color); if (error) - return "boundingPoly." + error; + return "color." + error; } - if (message.confidence != null && message.hasOwnProperty("confidence")) - if (typeof message.confidence !== "number") - return "confidence: number expected"; - if (message.importanceFraction != null && message.hasOwnProperty("importanceFraction")) - if (typeof message.importanceFraction !== "number") - return "importanceFraction: number expected"; + if (message.score != null && message.hasOwnProperty("score")) + if (typeof message.score !== "number") + return "score: number expected"; + if (message.pixelFraction != null && message.hasOwnProperty("pixelFraction")) + if (typeof message.pixelFraction !== "number") + return "pixelFraction: number expected"; return null; }; /** - * Creates a CropHint message from a plain object. Also converts values to their respective internal types. + * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.CropHint + * @memberof google.cloud.vision.v1.ColorInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.CropHint} CropHint + * @returns {google.cloud.vision.v1.ColorInfo} ColorInfo */ - CropHint.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.CropHint) + ColorInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.ColorInfo) return object; - var message = new $root.google.cloud.vision.v1.CropHint(); - if (object.boundingPoly != null) { - if (typeof object.boundingPoly !== "object") - throw TypeError(".google.cloud.vision.v1.CropHint.boundingPoly: object expected"); - message.boundingPoly = $root.google.cloud.vision.v1.BoundingPoly.fromObject(object.boundingPoly); + var message = new $root.google.cloud.vision.v1.ColorInfo(); + if (object.color != null) { + if (typeof object.color !== "object") + throw TypeError(".google.cloud.vision.v1.ColorInfo.color: object expected"); + message.color = $root.google.type.Color.fromObject(object.color); } - if (object.confidence != null) - message.confidence = Number(object.confidence); - if (object.importanceFraction != null) - message.importanceFraction = Number(object.importanceFraction); + if (object.score != null) + message.score = Number(object.score); + if (object.pixelFraction != null) + message.pixelFraction = Number(object.pixelFraction); return message; }; /** - * Creates a plain object from a CropHint message. Also converts values to other types if specified. + * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.CropHint + * @memberof google.cloud.vision.v1.ColorInfo * @static - * @param {google.cloud.vision.v1.CropHint} message CropHint + * @param {google.cloud.vision.v1.ColorInfo} message ColorInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CropHint.toObject = function toObject(message, options) { + ColorInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.boundingPoly = null; - object.confidence = 0; - object.importanceFraction = 0; + object.color = null; + object.score = 0; + object.pixelFraction = 0; } - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - object.boundingPoly = $root.google.cloud.vision.v1.BoundingPoly.toObject(message.boundingPoly, options); - if (message.confidence != null && message.hasOwnProperty("confidence")) - object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; - if (message.importanceFraction != null && message.hasOwnProperty("importanceFraction")) - object.importanceFraction = options.json && !isFinite(message.importanceFraction) ? String(message.importanceFraction) : message.importanceFraction; + if (message.color != null && message.hasOwnProperty("color")) + object.color = $root.google.type.Color.toObject(message.color, options); + if (message.score != null && message.hasOwnProperty("score")) + object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; + if (message.pixelFraction != null && message.hasOwnProperty("pixelFraction")) + object.pixelFraction = options.json && !isFinite(message.pixelFraction) ? String(message.pixelFraction) : message.pixelFraction; return object; }; /** - * Converts this CropHint to JSON. + * Converts this ColorInfo to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.CropHint + * @memberof google.cloud.vision.v1.ColorInfo * @instance * @returns {Object.} JSON object */ - CropHint.prototype.toJSON = function toJSON() { + ColorInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CropHint; + return ColorInfo; })(); - v1.CropHintsAnnotation = (function() { + v1.DominantColorsAnnotation = (function() { /** - * Properties of a CropHintsAnnotation. + * Properties of a DominantColorsAnnotation. * @memberof google.cloud.vision.v1 - * @interface ICropHintsAnnotation - * @property {Array.|null} [cropHints] CropHintsAnnotation cropHints + * @interface IDominantColorsAnnotation + * @property {Array.|null} [colors] DominantColorsAnnotation colors */ /** - * Constructs a new CropHintsAnnotation. + * Constructs a new DominantColorsAnnotation. * @memberof google.cloud.vision.v1 - * @classdesc Represents a CropHintsAnnotation. - * @implements ICropHintsAnnotation + * @classdesc Represents a DominantColorsAnnotation. + * @implements IDominantColorsAnnotation * @constructor - * @param {google.cloud.vision.v1.ICropHintsAnnotation=} [properties] Properties to set + * @param {google.cloud.vision.v1.IDominantColorsAnnotation=} [properties] Properties to set */ - function CropHintsAnnotation(properties) { - this.cropHints = []; + function DominantColorsAnnotation(properties) { + this.colors = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -5082,78 +5349,78 @@ } /** - * CropHintsAnnotation cropHints. - * @member {Array.} cropHints - * @memberof google.cloud.vision.v1.CropHintsAnnotation + * DominantColorsAnnotation colors. + * @member {Array.} colors + * @memberof google.cloud.vision.v1.DominantColorsAnnotation * @instance */ - CropHintsAnnotation.prototype.cropHints = $util.emptyArray; + DominantColorsAnnotation.prototype.colors = $util.emptyArray; /** - * Creates a new CropHintsAnnotation instance using the specified properties. + * Creates a new DominantColorsAnnotation instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.CropHintsAnnotation + * @memberof google.cloud.vision.v1.DominantColorsAnnotation * @static - * @param {google.cloud.vision.v1.ICropHintsAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1.CropHintsAnnotation} CropHintsAnnotation instance + * @param {google.cloud.vision.v1.IDominantColorsAnnotation=} [properties] Properties to set + * @returns {google.cloud.vision.v1.DominantColorsAnnotation} DominantColorsAnnotation instance */ - CropHintsAnnotation.create = function create(properties) { - return new CropHintsAnnotation(properties); + DominantColorsAnnotation.create = function create(properties) { + return new DominantColorsAnnotation(properties); }; /** - * Encodes the specified CropHintsAnnotation message. Does not implicitly {@link google.cloud.vision.v1.CropHintsAnnotation.verify|verify} messages. + * Encodes the specified DominantColorsAnnotation message. Does not implicitly {@link google.cloud.vision.v1.DominantColorsAnnotation.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.CropHintsAnnotation + * @memberof google.cloud.vision.v1.DominantColorsAnnotation * @static - * @param {google.cloud.vision.v1.ICropHintsAnnotation} message CropHintsAnnotation message or plain object to encode + * @param {google.cloud.vision.v1.IDominantColorsAnnotation} message DominantColorsAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CropHintsAnnotation.encode = function encode(message, writer) { + DominantColorsAnnotation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.cropHints != null && message.cropHints.length) - for (var i = 0; i < message.cropHints.length; ++i) - $root.google.cloud.vision.v1.CropHint.encode(message.cropHints[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.colors != null && message.colors.length) + for (var i = 0; i < message.colors.length; ++i) + $root.google.cloud.vision.v1.ColorInfo.encode(message.colors[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified CropHintsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1.CropHintsAnnotation.verify|verify} messages. + * Encodes the specified DominantColorsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1.DominantColorsAnnotation.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.CropHintsAnnotation + * @memberof google.cloud.vision.v1.DominantColorsAnnotation * @static - * @param {google.cloud.vision.v1.ICropHintsAnnotation} message CropHintsAnnotation message or plain object to encode + * @param {google.cloud.vision.v1.IDominantColorsAnnotation} message DominantColorsAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CropHintsAnnotation.encodeDelimited = function encodeDelimited(message, writer) { + DominantColorsAnnotation.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CropHintsAnnotation message from the specified reader or buffer. + * Decodes a DominantColorsAnnotation message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.CropHintsAnnotation + * @memberof google.cloud.vision.v1.DominantColorsAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.CropHintsAnnotation} CropHintsAnnotation + * @returns {google.cloud.vision.v1.DominantColorsAnnotation} DominantColorsAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CropHintsAnnotation.decode = function decode(reader, length) { + DominantColorsAnnotation.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.vision.v1.CropHintsAnnotation(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.DominantColorsAnnotation(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.cropHints && message.cropHints.length)) - message.cropHints = []; - message.cropHints.push($root.google.cloud.vision.v1.CropHint.decode(reader, reader.uint32())); + if (!(message.colors && message.colors.length)) + message.colors = []; + message.colors.push($root.google.cloud.vision.v1.ColorInfo.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -5164,125 +5431,124 @@ }; /** - * Decodes a CropHintsAnnotation message from the specified reader or buffer, length delimited. + * Decodes a DominantColorsAnnotation message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.CropHintsAnnotation + * @memberof google.cloud.vision.v1.DominantColorsAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.CropHintsAnnotation} CropHintsAnnotation + * @returns {google.cloud.vision.v1.DominantColorsAnnotation} DominantColorsAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CropHintsAnnotation.decodeDelimited = function decodeDelimited(reader) { + DominantColorsAnnotation.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CropHintsAnnotation message. + * Verifies a DominantColorsAnnotation message. * @function verify - * @memberof google.cloud.vision.v1.CropHintsAnnotation + * @memberof google.cloud.vision.v1.DominantColorsAnnotation * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CropHintsAnnotation.verify = function verify(message) { + DominantColorsAnnotation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.cropHints != null && message.hasOwnProperty("cropHints")) { - if (!Array.isArray(message.cropHints)) - return "cropHints: array expected"; - for (var i = 0; i < message.cropHints.length; ++i) { - var error = $root.google.cloud.vision.v1.CropHint.verify(message.cropHints[i]); + if (message.colors != null && message.hasOwnProperty("colors")) { + if (!Array.isArray(message.colors)) + return "colors: array expected"; + for (var i = 0; i < message.colors.length; ++i) { + var error = $root.google.cloud.vision.v1.ColorInfo.verify(message.colors[i]); if (error) - return "cropHints." + error; + return "colors." + error; } } return null; }; /** - * Creates a CropHintsAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates a DominantColorsAnnotation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.CropHintsAnnotation + * @memberof google.cloud.vision.v1.DominantColorsAnnotation * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.CropHintsAnnotation} CropHintsAnnotation + * @returns {google.cloud.vision.v1.DominantColorsAnnotation} DominantColorsAnnotation */ - CropHintsAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.CropHintsAnnotation) + DominantColorsAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.DominantColorsAnnotation) return object; - var message = new $root.google.cloud.vision.v1.CropHintsAnnotation(); - if (object.cropHints) { - if (!Array.isArray(object.cropHints)) - throw TypeError(".google.cloud.vision.v1.CropHintsAnnotation.cropHints: array expected"); - message.cropHints = []; - for (var i = 0; i < object.cropHints.length; ++i) { - if (typeof object.cropHints[i] !== "object") - throw TypeError(".google.cloud.vision.v1.CropHintsAnnotation.cropHints: object expected"); - message.cropHints[i] = $root.google.cloud.vision.v1.CropHint.fromObject(object.cropHints[i]); + var message = new $root.google.cloud.vision.v1.DominantColorsAnnotation(); + if (object.colors) { + if (!Array.isArray(object.colors)) + throw TypeError(".google.cloud.vision.v1.DominantColorsAnnotation.colors: array expected"); + message.colors = []; + for (var i = 0; i < object.colors.length; ++i) { + if (typeof object.colors[i] !== "object") + throw TypeError(".google.cloud.vision.v1.DominantColorsAnnotation.colors: object expected"); + message.colors[i] = $root.google.cloud.vision.v1.ColorInfo.fromObject(object.colors[i]); } } return message; }; /** - * Creates a plain object from a CropHintsAnnotation message. Also converts values to other types if specified. + * Creates a plain object from a DominantColorsAnnotation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.CropHintsAnnotation + * @memberof google.cloud.vision.v1.DominantColorsAnnotation * @static - * @param {google.cloud.vision.v1.CropHintsAnnotation} message CropHintsAnnotation + * @param {google.cloud.vision.v1.DominantColorsAnnotation} message DominantColorsAnnotation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CropHintsAnnotation.toObject = function toObject(message, options) { + DominantColorsAnnotation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.cropHints = []; - if (message.cropHints && message.cropHints.length) { - object.cropHints = []; - for (var j = 0; j < message.cropHints.length; ++j) - object.cropHints[j] = $root.google.cloud.vision.v1.CropHint.toObject(message.cropHints[j], options); + object.colors = []; + if (message.colors && message.colors.length) { + object.colors = []; + for (var j = 0; j < message.colors.length; ++j) + object.colors[j] = $root.google.cloud.vision.v1.ColorInfo.toObject(message.colors[j], options); } return object; }; /** - * Converts this CropHintsAnnotation to JSON. + * Converts this DominantColorsAnnotation to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.CropHintsAnnotation + * @memberof google.cloud.vision.v1.DominantColorsAnnotation * @instance * @returns {Object.} JSON object */ - CropHintsAnnotation.prototype.toJSON = function toJSON() { + DominantColorsAnnotation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CropHintsAnnotation; + return DominantColorsAnnotation; })(); - v1.CropHintsParams = (function() { + v1.ImageProperties = (function() { /** - * Properties of a CropHintsParams. + * Properties of an ImageProperties. * @memberof google.cloud.vision.v1 - * @interface ICropHintsParams - * @property {Array.|null} [aspectRatios] CropHintsParams aspectRatios + * @interface IImageProperties + * @property {google.cloud.vision.v1.IDominantColorsAnnotation|null} [dominantColors] ImageProperties dominantColors */ /** - * Constructs a new CropHintsParams. + * Constructs a new ImageProperties. * @memberof google.cloud.vision.v1 - * @classdesc Represents a CropHintsParams. - * @implements ICropHintsParams + * @classdesc Represents an ImageProperties. + * @implements IImageProperties * @constructor - * @param {google.cloud.vision.v1.ICropHintsParams=} [properties] Properties to set + * @param {google.cloud.vision.v1.IImageProperties=} [properties] Properties to set */ - function CropHintsParams(properties) { - this.aspectRatios = []; + function ImageProperties(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -5290,86 +5556,75 @@ } /** - * CropHintsParams aspectRatios. - * @member {Array.} aspectRatios - * @memberof google.cloud.vision.v1.CropHintsParams - * @instance + * ImageProperties dominantColors. + * @member {google.cloud.vision.v1.IDominantColorsAnnotation|null|undefined} dominantColors + * @memberof google.cloud.vision.v1.ImageProperties + * @instance */ - CropHintsParams.prototype.aspectRatios = $util.emptyArray; + ImageProperties.prototype.dominantColors = null; /** - * Creates a new CropHintsParams instance using the specified properties. + * Creates a new ImageProperties instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.CropHintsParams + * @memberof google.cloud.vision.v1.ImageProperties * @static - * @param {google.cloud.vision.v1.ICropHintsParams=} [properties] Properties to set - * @returns {google.cloud.vision.v1.CropHintsParams} CropHintsParams instance + * @param {google.cloud.vision.v1.IImageProperties=} [properties] Properties to set + * @returns {google.cloud.vision.v1.ImageProperties} ImageProperties instance */ - CropHintsParams.create = function create(properties) { - return new CropHintsParams(properties); + ImageProperties.create = function create(properties) { + return new ImageProperties(properties); }; /** - * Encodes the specified CropHintsParams message. Does not implicitly {@link google.cloud.vision.v1.CropHintsParams.verify|verify} messages. + * Encodes the specified ImageProperties message. Does not implicitly {@link google.cloud.vision.v1.ImageProperties.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.CropHintsParams + * @memberof google.cloud.vision.v1.ImageProperties * @static - * @param {google.cloud.vision.v1.ICropHintsParams} message CropHintsParams message or plain object to encode + * @param {google.cloud.vision.v1.IImageProperties} message ImageProperties message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CropHintsParams.encode = function encode(message, writer) { + ImageProperties.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.aspectRatios != null && message.aspectRatios.length) { - writer.uint32(/* id 1, wireType 2 =*/10).fork(); - for (var i = 0; i < message.aspectRatios.length; ++i) - writer.float(message.aspectRatios[i]); - writer.ldelim(); - } + if (message.dominantColors != null && message.hasOwnProperty("dominantColors")) + $root.google.cloud.vision.v1.DominantColorsAnnotation.encode(message.dominantColors, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified CropHintsParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1.CropHintsParams.verify|verify} messages. + * Encodes the specified ImageProperties message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ImageProperties.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.CropHintsParams + * @memberof google.cloud.vision.v1.ImageProperties * @static - * @param {google.cloud.vision.v1.ICropHintsParams} message CropHintsParams message or plain object to encode + * @param {google.cloud.vision.v1.IImageProperties} message ImageProperties message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CropHintsParams.encodeDelimited = function encodeDelimited(message, writer) { + ImageProperties.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CropHintsParams message from the specified reader or buffer. + * Decodes an ImageProperties message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.CropHintsParams + * @memberof google.cloud.vision.v1.ImageProperties * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.CropHintsParams} CropHintsParams + * @returns {google.cloud.vision.v1.ImageProperties} ImageProperties * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CropHintsParams.decode = function decode(reader, length) { + ImageProperties.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.vision.v1.CropHintsParams(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.ImageProperties(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.aspectRatios && message.aspectRatios.length)) - message.aspectRatios = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.aspectRatios.push(reader.float()); - } else - message.aspectRatios.push(reader.float()); + message.dominantColors = $root.google.cloud.vision.v1.DominantColorsAnnotation.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -5380,119 +5635,114 @@ }; /** - * Decodes a CropHintsParams message from the specified reader or buffer, length delimited. + * Decodes an ImageProperties message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.CropHintsParams + * @memberof google.cloud.vision.v1.ImageProperties * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.CropHintsParams} CropHintsParams + * @returns {google.cloud.vision.v1.ImageProperties} ImageProperties * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CropHintsParams.decodeDelimited = function decodeDelimited(reader) { + ImageProperties.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CropHintsParams message. + * Verifies an ImageProperties message. * @function verify - * @memberof google.cloud.vision.v1.CropHintsParams + * @memberof google.cloud.vision.v1.ImageProperties * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CropHintsParams.verify = function verify(message) { + ImageProperties.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.aspectRatios != null && message.hasOwnProperty("aspectRatios")) { - if (!Array.isArray(message.aspectRatios)) - return "aspectRatios: array expected"; - for (var i = 0; i < message.aspectRatios.length; ++i) - if (typeof message.aspectRatios[i] !== "number") - return "aspectRatios: number[] expected"; + if (message.dominantColors != null && message.hasOwnProperty("dominantColors")) { + var error = $root.google.cloud.vision.v1.DominantColorsAnnotation.verify(message.dominantColors); + if (error) + return "dominantColors." + error; } return null; }; /** - * Creates a CropHintsParams message from a plain object. Also converts values to their respective internal types. + * Creates an ImageProperties message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.CropHintsParams + * @memberof google.cloud.vision.v1.ImageProperties * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.CropHintsParams} CropHintsParams + * @returns {google.cloud.vision.v1.ImageProperties} ImageProperties */ - CropHintsParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.CropHintsParams) + ImageProperties.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.ImageProperties) return object; - var message = new $root.google.cloud.vision.v1.CropHintsParams(); - if (object.aspectRatios) { - if (!Array.isArray(object.aspectRatios)) - throw TypeError(".google.cloud.vision.v1.CropHintsParams.aspectRatios: array expected"); - message.aspectRatios = []; - for (var i = 0; i < object.aspectRatios.length; ++i) - message.aspectRatios[i] = Number(object.aspectRatios[i]); + var message = new $root.google.cloud.vision.v1.ImageProperties(); + if (object.dominantColors != null) { + if (typeof object.dominantColors !== "object") + throw TypeError(".google.cloud.vision.v1.ImageProperties.dominantColors: object expected"); + message.dominantColors = $root.google.cloud.vision.v1.DominantColorsAnnotation.fromObject(object.dominantColors); } return message; }; /** - * Creates a plain object from a CropHintsParams message. Also converts values to other types if specified. + * Creates a plain object from an ImageProperties message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.CropHintsParams + * @memberof google.cloud.vision.v1.ImageProperties * @static - * @param {google.cloud.vision.v1.CropHintsParams} message CropHintsParams + * @param {google.cloud.vision.v1.ImageProperties} message ImageProperties * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CropHintsParams.toObject = function toObject(message, options) { + ImageProperties.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.aspectRatios = []; - if (message.aspectRatios && message.aspectRatios.length) { - object.aspectRatios = []; - for (var j = 0; j < message.aspectRatios.length; ++j) - object.aspectRatios[j] = options.json && !isFinite(message.aspectRatios[j]) ? String(message.aspectRatios[j]) : message.aspectRatios[j]; - } + if (options.defaults) + object.dominantColors = null; + if (message.dominantColors != null && message.hasOwnProperty("dominantColors")) + object.dominantColors = $root.google.cloud.vision.v1.DominantColorsAnnotation.toObject(message.dominantColors, options); return object; }; /** - * Converts this CropHintsParams to JSON. + * Converts this ImageProperties to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.CropHintsParams + * @memberof google.cloud.vision.v1.ImageProperties * @instance * @returns {Object.} JSON object */ - CropHintsParams.prototype.toJSON = function toJSON() { + ImageProperties.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CropHintsParams; + return ImageProperties; })(); - v1.WebDetectionParams = (function() { + v1.CropHint = (function() { /** - * Properties of a WebDetectionParams. + * Properties of a CropHint. * @memberof google.cloud.vision.v1 - * @interface IWebDetectionParams - * @property {boolean|null} [includeGeoResults] WebDetectionParams includeGeoResults + * @interface ICropHint + * @property {google.cloud.vision.v1.IBoundingPoly|null} [boundingPoly] CropHint boundingPoly + * @property {number|null} [confidence] CropHint confidence + * @property {number|null} [importanceFraction] CropHint importanceFraction */ /** - * Constructs a new WebDetectionParams. + * Constructs a new CropHint. * @memberof google.cloud.vision.v1 - * @classdesc Represents a WebDetectionParams. - * @implements IWebDetectionParams + * @classdesc Represents a CropHint. + * @implements ICropHint * @constructor - * @param {google.cloud.vision.v1.IWebDetectionParams=} [properties] Properties to set + * @param {google.cloud.vision.v1.ICropHint=} [properties] Properties to set */ - function WebDetectionParams(properties) { + function CropHint(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -5500,75 +5750,101 @@ } /** - * WebDetectionParams includeGeoResults. - * @member {boolean} includeGeoResults - * @memberof google.cloud.vision.v1.WebDetectionParams + * CropHint boundingPoly. + * @member {google.cloud.vision.v1.IBoundingPoly|null|undefined} boundingPoly + * @memberof google.cloud.vision.v1.CropHint * @instance */ - WebDetectionParams.prototype.includeGeoResults = false; + CropHint.prototype.boundingPoly = null; /** - * Creates a new WebDetectionParams instance using the specified properties. + * CropHint confidence. + * @member {number} confidence + * @memberof google.cloud.vision.v1.CropHint + * @instance + */ + CropHint.prototype.confidence = 0; + + /** + * CropHint importanceFraction. + * @member {number} importanceFraction + * @memberof google.cloud.vision.v1.CropHint + * @instance + */ + CropHint.prototype.importanceFraction = 0; + + /** + * Creates a new CropHint instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.WebDetectionParams + * @memberof google.cloud.vision.v1.CropHint * @static - * @param {google.cloud.vision.v1.IWebDetectionParams=} [properties] Properties to set - * @returns {google.cloud.vision.v1.WebDetectionParams} WebDetectionParams instance + * @param {google.cloud.vision.v1.ICropHint=} [properties] Properties to set + * @returns {google.cloud.vision.v1.CropHint} CropHint instance */ - WebDetectionParams.create = function create(properties) { - return new WebDetectionParams(properties); + CropHint.create = function create(properties) { + return new CropHint(properties); }; /** - * Encodes the specified WebDetectionParams message. Does not implicitly {@link google.cloud.vision.v1.WebDetectionParams.verify|verify} messages. + * Encodes the specified CropHint message. Does not implicitly {@link google.cloud.vision.v1.CropHint.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.WebDetectionParams + * @memberof google.cloud.vision.v1.CropHint * @static - * @param {google.cloud.vision.v1.IWebDetectionParams} message WebDetectionParams message or plain object to encode + * @param {google.cloud.vision.v1.ICropHint} message CropHint message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WebDetectionParams.encode = function encode(message, writer) { + CropHint.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.includeGeoResults != null && message.hasOwnProperty("includeGeoResults")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.includeGeoResults); + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + $root.google.cloud.vision.v1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.confidence != null && message.hasOwnProperty("confidence")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); + if (message.importanceFraction != null && message.hasOwnProperty("importanceFraction")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.importanceFraction); return writer; }; /** - * Encodes the specified WebDetectionParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1.WebDetectionParams.verify|verify} messages. + * Encodes the specified CropHint message, length delimited. Does not implicitly {@link google.cloud.vision.v1.CropHint.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.WebDetectionParams + * @memberof google.cloud.vision.v1.CropHint * @static - * @param {google.cloud.vision.v1.IWebDetectionParams} message WebDetectionParams message or plain object to encode + * @param {google.cloud.vision.v1.ICropHint} message CropHint message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WebDetectionParams.encodeDelimited = function encodeDelimited(message, writer) { + CropHint.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a WebDetectionParams message from the specified reader or buffer. + * Decodes a CropHint message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.WebDetectionParams + * @memberof google.cloud.vision.v1.CropHint * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.WebDetectionParams} WebDetectionParams + * @returns {google.cloud.vision.v1.CropHint} CropHint * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WebDetectionParams.decode = function decode(reader, length) { + CropHint.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.vision.v1.WebDetectionParams(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.CropHint(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.boundingPoly = $root.google.cloud.vision.v1.BoundingPoly.decode(reader, reader.uint32()); + break; case 2: - message.includeGeoResults = reader.bool(); + message.confidence = reader.float(); + break; + case 3: + message.importanceFraction = reader.float(); break; default: reader.skipType(tag & 7); @@ -5579,112 +5855,130 @@ }; /** - * Decodes a WebDetectionParams message from the specified reader or buffer, length delimited. + * Decodes a CropHint message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.WebDetectionParams + * @memberof google.cloud.vision.v1.CropHint * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.WebDetectionParams} WebDetectionParams + * @returns {google.cloud.vision.v1.CropHint} CropHint * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WebDetectionParams.decodeDelimited = function decodeDelimited(reader) { + CropHint.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a WebDetectionParams message. + * Verifies a CropHint message. * @function verify - * @memberof google.cloud.vision.v1.WebDetectionParams + * @memberof google.cloud.vision.v1.CropHint * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - WebDetectionParams.verify = function verify(message) { + CropHint.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.includeGeoResults != null && message.hasOwnProperty("includeGeoResults")) - if (typeof message.includeGeoResults !== "boolean") - return "includeGeoResults: boolean expected"; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { + var error = $root.google.cloud.vision.v1.BoundingPoly.verify(message.boundingPoly); + if (error) + return "boundingPoly." + error; + } + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + if (message.importanceFraction != null && message.hasOwnProperty("importanceFraction")) + if (typeof message.importanceFraction !== "number") + return "importanceFraction: number expected"; return null; }; /** - * Creates a WebDetectionParams message from a plain object. Also converts values to their respective internal types. + * Creates a CropHint message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.WebDetectionParams + * @memberof google.cloud.vision.v1.CropHint * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.WebDetectionParams} WebDetectionParams + * @returns {google.cloud.vision.v1.CropHint} CropHint */ - WebDetectionParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.WebDetectionParams) + CropHint.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.CropHint) return object; - var message = new $root.google.cloud.vision.v1.WebDetectionParams(); - if (object.includeGeoResults != null) - message.includeGeoResults = Boolean(object.includeGeoResults); + var message = new $root.google.cloud.vision.v1.CropHint(); + if (object.boundingPoly != null) { + if (typeof object.boundingPoly !== "object") + throw TypeError(".google.cloud.vision.v1.CropHint.boundingPoly: object expected"); + message.boundingPoly = $root.google.cloud.vision.v1.BoundingPoly.fromObject(object.boundingPoly); + } + if (object.confidence != null) + message.confidence = Number(object.confidence); + if (object.importanceFraction != null) + message.importanceFraction = Number(object.importanceFraction); return message; }; /** - * Creates a plain object from a WebDetectionParams message. Also converts values to other types if specified. + * Creates a plain object from a CropHint message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.WebDetectionParams + * @memberof google.cloud.vision.v1.CropHint * @static - * @param {google.cloud.vision.v1.WebDetectionParams} message WebDetectionParams + * @param {google.cloud.vision.v1.CropHint} message CropHint * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - WebDetectionParams.toObject = function toObject(message, options) { + CropHint.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.includeGeoResults = false; - if (message.includeGeoResults != null && message.hasOwnProperty("includeGeoResults")) - object.includeGeoResults = message.includeGeoResults; + if (options.defaults) { + object.boundingPoly = null; + object.confidence = 0; + object.importanceFraction = 0; + } + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + object.boundingPoly = $root.google.cloud.vision.v1.BoundingPoly.toObject(message.boundingPoly, options); + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + if (message.importanceFraction != null && message.hasOwnProperty("importanceFraction")) + object.importanceFraction = options.json && !isFinite(message.importanceFraction) ? String(message.importanceFraction) : message.importanceFraction; return object; }; /** - * Converts this WebDetectionParams to JSON. + * Converts this CropHint to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.WebDetectionParams + * @memberof google.cloud.vision.v1.CropHint * @instance * @returns {Object.} JSON object */ - WebDetectionParams.prototype.toJSON = function toJSON() { + CropHint.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return WebDetectionParams; + return CropHint; })(); - v1.ImageContext = (function() { + v1.CropHintsAnnotation = (function() { /** - * Properties of an ImageContext. + * Properties of a CropHintsAnnotation. * @memberof google.cloud.vision.v1 - * @interface IImageContext - * @property {google.cloud.vision.v1.ILatLongRect|null} [latLongRect] ImageContext latLongRect - * @property {Array.|null} [languageHints] ImageContext languageHints - * @property {google.cloud.vision.v1.ICropHintsParams|null} [cropHintsParams] ImageContext cropHintsParams - * @property {google.cloud.vision.v1.IProductSearchParams|null} [productSearchParams] ImageContext productSearchParams - * @property {google.cloud.vision.v1.IWebDetectionParams|null} [webDetectionParams] ImageContext webDetectionParams + * @interface ICropHintsAnnotation + * @property {Array.|null} [cropHints] CropHintsAnnotation cropHints */ /** - * Constructs a new ImageContext. + * Constructs a new CropHintsAnnotation. * @memberof google.cloud.vision.v1 - * @classdesc Represents an ImageContext. - * @implements IImageContext + * @classdesc Represents a CropHintsAnnotation. + * @implements ICropHintsAnnotation * @constructor - * @param {google.cloud.vision.v1.IImageContext=} [properties] Properties to set + * @param {google.cloud.vision.v1.ICropHintsAnnotation=} [properties] Properties to set */ - function ImageContext(properties) { - this.languageHints = []; + function CropHintsAnnotation(properties) { + this.cropHints = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -5692,130 +5986,78 @@ } /** - * ImageContext latLongRect. - * @member {google.cloud.vision.v1.ILatLongRect|null|undefined} latLongRect - * @memberof google.cloud.vision.v1.ImageContext - * @instance - */ - ImageContext.prototype.latLongRect = null; - - /** - * ImageContext languageHints. - * @member {Array.} languageHints - * @memberof google.cloud.vision.v1.ImageContext - * @instance - */ - ImageContext.prototype.languageHints = $util.emptyArray; - - /** - * ImageContext cropHintsParams. - * @member {google.cloud.vision.v1.ICropHintsParams|null|undefined} cropHintsParams - * @memberof google.cloud.vision.v1.ImageContext - * @instance - */ - ImageContext.prototype.cropHintsParams = null; - - /** - * ImageContext productSearchParams. - * @member {google.cloud.vision.v1.IProductSearchParams|null|undefined} productSearchParams - * @memberof google.cloud.vision.v1.ImageContext - * @instance - */ - ImageContext.prototype.productSearchParams = null; - - /** - * ImageContext webDetectionParams. - * @member {google.cloud.vision.v1.IWebDetectionParams|null|undefined} webDetectionParams - * @memberof google.cloud.vision.v1.ImageContext + * CropHintsAnnotation cropHints. + * @member {Array.} cropHints + * @memberof google.cloud.vision.v1.CropHintsAnnotation * @instance */ - ImageContext.prototype.webDetectionParams = null; + CropHintsAnnotation.prototype.cropHints = $util.emptyArray; /** - * Creates a new ImageContext instance using the specified properties. + * Creates a new CropHintsAnnotation instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.ImageContext + * @memberof google.cloud.vision.v1.CropHintsAnnotation * @static - * @param {google.cloud.vision.v1.IImageContext=} [properties] Properties to set - * @returns {google.cloud.vision.v1.ImageContext} ImageContext instance + * @param {google.cloud.vision.v1.ICropHintsAnnotation=} [properties] Properties to set + * @returns {google.cloud.vision.v1.CropHintsAnnotation} CropHintsAnnotation instance */ - ImageContext.create = function create(properties) { - return new ImageContext(properties); + CropHintsAnnotation.create = function create(properties) { + return new CropHintsAnnotation(properties); }; /** - * Encodes the specified ImageContext message. Does not implicitly {@link google.cloud.vision.v1.ImageContext.verify|verify} messages. + * Encodes the specified CropHintsAnnotation message. Does not implicitly {@link google.cloud.vision.v1.CropHintsAnnotation.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.ImageContext + * @memberof google.cloud.vision.v1.CropHintsAnnotation * @static - * @param {google.cloud.vision.v1.IImageContext} message ImageContext message or plain object to encode + * @param {google.cloud.vision.v1.ICropHintsAnnotation} message CropHintsAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageContext.encode = function encode(message, writer) { + CropHintsAnnotation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.latLongRect != null && message.hasOwnProperty("latLongRect")) - $root.google.cloud.vision.v1.LatLongRect.encode(message.latLongRect, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.languageHints != null && message.languageHints.length) - for (var i = 0; i < message.languageHints.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageHints[i]); - if (message.cropHintsParams != null && message.hasOwnProperty("cropHintsParams")) - $root.google.cloud.vision.v1.CropHintsParams.encode(message.cropHintsParams, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.productSearchParams != null && message.hasOwnProperty("productSearchParams")) - $root.google.cloud.vision.v1.ProductSearchParams.encode(message.productSearchParams, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.webDetectionParams != null && message.hasOwnProperty("webDetectionParams")) - $root.google.cloud.vision.v1.WebDetectionParams.encode(message.webDetectionParams, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.cropHints != null && message.cropHints.length) + for (var i = 0; i < message.cropHints.length; ++i) + $root.google.cloud.vision.v1.CropHint.encode(message.cropHints[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified ImageContext message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ImageContext.verify|verify} messages. + * Encodes the specified CropHintsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1.CropHintsAnnotation.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.ImageContext + * @memberof google.cloud.vision.v1.CropHintsAnnotation * @static - * @param {google.cloud.vision.v1.IImageContext} message ImageContext message or plain object to encode + * @param {google.cloud.vision.v1.ICropHintsAnnotation} message CropHintsAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageContext.encodeDelimited = function encodeDelimited(message, writer) { + CropHintsAnnotation.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImageContext message from the specified reader or buffer. + * Decodes a CropHintsAnnotation message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.ImageContext + * @memberof google.cloud.vision.v1.CropHintsAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.ImageContext} ImageContext + * @returns {google.cloud.vision.v1.CropHintsAnnotation} CropHintsAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageContext.decode = function decode(reader, length) { + CropHintsAnnotation.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.vision.v1.ImageContext(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.CropHintsAnnotation(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.latLongRect = $root.google.cloud.vision.v1.LatLongRect.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.languageHints && message.languageHints.length)) - message.languageHints = []; - message.languageHints.push(reader.string()); - break; - case 4: - message.cropHintsParams = $root.google.cloud.vision.v1.CropHintsParams.decode(reader, reader.uint32()); - break; - case 5: - message.productSearchParams = $root.google.cloud.vision.v1.ProductSearchParams.decode(reader, reader.uint32()); - break; - case 6: - message.webDetectionParams = $root.google.cloud.vision.v1.WebDetectionParams.decode(reader, reader.uint32()); + if (!(message.cropHints && message.cropHints.length)) + message.cropHints = []; + message.cropHints.push($root.google.cloud.vision.v1.CropHint.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -5826,176 +6068,125 @@ }; /** - * Decodes an ImageContext message from the specified reader or buffer, length delimited. + * Decodes a CropHintsAnnotation message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.ImageContext + * @memberof google.cloud.vision.v1.CropHintsAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.ImageContext} ImageContext + * @returns {google.cloud.vision.v1.CropHintsAnnotation} CropHintsAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageContext.decodeDelimited = function decodeDelimited(reader) { + CropHintsAnnotation.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImageContext message. + * Verifies a CropHintsAnnotation message. * @function verify - * @memberof google.cloud.vision.v1.ImageContext + * @memberof google.cloud.vision.v1.CropHintsAnnotation * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImageContext.verify = function verify(message) { + CropHintsAnnotation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.latLongRect != null && message.hasOwnProperty("latLongRect")) { - var error = $root.google.cloud.vision.v1.LatLongRect.verify(message.latLongRect); - if (error) - return "latLongRect." + error; - } - if (message.languageHints != null && message.hasOwnProperty("languageHints")) { - if (!Array.isArray(message.languageHints)) - return "languageHints: array expected"; - for (var i = 0; i < message.languageHints.length; ++i) - if (!$util.isString(message.languageHints[i])) - return "languageHints: string[] expected"; - } - if (message.cropHintsParams != null && message.hasOwnProperty("cropHintsParams")) { - var error = $root.google.cloud.vision.v1.CropHintsParams.verify(message.cropHintsParams); - if (error) - return "cropHintsParams." + error; - } - if (message.productSearchParams != null && message.hasOwnProperty("productSearchParams")) { - var error = $root.google.cloud.vision.v1.ProductSearchParams.verify(message.productSearchParams); - if (error) - return "productSearchParams." + error; - } - if (message.webDetectionParams != null && message.hasOwnProperty("webDetectionParams")) { - var error = $root.google.cloud.vision.v1.WebDetectionParams.verify(message.webDetectionParams); - if (error) - return "webDetectionParams." + error; + if (message.cropHints != null && message.hasOwnProperty("cropHints")) { + if (!Array.isArray(message.cropHints)) + return "cropHints: array expected"; + for (var i = 0; i < message.cropHints.length; ++i) { + var error = $root.google.cloud.vision.v1.CropHint.verify(message.cropHints[i]); + if (error) + return "cropHints." + error; + } } return null; }; /** - * Creates an ImageContext message from a plain object. Also converts values to their respective internal types. + * Creates a CropHintsAnnotation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.ImageContext + * @memberof google.cloud.vision.v1.CropHintsAnnotation * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.ImageContext} ImageContext + * @returns {google.cloud.vision.v1.CropHintsAnnotation} CropHintsAnnotation */ - ImageContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.ImageContext) + CropHintsAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.CropHintsAnnotation) return object; - var message = new $root.google.cloud.vision.v1.ImageContext(); - if (object.latLongRect != null) { - if (typeof object.latLongRect !== "object") - throw TypeError(".google.cloud.vision.v1.ImageContext.latLongRect: object expected"); - message.latLongRect = $root.google.cloud.vision.v1.LatLongRect.fromObject(object.latLongRect); - } - if (object.languageHints) { - if (!Array.isArray(object.languageHints)) - throw TypeError(".google.cloud.vision.v1.ImageContext.languageHints: array expected"); - message.languageHints = []; - for (var i = 0; i < object.languageHints.length; ++i) - message.languageHints[i] = String(object.languageHints[i]); - } - if (object.cropHintsParams != null) { - if (typeof object.cropHintsParams !== "object") - throw TypeError(".google.cloud.vision.v1.ImageContext.cropHintsParams: object expected"); - message.cropHintsParams = $root.google.cloud.vision.v1.CropHintsParams.fromObject(object.cropHintsParams); - } - if (object.productSearchParams != null) { - if (typeof object.productSearchParams !== "object") - throw TypeError(".google.cloud.vision.v1.ImageContext.productSearchParams: object expected"); - message.productSearchParams = $root.google.cloud.vision.v1.ProductSearchParams.fromObject(object.productSearchParams); - } - if (object.webDetectionParams != null) { - if (typeof object.webDetectionParams !== "object") - throw TypeError(".google.cloud.vision.v1.ImageContext.webDetectionParams: object expected"); - message.webDetectionParams = $root.google.cloud.vision.v1.WebDetectionParams.fromObject(object.webDetectionParams); + var message = new $root.google.cloud.vision.v1.CropHintsAnnotation(); + if (object.cropHints) { + if (!Array.isArray(object.cropHints)) + throw TypeError(".google.cloud.vision.v1.CropHintsAnnotation.cropHints: array expected"); + message.cropHints = []; + for (var i = 0; i < object.cropHints.length; ++i) { + if (typeof object.cropHints[i] !== "object") + throw TypeError(".google.cloud.vision.v1.CropHintsAnnotation.cropHints: object expected"); + message.cropHints[i] = $root.google.cloud.vision.v1.CropHint.fromObject(object.cropHints[i]); + } } return message; }; /** - * Creates a plain object from an ImageContext message. Also converts values to other types if specified. + * Creates a plain object from a CropHintsAnnotation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.ImageContext + * @memberof google.cloud.vision.v1.CropHintsAnnotation * @static - * @param {google.cloud.vision.v1.ImageContext} message ImageContext + * @param {google.cloud.vision.v1.CropHintsAnnotation} message CropHintsAnnotation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImageContext.toObject = function toObject(message, options) { + CropHintsAnnotation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.languageHints = []; - if (options.defaults) { - object.latLongRect = null; - object.cropHintsParams = null; - object.productSearchParams = null; - object.webDetectionParams = null; - } - if (message.latLongRect != null && message.hasOwnProperty("latLongRect")) - object.latLongRect = $root.google.cloud.vision.v1.LatLongRect.toObject(message.latLongRect, options); - if (message.languageHints && message.languageHints.length) { - object.languageHints = []; - for (var j = 0; j < message.languageHints.length; ++j) - object.languageHints[j] = message.languageHints[j]; + object.cropHints = []; + if (message.cropHints && message.cropHints.length) { + object.cropHints = []; + for (var j = 0; j < message.cropHints.length; ++j) + object.cropHints[j] = $root.google.cloud.vision.v1.CropHint.toObject(message.cropHints[j], options); } - if (message.cropHintsParams != null && message.hasOwnProperty("cropHintsParams")) - object.cropHintsParams = $root.google.cloud.vision.v1.CropHintsParams.toObject(message.cropHintsParams, options); - if (message.productSearchParams != null && message.hasOwnProperty("productSearchParams")) - object.productSearchParams = $root.google.cloud.vision.v1.ProductSearchParams.toObject(message.productSearchParams, options); - if (message.webDetectionParams != null && message.hasOwnProperty("webDetectionParams")) - object.webDetectionParams = $root.google.cloud.vision.v1.WebDetectionParams.toObject(message.webDetectionParams, options); return object; }; /** - * Converts this ImageContext to JSON. + * Converts this CropHintsAnnotation to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.ImageContext + * @memberof google.cloud.vision.v1.CropHintsAnnotation * @instance * @returns {Object.} JSON object */ - ImageContext.prototype.toJSON = function toJSON() { + CropHintsAnnotation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImageContext; + return CropHintsAnnotation; })(); - v1.AnnotateImageRequest = (function() { + v1.CropHintsParams = (function() { /** - * Properties of an AnnotateImageRequest. + * Properties of a CropHintsParams. * @memberof google.cloud.vision.v1 - * @interface IAnnotateImageRequest - * @property {google.cloud.vision.v1.IImage|null} [image] AnnotateImageRequest image - * @property {Array.|null} [features] AnnotateImageRequest features - * @property {google.cloud.vision.v1.IImageContext|null} [imageContext] AnnotateImageRequest imageContext + * @interface ICropHintsParams + * @property {Array.|null} [aspectRatios] CropHintsParams aspectRatios */ /** - * Constructs a new AnnotateImageRequest. + * Constructs a new CropHintsParams. * @memberof google.cloud.vision.v1 - * @classdesc Represents an AnnotateImageRequest. - * @implements IAnnotateImageRequest + * @classdesc Represents a CropHintsParams. + * @implements ICropHintsParams * @constructor - * @param {google.cloud.vision.v1.IAnnotateImageRequest=} [properties] Properties to set + * @param {google.cloud.vision.v1.ICropHintsParams=} [properties] Properties to set */ - function AnnotateImageRequest(properties) { - this.features = []; + function CropHintsParams(properties) { + this.aspectRatios = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -6003,104 +6194,86 @@ } /** - * AnnotateImageRequest image. - * @member {google.cloud.vision.v1.IImage|null|undefined} image - * @memberof google.cloud.vision.v1.AnnotateImageRequest - * @instance - */ - AnnotateImageRequest.prototype.image = null; - - /** - * AnnotateImageRequest features. - * @member {Array.} features - * @memberof google.cloud.vision.v1.AnnotateImageRequest - * @instance - */ - AnnotateImageRequest.prototype.features = $util.emptyArray; - - /** - * AnnotateImageRequest imageContext. - * @member {google.cloud.vision.v1.IImageContext|null|undefined} imageContext - * @memberof google.cloud.vision.v1.AnnotateImageRequest + * CropHintsParams aspectRatios. + * @member {Array.} aspectRatios + * @memberof google.cloud.vision.v1.CropHintsParams * @instance */ - AnnotateImageRequest.prototype.imageContext = null; + CropHintsParams.prototype.aspectRatios = $util.emptyArray; /** - * Creates a new AnnotateImageRequest instance using the specified properties. + * Creates a new CropHintsParams instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.AnnotateImageRequest + * @memberof google.cloud.vision.v1.CropHintsParams * @static - * @param {google.cloud.vision.v1.IAnnotateImageRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.AnnotateImageRequest} AnnotateImageRequest instance + * @param {google.cloud.vision.v1.ICropHintsParams=} [properties] Properties to set + * @returns {google.cloud.vision.v1.CropHintsParams} CropHintsParams instance */ - AnnotateImageRequest.create = function create(properties) { - return new AnnotateImageRequest(properties); + CropHintsParams.create = function create(properties) { + return new CropHintsParams(properties); }; /** - * Encodes the specified AnnotateImageRequest message. Does not implicitly {@link google.cloud.vision.v1.AnnotateImageRequest.verify|verify} messages. + * Encodes the specified CropHintsParams message. Does not implicitly {@link google.cloud.vision.v1.CropHintsParams.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.AnnotateImageRequest + * @memberof google.cloud.vision.v1.CropHintsParams * @static - * @param {google.cloud.vision.v1.IAnnotateImageRequest} message AnnotateImageRequest message or plain object to encode + * @param {google.cloud.vision.v1.ICropHintsParams} message CropHintsParams message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateImageRequest.encode = function encode(message, writer) { + CropHintsParams.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.image != null && message.hasOwnProperty("image")) - $root.google.cloud.vision.v1.Image.encode(message.image, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.features != null && message.features.length) - for (var i = 0; i < message.features.length; ++i) - $root.google.cloud.vision.v1.Feature.encode(message.features[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.imageContext != null && message.hasOwnProperty("imageContext")) - $root.google.cloud.vision.v1.ImageContext.encode(message.imageContext, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.aspectRatios != null && message.aspectRatios.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.aspectRatios.length; ++i) + writer.float(message.aspectRatios[i]); + writer.ldelim(); + } return writer; }; /** - * Encodes the specified AnnotateImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.AnnotateImageRequest.verify|verify} messages. + * Encodes the specified CropHintsParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1.CropHintsParams.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.AnnotateImageRequest + * @memberof google.cloud.vision.v1.CropHintsParams * @static - * @param {google.cloud.vision.v1.IAnnotateImageRequest} message AnnotateImageRequest message or plain object to encode + * @param {google.cloud.vision.v1.ICropHintsParams} message CropHintsParams message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateImageRequest.encodeDelimited = function encodeDelimited(message, writer) { + CropHintsParams.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AnnotateImageRequest message from the specified reader or buffer. + * Decodes a CropHintsParams message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.AnnotateImageRequest + * @memberof google.cloud.vision.v1.CropHintsParams * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.AnnotateImageRequest} AnnotateImageRequest + * @returns {google.cloud.vision.v1.CropHintsParams} CropHintsParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateImageRequest.decode = function decode(reader, length) { + CropHintsParams.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.vision.v1.AnnotateImageRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.CropHintsParams(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.image = $root.google.cloud.vision.v1.Image.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.features && message.features.length)) - message.features = []; - message.features.push($root.google.cloud.vision.v1.Feature.decode(reader, reader.uint32())); - break; - case 3: - message.imageContext = $root.google.cloud.vision.v1.ImageContext.decode(reader, reader.uint32()); + if (!(message.aspectRatios && message.aspectRatios.length)) + message.aspectRatios = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.aspectRatios.push(reader.float()); + } else + message.aspectRatios.push(reader.float()); break; default: reader.skipType(tag & 7); @@ -6111,153 +6284,119 @@ }; /** - * Decodes an AnnotateImageRequest message from the specified reader or buffer, length delimited. + * Decodes a CropHintsParams message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.AnnotateImageRequest + * @memberof google.cloud.vision.v1.CropHintsParams * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.AnnotateImageRequest} AnnotateImageRequest + * @returns {google.cloud.vision.v1.CropHintsParams} CropHintsParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateImageRequest.decodeDelimited = function decodeDelimited(reader) { + CropHintsParams.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AnnotateImageRequest message. + * Verifies a CropHintsParams message. * @function verify - * @memberof google.cloud.vision.v1.AnnotateImageRequest + * @memberof google.cloud.vision.v1.CropHintsParams * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AnnotateImageRequest.verify = function verify(message) { + CropHintsParams.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.image != null && message.hasOwnProperty("image")) { - var error = $root.google.cloud.vision.v1.Image.verify(message.image); - if (error) - return "image." + error; - } - if (message.features != null && message.hasOwnProperty("features")) { - if (!Array.isArray(message.features)) - return "features: array expected"; - for (var i = 0; i < message.features.length; ++i) { - var error = $root.google.cloud.vision.v1.Feature.verify(message.features[i]); - if (error) - return "features." + error; - } - } - if (message.imageContext != null && message.hasOwnProperty("imageContext")) { - var error = $root.google.cloud.vision.v1.ImageContext.verify(message.imageContext); - if (error) - return "imageContext." + error; + if (message.aspectRatios != null && message.hasOwnProperty("aspectRatios")) { + if (!Array.isArray(message.aspectRatios)) + return "aspectRatios: array expected"; + for (var i = 0; i < message.aspectRatios.length; ++i) + if (typeof message.aspectRatios[i] !== "number") + return "aspectRatios: number[] expected"; } return null; }; /** - * Creates an AnnotateImageRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CropHintsParams message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.AnnotateImageRequest + * @memberof google.cloud.vision.v1.CropHintsParams * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.AnnotateImageRequest} AnnotateImageRequest + * @returns {google.cloud.vision.v1.CropHintsParams} CropHintsParams */ - AnnotateImageRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.AnnotateImageRequest) + CropHintsParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.CropHintsParams) return object; - var message = new $root.google.cloud.vision.v1.AnnotateImageRequest(); - if (object.image != null) { - if (typeof object.image !== "object") - throw TypeError(".google.cloud.vision.v1.AnnotateImageRequest.image: object expected"); - message.image = $root.google.cloud.vision.v1.Image.fromObject(object.image); - } - if (object.features) { - if (!Array.isArray(object.features)) - throw TypeError(".google.cloud.vision.v1.AnnotateImageRequest.features: array expected"); - message.features = []; - for (var i = 0; i < object.features.length; ++i) { - if (typeof object.features[i] !== "object") - throw TypeError(".google.cloud.vision.v1.AnnotateImageRequest.features: object expected"); - message.features[i] = $root.google.cloud.vision.v1.Feature.fromObject(object.features[i]); - } - } - if (object.imageContext != null) { - if (typeof object.imageContext !== "object") - throw TypeError(".google.cloud.vision.v1.AnnotateImageRequest.imageContext: object expected"); - message.imageContext = $root.google.cloud.vision.v1.ImageContext.fromObject(object.imageContext); + var message = new $root.google.cloud.vision.v1.CropHintsParams(); + if (object.aspectRatios) { + if (!Array.isArray(object.aspectRatios)) + throw TypeError(".google.cloud.vision.v1.CropHintsParams.aspectRatios: array expected"); + message.aspectRatios = []; + for (var i = 0; i < object.aspectRatios.length; ++i) + message.aspectRatios[i] = Number(object.aspectRatios[i]); } return message; }; /** - * Creates a plain object from an AnnotateImageRequest message. Also converts values to other types if specified. + * Creates a plain object from a CropHintsParams message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.AnnotateImageRequest + * @memberof google.cloud.vision.v1.CropHintsParams * @static - * @param {google.cloud.vision.v1.AnnotateImageRequest} message AnnotateImageRequest + * @param {google.cloud.vision.v1.CropHintsParams} message CropHintsParams * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AnnotateImageRequest.toObject = function toObject(message, options) { + CropHintsParams.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.features = []; - if (options.defaults) { - object.image = null; - object.imageContext = null; - } - if (message.image != null && message.hasOwnProperty("image")) - object.image = $root.google.cloud.vision.v1.Image.toObject(message.image, options); - if (message.features && message.features.length) { - object.features = []; - for (var j = 0; j < message.features.length; ++j) - object.features[j] = $root.google.cloud.vision.v1.Feature.toObject(message.features[j], options); + object.aspectRatios = []; + if (message.aspectRatios && message.aspectRatios.length) { + object.aspectRatios = []; + for (var j = 0; j < message.aspectRatios.length; ++j) + object.aspectRatios[j] = options.json && !isFinite(message.aspectRatios[j]) ? String(message.aspectRatios[j]) : message.aspectRatios[j]; } - if (message.imageContext != null && message.hasOwnProperty("imageContext")) - object.imageContext = $root.google.cloud.vision.v1.ImageContext.toObject(message.imageContext, options); return object; }; /** - * Converts this AnnotateImageRequest to JSON. + * Converts this CropHintsParams to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.AnnotateImageRequest + * @memberof google.cloud.vision.v1.CropHintsParams * @instance * @returns {Object.} JSON object */ - AnnotateImageRequest.prototype.toJSON = function toJSON() { + CropHintsParams.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AnnotateImageRequest; + return CropHintsParams; })(); - v1.ImageAnnotationContext = (function() { + v1.WebDetectionParams = (function() { /** - * Properties of an ImageAnnotationContext. + * Properties of a WebDetectionParams. * @memberof google.cloud.vision.v1 - * @interface IImageAnnotationContext - * @property {string|null} [uri] ImageAnnotationContext uri - * @property {number|null} [pageNumber] ImageAnnotationContext pageNumber + * @interface IWebDetectionParams + * @property {boolean|null} [includeGeoResults] WebDetectionParams includeGeoResults */ /** - * Constructs a new ImageAnnotationContext. + * Constructs a new WebDetectionParams. * @memberof google.cloud.vision.v1 - * @classdesc Represents an ImageAnnotationContext. - * @implements IImageAnnotationContext + * @classdesc Represents a WebDetectionParams. + * @implements IWebDetectionParams * @constructor - * @param {google.cloud.vision.v1.IImageAnnotationContext=} [properties] Properties to set + * @param {google.cloud.vision.v1.IWebDetectionParams=} [properties] Properties to set */ - function ImageAnnotationContext(properties) { + function WebDetectionParams(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -6265,88 +6404,75 @@ } /** - * ImageAnnotationContext uri. - * @member {string} uri - * @memberof google.cloud.vision.v1.ImageAnnotationContext - * @instance - */ - ImageAnnotationContext.prototype.uri = ""; - - /** - * ImageAnnotationContext pageNumber. - * @member {number} pageNumber - * @memberof google.cloud.vision.v1.ImageAnnotationContext + * WebDetectionParams includeGeoResults. + * @member {boolean} includeGeoResults + * @memberof google.cloud.vision.v1.WebDetectionParams * @instance */ - ImageAnnotationContext.prototype.pageNumber = 0; + WebDetectionParams.prototype.includeGeoResults = false; /** - * Creates a new ImageAnnotationContext instance using the specified properties. + * Creates a new WebDetectionParams instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.ImageAnnotationContext + * @memberof google.cloud.vision.v1.WebDetectionParams * @static - * @param {google.cloud.vision.v1.IImageAnnotationContext=} [properties] Properties to set - * @returns {google.cloud.vision.v1.ImageAnnotationContext} ImageAnnotationContext instance + * @param {google.cloud.vision.v1.IWebDetectionParams=} [properties] Properties to set + * @returns {google.cloud.vision.v1.WebDetectionParams} WebDetectionParams instance */ - ImageAnnotationContext.create = function create(properties) { - return new ImageAnnotationContext(properties); + WebDetectionParams.create = function create(properties) { + return new WebDetectionParams(properties); }; /** - * Encodes the specified ImageAnnotationContext message. Does not implicitly {@link google.cloud.vision.v1.ImageAnnotationContext.verify|verify} messages. + * Encodes the specified WebDetectionParams message. Does not implicitly {@link google.cloud.vision.v1.WebDetectionParams.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.ImageAnnotationContext + * @memberof google.cloud.vision.v1.WebDetectionParams * @static - * @param {google.cloud.vision.v1.IImageAnnotationContext} message ImageAnnotationContext message or plain object to encode + * @param {google.cloud.vision.v1.IWebDetectionParams} message WebDetectionParams message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageAnnotationContext.encode = function encode(message, writer) { + WebDetectionParams.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.uri != null && message.hasOwnProperty("uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); - if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageNumber); + if (message.includeGeoResults != null && message.hasOwnProperty("includeGeoResults")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.includeGeoResults); return writer; }; /** - * Encodes the specified ImageAnnotationContext message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ImageAnnotationContext.verify|verify} messages. + * Encodes the specified WebDetectionParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1.WebDetectionParams.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.ImageAnnotationContext + * @memberof google.cloud.vision.v1.WebDetectionParams * @static - * @param {google.cloud.vision.v1.IImageAnnotationContext} message ImageAnnotationContext message or plain object to encode + * @param {google.cloud.vision.v1.IWebDetectionParams} message WebDetectionParams message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageAnnotationContext.encodeDelimited = function encodeDelimited(message, writer) { + WebDetectionParams.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImageAnnotationContext message from the specified reader or buffer. + * Decodes a WebDetectionParams message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.ImageAnnotationContext + * @memberof google.cloud.vision.v1.WebDetectionParams * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.ImageAnnotationContext} ImageAnnotationContext + * @returns {google.cloud.vision.v1.WebDetectionParams} WebDetectionParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageAnnotationContext.decode = function decode(reader, length) { + WebDetectionParams.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.vision.v1.ImageAnnotationContext(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.WebDetectionParams(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.uri = reader.string(); - break; case 2: - message.pageNumber = reader.int32(); + message.includeGeoResults = reader.bool(); break; default: reader.skipType(tag & 7); @@ -6357,135 +6483,112 @@ }; /** - * Decodes an ImageAnnotationContext message from the specified reader or buffer, length delimited. + * Decodes a WebDetectionParams message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.ImageAnnotationContext + * @memberof google.cloud.vision.v1.WebDetectionParams * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.ImageAnnotationContext} ImageAnnotationContext + * @returns {google.cloud.vision.v1.WebDetectionParams} WebDetectionParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageAnnotationContext.decodeDelimited = function decodeDelimited(reader) { + WebDetectionParams.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImageAnnotationContext message. + * Verifies a WebDetectionParams message. * @function verify - * @memberof google.cloud.vision.v1.ImageAnnotationContext + * @memberof google.cloud.vision.v1.WebDetectionParams * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImageAnnotationContext.verify = function verify(message) { + WebDetectionParams.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) - if (!$util.isInteger(message.pageNumber)) - return "pageNumber: integer expected"; + if (message.includeGeoResults != null && message.hasOwnProperty("includeGeoResults")) + if (typeof message.includeGeoResults !== "boolean") + return "includeGeoResults: boolean expected"; return null; }; /** - * Creates an ImageAnnotationContext message from a plain object. Also converts values to their respective internal types. + * Creates a WebDetectionParams message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.ImageAnnotationContext + * @memberof google.cloud.vision.v1.WebDetectionParams * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.ImageAnnotationContext} ImageAnnotationContext + * @returns {google.cloud.vision.v1.WebDetectionParams} WebDetectionParams */ - ImageAnnotationContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.ImageAnnotationContext) + WebDetectionParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.WebDetectionParams) return object; - var message = new $root.google.cloud.vision.v1.ImageAnnotationContext(); - if (object.uri != null) - message.uri = String(object.uri); - if (object.pageNumber != null) - message.pageNumber = object.pageNumber | 0; + var message = new $root.google.cloud.vision.v1.WebDetectionParams(); + if (object.includeGeoResults != null) + message.includeGeoResults = Boolean(object.includeGeoResults); return message; }; /** - * Creates a plain object from an ImageAnnotationContext message. Also converts values to other types if specified. + * Creates a plain object from a WebDetectionParams message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.ImageAnnotationContext + * @memberof google.cloud.vision.v1.WebDetectionParams * @static - * @param {google.cloud.vision.v1.ImageAnnotationContext} message ImageAnnotationContext + * @param {google.cloud.vision.v1.WebDetectionParams} message WebDetectionParams * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImageAnnotationContext.toObject = function toObject(message, options) { + WebDetectionParams.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.uri = ""; - object.pageNumber = 0; - } - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) - object.pageNumber = message.pageNumber; + if (options.defaults) + object.includeGeoResults = false; + if (message.includeGeoResults != null && message.hasOwnProperty("includeGeoResults")) + object.includeGeoResults = message.includeGeoResults; return object; }; /** - * Converts this ImageAnnotationContext to JSON. + * Converts this WebDetectionParams to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.ImageAnnotationContext + * @memberof google.cloud.vision.v1.WebDetectionParams * @instance * @returns {Object.} JSON object */ - ImageAnnotationContext.prototype.toJSON = function toJSON() { + WebDetectionParams.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImageAnnotationContext; + return WebDetectionParams; })(); - v1.AnnotateImageResponse = (function() { + v1.ImageContext = (function() { /** - * Properties of an AnnotateImageResponse. + * Properties of an ImageContext. * @memberof google.cloud.vision.v1 - * @interface IAnnotateImageResponse - * @property {Array.|null} [faceAnnotations] AnnotateImageResponse faceAnnotations - * @property {Array.|null} [landmarkAnnotations] AnnotateImageResponse landmarkAnnotations - * @property {Array.|null} [logoAnnotations] AnnotateImageResponse logoAnnotations - * @property {Array.|null} [labelAnnotations] AnnotateImageResponse labelAnnotations - * @property {Array.|null} [localizedObjectAnnotations] AnnotateImageResponse localizedObjectAnnotations - * @property {Array.|null} [textAnnotations] AnnotateImageResponse textAnnotations - * @property {google.cloud.vision.v1.ITextAnnotation|null} [fullTextAnnotation] AnnotateImageResponse fullTextAnnotation - * @property {google.cloud.vision.v1.ISafeSearchAnnotation|null} [safeSearchAnnotation] AnnotateImageResponse safeSearchAnnotation - * @property {google.cloud.vision.v1.IImageProperties|null} [imagePropertiesAnnotation] AnnotateImageResponse imagePropertiesAnnotation - * @property {google.cloud.vision.v1.ICropHintsAnnotation|null} [cropHintsAnnotation] AnnotateImageResponse cropHintsAnnotation - * @property {google.cloud.vision.v1.IWebDetection|null} [webDetection] AnnotateImageResponse webDetection - * @property {google.cloud.vision.v1.IProductSearchResults|null} [productSearchResults] AnnotateImageResponse productSearchResults - * @property {google.rpc.IStatus|null} [error] AnnotateImageResponse error - * @property {google.cloud.vision.v1.IImageAnnotationContext|null} [context] AnnotateImageResponse context + * @interface IImageContext + * @property {google.cloud.vision.v1.ILatLongRect|null} [latLongRect] ImageContext latLongRect + * @property {Array.|null} [languageHints] ImageContext languageHints + * @property {google.cloud.vision.v1.ICropHintsParams|null} [cropHintsParams] ImageContext cropHintsParams + * @property {google.cloud.vision.v1.IProductSearchParams|null} [productSearchParams] ImageContext productSearchParams + * @property {google.cloud.vision.v1.IWebDetectionParams|null} [webDetectionParams] ImageContext webDetectionParams */ /** - * Constructs a new AnnotateImageResponse. + * Constructs a new ImageContext. * @memberof google.cloud.vision.v1 - * @classdesc Represents an AnnotateImageResponse. - * @implements IAnnotateImageResponse + * @classdesc Represents an ImageContext. + * @implements IImageContext * @constructor - * @param {google.cloud.vision.v1.IAnnotateImageResponse=} [properties] Properties to set + * @param {google.cloud.vision.v1.IImageContext=} [properties] Properties to set */ - function AnnotateImageResponse(properties) { - this.faceAnnotations = []; - this.landmarkAnnotations = []; - this.logoAnnotations = []; - this.labelAnnotations = []; - this.localizedObjectAnnotations = []; - this.textAnnotations = []; + function ImageContext(properties) { + this.languageHints = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -6493,262 +6596,130 @@ } /** - * AnnotateImageResponse faceAnnotations. - * @member {Array.} faceAnnotations - * @memberof google.cloud.vision.v1.AnnotateImageResponse + * ImageContext latLongRect. + * @member {google.cloud.vision.v1.ILatLongRect|null|undefined} latLongRect + * @memberof google.cloud.vision.v1.ImageContext * @instance */ - AnnotateImageResponse.prototype.faceAnnotations = $util.emptyArray; + ImageContext.prototype.latLongRect = null; /** - * AnnotateImageResponse landmarkAnnotations. - * @member {Array.} landmarkAnnotations - * @memberof google.cloud.vision.v1.AnnotateImageResponse + * ImageContext languageHints. + * @member {Array.} languageHints + * @memberof google.cloud.vision.v1.ImageContext * @instance */ - AnnotateImageResponse.prototype.landmarkAnnotations = $util.emptyArray; + ImageContext.prototype.languageHints = $util.emptyArray; /** - * AnnotateImageResponse logoAnnotations. - * @member {Array.} logoAnnotations - * @memberof google.cloud.vision.v1.AnnotateImageResponse + * ImageContext cropHintsParams. + * @member {google.cloud.vision.v1.ICropHintsParams|null|undefined} cropHintsParams + * @memberof google.cloud.vision.v1.ImageContext * @instance */ - AnnotateImageResponse.prototype.logoAnnotations = $util.emptyArray; - - /** - * AnnotateImageResponse labelAnnotations. - * @member {Array.} labelAnnotations - * @memberof google.cloud.vision.v1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.labelAnnotations = $util.emptyArray; - - /** - * AnnotateImageResponse localizedObjectAnnotations. - * @member {Array.} localizedObjectAnnotations - * @memberof google.cloud.vision.v1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.localizedObjectAnnotations = $util.emptyArray; - - /** - * AnnotateImageResponse textAnnotations. - * @member {Array.} textAnnotations - * @memberof google.cloud.vision.v1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.textAnnotations = $util.emptyArray; - - /** - * AnnotateImageResponse fullTextAnnotation. - * @member {google.cloud.vision.v1.ITextAnnotation|null|undefined} fullTextAnnotation - * @memberof google.cloud.vision.v1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.fullTextAnnotation = null; - - /** - * AnnotateImageResponse safeSearchAnnotation. - * @member {google.cloud.vision.v1.ISafeSearchAnnotation|null|undefined} safeSearchAnnotation - * @memberof google.cloud.vision.v1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.safeSearchAnnotation = null; - - /** - * AnnotateImageResponse imagePropertiesAnnotation. - * @member {google.cloud.vision.v1.IImageProperties|null|undefined} imagePropertiesAnnotation - * @memberof google.cloud.vision.v1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.imagePropertiesAnnotation = null; - - /** - * AnnotateImageResponse cropHintsAnnotation. - * @member {google.cloud.vision.v1.ICropHintsAnnotation|null|undefined} cropHintsAnnotation - * @memberof google.cloud.vision.v1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.cropHintsAnnotation = null; - - /** - * AnnotateImageResponse webDetection. - * @member {google.cloud.vision.v1.IWebDetection|null|undefined} webDetection - * @memberof google.cloud.vision.v1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.webDetection = null; - - /** - * AnnotateImageResponse productSearchResults. - * @member {google.cloud.vision.v1.IProductSearchResults|null|undefined} productSearchResults - * @memberof google.cloud.vision.v1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.productSearchResults = null; + ImageContext.prototype.cropHintsParams = null; /** - * AnnotateImageResponse error. - * @member {google.rpc.IStatus|null|undefined} error - * @memberof google.cloud.vision.v1.AnnotateImageResponse + * ImageContext productSearchParams. + * @member {google.cloud.vision.v1.IProductSearchParams|null|undefined} productSearchParams + * @memberof google.cloud.vision.v1.ImageContext * @instance */ - AnnotateImageResponse.prototype.error = null; + ImageContext.prototype.productSearchParams = null; /** - * AnnotateImageResponse context. - * @member {google.cloud.vision.v1.IImageAnnotationContext|null|undefined} context - * @memberof google.cloud.vision.v1.AnnotateImageResponse + * ImageContext webDetectionParams. + * @member {google.cloud.vision.v1.IWebDetectionParams|null|undefined} webDetectionParams + * @memberof google.cloud.vision.v1.ImageContext * @instance */ - AnnotateImageResponse.prototype.context = null; + ImageContext.prototype.webDetectionParams = null; /** - * Creates a new AnnotateImageResponse instance using the specified properties. + * Creates a new ImageContext instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.AnnotateImageResponse + * @memberof google.cloud.vision.v1.ImageContext * @static - * @param {google.cloud.vision.v1.IAnnotateImageResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1.AnnotateImageResponse} AnnotateImageResponse instance + * @param {google.cloud.vision.v1.IImageContext=} [properties] Properties to set + * @returns {google.cloud.vision.v1.ImageContext} ImageContext instance */ - AnnotateImageResponse.create = function create(properties) { - return new AnnotateImageResponse(properties); + ImageContext.create = function create(properties) { + return new ImageContext(properties); }; /** - * Encodes the specified AnnotateImageResponse message. Does not implicitly {@link google.cloud.vision.v1.AnnotateImageResponse.verify|verify} messages. + * Encodes the specified ImageContext message. Does not implicitly {@link google.cloud.vision.v1.ImageContext.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.AnnotateImageResponse + * @memberof google.cloud.vision.v1.ImageContext * @static - * @param {google.cloud.vision.v1.IAnnotateImageResponse} message AnnotateImageResponse message or plain object to encode + * @param {google.cloud.vision.v1.IImageContext} message ImageContext message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateImageResponse.encode = function encode(message, writer) { + ImageContext.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.faceAnnotations != null && message.faceAnnotations.length) - for (var i = 0; i < message.faceAnnotations.length; ++i) - $root.google.cloud.vision.v1.FaceAnnotation.encode(message.faceAnnotations[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.landmarkAnnotations != null && message.landmarkAnnotations.length) - for (var i = 0; i < message.landmarkAnnotations.length; ++i) - $root.google.cloud.vision.v1.EntityAnnotation.encode(message.landmarkAnnotations[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.logoAnnotations != null && message.logoAnnotations.length) - for (var i = 0; i < message.logoAnnotations.length; ++i) - $root.google.cloud.vision.v1.EntityAnnotation.encode(message.logoAnnotations[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.labelAnnotations != null && message.labelAnnotations.length) - for (var i = 0; i < message.labelAnnotations.length; ++i) - $root.google.cloud.vision.v1.EntityAnnotation.encode(message.labelAnnotations[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.textAnnotations != null && message.textAnnotations.length) - for (var i = 0; i < message.textAnnotations.length; ++i) - $root.google.cloud.vision.v1.EntityAnnotation.encode(message.textAnnotations[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.safeSearchAnnotation != null && message.hasOwnProperty("safeSearchAnnotation")) - $root.google.cloud.vision.v1.SafeSearchAnnotation.encode(message.safeSearchAnnotation, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.imagePropertiesAnnotation != null && message.hasOwnProperty("imagePropertiesAnnotation")) - $root.google.cloud.vision.v1.ImageProperties.encode(message.imagePropertiesAnnotation, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.error != null && message.hasOwnProperty("error")) - $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.cropHintsAnnotation != null && message.hasOwnProperty("cropHintsAnnotation")) - $root.google.cloud.vision.v1.CropHintsAnnotation.encode(message.cropHintsAnnotation, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.fullTextAnnotation != null && message.hasOwnProperty("fullTextAnnotation")) - $root.google.cloud.vision.v1.TextAnnotation.encode(message.fullTextAnnotation, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.webDetection != null && message.hasOwnProperty("webDetection")) - $root.google.cloud.vision.v1.WebDetection.encode(message.webDetection, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); - if (message.productSearchResults != null && message.hasOwnProperty("productSearchResults")) - $root.google.cloud.vision.v1.ProductSearchResults.encode(message.productSearchResults, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); - if (message.context != null && message.hasOwnProperty("context")) - $root.google.cloud.vision.v1.ImageAnnotationContext.encode(message.context, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); - if (message.localizedObjectAnnotations != null && message.localizedObjectAnnotations.length) - for (var i = 0; i < message.localizedObjectAnnotations.length; ++i) - $root.google.cloud.vision.v1.LocalizedObjectAnnotation.encode(message.localizedObjectAnnotations[i], writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); + if (message.latLongRect != null && message.hasOwnProperty("latLongRect")) + $root.google.cloud.vision.v1.LatLongRect.encode(message.latLongRect, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.languageHints != null && message.languageHints.length) + for (var i = 0; i < message.languageHints.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageHints[i]); + if (message.cropHintsParams != null && message.hasOwnProperty("cropHintsParams")) + $root.google.cloud.vision.v1.CropHintsParams.encode(message.cropHintsParams, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.productSearchParams != null && message.hasOwnProperty("productSearchParams")) + $root.google.cloud.vision.v1.ProductSearchParams.encode(message.productSearchParams, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.webDetectionParams != null && message.hasOwnProperty("webDetectionParams")) + $root.google.cloud.vision.v1.WebDetectionParams.encode(message.webDetectionParams, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); return writer; }; /** - * Encodes the specified AnnotateImageResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.AnnotateImageResponse.verify|verify} messages. + * Encodes the specified ImageContext message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ImageContext.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.AnnotateImageResponse + * @memberof google.cloud.vision.v1.ImageContext * @static - * @param {google.cloud.vision.v1.IAnnotateImageResponse} message AnnotateImageResponse message or plain object to encode + * @param {google.cloud.vision.v1.IImageContext} message ImageContext message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateImageResponse.encodeDelimited = function encodeDelimited(message, writer) { + ImageContext.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AnnotateImageResponse message from the specified reader or buffer. + * Decodes an ImageContext message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.AnnotateImageResponse + * @memberof google.cloud.vision.v1.ImageContext * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.AnnotateImageResponse} AnnotateImageResponse + * @returns {google.cloud.vision.v1.ImageContext} ImageContext * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateImageResponse.decode = function decode(reader, length) { + ImageContext.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.vision.v1.AnnotateImageResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.ImageContext(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.faceAnnotations && message.faceAnnotations.length)) - message.faceAnnotations = []; - message.faceAnnotations.push($root.google.cloud.vision.v1.FaceAnnotation.decode(reader, reader.uint32())); + message.latLongRect = $root.google.cloud.vision.v1.LatLongRect.decode(reader, reader.uint32()); break; case 2: - if (!(message.landmarkAnnotations && message.landmarkAnnotations.length)) - message.landmarkAnnotations = []; - message.landmarkAnnotations.push($root.google.cloud.vision.v1.EntityAnnotation.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.logoAnnotations && message.logoAnnotations.length)) - message.logoAnnotations = []; - message.logoAnnotations.push($root.google.cloud.vision.v1.EntityAnnotation.decode(reader, reader.uint32())); + if (!(message.languageHints && message.languageHints.length)) + message.languageHints = []; + message.languageHints.push(reader.string()); break; case 4: - if (!(message.labelAnnotations && message.labelAnnotations.length)) - message.labelAnnotations = []; - message.labelAnnotations.push($root.google.cloud.vision.v1.EntityAnnotation.decode(reader, reader.uint32())); - break; - case 22: - if (!(message.localizedObjectAnnotations && message.localizedObjectAnnotations.length)) - message.localizedObjectAnnotations = []; - message.localizedObjectAnnotations.push($root.google.cloud.vision.v1.LocalizedObjectAnnotation.decode(reader, reader.uint32())); + message.cropHintsParams = $root.google.cloud.vision.v1.CropHintsParams.decode(reader, reader.uint32()); break; case 5: - if (!(message.textAnnotations && message.textAnnotations.length)) - message.textAnnotations = []; - message.textAnnotations.push($root.google.cloud.vision.v1.EntityAnnotation.decode(reader, reader.uint32())); - break; - case 12: - message.fullTextAnnotation = $root.google.cloud.vision.v1.TextAnnotation.decode(reader, reader.uint32()); + message.productSearchParams = $root.google.cloud.vision.v1.ProductSearchParams.decode(reader, reader.uint32()); break; case 6: - message.safeSearchAnnotation = $root.google.cloud.vision.v1.SafeSearchAnnotation.decode(reader, reader.uint32()); - break; - case 8: - message.imagePropertiesAnnotation = $root.google.cloud.vision.v1.ImageProperties.decode(reader, reader.uint32()); - break; - case 11: - message.cropHintsAnnotation = $root.google.cloud.vision.v1.CropHintsAnnotation.decode(reader, reader.uint32()); - break; - case 13: - message.webDetection = $root.google.cloud.vision.v1.WebDetection.decode(reader, reader.uint32()); - break; - case 14: - message.productSearchResults = $root.google.cloud.vision.v1.ProductSearchResults.decode(reader, reader.uint32()); - break; - case 9: - message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); - break; - case 21: - message.context = $root.google.cloud.vision.v1.ImageAnnotationContext.decode(reader, reader.uint32()); + message.webDetectionParams = $root.google.cloud.vision.v1.WebDetectionParams.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -6759,358 +6730,176 @@ }; /** - * Decodes an AnnotateImageResponse message from the specified reader or buffer, length delimited. + * Decodes an ImageContext message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.AnnotateImageResponse + * @memberof google.cloud.vision.v1.ImageContext * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.AnnotateImageResponse} AnnotateImageResponse + * @returns {google.cloud.vision.v1.ImageContext} ImageContext * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateImageResponse.decodeDelimited = function decodeDelimited(reader) { + ImageContext.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AnnotateImageResponse message. + * Verifies an ImageContext message. * @function verify - * @memberof google.cloud.vision.v1.AnnotateImageResponse + * @memberof google.cloud.vision.v1.ImageContext * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AnnotateImageResponse.verify = function verify(message) { + ImageContext.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.faceAnnotations != null && message.hasOwnProperty("faceAnnotations")) { - if (!Array.isArray(message.faceAnnotations)) - return "faceAnnotations: array expected"; - for (var i = 0; i < message.faceAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1.FaceAnnotation.verify(message.faceAnnotations[i]); - if (error) - return "faceAnnotations." + error; - } - } - if (message.landmarkAnnotations != null && message.hasOwnProperty("landmarkAnnotations")) { - if (!Array.isArray(message.landmarkAnnotations)) - return "landmarkAnnotations: array expected"; - for (var i = 0; i < message.landmarkAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1.EntityAnnotation.verify(message.landmarkAnnotations[i]); - if (error) - return "landmarkAnnotations." + error; - } - } - if (message.logoAnnotations != null && message.hasOwnProperty("logoAnnotations")) { - if (!Array.isArray(message.logoAnnotations)) - return "logoAnnotations: array expected"; - for (var i = 0; i < message.logoAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1.EntityAnnotation.verify(message.logoAnnotations[i]); - if (error) - return "logoAnnotations." + error; - } - } - if (message.labelAnnotations != null && message.hasOwnProperty("labelAnnotations")) { - if (!Array.isArray(message.labelAnnotations)) - return "labelAnnotations: array expected"; - for (var i = 0; i < message.labelAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1.EntityAnnotation.verify(message.labelAnnotations[i]); - if (error) - return "labelAnnotations." + error; - } - } - if (message.localizedObjectAnnotations != null && message.hasOwnProperty("localizedObjectAnnotations")) { - if (!Array.isArray(message.localizedObjectAnnotations)) - return "localizedObjectAnnotations: array expected"; - for (var i = 0; i < message.localizedObjectAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1.LocalizedObjectAnnotation.verify(message.localizedObjectAnnotations[i]); - if (error) - return "localizedObjectAnnotations." + error; - } - } - if (message.textAnnotations != null && message.hasOwnProperty("textAnnotations")) { - if (!Array.isArray(message.textAnnotations)) - return "textAnnotations: array expected"; - for (var i = 0; i < message.textAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1.EntityAnnotation.verify(message.textAnnotations[i]); - if (error) - return "textAnnotations." + error; - } - } - if (message.fullTextAnnotation != null && message.hasOwnProperty("fullTextAnnotation")) { - var error = $root.google.cloud.vision.v1.TextAnnotation.verify(message.fullTextAnnotation); - if (error) - return "fullTextAnnotation." + error; - } - if (message.safeSearchAnnotation != null && message.hasOwnProperty("safeSearchAnnotation")) { - var error = $root.google.cloud.vision.v1.SafeSearchAnnotation.verify(message.safeSearchAnnotation); - if (error) - return "safeSearchAnnotation." + error; - } - if (message.imagePropertiesAnnotation != null && message.hasOwnProperty("imagePropertiesAnnotation")) { - var error = $root.google.cloud.vision.v1.ImageProperties.verify(message.imagePropertiesAnnotation); - if (error) - return "imagePropertiesAnnotation." + error; - } - if (message.cropHintsAnnotation != null && message.hasOwnProperty("cropHintsAnnotation")) { - var error = $root.google.cloud.vision.v1.CropHintsAnnotation.verify(message.cropHintsAnnotation); + if (message.latLongRect != null && message.hasOwnProperty("latLongRect")) { + var error = $root.google.cloud.vision.v1.LatLongRect.verify(message.latLongRect); if (error) - return "cropHintsAnnotation." + error; + return "latLongRect." + error; } - if (message.webDetection != null && message.hasOwnProperty("webDetection")) { - var error = $root.google.cloud.vision.v1.WebDetection.verify(message.webDetection); - if (error) - return "webDetection." + error; + if (message.languageHints != null && message.hasOwnProperty("languageHints")) { + if (!Array.isArray(message.languageHints)) + return "languageHints: array expected"; + for (var i = 0; i < message.languageHints.length; ++i) + if (!$util.isString(message.languageHints[i])) + return "languageHints: string[] expected"; } - if (message.productSearchResults != null && message.hasOwnProperty("productSearchResults")) { - var error = $root.google.cloud.vision.v1.ProductSearchResults.verify(message.productSearchResults); + if (message.cropHintsParams != null && message.hasOwnProperty("cropHintsParams")) { + var error = $root.google.cloud.vision.v1.CropHintsParams.verify(message.cropHintsParams); if (error) - return "productSearchResults." + error; + return "cropHintsParams." + error; } - if (message.error != null && message.hasOwnProperty("error")) { - var error = $root.google.rpc.Status.verify(message.error); + if (message.productSearchParams != null && message.hasOwnProperty("productSearchParams")) { + var error = $root.google.cloud.vision.v1.ProductSearchParams.verify(message.productSearchParams); if (error) - return "error." + error; + return "productSearchParams." + error; } - if (message.context != null && message.hasOwnProperty("context")) { - var error = $root.google.cloud.vision.v1.ImageAnnotationContext.verify(message.context); + if (message.webDetectionParams != null && message.hasOwnProperty("webDetectionParams")) { + var error = $root.google.cloud.vision.v1.WebDetectionParams.verify(message.webDetectionParams); if (error) - return "context." + error; + return "webDetectionParams." + error; } return null; }; /** - * Creates an AnnotateImageResponse message from a plain object. Also converts values to their respective internal types. + * Creates an ImageContext message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.AnnotateImageResponse + * @memberof google.cloud.vision.v1.ImageContext * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.AnnotateImageResponse} AnnotateImageResponse + * @returns {google.cloud.vision.v1.ImageContext} ImageContext */ - AnnotateImageResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.AnnotateImageResponse) + ImageContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.ImageContext) return object; - var message = new $root.google.cloud.vision.v1.AnnotateImageResponse(); - if (object.faceAnnotations) { - if (!Array.isArray(object.faceAnnotations)) - throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.faceAnnotations: array expected"); - message.faceAnnotations = []; - for (var i = 0; i < object.faceAnnotations.length; ++i) { - if (typeof object.faceAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.faceAnnotations: object expected"); - message.faceAnnotations[i] = $root.google.cloud.vision.v1.FaceAnnotation.fromObject(object.faceAnnotations[i]); - } - } - if (object.landmarkAnnotations) { - if (!Array.isArray(object.landmarkAnnotations)) - throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.landmarkAnnotations: array expected"); - message.landmarkAnnotations = []; - for (var i = 0; i < object.landmarkAnnotations.length; ++i) { - if (typeof object.landmarkAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.landmarkAnnotations: object expected"); - message.landmarkAnnotations[i] = $root.google.cloud.vision.v1.EntityAnnotation.fromObject(object.landmarkAnnotations[i]); - } - } - if (object.logoAnnotations) { - if (!Array.isArray(object.logoAnnotations)) - throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.logoAnnotations: array expected"); - message.logoAnnotations = []; - for (var i = 0; i < object.logoAnnotations.length; ++i) { - if (typeof object.logoAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.logoAnnotations: object expected"); - message.logoAnnotations[i] = $root.google.cloud.vision.v1.EntityAnnotation.fromObject(object.logoAnnotations[i]); - } - } - if (object.labelAnnotations) { - if (!Array.isArray(object.labelAnnotations)) - throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.labelAnnotations: array expected"); - message.labelAnnotations = []; - for (var i = 0; i < object.labelAnnotations.length; ++i) { - if (typeof object.labelAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.labelAnnotations: object expected"); - message.labelAnnotations[i] = $root.google.cloud.vision.v1.EntityAnnotation.fromObject(object.labelAnnotations[i]); - } - } - if (object.localizedObjectAnnotations) { - if (!Array.isArray(object.localizedObjectAnnotations)) - throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.localizedObjectAnnotations: array expected"); - message.localizedObjectAnnotations = []; - for (var i = 0; i < object.localizedObjectAnnotations.length; ++i) { - if (typeof object.localizedObjectAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.localizedObjectAnnotations: object expected"); - message.localizedObjectAnnotations[i] = $root.google.cloud.vision.v1.LocalizedObjectAnnotation.fromObject(object.localizedObjectAnnotations[i]); - } - } - if (object.textAnnotations) { - if (!Array.isArray(object.textAnnotations)) - throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.textAnnotations: array expected"); - message.textAnnotations = []; - for (var i = 0; i < object.textAnnotations.length; ++i) { - if (typeof object.textAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.textAnnotations: object expected"); - message.textAnnotations[i] = $root.google.cloud.vision.v1.EntityAnnotation.fromObject(object.textAnnotations[i]); - } - } - if (object.fullTextAnnotation != null) { - if (typeof object.fullTextAnnotation !== "object") - throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.fullTextAnnotation: object expected"); - message.fullTextAnnotation = $root.google.cloud.vision.v1.TextAnnotation.fromObject(object.fullTextAnnotation); - } - if (object.safeSearchAnnotation != null) { - if (typeof object.safeSearchAnnotation !== "object") - throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.safeSearchAnnotation: object expected"); - message.safeSearchAnnotation = $root.google.cloud.vision.v1.SafeSearchAnnotation.fromObject(object.safeSearchAnnotation); - } - if (object.imagePropertiesAnnotation != null) { - if (typeof object.imagePropertiesAnnotation !== "object") - throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.imagePropertiesAnnotation: object expected"); - message.imagePropertiesAnnotation = $root.google.cloud.vision.v1.ImageProperties.fromObject(object.imagePropertiesAnnotation); - } - if (object.cropHintsAnnotation != null) { - if (typeof object.cropHintsAnnotation !== "object") - throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.cropHintsAnnotation: object expected"); - message.cropHintsAnnotation = $root.google.cloud.vision.v1.CropHintsAnnotation.fromObject(object.cropHintsAnnotation); + var message = new $root.google.cloud.vision.v1.ImageContext(); + if (object.latLongRect != null) { + if (typeof object.latLongRect !== "object") + throw TypeError(".google.cloud.vision.v1.ImageContext.latLongRect: object expected"); + message.latLongRect = $root.google.cloud.vision.v1.LatLongRect.fromObject(object.latLongRect); } - if (object.webDetection != null) { - if (typeof object.webDetection !== "object") - throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.webDetection: object expected"); - message.webDetection = $root.google.cloud.vision.v1.WebDetection.fromObject(object.webDetection); + if (object.languageHints) { + if (!Array.isArray(object.languageHints)) + throw TypeError(".google.cloud.vision.v1.ImageContext.languageHints: array expected"); + message.languageHints = []; + for (var i = 0; i < object.languageHints.length; ++i) + message.languageHints[i] = String(object.languageHints[i]); } - if (object.productSearchResults != null) { - if (typeof object.productSearchResults !== "object") - throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.productSearchResults: object expected"); - message.productSearchResults = $root.google.cloud.vision.v1.ProductSearchResults.fromObject(object.productSearchResults); + if (object.cropHintsParams != null) { + if (typeof object.cropHintsParams !== "object") + throw TypeError(".google.cloud.vision.v1.ImageContext.cropHintsParams: object expected"); + message.cropHintsParams = $root.google.cloud.vision.v1.CropHintsParams.fromObject(object.cropHintsParams); } - if (object.error != null) { - if (typeof object.error !== "object") - throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.error: object expected"); - message.error = $root.google.rpc.Status.fromObject(object.error); + if (object.productSearchParams != null) { + if (typeof object.productSearchParams !== "object") + throw TypeError(".google.cloud.vision.v1.ImageContext.productSearchParams: object expected"); + message.productSearchParams = $root.google.cloud.vision.v1.ProductSearchParams.fromObject(object.productSearchParams); } - if (object.context != null) { - if (typeof object.context !== "object") - throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.context: object expected"); - message.context = $root.google.cloud.vision.v1.ImageAnnotationContext.fromObject(object.context); + if (object.webDetectionParams != null) { + if (typeof object.webDetectionParams !== "object") + throw TypeError(".google.cloud.vision.v1.ImageContext.webDetectionParams: object expected"); + message.webDetectionParams = $root.google.cloud.vision.v1.WebDetectionParams.fromObject(object.webDetectionParams); } return message; }; /** - * Creates a plain object from an AnnotateImageResponse message. Also converts values to other types if specified. + * Creates a plain object from an ImageContext message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.AnnotateImageResponse + * @memberof google.cloud.vision.v1.ImageContext * @static - * @param {google.cloud.vision.v1.AnnotateImageResponse} message AnnotateImageResponse + * @param {google.cloud.vision.v1.ImageContext} message ImageContext * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AnnotateImageResponse.toObject = function toObject(message, options) { + ImageContext.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.faceAnnotations = []; - object.landmarkAnnotations = []; - object.logoAnnotations = []; - object.labelAnnotations = []; - object.textAnnotations = []; - object.localizedObjectAnnotations = []; - } + if (options.arrays || options.defaults) + object.languageHints = []; if (options.defaults) { - object.safeSearchAnnotation = null; - object.imagePropertiesAnnotation = null; - object.error = null; - object.cropHintsAnnotation = null; - object.fullTextAnnotation = null; - object.webDetection = null; - object.productSearchResults = null; - object.context = null; + object.latLongRect = null; + object.cropHintsParams = null; + object.productSearchParams = null; + object.webDetectionParams = null; } - if (message.faceAnnotations && message.faceAnnotations.length) { - object.faceAnnotations = []; - for (var j = 0; j < message.faceAnnotations.length; ++j) - object.faceAnnotations[j] = $root.google.cloud.vision.v1.FaceAnnotation.toObject(message.faceAnnotations[j], options); - } - if (message.landmarkAnnotations && message.landmarkAnnotations.length) { - object.landmarkAnnotations = []; - for (var j = 0; j < message.landmarkAnnotations.length; ++j) - object.landmarkAnnotations[j] = $root.google.cloud.vision.v1.EntityAnnotation.toObject(message.landmarkAnnotations[j], options); - } - if (message.logoAnnotations && message.logoAnnotations.length) { - object.logoAnnotations = []; - for (var j = 0; j < message.logoAnnotations.length; ++j) - object.logoAnnotations[j] = $root.google.cloud.vision.v1.EntityAnnotation.toObject(message.logoAnnotations[j], options); - } - if (message.labelAnnotations && message.labelAnnotations.length) { - object.labelAnnotations = []; - for (var j = 0; j < message.labelAnnotations.length; ++j) - object.labelAnnotations[j] = $root.google.cloud.vision.v1.EntityAnnotation.toObject(message.labelAnnotations[j], options); - } - if (message.textAnnotations && message.textAnnotations.length) { - object.textAnnotations = []; - for (var j = 0; j < message.textAnnotations.length; ++j) - object.textAnnotations[j] = $root.google.cloud.vision.v1.EntityAnnotation.toObject(message.textAnnotations[j], options); - } - if (message.safeSearchAnnotation != null && message.hasOwnProperty("safeSearchAnnotation")) - object.safeSearchAnnotation = $root.google.cloud.vision.v1.SafeSearchAnnotation.toObject(message.safeSearchAnnotation, options); - if (message.imagePropertiesAnnotation != null && message.hasOwnProperty("imagePropertiesAnnotation")) - object.imagePropertiesAnnotation = $root.google.cloud.vision.v1.ImageProperties.toObject(message.imagePropertiesAnnotation, options); - if (message.error != null && message.hasOwnProperty("error")) - object.error = $root.google.rpc.Status.toObject(message.error, options); - if (message.cropHintsAnnotation != null && message.hasOwnProperty("cropHintsAnnotation")) - object.cropHintsAnnotation = $root.google.cloud.vision.v1.CropHintsAnnotation.toObject(message.cropHintsAnnotation, options); - if (message.fullTextAnnotation != null && message.hasOwnProperty("fullTextAnnotation")) - object.fullTextAnnotation = $root.google.cloud.vision.v1.TextAnnotation.toObject(message.fullTextAnnotation, options); - if (message.webDetection != null && message.hasOwnProperty("webDetection")) - object.webDetection = $root.google.cloud.vision.v1.WebDetection.toObject(message.webDetection, options); - if (message.productSearchResults != null && message.hasOwnProperty("productSearchResults")) - object.productSearchResults = $root.google.cloud.vision.v1.ProductSearchResults.toObject(message.productSearchResults, options); - if (message.context != null && message.hasOwnProperty("context")) - object.context = $root.google.cloud.vision.v1.ImageAnnotationContext.toObject(message.context, options); - if (message.localizedObjectAnnotations && message.localizedObjectAnnotations.length) { - object.localizedObjectAnnotations = []; - for (var j = 0; j < message.localizedObjectAnnotations.length; ++j) - object.localizedObjectAnnotations[j] = $root.google.cloud.vision.v1.LocalizedObjectAnnotation.toObject(message.localizedObjectAnnotations[j], options); + if (message.latLongRect != null && message.hasOwnProperty("latLongRect")) + object.latLongRect = $root.google.cloud.vision.v1.LatLongRect.toObject(message.latLongRect, options); + if (message.languageHints && message.languageHints.length) { + object.languageHints = []; + for (var j = 0; j < message.languageHints.length; ++j) + object.languageHints[j] = message.languageHints[j]; } + if (message.cropHintsParams != null && message.hasOwnProperty("cropHintsParams")) + object.cropHintsParams = $root.google.cloud.vision.v1.CropHintsParams.toObject(message.cropHintsParams, options); + if (message.productSearchParams != null && message.hasOwnProperty("productSearchParams")) + object.productSearchParams = $root.google.cloud.vision.v1.ProductSearchParams.toObject(message.productSearchParams, options); + if (message.webDetectionParams != null && message.hasOwnProperty("webDetectionParams")) + object.webDetectionParams = $root.google.cloud.vision.v1.WebDetectionParams.toObject(message.webDetectionParams, options); return object; }; /** - * Converts this AnnotateImageResponse to JSON. + * Converts this ImageContext to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.AnnotateImageResponse + * @memberof google.cloud.vision.v1.ImageContext * @instance * @returns {Object.} JSON object */ - AnnotateImageResponse.prototype.toJSON = function toJSON() { + ImageContext.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AnnotateImageResponse; + return ImageContext; })(); - v1.BatchAnnotateImagesRequest = (function() { + v1.AnnotateImageRequest = (function() { /** - * Properties of a BatchAnnotateImagesRequest. + * Properties of an AnnotateImageRequest. * @memberof google.cloud.vision.v1 - * @interface IBatchAnnotateImagesRequest - * @property {Array.|null} [requests] BatchAnnotateImagesRequest requests - * @property {string|null} [parent] BatchAnnotateImagesRequest parent + * @interface IAnnotateImageRequest + * @property {google.cloud.vision.v1.IImage|null} [image] AnnotateImageRequest image + * @property {Array.|null} [features] AnnotateImageRequest features + * @property {google.cloud.vision.v1.IImageContext|null} [imageContext] AnnotateImageRequest imageContext */ /** - * Constructs a new BatchAnnotateImagesRequest. + * Constructs a new AnnotateImageRequest. * @memberof google.cloud.vision.v1 - * @classdesc Represents a BatchAnnotateImagesRequest. - * @implements IBatchAnnotateImagesRequest + * @classdesc Represents an AnnotateImageRequest. + * @implements IAnnotateImageRequest * @constructor - * @param {google.cloud.vision.v1.IBatchAnnotateImagesRequest=} [properties] Properties to set + * @param {google.cloud.vision.v1.IAnnotateImageRequest=} [properties] Properties to set */ - function BatchAnnotateImagesRequest(properties) { - this.requests = []; + function AnnotateImageRequest(properties) { + this.features = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -7118,91 +6907,104 @@ } /** - * BatchAnnotateImagesRequest requests. - * @member {Array.} requests - * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest + * AnnotateImageRequest image. + * @member {google.cloud.vision.v1.IImage|null|undefined} image + * @memberof google.cloud.vision.v1.AnnotateImageRequest * @instance */ - BatchAnnotateImagesRequest.prototype.requests = $util.emptyArray; + AnnotateImageRequest.prototype.image = null; /** - * BatchAnnotateImagesRequest parent. - * @member {string} parent - * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest + * AnnotateImageRequest features. + * @member {Array.} features + * @memberof google.cloud.vision.v1.AnnotateImageRequest * @instance */ - BatchAnnotateImagesRequest.prototype.parent = ""; + AnnotateImageRequest.prototype.features = $util.emptyArray; /** - * Creates a new BatchAnnotateImagesRequest instance using the specified properties. + * AnnotateImageRequest imageContext. + * @member {google.cloud.vision.v1.IImageContext|null|undefined} imageContext + * @memberof google.cloud.vision.v1.AnnotateImageRequest + * @instance + */ + AnnotateImageRequest.prototype.imageContext = null; + + /** + * Creates a new AnnotateImageRequest instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1.AnnotateImageRequest * @static - * @param {google.cloud.vision.v1.IBatchAnnotateImagesRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest instance + * @param {google.cloud.vision.v1.IAnnotateImageRequest=} [properties] Properties to set + * @returns {google.cloud.vision.v1.AnnotateImageRequest} AnnotateImageRequest instance */ - BatchAnnotateImagesRequest.create = function create(properties) { - return new BatchAnnotateImagesRequest(properties); + AnnotateImageRequest.create = function create(properties) { + return new AnnotateImageRequest(properties); }; /** - * Encodes the specified BatchAnnotateImagesRequest message. Does not implicitly {@link google.cloud.vision.v1.BatchAnnotateImagesRequest.verify|verify} messages. + * Encodes the specified AnnotateImageRequest message. Does not implicitly {@link google.cloud.vision.v1.AnnotateImageRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1.AnnotateImageRequest * @static - * @param {google.cloud.vision.v1.IBatchAnnotateImagesRequest} message BatchAnnotateImagesRequest message or plain object to encode + * @param {google.cloud.vision.v1.IAnnotateImageRequest} message AnnotateImageRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchAnnotateImagesRequest.encode = function encode(message, writer) { + AnnotateImageRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.requests != null && message.requests.length) - for (var i = 0; i < message.requests.length; ++i) - $root.google.cloud.vision.v1.AnnotateImageRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.parent != null && message.hasOwnProperty("parent")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.parent); + if (message.image != null && message.hasOwnProperty("image")) + $root.google.cloud.vision.v1.Image.encode(message.image, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.features != null && message.features.length) + for (var i = 0; i < message.features.length; ++i) + $root.google.cloud.vision.v1.Feature.encode(message.features[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.imageContext != null && message.hasOwnProperty("imageContext")) + $root.google.cloud.vision.v1.ImageContext.encode(message.imageContext, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified BatchAnnotateImagesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.BatchAnnotateImagesRequest.verify|verify} messages. + * Encodes the specified AnnotateImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.AnnotateImageRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1.AnnotateImageRequest * @static - * @param {google.cloud.vision.v1.IBatchAnnotateImagesRequest} message BatchAnnotateImagesRequest message or plain object to encode + * @param {google.cloud.vision.v1.IAnnotateImageRequest} message AnnotateImageRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchAnnotateImagesRequest.encodeDelimited = function encodeDelimited(message, writer) { + AnnotateImageRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer. + * Decodes an AnnotateImageRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1.AnnotateImageRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest + * @returns {google.cloud.vision.v1.AnnotateImageRequest} AnnotateImageRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchAnnotateImagesRequest.decode = function decode(reader, length) { + AnnotateImageRequest.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.vision.v1.BatchAnnotateImagesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.AnnotateImageRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.requests && message.requests.length)) - message.requests = []; - message.requests.push($root.google.cloud.vision.v1.AnnotateImageRequest.decode(reader, reader.uint32())); + message.image = $root.google.cloud.vision.v1.Image.decode(reader, reader.uint32()); break; - case 4: - message.parent = reader.string(); + case 2: + if (!(message.features && message.features.length)) + message.features = []; + message.features.push($root.google.cloud.vision.v1.Feature.decode(reader, reader.uint32())); + break; + case 3: + message.imageContext = $root.google.cloud.vision.v1.ImageContext.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -7213,134 +7015,153 @@ }; /** - * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. + * Decodes an AnnotateImageRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1.AnnotateImageRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest + * @returns {google.cloud.vision.v1.AnnotateImageRequest} AnnotateImageRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchAnnotateImagesRequest.decodeDelimited = function decodeDelimited(reader) { + AnnotateImageRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BatchAnnotateImagesRequest message. + * Verifies an AnnotateImageRequest message. * @function verify - * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1.AnnotateImageRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BatchAnnotateImagesRequest.verify = function verify(message) { + AnnotateImageRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.requests != null && message.hasOwnProperty("requests")) { - if (!Array.isArray(message.requests)) - return "requests: array expected"; - for (var i = 0; i < message.requests.length; ++i) { - var error = $root.google.cloud.vision.v1.AnnotateImageRequest.verify(message.requests[i]); + if (message.image != null && message.hasOwnProperty("image")) { + var error = $root.google.cloud.vision.v1.Image.verify(message.image); + if (error) + return "image." + error; + } + if (message.features != null && message.hasOwnProperty("features")) { + if (!Array.isArray(message.features)) + return "features: array expected"; + for (var i = 0; i < message.features.length; ++i) { + var error = $root.google.cloud.vision.v1.Feature.verify(message.features[i]); if (error) - return "requests." + error; + return "features." + error; } } - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; + if (message.imageContext != null && message.hasOwnProperty("imageContext")) { + var error = $root.google.cloud.vision.v1.ImageContext.verify(message.imageContext); + if (error) + return "imageContext." + error; + } return null; }; /** - * Creates a BatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. + * Creates an AnnotateImageRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1.AnnotateImageRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest + * @returns {google.cloud.vision.v1.AnnotateImageRequest} AnnotateImageRequest */ - BatchAnnotateImagesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.BatchAnnotateImagesRequest) + AnnotateImageRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.AnnotateImageRequest) return object; - var message = new $root.google.cloud.vision.v1.BatchAnnotateImagesRequest(); - if (object.requests) { - if (!Array.isArray(object.requests)) - throw TypeError(".google.cloud.vision.v1.BatchAnnotateImagesRequest.requests: array expected"); - message.requests = []; - for (var i = 0; i < object.requests.length; ++i) { - if (typeof object.requests[i] !== "object") - throw TypeError(".google.cloud.vision.v1.BatchAnnotateImagesRequest.requests: object expected"); - message.requests[i] = $root.google.cloud.vision.v1.AnnotateImageRequest.fromObject(object.requests[i]); + var message = new $root.google.cloud.vision.v1.AnnotateImageRequest(); + if (object.image != null) { + if (typeof object.image !== "object") + throw TypeError(".google.cloud.vision.v1.AnnotateImageRequest.image: object expected"); + message.image = $root.google.cloud.vision.v1.Image.fromObject(object.image); + } + if (object.features) { + if (!Array.isArray(object.features)) + throw TypeError(".google.cloud.vision.v1.AnnotateImageRequest.features: array expected"); + message.features = []; + for (var i = 0; i < object.features.length; ++i) { + if (typeof object.features[i] !== "object") + throw TypeError(".google.cloud.vision.v1.AnnotateImageRequest.features: object expected"); + message.features[i] = $root.google.cloud.vision.v1.Feature.fromObject(object.features[i]); } } - if (object.parent != null) - message.parent = String(object.parent); + if (object.imageContext != null) { + if (typeof object.imageContext !== "object") + throw TypeError(".google.cloud.vision.v1.AnnotateImageRequest.imageContext: object expected"); + message.imageContext = $root.google.cloud.vision.v1.ImageContext.fromObject(object.imageContext); + } return message; }; /** - * Creates a plain object from a BatchAnnotateImagesRequest message. Also converts values to other types if specified. + * Creates a plain object from an AnnotateImageRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1.AnnotateImageRequest * @static - * @param {google.cloud.vision.v1.BatchAnnotateImagesRequest} message BatchAnnotateImagesRequest + * @param {google.cloud.vision.v1.AnnotateImageRequest} message AnnotateImageRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BatchAnnotateImagesRequest.toObject = function toObject(message, options) { + AnnotateImageRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.requests = []; - if (options.defaults) - object.parent = ""; - if (message.requests && message.requests.length) { - object.requests = []; - for (var j = 0; j < message.requests.length; ++j) - object.requests[j] = $root.google.cloud.vision.v1.AnnotateImageRequest.toObject(message.requests[j], options); + object.features = []; + if (options.defaults) { + object.image = null; + object.imageContext = null; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; + if (message.image != null && message.hasOwnProperty("image")) + object.image = $root.google.cloud.vision.v1.Image.toObject(message.image, options); + if (message.features && message.features.length) { + object.features = []; + for (var j = 0; j < message.features.length; ++j) + object.features[j] = $root.google.cloud.vision.v1.Feature.toObject(message.features[j], options); + } + if (message.imageContext != null && message.hasOwnProperty("imageContext")) + object.imageContext = $root.google.cloud.vision.v1.ImageContext.toObject(message.imageContext, options); return object; }; /** - * Converts this BatchAnnotateImagesRequest to JSON. + * Converts this AnnotateImageRequest to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1.AnnotateImageRequest * @instance * @returns {Object.} JSON object */ - BatchAnnotateImagesRequest.prototype.toJSON = function toJSON() { + AnnotateImageRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BatchAnnotateImagesRequest; + return AnnotateImageRequest; })(); - v1.BatchAnnotateImagesResponse = (function() { + v1.ImageAnnotationContext = (function() { /** - * Properties of a BatchAnnotateImagesResponse. + * Properties of an ImageAnnotationContext. * @memberof google.cloud.vision.v1 - * @interface IBatchAnnotateImagesResponse - * @property {Array.|null} [responses] BatchAnnotateImagesResponse responses + * @interface IImageAnnotationContext + * @property {string|null} [uri] ImageAnnotationContext uri + * @property {number|null} [pageNumber] ImageAnnotationContext pageNumber */ /** - * Constructs a new BatchAnnotateImagesResponse. + * Constructs a new ImageAnnotationContext. * @memberof google.cloud.vision.v1 - * @classdesc Represents a BatchAnnotateImagesResponse. - * @implements IBatchAnnotateImagesResponse + * @classdesc Represents an ImageAnnotationContext. + * @implements IImageAnnotationContext * @constructor - * @param {google.cloud.vision.v1.IBatchAnnotateImagesResponse=} [properties] Properties to set + * @param {google.cloud.vision.v1.IImageAnnotationContext=} [properties] Properties to set */ - function BatchAnnotateImagesResponse(properties) { - this.responses = []; + function ImageAnnotationContext(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -7348,78 +7169,88 @@ } /** - * BatchAnnotateImagesResponse responses. - * @member {Array.} responses - * @memberof google.cloud.vision.v1.BatchAnnotateImagesResponse + * ImageAnnotationContext uri. + * @member {string} uri + * @memberof google.cloud.vision.v1.ImageAnnotationContext * @instance */ - BatchAnnotateImagesResponse.prototype.responses = $util.emptyArray; + ImageAnnotationContext.prototype.uri = ""; /** - * Creates a new BatchAnnotateImagesResponse instance using the specified properties. + * ImageAnnotationContext pageNumber. + * @member {number} pageNumber + * @memberof google.cloud.vision.v1.ImageAnnotationContext + * @instance + */ + ImageAnnotationContext.prototype.pageNumber = 0; + + /** + * Creates a new ImageAnnotationContext instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1.ImageAnnotationContext * @static - * @param {google.cloud.vision.v1.IBatchAnnotateImagesResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse instance + * @param {google.cloud.vision.v1.IImageAnnotationContext=} [properties] Properties to set + * @returns {google.cloud.vision.v1.ImageAnnotationContext} ImageAnnotationContext instance */ - BatchAnnotateImagesResponse.create = function create(properties) { - return new BatchAnnotateImagesResponse(properties); + ImageAnnotationContext.create = function create(properties) { + return new ImageAnnotationContext(properties); }; /** - * Encodes the specified BatchAnnotateImagesResponse message. Does not implicitly {@link google.cloud.vision.v1.BatchAnnotateImagesResponse.verify|verify} messages. + * Encodes the specified ImageAnnotationContext message. Does not implicitly {@link google.cloud.vision.v1.ImageAnnotationContext.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1.ImageAnnotationContext * @static - * @param {google.cloud.vision.v1.IBatchAnnotateImagesResponse} message BatchAnnotateImagesResponse message or plain object to encode + * @param {google.cloud.vision.v1.IImageAnnotationContext} message ImageAnnotationContext message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchAnnotateImagesResponse.encode = function encode(message, writer) { + ImageAnnotationContext.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.responses != null && message.responses.length) - for (var i = 0; i < message.responses.length; ++i) - $root.google.cloud.vision.v1.AnnotateImageResponse.encode(message.responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.uri != null && message.hasOwnProperty("uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageNumber); return writer; }; /** - * Encodes the specified BatchAnnotateImagesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.BatchAnnotateImagesResponse.verify|verify} messages. + * Encodes the specified ImageAnnotationContext message, length delimited. Does not implicitly {@link google.cloud.vision.v1.ImageAnnotationContext.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1.ImageAnnotationContext * @static - * @param {google.cloud.vision.v1.IBatchAnnotateImagesResponse} message BatchAnnotateImagesResponse message or plain object to encode + * @param {google.cloud.vision.v1.IImageAnnotationContext} message ImageAnnotationContext message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchAnnotateImagesResponse.encodeDelimited = function encodeDelimited(message, writer) { + ImageAnnotationContext.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BatchAnnotateImagesResponse message from the specified reader or buffer. + * Decodes an ImageAnnotationContext message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1.ImageAnnotationContext * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse + * @returns {google.cloud.vision.v1.ImageAnnotationContext} ImageAnnotationContext * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchAnnotateImagesResponse.decode = function decode(reader, length) { + ImageAnnotationContext.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.vision.v1.BatchAnnotateImagesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.ImageAnnotationContext(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.responses && message.responses.length)) - message.responses = []; - message.responses.push($root.google.cloud.vision.v1.AnnotateImageResponse.decode(reader, reader.uint32())); + message.uri = reader.string(); + break; + case 2: + message.pageNumber = reader.int32(); break; default: reader.skipType(tag & 7); @@ -7430,129 +7261,135 @@ }; /** - * Decodes a BatchAnnotateImagesResponse message from the specified reader or buffer, length delimited. + * Decodes an ImageAnnotationContext message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1.ImageAnnotationContext * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse + * @returns {google.cloud.vision.v1.ImageAnnotationContext} ImageAnnotationContext * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchAnnotateImagesResponse.decodeDelimited = function decodeDelimited(reader) { + ImageAnnotationContext.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BatchAnnotateImagesResponse message. + * Verifies an ImageAnnotationContext message. * @function verify - * @memberof google.cloud.vision.v1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1.ImageAnnotationContext * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BatchAnnotateImagesResponse.verify = function verify(message) { + ImageAnnotationContext.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.responses != null && message.hasOwnProperty("responses")) { - if (!Array.isArray(message.responses)) - return "responses: array expected"; - for (var i = 0; i < message.responses.length; ++i) { - var error = $root.google.cloud.vision.v1.AnnotateImageResponse.verify(message.responses[i]); - if (error) - return "responses." + error; - } - } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + if (!$util.isInteger(message.pageNumber)) + return "pageNumber: integer expected"; return null; }; /** - * Creates a BatchAnnotateImagesResponse message from a plain object. Also converts values to their respective internal types. + * Creates an ImageAnnotationContext message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1.ImageAnnotationContext * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse + * @returns {google.cloud.vision.v1.ImageAnnotationContext} ImageAnnotationContext */ - BatchAnnotateImagesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.BatchAnnotateImagesResponse) + ImageAnnotationContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.ImageAnnotationContext) return object; - var message = new $root.google.cloud.vision.v1.BatchAnnotateImagesResponse(); - if (object.responses) { - if (!Array.isArray(object.responses)) - throw TypeError(".google.cloud.vision.v1.BatchAnnotateImagesResponse.responses: array expected"); - message.responses = []; - for (var i = 0; i < object.responses.length; ++i) { - if (typeof object.responses[i] !== "object") - throw TypeError(".google.cloud.vision.v1.BatchAnnotateImagesResponse.responses: object expected"); - message.responses[i] = $root.google.cloud.vision.v1.AnnotateImageResponse.fromObject(object.responses[i]); - } - } + var message = new $root.google.cloud.vision.v1.ImageAnnotationContext(); + if (object.uri != null) + message.uri = String(object.uri); + if (object.pageNumber != null) + message.pageNumber = object.pageNumber | 0; return message; }; /** - * Creates a plain object from a BatchAnnotateImagesResponse message. Also converts values to other types if specified. + * Creates a plain object from an ImageAnnotationContext message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1.ImageAnnotationContext * @static - * @param {google.cloud.vision.v1.BatchAnnotateImagesResponse} message BatchAnnotateImagesResponse + * @param {google.cloud.vision.v1.ImageAnnotationContext} message ImageAnnotationContext * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BatchAnnotateImagesResponse.toObject = function toObject(message, options) { + ImageAnnotationContext.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.responses = []; - if (message.responses && message.responses.length) { - object.responses = []; - for (var j = 0; j < message.responses.length; ++j) - object.responses[j] = $root.google.cloud.vision.v1.AnnotateImageResponse.toObject(message.responses[j], options); + if (options.defaults) { + object.uri = ""; + object.pageNumber = 0; } + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + object.pageNumber = message.pageNumber; return object; }; /** - * Converts this BatchAnnotateImagesResponse to JSON. + * Converts this ImageAnnotationContext to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1.ImageAnnotationContext * @instance * @returns {Object.} JSON object */ - BatchAnnotateImagesResponse.prototype.toJSON = function toJSON() { + ImageAnnotationContext.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BatchAnnotateImagesResponse; + return ImageAnnotationContext; })(); - v1.AnnotateFileRequest = (function() { + v1.AnnotateImageResponse = (function() { /** - * Properties of an AnnotateFileRequest. + * Properties of an AnnotateImageResponse. * @memberof google.cloud.vision.v1 - * @interface IAnnotateFileRequest - * @property {google.cloud.vision.v1.IInputConfig|null} [inputConfig] AnnotateFileRequest inputConfig - * @property {Array.|null} [features] AnnotateFileRequest features - * @property {google.cloud.vision.v1.IImageContext|null} [imageContext] AnnotateFileRequest imageContext - * @property {Array.|null} [pages] AnnotateFileRequest pages + * @interface IAnnotateImageResponse + * @property {Array.|null} [faceAnnotations] AnnotateImageResponse faceAnnotations + * @property {Array.|null} [landmarkAnnotations] AnnotateImageResponse landmarkAnnotations + * @property {Array.|null} [logoAnnotations] AnnotateImageResponse logoAnnotations + * @property {Array.|null} [labelAnnotations] AnnotateImageResponse labelAnnotations + * @property {Array.|null} [localizedObjectAnnotations] AnnotateImageResponse localizedObjectAnnotations + * @property {Array.|null} [textAnnotations] AnnotateImageResponse textAnnotations + * @property {google.cloud.vision.v1.ITextAnnotation|null} [fullTextAnnotation] AnnotateImageResponse fullTextAnnotation + * @property {google.cloud.vision.v1.ISafeSearchAnnotation|null} [safeSearchAnnotation] AnnotateImageResponse safeSearchAnnotation + * @property {google.cloud.vision.v1.IImageProperties|null} [imagePropertiesAnnotation] AnnotateImageResponse imagePropertiesAnnotation + * @property {google.cloud.vision.v1.ICropHintsAnnotation|null} [cropHintsAnnotation] AnnotateImageResponse cropHintsAnnotation + * @property {google.cloud.vision.v1.IWebDetection|null} [webDetection] AnnotateImageResponse webDetection + * @property {google.cloud.vision.v1.IProductSearchResults|null} [productSearchResults] AnnotateImageResponse productSearchResults + * @property {google.rpc.IStatus|null} [error] AnnotateImageResponse error + * @property {google.cloud.vision.v1.IImageAnnotationContext|null} [context] AnnotateImageResponse context */ /** - * Constructs a new AnnotateFileRequest. + * Constructs a new AnnotateImageResponse. * @memberof google.cloud.vision.v1 - * @classdesc Represents an AnnotateFileRequest. - * @implements IAnnotateFileRequest + * @classdesc Represents an AnnotateImageResponse. + * @implements IAnnotateImageResponse * @constructor - * @param {google.cloud.vision.v1.IAnnotateFileRequest=} [properties] Properties to set + * @param {google.cloud.vision.v1.IAnnotateImageResponse=} [properties] Properties to set */ - function AnnotateFileRequest(properties) { - this.features = []; - this.pages = []; + function AnnotateImageResponse(properties) { + this.faceAnnotations = []; + this.landmarkAnnotations = []; + this.logoAnnotations = []; + this.labelAnnotations = []; + this.localizedObjectAnnotations = []; + this.textAnnotations = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -7560,428 +7397,263 @@ } /** - * AnnotateFileRequest inputConfig. - * @member {google.cloud.vision.v1.IInputConfig|null|undefined} inputConfig - * @memberof google.cloud.vision.v1.AnnotateFileRequest + * AnnotateImageResponse faceAnnotations. + * @member {Array.} faceAnnotations + * @memberof google.cloud.vision.v1.AnnotateImageResponse * @instance */ - AnnotateFileRequest.prototype.inputConfig = null; + AnnotateImageResponse.prototype.faceAnnotations = $util.emptyArray; /** - * AnnotateFileRequest features. - * @member {Array.} features - * @memberof google.cloud.vision.v1.AnnotateFileRequest + * AnnotateImageResponse landmarkAnnotations. + * @member {Array.} landmarkAnnotations + * @memberof google.cloud.vision.v1.AnnotateImageResponse * @instance */ - AnnotateFileRequest.prototype.features = $util.emptyArray; + AnnotateImageResponse.prototype.landmarkAnnotations = $util.emptyArray; /** - * AnnotateFileRequest imageContext. - * @member {google.cloud.vision.v1.IImageContext|null|undefined} imageContext - * @memberof google.cloud.vision.v1.AnnotateFileRequest + * AnnotateImageResponse logoAnnotations. + * @member {Array.} logoAnnotations + * @memberof google.cloud.vision.v1.AnnotateImageResponse * @instance */ - AnnotateFileRequest.prototype.imageContext = null; + AnnotateImageResponse.prototype.logoAnnotations = $util.emptyArray; /** - * AnnotateFileRequest pages. - * @member {Array.} pages - * @memberof google.cloud.vision.v1.AnnotateFileRequest + * AnnotateImageResponse labelAnnotations. + * @member {Array.} labelAnnotations + * @memberof google.cloud.vision.v1.AnnotateImageResponse * @instance */ - AnnotateFileRequest.prototype.pages = $util.emptyArray; - - /** - * Creates a new AnnotateFileRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1.AnnotateFileRequest - * @static - * @param {google.cloud.vision.v1.IAnnotateFileRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.AnnotateFileRequest} AnnotateFileRequest instance - */ - AnnotateFileRequest.create = function create(properties) { - return new AnnotateFileRequest(properties); - }; - - /** - * Encodes the specified AnnotateFileRequest message. Does not implicitly {@link google.cloud.vision.v1.AnnotateFileRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1.AnnotateFileRequest - * @static - * @param {google.cloud.vision.v1.IAnnotateFileRequest} message AnnotateFileRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AnnotateFileRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - $root.google.cloud.vision.v1.InputConfig.encode(message.inputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.features != null && message.features.length) - for (var i = 0; i < message.features.length; ++i) - $root.google.cloud.vision.v1.Feature.encode(message.features[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.imageContext != null && message.hasOwnProperty("imageContext")) - $root.google.cloud.vision.v1.ImageContext.encode(message.imageContext, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.pages != null && message.pages.length) { - writer.uint32(/* id 4, wireType 2 =*/34).fork(); - for (var i = 0; i < message.pages.length; ++i) - writer.int32(message.pages[i]); - writer.ldelim(); - } - return writer; - }; - - /** - * Encodes the specified AnnotateFileRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.AnnotateFileRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1.AnnotateFileRequest - * @static - * @param {google.cloud.vision.v1.IAnnotateFileRequest} message AnnotateFileRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AnnotateFileRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AnnotateFileRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1.AnnotateFileRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.AnnotateFileRequest} AnnotateFileRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AnnotateFileRequest.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.vision.v1.AnnotateFileRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.inputConfig = $root.google.cloud.vision.v1.InputConfig.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.features && message.features.length)) - message.features = []; - message.features.push($root.google.cloud.vision.v1.Feature.decode(reader, reader.uint32())); - break; - case 3: - message.imageContext = $root.google.cloud.vision.v1.ImageContext.decode(reader, reader.uint32()); - break; - case 4: - if (!(message.pages && message.pages.length)) - message.pages = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.pages.push(reader.int32()); - } else - message.pages.push(reader.int32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AnnotateFileRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1.AnnotateFileRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.AnnotateFileRequest} AnnotateFileRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AnnotateFileRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + AnnotateImageResponse.prototype.labelAnnotations = $util.emptyArray; /** - * Verifies an AnnotateFileRequest message. - * @function verify - * @memberof google.cloud.vision.v1.AnnotateFileRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not + * AnnotateImageResponse localizedObjectAnnotations. + * @member {Array.} localizedObjectAnnotations + * @memberof google.cloud.vision.v1.AnnotateImageResponse + * @instance */ - AnnotateFileRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.vision.v1.InputConfig.verify(message.inputConfig); - if (error) - return "inputConfig." + error; - } - if (message.features != null && message.hasOwnProperty("features")) { - if (!Array.isArray(message.features)) - return "features: array expected"; - for (var i = 0; i < message.features.length; ++i) { - var error = $root.google.cloud.vision.v1.Feature.verify(message.features[i]); - if (error) - return "features." + error; - } - } - if (message.imageContext != null && message.hasOwnProperty("imageContext")) { - var error = $root.google.cloud.vision.v1.ImageContext.verify(message.imageContext); - if (error) - return "imageContext." + error; - } - if (message.pages != null && message.hasOwnProperty("pages")) { - if (!Array.isArray(message.pages)) - return "pages: array expected"; - for (var i = 0; i < message.pages.length; ++i) - if (!$util.isInteger(message.pages[i])) - return "pages: integer[] expected"; - } - return null; - }; + AnnotateImageResponse.prototype.localizedObjectAnnotations = $util.emptyArray; /** - * Creates an AnnotateFileRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1.AnnotateFileRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.AnnotateFileRequest} AnnotateFileRequest + * AnnotateImageResponse textAnnotations. + * @member {Array.} textAnnotations + * @memberof google.cloud.vision.v1.AnnotateImageResponse + * @instance */ - AnnotateFileRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.AnnotateFileRequest) - return object; - var message = new $root.google.cloud.vision.v1.AnnotateFileRequest(); - if (object.inputConfig != null) { - if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.vision.v1.AnnotateFileRequest.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.vision.v1.InputConfig.fromObject(object.inputConfig); - } - if (object.features) { - if (!Array.isArray(object.features)) - throw TypeError(".google.cloud.vision.v1.AnnotateFileRequest.features: array expected"); - message.features = []; - for (var i = 0; i < object.features.length; ++i) { - if (typeof object.features[i] !== "object") - throw TypeError(".google.cloud.vision.v1.AnnotateFileRequest.features: object expected"); - message.features[i] = $root.google.cloud.vision.v1.Feature.fromObject(object.features[i]); - } - } - if (object.imageContext != null) { - if (typeof object.imageContext !== "object") - throw TypeError(".google.cloud.vision.v1.AnnotateFileRequest.imageContext: object expected"); - message.imageContext = $root.google.cloud.vision.v1.ImageContext.fromObject(object.imageContext); - } - if (object.pages) { - if (!Array.isArray(object.pages)) - throw TypeError(".google.cloud.vision.v1.AnnotateFileRequest.pages: array expected"); - message.pages = []; - for (var i = 0; i < object.pages.length; ++i) - message.pages[i] = object.pages[i] | 0; - } - return message; - }; + AnnotateImageResponse.prototype.textAnnotations = $util.emptyArray; /** - * Creates a plain object from an AnnotateFileRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1.AnnotateFileRequest - * @static - * @param {google.cloud.vision.v1.AnnotateFileRequest} message AnnotateFileRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object + * AnnotateImageResponse fullTextAnnotation. + * @member {google.cloud.vision.v1.ITextAnnotation|null|undefined} fullTextAnnotation + * @memberof google.cloud.vision.v1.AnnotateImageResponse + * @instance */ - AnnotateFileRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.features = []; - object.pages = []; - } - if (options.defaults) { - object.inputConfig = null; - object.imageContext = null; - } - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - object.inputConfig = $root.google.cloud.vision.v1.InputConfig.toObject(message.inputConfig, options); - if (message.features && message.features.length) { - object.features = []; - for (var j = 0; j < message.features.length; ++j) - object.features[j] = $root.google.cloud.vision.v1.Feature.toObject(message.features[j], options); - } - if (message.imageContext != null && message.hasOwnProperty("imageContext")) - object.imageContext = $root.google.cloud.vision.v1.ImageContext.toObject(message.imageContext, options); - if (message.pages && message.pages.length) { - object.pages = []; - for (var j = 0; j < message.pages.length; ++j) - object.pages[j] = message.pages[j]; - } - return object; - }; + AnnotateImageResponse.prototype.fullTextAnnotation = null; /** - * Converts this AnnotateFileRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1.AnnotateFileRequest + * AnnotateImageResponse safeSearchAnnotation. + * @member {google.cloud.vision.v1.ISafeSearchAnnotation|null|undefined} safeSearchAnnotation + * @memberof google.cloud.vision.v1.AnnotateImageResponse * @instance - * @returns {Object.} JSON object */ - AnnotateFileRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return AnnotateFileRequest; - })(); - - v1.AnnotateFileResponse = (function() { + AnnotateImageResponse.prototype.safeSearchAnnotation = null; /** - * Properties of an AnnotateFileResponse. - * @memberof google.cloud.vision.v1 - * @interface IAnnotateFileResponse - * @property {google.cloud.vision.v1.IInputConfig|null} [inputConfig] AnnotateFileResponse inputConfig - * @property {Array.|null} [responses] AnnotateFileResponse responses - * @property {number|null} [totalPages] AnnotateFileResponse totalPages - * @property {google.rpc.IStatus|null} [error] AnnotateFileResponse error + * AnnotateImageResponse imagePropertiesAnnotation. + * @member {google.cloud.vision.v1.IImageProperties|null|undefined} imagePropertiesAnnotation + * @memberof google.cloud.vision.v1.AnnotateImageResponse + * @instance */ + AnnotateImageResponse.prototype.imagePropertiesAnnotation = null; /** - * Constructs a new AnnotateFileResponse. - * @memberof google.cloud.vision.v1 - * @classdesc Represents an AnnotateFileResponse. - * @implements IAnnotateFileResponse - * @constructor - * @param {google.cloud.vision.v1.IAnnotateFileResponse=} [properties] Properties to set + * AnnotateImageResponse cropHintsAnnotation. + * @member {google.cloud.vision.v1.ICropHintsAnnotation|null|undefined} cropHintsAnnotation + * @memberof google.cloud.vision.v1.AnnotateImageResponse + * @instance */ - function AnnotateFileResponse(properties) { - this.responses = []; - 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]]; - } + AnnotateImageResponse.prototype.cropHintsAnnotation = null; /** - * AnnotateFileResponse inputConfig. - * @member {google.cloud.vision.v1.IInputConfig|null|undefined} inputConfig - * @memberof google.cloud.vision.v1.AnnotateFileResponse + * AnnotateImageResponse webDetection. + * @member {google.cloud.vision.v1.IWebDetection|null|undefined} webDetection + * @memberof google.cloud.vision.v1.AnnotateImageResponse * @instance */ - AnnotateFileResponse.prototype.inputConfig = null; + AnnotateImageResponse.prototype.webDetection = null; /** - * AnnotateFileResponse responses. - * @member {Array.} responses - * @memberof google.cloud.vision.v1.AnnotateFileResponse + * AnnotateImageResponse productSearchResults. + * @member {google.cloud.vision.v1.IProductSearchResults|null|undefined} productSearchResults + * @memberof google.cloud.vision.v1.AnnotateImageResponse * @instance */ - AnnotateFileResponse.prototype.responses = $util.emptyArray; + AnnotateImageResponse.prototype.productSearchResults = null; /** - * AnnotateFileResponse totalPages. - * @member {number} totalPages - * @memberof google.cloud.vision.v1.AnnotateFileResponse + * AnnotateImageResponse error. + * @member {google.rpc.IStatus|null|undefined} error + * @memberof google.cloud.vision.v1.AnnotateImageResponse * @instance */ - AnnotateFileResponse.prototype.totalPages = 0; + AnnotateImageResponse.prototype.error = null; /** - * AnnotateFileResponse error. - * @member {google.rpc.IStatus|null|undefined} error - * @memberof google.cloud.vision.v1.AnnotateFileResponse + * AnnotateImageResponse context. + * @member {google.cloud.vision.v1.IImageAnnotationContext|null|undefined} context + * @memberof google.cloud.vision.v1.AnnotateImageResponse * @instance */ - AnnotateFileResponse.prototype.error = null; + AnnotateImageResponse.prototype.context = null; /** - * Creates a new AnnotateFileResponse instance using the specified properties. + * Creates a new AnnotateImageResponse instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.AnnotateFileResponse + * @memberof google.cloud.vision.v1.AnnotateImageResponse * @static - * @param {google.cloud.vision.v1.IAnnotateFileResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1.AnnotateFileResponse} AnnotateFileResponse instance + * @param {google.cloud.vision.v1.IAnnotateImageResponse=} [properties] Properties to set + * @returns {google.cloud.vision.v1.AnnotateImageResponse} AnnotateImageResponse instance */ - AnnotateFileResponse.create = function create(properties) { - return new AnnotateFileResponse(properties); + AnnotateImageResponse.create = function create(properties) { + return new AnnotateImageResponse(properties); }; /** - * Encodes the specified AnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1.AnnotateFileResponse.verify|verify} messages. + * Encodes the specified AnnotateImageResponse message. Does not implicitly {@link google.cloud.vision.v1.AnnotateImageResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.AnnotateFileResponse + * @memberof google.cloud.vision.v1.AnnotateImageResponse * @static - * @param {google.cloud.vision.v1.IAnnotateFileResponse} message AnnotateFileResponse message or plain object to encode + * @param {google.cloud.vision.v1.IAnnotateImageResponse} message AnnotateImageResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateFileResponse.encode = function encode(message, writer) { + AnnotateImageResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - $root.google.cloud.vision.v1.InputConfig.encode(message.inputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.responses != null && message.responses.length) - for (var i = 0; i < message.responses.length; ++i) - $root.google.cloud.vision.v1.AnnotateImageResponse.encode(message.responses[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.totalPages != null && message.hasOwnProperty("totalPages")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.totalPages); + if (message.faceAnnotations != null && message.faceAnnotations.length) + for (var i = 0; i < message.faceAnnotations.length; ++i) + $root.google.cloud.vision.v1.FaceAnnotation.encode(message.faceAnnotations[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.landmarkAnnotations != null && message.landmarkAnnotations.length) + for (var i = 0; i < message.landmarkAnnotations.length; ++i) + $root.google.cloud.vision.v1.EntityAnnotation.encode(message.landmarkAnnotations[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.logoAnnotations != null && message.logoAnnotations.length) + for (var i = 0; i < message.logoAnnotations.length; ++i) + $root.google.cloud.vision.v1.EntityAnnotation.encode(message.logoAnnotations[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.labelAnnotations != null && message.labelAnnotations.length) + for (var i = 0; i < message.labelAnnotations.length; ++i) + $root.google.cloud.vision.v1.EntityAnnotation.encode(message.labelAnnotations[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.textAnnotations != null && message.textAnnotations.length) + for (var i = 0; i < message.textAnnotations.length; ++i) + $root.google.cloud.vision.v1.EntityAnnotation.encode(message.textAnnotations[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.safeSearchAnnotation != null && message.hasOwnProperty("safeSearchAnnotation")) + $root.google.cloud.vision.v1.SafeSearchAnnotation.encode(message.safeSearchAnnotation, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.imagePropertiesAnnotation != null && message.hasOwnProperty("imagePropertiesAnnotation")) + $root.google.cloud.vision.v1.ImageProperties.encode(message.imagePropertiesAnnotation, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); if (message.error != null && message.hasOwnProperty("error")) - $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.cropHintsAnnotation != null && message.hasOwnProperty("cropHintsAnnotation")) + $root.google.cloud.vision.v1.CropHintsAnnotation.encode(message.cropHintsAnnotation, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.fullTextAnnotation != null && message.hasOwnProperty("fullTextAnnotation")) + $root.google.cloud.vision.v1.TextAnnotation.encode(message.fullTextAnnotation, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.webDetection != null && message.hasOwnProperty("webDetection")) + $root.google.cloud.vision.v1.WebDetection.encode(message.webDetection, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.productSearchResults != null && message.hasOwnProperty("productSearchResults")) + $root.google.cloud.vision.v1.ProductSearchResults.encode(message.productSearchResults, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.context != null && message.hasOwnProperty("context")) + $root.google.cloud.vision.v1.ImageAnnotationContext.encode(message.context, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.localizedObjectAnnotations != null && message.localizedObjectAnnotations.length) + for (var i = 0; i < message.localizedObjectAnnotations.length; ++i) + $root.google.cloud.vision.v1.LocalizedObjectAnnotation.encode(message.localizedObjectAnnotations[i], writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); return writer; }; /** - * Encodes the specified AnnotateFileResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.AnnotateFileResponse.verify|verify} messages. + * Encodes the specified AnnotateImageResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.AnnotateImageResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.AnnotateFileResponse + * @memberof google.cloud.vision.v1.AnnotateImageResponse * @static - * @param {google.cloud.vision.v1.IAnnotateFileResponse} message AnnotateFileResponse message or plain object to encode + * @param {google.cloud.vision.v1.IAnnotateImageResponse} message AnnotateImageResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateFileResponse.encodeDelimited = function encodeDelimited(message, writer) { + AnnotateImageResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AnnotateFileResponse message from the specified reader or buffer. + * Decodes an AnnotateImageResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.AnnotateFileResponse + * @memberof google.cloud.vision.v1.AnnotateImageResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.AnnotateFileResponse} AnnotateFileResponse + * @returns {google.cloud.vision.v1.AnnotateImageResponse} AnnotateImageResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateFileResponse.decode = function decode(reader, length) { + AnnotateImageResponse.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.vision.v1.AnnotateFileResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.AnnotateImageResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.inputConfig = $root.google.cloud.vision.v1.InputConfig.decode(reader, reader.uint32()); + if (!(message.faceAnnotations && message.faceAnnotations.length)) + message.faceAnnotations = []; + message.faceAnnotations.push($root.google.cloud.vision.v1.FaceAnnotation.decode(reader, reader.uint32())); break; case 2: - if (!(message.responses && message.responses.length)) - message.responses = []; - message.responses.push($root.google.cloud.vision.v1.AnnotateImageResponse.decode(reader, reader.uint32())); + if (!(message.landmarkAnnotations && message.landmarkAnnotations.length)) + message.landmarkAnnotations = []; + message.landmarkAnnotations.push($root.google.cloud.vision.v1.EntityAnnotation.decode(reader, reader.uint32())); break; case 3: - message.totalPages = reader.int32(); + if (!(message.logoAnnotations && message.logoAnnotations.length)) + message.logoAnnotations = []; + message.logoAnnotations.push($root.google.cloud.vision.v1.EntityAnnotation.decode(reader, reader.uint32())); break; case 4: + if (!(message.labelAnnotations && message.labelAnnotations.length)) + message.labelAnnotations = []; + message.labelAnnotations.push($root.google.cloud.vision.v1.EntityAnnotation.decode(reader, reader.uint32())); + break; + case 22: + if (!(message.localizedObjectAnnotations && message.localizedObjectAnnotations.length)) + message.localizedObjectAnnotations = []; + message.localizedObjectAnnotations.push($root.google.cloud.vision.v1.LocalizedObjectAnnotation.decode(reader, reader.uint32())); + break; + case 5: + if (!(message.textAnnotations && message.textAnnotations.length)) + message.textAnnotations = []; + message.textAnnotations.push($root.google.cloud.vision.v1.EntityAnnotation.decode(reader, reader.uint32())); + break; + case 12: + message.fullTextAnnotation = $root.google.cloud.vision.v1.TextAnnotation.decode(reader, reader.uint32()); + break; + case 6: + message.safeSearchAnnotation = $root.google.cloud.vision.v1.SafeSearchAnnotation.decode(reader, reader.uint32()); + break; + case 8: + message.imagePropertiesAnnotation = $root.google.cloud.vision.v1.ImageProperties.decode(reader, reader.uint32()); + break; + case 11: + message.cropHintsAnnotation = $root.google.cloud.vision.v1.CropHintsAnnotation.decode(reader, reader.uint32()); + break; + case 13: + message.webDetection = $root.google.cloud.vision.v1.WebDetection.decode(reader, reader.uint32()); + break; + case 14: + message.productSearchResults = $root.google.cloud.vision.v1.ProductSearchResults.decode(reader, reader.uint32()); + break; + case 9: message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); break; + case 21: + message.context = $root.google.cloud.vision.v1.ImageAnnotationContext.decode(reader, reader.uint32()); + break; default: reader.skipType(tag & 7); break; @@ -7991,161 +7663,357 @@ }; /** - * Decodes an AnnotateFileResponse message from the specified reader or buffer, length delimited. + * Decodes an AnnotateImageResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.AnnotateFileResponse + * @memberof google.cloud.vision.v1.AnnotateImageResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.AnnotateFileResponse} AnnotateFileResponse + * @returns {google.cloud.vision.v1.AnnotateImageResponse} AnnotateImageResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateFileResponse.decodeDelimited = function decodeDelimited(reader) { + AnnotateImageResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AnnotateFileResponse message. + * Verifies an AnnotateImageResponse message. * @function verify - * @memberof google.cloud.vision.v1.AnnotateFileResponse + * @memberof google.cloud.vision.v1.AnnotateImageResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AnnotateFileResponse.verify = function verify(message) { + AnnotateImageResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.vision.v1.InputConfig.verify(message.inputConfig); - if (error) - return "inputConfig." + error; - } - if (message.responses != null && message.hasOwnProperty("responses")) { - if (!Array.isArray(message.responses)) - return "responses: array expected"; - for (var i = 0; i < message.responses.length; ++i) { - var error = $root.google.cloud.vision.v1.AnnotateImageResponse.verify(message.responses[i]); + if (message.faceAnnotations != null && message.hasOwnProperty("faceAnnotations")) { + if (!Array.isArray(message.faceAnnotations)) + return "faceAnnotations: array expected"; + for (var i = 0; i < message.faceAnnotations.length; ++i) { + var error = $root.google.cloud.vision.v1.FaceAnnotation.verify(message.faceAnnotations[i]); if (error) - return "responses." + error; + return "faceAnnotations." + error; } } - if (message.totalPages != null && message.hasOwnProperty("totalPages")) - if (!$util.isInteger(message.totalPages)) - return "totalPages: integer expected"; - if (message.error != null && message.hasOwnProperty("error")) { - var error = $root.google.rpc.Status.verify(message.error); - if (error) - return "error." + error; + if (message.landmarkAnnotations != null && message.hasOwnProperty("landmarkAnnotations")) { + if (!Array.isArray(message.landmarkAnnotations)) + return "landmarkAnnotations: array expected"; + for (var i = 0; i < message.landmarkAnnotations.length; ++i) { + var error = $root.google.cloud.vision.v1.EntityAnnotation.verify(message.landmarkAnnotations[i]); + if (error) + return "landmarkAnnotations." + error; + } } - return null; - }; - - /** - * Creates an AnnotateFileResponse message from a plain object. Also converts values to their respective internal types. + if (message.logoAnnotations != null && message.hasOwnProperty("logoAnnotations")) { + if (!Array.isArray(message.logoAnnotations)) + return "logoAnnotations: array expected"; + for (var i = 0; i < message.logoAnnotations.length; ++i) { + var error = $root.google.cloud.vision.v1.EntityAnnotation.verify(message.logoAnnotations[i]); + if (error) + return "logoAnnotations." + error; + } + } + if (message.labelAnnotations != null && message.hasOwnProperty("labelAnnotations")) { + if (!Array.isArray(message.labelAnnotations)) + return "labelAnnotations: array expected"; + for (var i = 0; i < message.labelAnnotations.length; ++i) { + var error = $root.google.cloud.vision.v1.EntityAnnotation.verify(message.labelAnnotations[i]); + if (error) + return "labelAnnotations." + error; + } + } + if (message.localizedObjectAnnotations != null && message.hasOwnProperty("localizedObjectAnnotations")) { + if (!Array.isArray(message.localizedObjectAnnotations)) + return "localizedObjectAnnotations: array expected"; + for (var i = 0; i < message.localizedObjectAnnotations.length; ++i) { + var error = $root.google.cloud.vision.v1.LocalizedObjectAnnotation.verify(message.localizedObjectAnnotations[i]); + if (error) + return "localizedObjectAnnotations." + error; + } + } + if (message.textAnnotations != null && message.hasOwnProperty("textAnnotations")) { + if (!Array.isArray(message.textAnnotations)) + return "textAnnotations: array expected"; + for (var i = 0; i < message.textAnnotations.length; ++i) { + var error = $root.google.cloud.vision.v1.EntityAnnotation.verify(message.textAnnotations[i]); + if (error) + return "textAnnotations." + error; + } + } + if (message.fullTextAnnotation != null && message.hasOwnProperty("fullTextAnnotation")) { + var error = $root.google.cloud.vision.v1.TextAnnotation.verify(message.fullTextAnnotation); + if (error) + return "fullTextAnnotation." + error; + } + if (message.safeSearchAnnotation != null && message.hasOwnProperty("safeSearchAnnotation")) { + var error = $root.google.cloud.vision.v1.SafeSearchAnnotation.verify(message.safeSearchAnnotation); + if (error) + return "safeSearchAnnotation." + error; + } + if (message.imagePropertiesAnnotation != null && message.hasOwnProperty("imagePropertiesAnnotation")) { + var error = $root.google.cloud.vision.v1.ImageProperties.verify(message.imagePropertiesAnnotation); + if (error) + return "imagePropertiesAnnotation." + error; + } + if (message.cropHintsAnnotation != null && message.hasOwnProperty("cropHintsAnnotation")) { + var error = $root.google.cloud.vision.v1.CropHintsAnnotation.verify(message.cropHintsAnnotation); + if (error) + return "cropHintsAnnotation." + error; + } + if (message.webDetection != null && message.hasOwnProperty("webDetection")) { + var error = $root.google.cloud.vision.v1.WebDetection.verify(message.webDetection); + if (error) + return "webDetection." + error; + } + if (message.productSearchResults != null && message.hasOwnProperty("productSearchResults")) { + var error = $root.google.cloud.vision.v1.ProductSearchResults.verify(message.productSearchResults); + if (error) + return "productSearchResults." + error; + } + if (message.error != null && message.hasOwnProperty("error")) { + var error = $root.google.rpc.Status.verify(message.error); + if (error) + return "error." + error; + } + if (message.context != null && message.hasOwnProperty("context")) { + var error = $root.google.cloud.vision.v1.ImageAnnotationContext.verify(message.context); + if (error) + return "context." + error; + } + return null; + }; + + /** + * Creates an AnnotateImageResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.AnnotateFileResponse + * @memberof google.cloud.vision.v1.AnnotateImageResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.AnnotateFileResponse} AnnotateFileResponse + * @returns {google.cloud.vision.v1.AnnotateImageResponse} AnnotateImageResponse */ - AnnotateFileResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.AnnotateFileResponse) + AnnotateImageResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.AnnotateImageResponse) return object; - var message = new $root.google.cloud.vision.v1.AnnotateFileResponse(); - if (object.inputConfig != null) { - if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.vision.v1.AnnotateFileResponse.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.vision.v1.InputConfig.fromObject(object.inputConfig); + var message = new $root.google.cloud.vision.v1.AnnotateImageResponse(); + if (object.faceAnnotations) { + if (!Array.isArray(object.faceAnnotations)) + throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.faceAnnotations: array expected"); + message.faceAnnotations = []; + for (var i = 0; i < object.faceAnnotations.length; ++i) { + if (typeof object.faceAnnotations[i] !== "object") + throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.faceAnnotations: object expected"); + message.faceAnnotations[i] = $root.google.cloud.vision.v1.FaceAnnotation.fromObject(object.faceAnnotations[i]); + } } - if (object.responses) { - if (!Array.isArray(object.responses)) - throw TypeError(".google.cloud.vision.v1.AnnotateFileResponse.responses: array expected"); - message.responses = []; - for (var i = 0; i < object.responses.length; ++i) { - if (typeof object.responses[i] !== "object") - throw TypeError(".google.cloud.vision.v1.AnnotateFileResponse.responses: object expected"); - message.responses[i] = $root.google.cloud.vision.v1.AnnotateImageResponse.fromObject(object.responses[i]); + if (object.landmarkAnnotations) { + if (!Array.isArray(object.landmarkAnnotations)) + throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.landmarkAnnotations: array expected"); + message.landmarkAnnotations = []; + for (var i = 0; i < object.landmarkAnnotations.length; ++i) { + if (typeof object.landmarkAnnotations[i] !== "object") + throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.landmarkAnnotations: object expected"); + message.landmarkAnnotations[i] = $root.google.cloud.vision.v1.EntityAnnotation.fromObject(object.landmarkAnnotations[i]); } } - if (object.totalPages != null) - message.totalPages = object.totalPages | 0; + if (object.logoAnnotations) { + if (!Array.isArray(object.logoAnnotations)) + throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.logoAnnotations: array expected"); + message.logoAnnotations = []; + for (var i = 0; i < object.logoAnnotations.length; ++i) { + if (typeof object.logoAnnotations[i] !== "object") + throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.logoAnnotations: object expected"); + message.logoAnnotations[i] = $root.google.cloud.vision.v1.EntityAnnotation.fromObject(object.logoAnnotations[i]); + } + } + if (object.labelAnnotations) { + if (!Array.isArray(object.labelAnnotations)) + throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.labelAnnotations: array expected"); + message.labelAnnotations = []; + for (var i = 0; i < object.labelAnnotations.length; ++i) { + if (typeof object.labelAnnotations[i] !== "object") + throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.labelAnnotations: object expected"); + message.labelAnnotations[i] = $root.google.cloud.vision.v1.EntityAnnotation.fromObject(object.labelAnnotations[i]); + } + } + if (object.localizedObjectAnnotations) { + if (!Array.isArray(object.localizedObjectAnnotations)) + throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.localizedObjectAnnotations: array expected"); + message.localizedObjectAnnotations = []; + for (var i = 0; i < object.localizedObjectAnnotations.length; ++i) { + if (typeof object.localizedObjectAnnotations[i] !== "object") + throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.localizedObjectAnnotations: object expected"); + message.localizedObjectAnnotations[i] = $root.google.cloud.vision.v1.LocalizedObjectAnnotation.fromObject(object.localizedObjectAnnotations[i]); + } + } + if (object.textAnnotations) { + if (!Array.isArray(object.textAnnotations)) + throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.textAnnotations: array expected"); + message.textAnnotations = []; + for (var i = 0; i < object.textAnnotations.length; ++i) { + if (typeof object.textAnnotations[i] !== "object") + throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.textAnnotations: object expected"); + message.textAnnotations[i] = $root.google.cloud.vision.v1.EntityAnnotation.fromObject(object.textAnnotations[i]); + } + } + if (object.fullTextAnnotation != null) { + if (typeof object.fullTextAnnotation !== "object") + throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.fullTextAnnotation: object expected"); + message.fullTextAnnotation = $root.google.cloud.vision.v1.TextAnnotation.fromObject(object.fullTextAnnotation); + } + if (object.safeSearchAnnotation != null) { + if (typeof object.safeSearchAnnotation !== "object") + throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.safeSearchAnnotation: object expected"); + message.safeSearchAnnotation = $root.google.cloud.vision.v1.SafeSearchAnnotation.fromObject(object.safeSearchAnnotation); + } + if (object.imagePropertiesAnnotation != null) { + if (typeof object.imagePropertiesAnnotation !== "object") + throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.imagePropertiesAnnotation: object expected"); + message.imagePropertiesAnnotation = $root.google.cloud.vision.v1.ImageProperties.fromObject(object.imagePropertiesAnnotation); + } + if (object.cropHintsAnnotation != null) { + if (typeof object.cropHintsAnnotation !== "object") + throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.cropHintsAnnotation: object expected"); + message.cropHintsAnnotation = $root.google.cloud.vision.v1.CropHintsAnnotation.fromObject(object.cropHintsAnnotation); + } + if (object.webDetection != null) { + if (typeof object.webDetection !== "object") + throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.webDetection: object expected"); + message.webDetection = $root.google.cloud.vision.v1.WebDetection.fromObject(object.webDetection); + } + if (object.productSearchResults != null) { + if (typeof object.productSearchResults !== "object") + throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.productSearchResults: object expected"); + message.productSearchResults = $root.google.cloud.vision.v1.ProductSearchResults.fromObject(object.productSearchResults); + } if (object.error != null) { if (typeof object.error !== "object") - throw TypeError(".google.cloud.vision.v1.AnnotateFileResponse.error: object expected"); + throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.error: object expected"); message.error = $root.google.rpc.Status.fromObject(object.error); } + if (object.context != null) { + if (typeof object.context !== "object") + throw TypeError(".google.cloud.vision.v1.AnnotateImageResponse.context: object expected"); + message.context = $root.google.cloud.vision.v1.ImageAnnotationContext.fromObject(object.context); + } return message; }; /** - * Creates a plain object from an AnnotateFileResponse message. Also converts values to other types if specified. + * Creates a plain object from an AnnotateImageResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.AnnotateFileResponse + * @memberof google.cloud.vision.v1.AnnotateImageResponse * @static - * @param {google.cloud.vision.v1.AnnotateFileResponse} message AnnotateFileResponse + * @param {google.cloud.vision.v1.AnnotateImageResponse} message AnnotateImageResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AnnotateFileResponse.toObject = function toObject(message, options) { + AnnotateImageResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.responses = []; + if (options.arrays || options.defaults) { + object.faceAnnotations = []; + object.landmarkAnnotations = []; + object.logoAnnotations = []; + object.labelAnnotations = []; + object.textAnnotations = []; + object.localizedObjectAnnotations = []; + } if (options.defaults) { - object.inputConfig = null; - object.totalPages = 0; + object.safeSearchAnnotation = null; + object.imagePropertiesAnnotation = null; object.error = null; + object.cropHintsAnnotation = null; + object.fullTextAnnotation = null; + object.webDetection = null; + object.productSearchResults = null; + object.context = null; } - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - object.inputConfig = $root.google.cloud.vision.v1.InputConfig.toObject(message.inputConfig, options); - if (message.responses && message.responses.length) { - object.responses = []; - for (var j = 0; j < message.responses.length; ++j) - object.responses[j] = $root.google.cloud.vision.v1.AnnotateImageResponse.toObject(message.responses[j], options); + if (message.faceAnnotations && message.faceAnnotations.length) { + object.faceAnnotations = []; + for (var j = 0; j < message.faceAnnotations.length; ++j) + object.faceAnnotations[j] = $root.google.cloud.vision.v1.FaceAnnotation.toObject(message.faceAnnotations[j], options); } - if (message.totalPages != null && message.hasOwnProperty("totalPages")) - object.totalPages = message.totalPages; + if (message.landmarkAnnotations && message.landmarkAnnotations.length) { + object.landmarkAnnotations = []; + for (var j = 0; j < message.landmarkAnnotations.length; ++j) + object.landmarkAnnotations[j] = $root.google.cloud.vision.v1.EntityAnnotation.toObject(message.landmarkAnnotations[j], options); + } + if (message.logoAnnotations && message.logoAnnotations.length) { + object.logoAnnotations = []; + for (var j = 0; j < message.logoAnnotations.length; ++j) + object.logoAnnotations[j] = $root.google.cloud.vision.v1.EntityAnnotation.toObject(message.logoAnnotations[j], options); + } + if (message.labelAnnotations && message.labelAnnotations.length) { + object.labelAnnotations = []; + for (var j = 0; j < message.labelAnnotations.length; ++j) + object.labelAnnotations[j] = $root.google.cloud.vision.v1.EntityAnnotation.toObject(message.labelAnnotations[j], options); + } + if (message.textAnnotations && message.textAnnotations.length) { + object.textAnnotations = []; + for (var j = 0; j < message.textAnnotations.length; ++j) + object.textAnnotations[j] = $root.google.cloud.vision.v1.EntityAnnotation.toObject(message.textAnnotations[j], options); + } + if (message.safeSearchAnnotation != null && message.hasOwnProperty("safeSearchAnnotation")) + object.safeSearchAnnotation = $root.google.cloud.vision.v1.SafeSearchAnnotation.toObject(message.safeSearchAnnotation, options); + if (message.imagePropertiesAnnotation != null && message.hasOwnProperty("imagePropertiesAnnotation")) + object.imagePropertiesAnnotation = $root.google.cloud.vision.v1.ImageProperties.toObject(message.imagePropertiesAnnotation, options); if (message.error != null && message.hasOwnProperty("error")) object.error = $root.google.rpc.Status.toObject(message.error, options); + if (message.cropHintsAnnotation != null && message.hasOwnProperty("cropHintsAnnotation")) + object.cropHintsAnnotation = $root.google.cloud.vision.v1.CropHintsAnnotation.toObject(message.cropHintsAnnotation, options); + if (message.fullTextAnnotation != null && message.hasOwnProperty("fullTextAnnotation")) + object.fullTextAnnotation = $root.google.cloud.vision.v1.TextAnnotation.toObject(message.fullTextAnnotation, options); + if (message.webDetection != null && message.hasOwnProperty("webDetection")) + object.webDetection = $root.google.cloud.vision.v1.WebDetection.toObject(message.webDetection, options); + if (message.productSearchResults != null && message.hasOwnProperty("productSearchResults")) + object.productSearchResults = $root.google.cloud.vision.v1.ProductSearchResults.toObject(message.productSearchResults, options); + if (message.context != null && message.hasOwnProperty("context")) + object.context = $root.google.cloud.vision.v1.ImageAnnotationContext.toObject(message.context, options); + if (message.localizedObjectAnnotations && message.localizedObjectAnnotations.length) { + object.localizedObjectAnnotations = []; + for (var j = 0; j < message.localizedObjectAnnotations.length; ++j) + object.localizedObjectAnnotations[j] = $root.google.cloud.vision.v1.LocalizedObjectAnnotation.toObject(message.localizedObjectAnnotations[j], options); + } return object; }; /** - * Converts this AnnotateFileResponse to JSON. + * Converts this AnnotateImageResponse to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.AnnotateFileResponse + * @memberof google.cloud.vision.v1.AnnotateImageResponse * @instance * @returns {Object.} JSON object */ - AnnotateFileResponse.prototype.toJSON = function toJSON() { + AnnotateImageResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AnnotateFileResponse; + return AnnotateImageResponse; })(); - v1.BatchAnnotateFilesRequest = (function() { + v1.BatchAnnotateImagesRequest = (function() { /** - * Properties of a BatchAnnotateFilesRequest. + * Properties of a BatchAnnotateImagesRequest. * @memberof google.cloud.vision.v1 - * @interface IBatchAnnotateFilesRequest - * @property {Array.|null} [requests] BatchAnnotateFilesRequest requests - * @property {string|null} [parent] BatchAnnotateFilesRequest parent + * @interface IBatchAnnotateImagesRequest + * @property {Array.|null} [requests] BatchAnnotateImagesRequest requests + * @property {string|null} [parent] BatchAnnotateImagesRequest parent */ /** - * Constructs a new BatchAnnotateFilesRequest. + * Constructs a new BatchAnnotateImagesRequest. * @memberof google.cloud.vision.v1 - * @classdesc Represents a BatchAnnotateFilesRequest. - * @implements IBatchAnnotateFilesRequest + * @classdesc Represents a BatchAnnotateImagesRequest. + * @implements IBatchAnnotateImagesRequest * @constructor - * @param {google.cloud.vision.v1.IBatchAnnotateFilesRequest=} [properties] Properties to set + * @param {google.cloud.vision.v1.IBatchAnnotateImagesRequest=} [properties] Properties to set */ - function BatchAnnotateFilesRequest(properties) { + function BatchAnnotateImagesRequest(properties) { this.requests = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) @@ -8154,90 +8022,90 @@ } /** - * BatchAnnotateFilesRequest requests. - * @member {Array.} requests - * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest + * BatchAnnotateImagesRequest requests. + * @member {Array.} requests + * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest * @instance */ - BatchAnnotateFilesRequest.prototype.requests = $util.emptyArray; + BatchAnnotateImagesRequest.prototype.requests = $util.emptyArray; /** - * BatchAnnotateFilesRequest parent. + * BatchAnnotateImagesRequest parent. * @member {string} parent - * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest * @instance */ - BatchAnnotateFilesRequest.prototype.parent = ""; + BatchAnnotateImagesRequest.prototype.parent = ""; /** - * Creates a new BatchAnnotateFilesRequest instance using the specified properties. + * Creates a new BatchAnnotateImagesRequest instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest * @static - * @param {google.cloud.vision.v1.IBatchAnnotateFilesRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.BatchAnnotateFilesRequest} BatchAnnotateFilesRequest instance + * @param {google.cloud.vision.v1.IBatchAnnotateImagesRequest=} [properties] Properties to set + * @returns {google.cloud.vision.v1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest instance */ - BatchAnnotateFilesRequest.create = function create(properties) { - return new BatchAnnotateFilesRequest(properties); + BatchAnnotateImagesRequest.create = function create(properties) { + return new BatchAnnotateImagesRequest(properties); }; /** - * Encodes the specified BatchAnnotateFilesRequest message. Does not implicitly {@link google.cloud.vision.v1.BatchAnnotateFilesRequest.verify|verify} messages. + * Encodes the specified BatchAnnotateImagesRequest message. Does not implicitly {@link google.cloud.vision.v1.BatchAnnotateImagesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest * @static - * @param {google.cloud.vision.v1.IBatchAnnotateFilesRequest} message BatchAnnotateFilesRequest message or plain object to encode + * @param {google.cloud.vision.v1.IBatchAnnotateImagesRequest} message BatchAnnotateImagesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchAnnotateFilesRequest.encode = function encode(message, writer) { + BatchAnnotateImagesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.requests != null && message.requests.length) for (var i = 0; i < message.requests.length; ++i) - $root.google.cloud.vision.v1.AnnotateFileRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.cloud.vision.v1.AnnotateImageRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.parent != null && message.hasOwnProperty("parent")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.parent); + writer.uint32(/* id 4, wireType 2 =*/34).string(message.parent); return writer; }; /** - * Encodes the specified BatchAnnotateFilesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.BatchAnnotateFilesRequest.verify|verify} messages. + * Encodes the specified BatchAnnotateImagesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.BatchAnnotateImagesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest * @static - * @param {google.cloud.vision.v1.IBatchAnnotateFilesRequest} message BatchAnnotateFilesRequest message or plain object to encode + * @param {google.cloud.vision.v1.IBatchAnnotateImagesRequest} message BatchAnnotateImagesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchAnnotateFilesRequest.encodeDelimited = function encodeDelimited(message, writer) { + BatchAnnotateImagesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BatchAnnotateFilesRequest message from the specified reader or buffer. + * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.BatchAnnotateFilesRequest} BatchAnnotateFilesRequest + * @returns {google.cloud.vision.v1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchAnnotateFilesRequest.decode = function decode(reader, length) { + BatchAnnotateImagesRequest.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.vision.v1.BatchAnnotateFilesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.BatchAnnotateImagesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: if (!(message.requests && message.requests.length)) message.requests = []; - message.requests.push($root.google.cloud.vision.v1.AnnotateFileRequest.decode(reader, reader.uint32())); + message.requests.push($root.google.cloud.vision.v1.AnnotateImageRequest.decode(reader, reader.uint32())); break; - case 3: + case 4: message.parent = reader.string(); break; default: @@ -8249,37 +8117,37 @@ }; /** - * Decodes a BatchAnnotateFilesRequest message from the specified reader or buffer, length delimited. + * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.BatchAnnotateFilesRequest} BatchAnnotateFilesRequest + * @returns {google.cloud.vision.v1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchAnnotateFilesRequest.decodeDelimited = function decodeDelimited(reader) { + BatchAnnotateImagesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BatchAnnotateFilesRequest message. + * Verifies a BatchAnnotateImagesRequest message. * @function verify - * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BatchAnnotateFilesRequest.verify = function verify(message) { + BatchAnnotateImagesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.requests != null && message.hasOwnProperty("requests")) { if (!Array.isArray(message.requests)) return "requests: array expected"; for (var i = 0; i < message.requests.length; ++i) { - var error = $root.google.cloud.vision.v1.AnnotateFileRequest.verify(message.requests[i]); + var error = $root.google.cloud.vision.v1.AnnotateImageRequest.verify(message.requests[i]); if (error) return "requests." + error; } @@ -8291,25 +8159,25 @@ }; /** - * Creates a BatchAnnotateFilesRequest message from a plain object. Also converts values to their respective internal types. + * Creates a BatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.BatchAnnotateFilesRequest} BatchAnnotateFilesRequest + * @returns {google.cloud.vision.v1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest */ - BatchAnnotateFilesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.BatchAnnotateFilesRequest) + BatchAnnotateImagesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.BatchAnnotateImagesRequest) return object; - var message = new $root.google.cloud.vision.v1.BatchAnnotateFilesRequest(); + var message = new $root.google.cloud.vision.v1.BatchAnnotateImagesRequest(); if (object.requests) { if (!Array.isArray(object.requests)) - throw TypeError(".google.cloud.vision.v1.BatchAnnotateFilesRequest.requests: array expected"); + throw TypeError(".google.cloud.vision.v1.BatchAnnotateImagesRequest.requests: array expected"); message.requests = []; for (var i = 0; i < object.requests.length; ++i) { if (typeof object.requests[i] !== "object") - throw TypeError(".google.cloud.vision.v1.BatchAnnotateFilesRequest.requests: object expected"); - message.requests[i] = $root.google.cloud.vision.v1.AnnotateFileRequest.fromObject(object.requests[i]); + throw TypeError(".google.cloud.vision.v1.BatchAnnotateImagesRequest.requests: object expected"); + message.requests[i] = $root.google.cloud.vision.v1.AnnotateImageRequest.fromObject(object.requests[i]); } } if (object.parent != null) @@ -8318,15 +8186,15 @@ }; /** - * Creates a plain object from a BatchAnnotateFilesRequest message. Also converts values to other types if specified. + * Creates a plain object from a BatchAnnotateImagesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest * @static - * @param {google.cloud.vision.v1.BatchAnnotateFilesRequest} message BatchAnnotateFilesRequest + * @param {google.cloud.vision.v1.BatchAnnotateImagesRequest} message BatchAnnotateImagesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BatchAnnotateFilesRequest.toObject = function toObject(message, options) { + BatchAnnotateImagesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; @@ -8337,7 +8205,7 @@ if (message.requests && message.requests.length) { object.requests = []; for (var j = 0; j < message.requests.length; ++j) - object.requests[j] = $root.google.cloud.vision.v1.AnnotateFileRequest.toObject(message.requests[j], options); + object.requests[j] = $root.google.cloud.vision.v1.AnnotateImageRequest.toObject(message.requests[j], options); } if (message.parent != null && message.hasOwnProperty("parent")) object.parent = message.parent; @@ -8345,37 +8213,37 @@ }; /** - * Converts this BatchAnnotateFilesRequest to JSON. + * Converts this BatchAnnotateImagesRequest to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1.BatchAnnotateImagesRequest * @instance * @returns {Object.} JSON object */ - BatchAnnotateFilesRequest.prototype.toJSON = function toJSON() { + BatchAnnotateImagesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BatchAnnotateFilesRequest; + return BatchAnnotateImagesRequest; })(); - v1.BatchAnnotateFilesResponse = (function() { + v1.BatchAnnotateImagesResponse = (function() { /** - * Properties of a BatchAnnotateFilesResponse. + * Properties of a BatchAnnotateImagesResponse. * @memberof google.cloud.vision.v1 - * @interface IBatchAnnotateFilesResponse - * @property {Array.|null} [responses] BatchAnnotateFilesResponse responses + * @interface IBatchAnnotateImagesResponse + * @property {Array.|null} [responses] BatchAnnotateImagesResponse responses */ /** - * Constructs a new BatchAnnotateFilesResponse. + * Constructs a new BatchAnnotateImagesResponse. * @memberof google.cloud.vision.v1 - * @classdesc Represents a BatchAnnotateFilesResponse. - * @implements IBatchAnnotateFilesResponse + * @classdesc Represents a BatchAnnotateImagesResponse. + * @implements IBatchAnnotateImagesResponse * @constructor - * @param {google.cloud.vision.v1.IBatchAnnotateFilesResponse=} [properties] Properties to set + * @param {google.cloud.vision.v1.IBatchAnnotateImagesResponse=} [properties] Properties to set */ - function BatchAnnotateFilesResponse(properties) { + function BatchAnnotateImagesResponse(properties) { this.responses = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) @@ -8384,78 +8252,78 @@ } /** - * BatchAnnotateFilesResponse responses. - * @member {Array.} responses - * @memberof google.cloud.vision.v1.BatchAnnotateFilesResponse + * BatchAnnotateImagesResponse responses. + * @member {Array.} responses + * @memberof google.cloud.vision.v1.BatchAnnotateImagesResponse * @instance */ - BatchAnnotateFilesResponse.prototype.responses = $util.emptyArray; + BatchAnnotateImagesResponse.prototype.responses = $util.emptyArray; /** - * Creates a new BatchAnnotateFilesResponse instance using the specified properties. + * Creates a new BatchAnnotateImagesResponse instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.BatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1.BatchAnnotateImagesResponse * @static - * @param {google.cloud.vision.v1.IBatchAnnotateFilesResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1.BatchAnnotateFilesResponse} BatchAnnotateFilesResponse instance + * @param {google.cloud.vision.v1.IBatchAnnotateImagesResponse=} [properties] Properties to set + * @returns {google.cloud.vision.v1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse instance */ - BatchAnnotateFilesResponse.create = function create(properties) { - return new BatchAnnotateFilesResponse(properties); + BatchAnnotateImagesResponse.create = function create(properties) { + return new BatchAnnotateImagesResponse(properties); }; /** - * Encodes the specified BatchAnnotateFilesResponse message. Does not implicitly {@link google.cloud.vision.v1.BatchAnnotateFilesResponse.verify|verify} messages. + * Encodes the specified BatchAnnotateImagesResponse message. Does not implicitly {@link google.cloud.vision.v1.BatchAnnotateImagesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.BatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1.BatchAnnotateImagesResponse * @static - * @param {google.cloud.vision.v1.IBatchAnnotateFilesResponse} message BatchAnnotateFilesResponse message or plain object to encode + * @param {google.cloud.vision.v1.IBatchAnnotateImagesResponse} message BatchAnnotateImagesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchAnnotateFilesResponse.encode = function encode(message, writer) { + BatchAnnotateImagesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.responses != null && message.responses.length) for (var i = 0; i < message.responses.length; ++i) - $root.google.cloud.vision.v1.AnnotateFileResponse.encode(message.responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.cloud.vision.v1.AnnotateImageResponse.encode(message.responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified BatchAnnotateFilesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.BatchAnnotateFilesResponse.verify|verify} messages. + * Encodes the specified BatchAnnotateImagesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.BatchAnnotateImagesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.BatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1.BatchAnnotateImagesResponse * @static - * @param {google.cloud.vision.v1.IBatchAnnotateFilesResponse} message BatchAnnotateFilesResponse message or plain object to encode + * @param {google.cloud.vision.v1.IBatchAnnotateImagesResponse} message BatchAnnotateImagesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchAnnotateFilesResponse.encodeDelimited = function encodeDelimited(message, writer) { + BatchAnnotateImagesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BatchAnnotateFilesResponse message from the specified reader or buffer. + * Decodes a BatchAnnotateImagesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.BatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1.BatchAnnotateImagesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.BatchAnnotateFilesResponse} BatchAnnotateFilesResponse + * @returns {google.cloud.vision.v1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchAnnotateFilesResponse.decode = function decode(reader, length) { + BatchAnnotateImagesResponse.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.vision.v1.BatchAnnotateFilesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.BatchAnnotateImagesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: if (!(message.responses && message.responses.length)) message.responses = []; - message.responses.push($root.google.cloud.vision.v1.AnnotateFileResponse.decode(reader, reader.uint32())); + message.responses.push($root.google.cloud.vision.v1.AnnotateImageResponse.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -8466,37 +8334,37 @@ }; /** - * Decodes a BatchAnnotateFilesResponse message from the specified reader or buffer, length delimited. + * Decodes a BatchAnnotateImagesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.BatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1.BatchAnnotateImagesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.BatchAnnotateFilesResponse} BatchAnnotateFilesResponse + * @returns {google.cloud.vision.v1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchAnnotateFilesResponse.decodeDelimited = function decodeDelimited(reader) { + BatchAnnotateImagesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BatchAnnotateFilesResponse message. + * Verifies a BatchAnnotateImagesResponse message. * @function verify - * @memberof google.cloud.vision.v1.BatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1.BatchAnnotateImagesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BatchAnnotateFilesResponse.verify = function verify(message) { + BatchAnnotateImagesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.responses != null && message.hasOwnProperty("responses")) { if (!Array.isArray(message.responses)) return "responses: array expected"; for (var i = 0; i < message.responses.length; ++i) { - var error = $root.google.cloud.vision.v1.AnnotateFileResponse.verify(message.responses[i]); + var error = $root.google.cloud.vision.v1.AnnotateImageResponse.verify(message.responses[i]); if (error) return "responses." + error; } @@ -8505,40 +8373,40 @@ }; /** - * Creates a BatchAnnotateFilesResponse message from a plain object. Also converts values to their respective internal types. + * Creates a BatchAnnotateImagesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.BatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1.BatchAnnotateImagesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.BatchAnnotateFilesResponse} BatchAnnotateFilesResponse + * @returns {google.cloud.vision.v1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse */ - BatchAnnotateFilesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.BatchAnnotateFilesResponse) + BatchAnnotateImagesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.BatchAnnotateImagesResponse) return object; - var message = new $root.google.cloud.vision.v1.BatchAnnotateFilesResponse(); + var message = new $root.google.cloud.vision.v1.BatchAnnotateImagesResponse(); if (object.responses) { if (!Array.isArray(object.responses)) - throw TypeError(".google.cloud.vision.v1.BatchAnnotateFilesResponse.responses: array expected"); + throw TypeError(".google.cloud.vision.v1.BatchAnnotateImagesResponse.responses: array expected"); message.responses = []; for (var i = 0; i < object.responses.length; ++i) { if (typeof object.responses[i] !== "object") - throw TypeError(".google.cloud.vision.v1.BatchAnnotateFilesResponse.responses: object expected"); - message.responses[i] = $root.google.cloud.vision.v1.AnnotateFileResponse.fromObject(object.responses[i]); + throw TypeError(".google.cloud.vision.v1.BatchAnnotateImagesResponse.responses: object expected"); + message.responses[i] = $root.google.cloud.vision.v1.AnnotateImageResponse.fromObject(object.responses[i]); } } return message; }; /** - * Creates a plain object from a BatchAnnotateFilesResponse message. Also converts values to other types if specified. + * Creates a plain object from a BatchAnnotateImagesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.BatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1.BatchAnnotateImagesResponse * @static - * @param {google.cloud.vision.v1.BatchAnnotateFilesResponse} message BatchAnnotateFilesResponse + * @param {google.cloud.vision.v1.BatchAnnotateImagesResponse} message BatchAnnotateImagesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BatchAnnotateFilesResponse.toObject = function toObject(message, options) { + BatchAnnotateImagesResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; @@ -8547,47 +8415,48 @@ if (message.responses && message.responses.length) { object.responses = []; for (var j = 0; j < message.responses.length; ++j) - object.responses[j] = $root.google.cloud.vision.v1.AnnotateFileResponse.toObject(message.responses[j], options); + object.responses[j] = $root.google.cloud.vision.v1.AnnotateImageResponse.toObject(message.responses[j], options); } return object; }; /** - * Converts this BatchAnnotateFilesResponse to JSON. + * Converts this BatchAnnotateImagesResponse to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.BatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1.BatchAnnotateImagesResponse * @instance * @returns {Object.} JSON object */ - BatchAnnotateFilesResponse.prototype.toJSON = function toJSON() { + BatchAnnotateImagesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BatchAnnotateFilesResponse; + return BatchAnnotateImagesResponse; })(); - v1.AsyncAnnotateFileRequest = (function() { + v1.AnnotateFileRequest = (function() { /** - * Properties of an AsyncAnnotateFileRequest. + * Properties of an AnnotateFileRequest. * @memberof google.cloud.vision.v1 - * @interface IAsyncAnnotateFileRequest - * @property {google.cloud.vision.v1.IInputConfig|null} [inputConfig] AsyncAnnotateFileRequest inputConfig - * @property {Array.|null} [features] AsyncAnnotateFileRequest features - * @property {google.cloud.vision.v1.IImageContext|null} [imageContext] AsyncAnnotateFileRequest imageContext - * @property {google.cloud.vision.v1.IOutputConfig|null} [outputConfig] AsyncAnnotateFileRequest outputConfig + * @interface IAnnotateFileRequest + * @property {google.cloud.vision.v1.IInputConfig|null} [inputConfig] AnnotateFileRequest inputConfig + * @property {Array.|null} [features] AnnotateFileRequest features + * @property {google.cloud.vision.v1.IImageContext|null} [imageContext] AnnotateFileRequest imageContext + * @property {Array.|null} [pages] AnnotateFileRequest pages */ /** - * Constructs a new AsyncAnnotateFileRequest. + * Constructs a new AnnotateFileRequest. * @memberof google.cloud.vision.v1 - * @classdesc Represents an AsyncAnnotateFileRequest. - * @implements IAsyncAnnotateFileRequest + * @classdesc Represents an AnnotateFileRequest. + * @implements IAnnotateFileRequest * @constructor - * @param {google.cloud.vision.v1.IAsyncAnnotateFileRequest=} [properties] Properties to set + * @param {google.cloud.vision.v1.IAnnotateFileRequest=} [properties] Properties to set */ - function AsyncAnnotateFileRequest(properties) { + function AnnotateFileRequest(properties) { this.features = []; + this.pages = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -8595,59 +8464,59 @@ } /** - * AsyncAnnotateFileRequest inputConfig. + * AnnotateFileRequest inputConfig. * @member {google.cloud.vision.v1.IInputConfig|null|undefined} inputConfig - * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1.AnnotateFileRequest * @instance */ - AsyncAnnotateFileRequest.prototype.inputConfig = null; + AnnotateFileRequest.prototype.inputConfig = null; /** - * AsyncAnnotateFileRequest features. + * AnnotateFileRequest features. * @member {Array.} features - * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1.AnnotateFileRequest * @instance */ - AsyncAnnotateFileRequest.prototype.features = $util.emptyArray; + AnnotateFileRequest.prototype.features = $util.emptyArray; /** - * AsyncAnnotateFileRequest imageContext. + * AnnotateFileRequest imageContext. * @member {google.cloud.vision.v1.IImageContext|null|undefined} imageContext - * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1.AnnotateFileRequest * @instance */ - AsyncAnnotateFileRequest.prototype.imageContext = null; + AnnotateFileRequest.prototype.imageContext = null; /** - * AsyncAnnotateFileRequest outputConfig. - * @member {google.cloud.vision.v1.IOutputConfig|null|undefined} outputConfig - * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest + * AnnotateFileRequest pages. + * @member {Array.} pages + * @memberof google.cloud.vision.v1.AnnotateFileRequest * @instance */ - AsyncAnnotateFileRequest.prototype.outputConfig = null; + AnnotateFileRequest.prototype.pages = $util.emptyArray; /** - * Creates a new AsyncAnnotateFileRequest instance using the specified properties. + * Creates a new AnnotateFileRequest instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1.AnnotateFileRequest * @static - * @param {google.cloud.vision.v1.IAsyncAnnotateFileRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest instance + * @param {google.cloud.vision.v1.IAnnotateFileRequest=} [properties] Properties to set + * @returns {google.cloud.vision.v1.AnnotateFileRequest} AnnotateFileRequest instance */ - AsyncAnnotateFileRequest.create = function create(properties) { - return new AsyncAnnotateFileRequest(properties); + AnnotateFileRequest.create = function create(properties) { + return new AnnotateFileRequest(properties); }; /** - * Encodes the specified AsyncAnnotateFileRequest message. Does not implicitly {@link google.cloud.vision.v1.AsyncAnnotateFileRequest.verify|verify} messages. + * Encodes the specified AnnotateFileRequest message. Does not implicitly {@link google.cloud.vision.v1.AnnotateFileRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1.AnnotateFileRequest * @static - * @param {google.cloud.vision.v1.IAsyncAnnotateFileRequest} message AsyncAnnotateFileRequest message or plain object to encode + * @param {google.cloud.vision.v1.IAnnotateFileRequest} message AnnotateFileRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncAnnotateFileRequest.encode = function encode(message, writer) { + AnnotateFileRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) @@ -8657,39 +8526,43 @@ $root.google.cloud.vision.v1.Feature.encode(message.features[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.imageContext != null && message.hasOwnProperty("imageContext")) $root.google.cloud.vision.v1.ImageContext.encode(message.imageContext, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) - $root.google.cloud.vision.v1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.pages != null && message.pages.length) { + writer.uint32(/* id 4, wireType 2 =*/34).fork(); + for (var i = 0; i < message.pages.length; ++i) + writer.int32(message.pages[i]); + writer.ldelim(); + } return writer; }; /** - * Encodes the specified AsyncAnnotateFileRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.AsyncAnnotateFileRequest.verify|verify} messages. + * Encodes the specified AnnotateFileRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.AnnotateFileRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1.AnnotateFileRequest * @static - * @param {google.cloud.vision.v1.IAsyncAnnotateFileRequest} message AsyncAnnotateFileRequest message or plain object to encode + * @param {google.cloud.vision.v1.IAnnotateFileRequest} message AnnotateFileRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncAnnotateFileRequest.encodeDelimited = function encodeDelimited(message, writer) { + AnnotateFileRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer. + * Decodes an AnnotateFileRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1.AnnotateFileRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest + * @returns {google.cloud.vision.v1.AnnotateFileRequest} AnnotateFileRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncAnnotateFileRequest.decode = function decode(reader, length) { + AnnotateFileRequest.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.vision.v1.AsyncAnnotateFileRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.AnnotateFileRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -8705,7 +8578,14 @@ message.imageContext = $root.google.cloud.vision.v1.ImageContext.decode(reader, reader.uint32()); break; case 4: - message.outputConfig = $root.google.cloud.vision.v1.OutputConfig.decode(reader, reader.uint32()); + if (!(message.pages && message.pages.length)) + message.pages = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.pages.push(reader.int32()); + } else + message.pages.push(reader.int32()); break; default: reader.skipType(tag & 7); @@ -8716,30 +8596,30 @@ }; /** - * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer, length delimited. + * Decodes an AnnotateFileRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1.AnnotateFileRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest + * @returns {google.cloud.vision.v1.AnnotateFileRequest} AnnotateFileRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncAnnotateFileRequest.decodeDelimited = function decodeDelimited(reader) { + AnnotateFileRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AsyncAnnotateFileRequest message. + * Verifies an AnnotateFileRequest message. * @function verify - * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1.AnnotateFileRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AsyncAnnotateFileRequest.verify = function verify(message) { + AnnotateFileRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { @@ -8761,73 +8641,78 @@ if (error) return "imageContext." + error; } - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { - var error = $root.google.cloud.vision.v1.OutputConfig.verify(message.outputConfig); - if (error) - return "outputConfig." + error; + if (message.pages != null && message.hasOwnProperty("pages")) { + if (!Array.isArray(message.pages)) + return "pages: array expected"; + for (var i = 0; i < message.pages.length; ++i) + if (!$util.isInteger(message.pages[i])) + return "pages: integer[] expected"; } return null; }; /** - * Creates an AsyncAnnotateFileRequest message from a plain object. Also converts values to their respective internal types. + * Creates an AnnotateFileRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1.AnnotateFileRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest + * @returns {google.cloud.vision.v1.AnnotateFileRequest} AnnotateFileRequest */ - AsyncAnnotateFileRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.AsyncAnnotateFileRequest) + AnnotateFileRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.AnnotateFileRequest) return object; - var message = new $root.google.cloud.vision.v1.AsyncAnnotateFileRequest(); + var message = new $root.google.cloud.vision.v1.AnnotateFileRequest(); if (object.inputConfig != null) { if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.vision.v1.AsyncAnnotateFileRequest.inputConfig: object expected"); + throw TypeError(".google.cloud.vision.v1.AnnotateFileRequest.inputConfig: object expected"); message.inputConfig = $root.google.cloud.vision.v1.InputConfig.fromObject(object.inputConfig); } if (object.features) { if (!Array.isArray(object.features)) - throw TypeError(".google.cloud.vision.v1.AsyncAnnotateFileRequest.features: array expected"); + throw TypeError(".google.cloud.vision.v1.AnnotateFileRequest.features: array expected"); message.features = []; for (var i = 0; i < object.features.length; ++i) { if (typeof object.features[i] !== "object") - throw TypeError(".google.cloud.vision.v1.AsyncAnnotateFileRequest.features: object expected"); + throw TypeError(".google.cloud.vision.v1.AnnotateFileRequest.features: object expected"); message.features[i] = $root.google.cloud.vision.v1.Feature.fromObject(object.features[i]); } } if (object.imageContext != null) { if (typeof object.imageContext !== "object") - throw TypeError(".google.cloud.vision.v1.AsyncAnnotateFileRequest.imageContext: object expected"); + throw TypeError(".google.cloud.vision.v1.AnnotateFileRequest.imageContext: object expected"); message.imageContext = $root.google.cloud.vision.v1.ImageContext.fromObject(object.imageContext); } - if (object.outputConfig != null) { - if (typeof object.outputConfig !== "object") - throw TypeError(".google.cloud.vision.v1.AsyncAnnotateFileRequest.outputConfig: object expected"); - message.outputConfig = $root.google.cloud.vision.v1.OutputConfig.fromObject(object.outputConfig); + if (object.pages) { + if (!Array.isArray(object.pages)) + throw TypeError(".google.cloud.vision.v1.AnnotateFileRequest.pages: array expected"); + message.pages = []; + for (var i = 0; i < object.pages.length; ++i) + message.pages[i] = object.pages[i] | 0; } return message; }; /** - * Creates a plain object from an AsyncAnnotateFileRequest message. Also converts values to other types if specified. + * Creates a plain object from an AnnotateFileRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1.AnnotateFileRequest * @static - * @param {google.cloud.vision.v1.AsyncAnnotateFileRequest} message AsyncAnnotateFileRequest + * @param {google.cloud.vision.v1.AnnotateFileRequest} message AnnotateFileRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AsyncAnnotateFileRequest.toObject = function toObject(message, options) { + AnnotateFileRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) + if (options.arrays || options.defaults) { object.features = []; + object.pages = []; + } if (options.defaults) { object.inputConfig = null; object.imageContext = null; - object.outputConfig = null; } if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) object.inputConfig = $root.google.cloud.vision.v1.InputConfig.toObject(message.inputConfig, options); @@ -8838,43 +8723,50 @@ } if (message.imageContext != null && message.hasOwnProperty("imageContext")) object.imageContext = $root.google.cloud.vision.v1.ImageContext.toObject(message.imageContext, options); - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) - object.outputConfig = $root.google.cloud.vision.v1.OutputConfig.toObject(message.outputConfig, options); + if (message.pages && message.pages.length) { + object.pages = []; + for (var j = 0; j < message.pages.length; ++j) + object.pages[j] = message.pages[j]; + } return object; }; /** - * Converts this AsyncAnnotateFileRequest to JSON. + * Converts this AnnotateFileRequest to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1.AnnotateFileRequest * @instance * @returns {Object.} JSON object */ - AsyncAnnotateFileRequest.prototype.toJSON = function toJSON() { + AnnotateFileRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AsyncAnnotateFileRequest; + return AnnotateFileRequest; })(); - v1.AsyncAnnotateFileResponse = (function() { + v1.AnnotateFileResponse = (function() { /** - * Properties of an AsyncAnnotateFileResponse. + * Properties of an AnnotateFileResponse. * @memberof google.cloud.vision.v1 - * @interface IAsyncAnnotateFileResponse - * @property {google.cloud.vision.v1.IOutputConfig|null} [outputConfig] AsyncAnnotateFileResponse outputConfig + * @interface IAnnotateFileResponse + * @property {google.cloud.vision.v1.IInputConfig|null} [inputConfig] AnnotateFileResponse inputConfig + * @property {Array.|null} [responses] AnnotateFileResponse responses + * @property {number|null} [totalPages] AnnotateFileResponse totalPages + * @property {google.rpc.IStatus|null} [error] AnnotateFileResponse error */ /** - * Constructs a new AsyncAnnotateFileResponse. + * Constructs a new AnnotateFileResponse. * @memberof google.cloud.vision.v1 - * @classdesc Represents an AsyncAnnotateFileResponse. - * @implements IAsyncAnnotateFileResponse + * @classdesc Represents an AnnotateFileResponse. + * @implements IAnnotateFileResponse * @constructor - * @param {google.cloud.vision.v1.IAsyncAnnotateFileResponse=} [properties] Properties to set + * @param {google.cloud.vision.v1.IAnnotateFileResponse=} [properties] Properties to set */ - function AsyncAnnotateFileResponse(properties) { + function AnnotateFileResponse(properties) { + this.responses = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -8882,75 +8774,117 @@ } /** - * AsyncAnnotateFileResponse outputConfig. - * @member {google.cloud.vision.v1.IOutputConfig|null|undefined} outputConfig - * @memberof google.cloud.vision.v1.AsyncAnnotateFileResponse + * AnnotateFileResponse inputConfig. + * @member {google.cloud.vision.v1.IInputConfig|null|undefined} inputConfig + * @memberof google.cloud.vision.v1.AnnotateFileResponse * @instance */ - AsyncAnnotateFileResponse.prototype.outputConfig = null; + AnnotateFileResponse.prototype.inputConfig = null; /** - * Creates a new AsyncAnnotateFileResponse instance using the specified properties. + * AnnotateFileResponse responses. + * @member {Array.} responses + * @memberof google.cloud.vision.v1.AnnotateFileResponse + * @instance + */ + AnnotateFileResponse.prototype.responses = $util.emptyArray; + + /** + * AnnotateFileResponse totalPages. + * @member {number} totalPages + * @memberof google.cloud.vision.v1.AnnotateFileResponse + * @instance + */ + AnnotateFileResponse.prototype.totalPages = 0; + + /** + * AnnotateFileResponse error. + * @member {google.rpc.IStatus|null|undefined} error + * @memberof google.cloud.vision.v1.AnnotateFileResponse + * @instance + */ + AnnotateFileResponse.prototype.error = null; + + /** + * Creates a new AnnotateFileResponse instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1.AnnotateFileResponse * @static - * @param {google.cloud.vision.v1.IAsyncAnnotateFileResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse instance + * @param {google.cloud.vision.v1.IAnnotateFileResponse=} [properties] Properties to set + * @returns {google.cloud.vision.v1.AnnotateFileResponse} AnnotateFileResponse instance */ - AsyncAnnotateFileResponse.create = function create(properties) { - return new AsyncAnnotateFileResponse(properties); + AnnotateFileResponse.create = function create(properties) { + return new AnnotateFileResponse(properties); }; /** - * Encodes the specified AsyncAnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1.AsyncAnnotateFileResponse.verify|verify} messages. + * Encodes the specified AnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1.AnnotateFileResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1.AnnotateFileResponse * @static - * @param {google.cloud.vision.v1.IAsyncAnnotateFileResponse} message AsyncAnnotateFileResponse message or plain object to encode + * @param {google.cloud.vision.v1.IAnnotateFileResponse} message AnnotateFileResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncAnnotateFileResponse.encode = function encode(message, writer) { + AnnotateFileResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) - $root.google.cloud.vision.v1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + $root.google.cloud.vision.v1.InputConfig.encode(message.inputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.responses != null && message.responses.length) + for (var i = 0; i < message.responses.length; ++i) + $root.google.cloud.vision.v1.AnnotateImageResponse.encode(message.responses[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.totalPages != null && message.hasOwnProperty("totalPages")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.totalPages); + if (message.error != null && message.hasOwnProperty("error")) + $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); return writer; }; /** - * Encodes the specified AsyncAnnotateFileResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.AsyncAnnotateFileResponse.verify|verify} messages. + * Encodes the specified AnnotateFileResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.AnnotateFileResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1.AnnotateFileResponse * @static - * @param {google.cloud.vision.v1.IAsyncAnnotateFileResponse} message AsyncAnnotateFileResponse message or plain object to encode + * @param {google.cloud.vision.v1.IAnnotateFileResponse} message AnnotateFileResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncAnnotateFileResponse.encodeDelimited = function encodeDelimited(message, writer) { + AnnotateFileResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer. + * Decodes an AnnotateFileResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1.AnnotateFileResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse + * @returns {google.cloud.vision.v1.AnnotateFileResponse} AnnotateFileResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncAnnotateFileResponse.decode = function decode(reader, length) { + AnnotateFileResponse.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.vision.v1.AsyncAnnotateFileResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.AnnotateFileResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.outputConfig = $root.google.cloud.vision.v1.OutputConfig.decode(reader, reader.uint32()); + message.inputConfig = $root.google.cloud.vision.v1.InputConfig.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.responses && message.responses.length)) + message.responses = []; + message.responses.push($root.google.cloud.vision.v1.AnnotateImageResponse.decode(reader, reader.uint32())); + break; + case 3: + message.totalPages = reader.int32(); + break; + case 4: + message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -8961,114 +8895,161 @@ }; /** - * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer, length delimited. + * Decodes an AnnotateFileResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1.AnnotateFileResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse + * @returns {google.cloud.vision.v1.AnnotateFileResponse} AnnotateFileResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncAnnotateFileResponse.decodeDelimited = function decodeDelimited(reader) { + AnnotateFileResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AsyncAnnotateFileResponse message. + * Verifies an AnnotateFileResponse message. * @function verify - * @memberof google.cloud.vision.v1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1.AnnotateFileResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AsyncAnnotateFileResponse.verify = function verify(message) { + AnnotateFileResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { - var error = $root.google.cloud.vision.v1.OutputConfig.verify(message.outputConfig); + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.vision.v1.InputConfig.verify(message.inputConfig); if (error) - return "outputConfig." + error; + return "inputConfig." + error; + } + if (message.responses != null && message.hasOwnProperty("responses")) { + if (!Array.isArray(message.responses)) + return "responses: array expected"; + for (var i = 0; i < message.responses.length; ++i) { + var error = $root.google.cloud.vision.v1.AnnotateImageResponse.verify(message.responses[i]); + if (error) + return "responses." + error; + } + } + if (message.totalPages != null && message.hasOwnProperty("totalPages")) + if (!$util.isInteger(message.totalPages)) + return "totalPages: integer expected"; + if (message.error != null && message.hasOwnProperty("error")) { + var error = $root.google.rpc.Status.verify(message.error); + if (error) + return "error." + error; } return null; }; /** - * Creates an AsyncAnnotateFileResponse message from a plain object. Also converts values to their respective internal types. + * Creates an AnnotateFileResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1.AnnotateFileResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse + * @returns {google.cloud.vision.v1.AnnotateFileResponse} AnnotateFileResponse */ - AsyncAnnotateFileResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.AsyncAnnotateFileResponse) + AnnotateFileResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.AnnotateFileResponse) return object; - var message = new $root.google.cloud.vision.v1.AsyncAnnotateFileResponse(); - if (object.outputConfig != null) { - if (typeof object.outputConfig !== "object") - throw TypeError(".google.cloud.vision.v1.AsyncAnnotateFileResponse.outputConfig: object expected"); - message.outputConfig = $root.google.cloud.vision.v1.OutputConfig.fromObject(object.outputConfig); + var message = new $root.google.cloud.vision.v1.AnnotateFileResponse(); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.vision.v1.AnnotateFileResponse.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.vision.v1.InputConfig.fromObject(object.inputConfig); + } + if (object.responses) { + if (!Array.isArray(object.responses)) + throw TypeError(".google.cloud.vision.v1.AnnotateFileResponse.responses: array expected"); + message.responses = []; + for (var i = 0; i < object.responses.length; ++i) { + if (typeof object.responses[i] !== "object") + throw TypeError(".google.cloud.vision.v1.AnnotateFileResponse.responses: object expected"); + message.responses[i] = $root.google.cloud.vision.v1.AnnotateImageResponse.fromObject(object.responses[i]); + } + } + if (object.totalPages != null) + message.totalPages = object.totalPages | 0; + if (object.error != null) { + if (typeof object.error !== "object") + throw TypeError(".google.cloud.vision.v1.AnnotateFileResponse.error: object expected"); + message.error = $root.google.rpc.Status.fromObject(object.error); } return message; }; /** - * Creates a plain object from an AsyncAnnotateFileResponse message. Also converts values to other types if specified. + * Creates a plain object from an AnnotateFileResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1.AnnotateFileResponse * @static - * @param {google.cloud.vision.v1.AsyncAnnotateFileResponse} message AsyncAnnotateFileResponse + * @param {google.cloud.vision.v1.AnnotateFileResponse} message AnnotateFileResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AsyncAnnotateFileResponse.toObject = function toObject(message, options) { + AnnotateFileResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.outputConfig = null; - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) - object.outputConfig = $root.google.cloud.vision.v1.OutputConfig.toObject(message.outputConfig, options); + if (options.arrays || options.defaults) + object.responses = []; + if (options.defaults) { + object.inputConfig = null; + object.totalPages = 0; + object.error = null; + } + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.vision.v1.InputConfig.toObject(message.inputConfig, options); + if (message.responses && message.responses.length) { + object.responses = []; + for (var j = 0; j < message.responses.length; ++j) + object.responses[j] = $root.google.cloud.vision.v1.AnnotateImageResponse.toObject(message.responses[j], options); + } + if (message.totalPages != null && message.hasOwnProperty("totalPages")) + object.totalPages = message.totalPages; + if (message.error != null && message.hasOwnProperty("error")) + object.error = $root.google.rpc.Status.toObject(message.error, options); return object; }; /** - * Converts this AsyncAnnotateFileResponse to JSON. + * Converts this AnnotateFileResponse to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1.AnnotateFileResponse * @instance * @returns {Object.} JSON object */ - AsyncAnnotateFileResponse.prototype.toJSON = function toJSON() { + AnnotateFileResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AsyncAnnotateFileResponse; + return AnnotateFileResponse; })(); - v1.AsyncBatchAnnotateImagesRequest = (function() { + v1.BatchAnnotateFilesRequest = (function() { /** - * Properties of an AsyncBatchAnnotateImagesRequest. + * Properties of a BatchAnnotateFilesRequest. * @memberof google.cloud.vision.v1 - * @interface IAsyncBatchAnnotateImagesRequest - * @property {Array.|null} [requests] AsyncBatchAnnotateImagesRequest requests - * @property {google.cloud.vision.v1.IOutputConfig|null} [outputConfig] AsyncBatchAnnotateImagesRequest outputConfig - * @property {string|null} [parent] AsyncBatchAnnotateImagesRequest parent + * @interface IBatchAnnotateFilesRequest + * @property {Array.|null} [requests] BatchAnnotateFilesRequest requests + * @property {string|null} [parent] BatchAnnotateFilesRequest parent */ /** - * Constructs a new AsyncBatchAnnotateImagesRequest. + * Constructs a new BatchAnnotateFilesRequest. * @memberof google.cloud.vision.v1 - * @classdesc Represents an AsyncBatchAnnotateImagesRequest. - * @implements IAsyncBatchAnnotateImagesRequest + * @classdesc Represents a BatchAnnotateFilesRequest. + * @implements IBatchAnnotateFilesRequest * @constructor - * @param {google.cloud.vision.v1.IAsyncBatchAnnotateImagesRequest=} [properties] Properties to set + * @param {google.cloud.vision.v1.IBatchAnnotateFilesRequest=} [properties] Properties to set */ - function AsyncBatchAnnotateImagesRequest(properties) { + function BatchAnnotateFilesRequest(properties) { this.requests = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) @@ -9077,103 +9058,90 @@ } /** - * AsyncBatchAnnotateImagesRequest requests. - * @member {Array.} requests - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest - * @instance - */ - AsyncBatchAnnotateImagesRequest.prototype.requests = $util.emptyArray; - - /** - * AsyncBatchAnnotateImagesRequest outputConfig. - * @member {google.cloud.vision.v1.IOutputConfig|null|undefined} outputConfig - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest + * BatchAnnotateFilesRequest requests. + * @member {Array.} requests + * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest * @instance */ - AsyncBatchAnnotateImagesRequest.prototype.outputConfig = null; + BatchAnnotateFilesRequest.prototype.requests = $util.emptyArray; /** - * AsyncBatchAnnotateImagesRequest parent. + * BatchAnnotateFilesRequest parent. * @member {string} parent - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest * @instance */ - AsyncBatchAnnotateImagesRequest.prototype.parent = ""; + BatchAnnotateFilesRequest.prototype.parent = ""; /** - * Creates a new AsyncBatchAnnotateImagesRequest instance using the specified properties. + * Creates a new BatchAnnotateFilesRequest instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest * @static - * @param {google.cloud.vision.v1.IAsyncBatchAnnotateImagesRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest} AsyncBatchAnnotateImagesRequest instance + * @param {google.cloud.vision.v1.IBatchAnnotateFilesRequest=} [properties] Properties to set + * @returns {google.cloud.vision.v1.BatchAnnotateFilesRequest} BatchAnnotateFilesRequest instance */ - AsyncBatchAnnotateImagesRequest.create = function create(properties) { - return new AsyncBatchAnnotateImagesRequest(properties); + BatchAnnotateFilesRequest.create = function create(properties) { + return new BatchAnnotateFilesRequest(properties); }; /** - * Encodes the specified AsyncBatchAnnotateImagesRequest message. Does not implicitly {@link google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest.verify|verify} messages. + * Encodes the specified BatchAnnotateFilesRequest message. Does not implicitly {@link google.cloud.vision.v1.BatchAnnotateFilesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest * @static - * @param {google.cloud.vision.v1.IAsyncBatchAnnotateImagesRequest} message AsyncBatchAnnotateImagesRequest message or plain object to encode + * @param {google.cloud.vision.v1.IBatchAnnotateFilesRequest} message BatchAnnotateFilesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncBatchAnnotateImagesRequest.encode = function encode(message, writer) { + BatchAnnotateFilesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.requests != null && message.requests.length) for (var i = 0; i < message.requests.length; ++i) - $root.google.cloud.vision.v1.AnnotateImageRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) - $root.google.cloud.vision.v1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.google.cloud.vision.v1.AnnotateFileRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.parent != null && message.hasOwnProperty("parent")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.parent); + writer.uint32(/* id 3, wireType 2 =*/26).string(message.parent); return writer; }; /** - * Encodes the specified AsyncBatchAnnotateImagesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest.verify|verify} messages. + * Encodes the specified BatchAnnotateFilesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.BatchAnnotateFilesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest * @static - * @param {google.cloud.vision.v1.IAsyncBatchAnnotateImagesRequest} message AsyncBatchAnnotateImagesRequest message or plain object to encode + * @param {google.cloud.vision.v1.IBatchAnnotateFilesRequest} message BatchAnnotateFilesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncBatchAnnotateImagesRequest.encodeDelimited = function encodeDelimited(message, writer) { + BatchAnnotateFilesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AsyncBatchAnnotateImagesRequest message from the specified reader or buffer. + * Decodes a BatchAnnotateFilesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest} AsyncBatchAnnotateImagesRequest + * @returns {google.cloud.vision.v1.BatchAnnotateFilesRequest} BatchAnnotateFilesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncBatchAnnotateImagesRequest.decode = function decode(reader, length) { + BatchAnnotateFilesRequest.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.vision.v1.AsyncBatchAnnotateImagesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.BatchAnnotateFilesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: if (!(message.requests && message.requests.length)) message.requests = []; - message.requests.push($root.google.cloud.vision.v1.AnnotateImageRequest.decode(reader, reader.uint32())); - break; - case 2: - message.outputConfig = $root.google.cloud.vision.v1.OutputConfig.decode(reader, reader.uint32()); + message.requests.push($root.google.cloud.vision.v1.AnnotateFileRequest.decode(reader, reader.uint32())); break; - case 4: + case 3: message.parent = reader.string(); break; default: @@ -9185,46 +9153,41 @@ }; /** - * Decodes an AsyncBatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. + * Decodes a BatchAnnotateFilesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest} AsyncBatchAnnotateImagesRequest + * @returns {google.cloud.vision.v1.BatchAnnotateFilesRequest} BatchAnnotateFilesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncBatchAnnotateImagesRequest.decodeDelimited = function decodeDelimited(reader) { + BatchAnnotateFilesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AsyncBatchAnnotateImagesRequest message. + * Verifies a BatchAnnotateFilesRequest message. * @function verify - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AsyncBatchAnnotateImagesRequest.verify = function verify(message) { + BatchAnnotateFilesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.requests != null && message.hasOwnProperty("requests")) { if (!Array.isArray(message.requests)) return "requests: array expected"; for (var i = 0; i < message.requests.length; ++i) { - var error = $root.google.cloud.vision.v1.AnnotateImageRequest.verify(message.requests[i]); + var error = $root.google.cloud.vision.v1.AnnotateFileRequest.verify(message.requests[i]); if (error) return "requests." + error; } } - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { - var error = $root.google.cloud.vision.v1.OutputConfig.verify(message.outputConfig); - if (error) - return "outputConfig." + error; - } if (message.parent != null && message.hasOwnProperty("parent")) if (!$util.isString(message.parent)) return "parent: string expected"; @@ -9232,100 +9195,92 @@ }; /** - * Creates an AsyncBatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. + * Creates a BatchAnnotateFilesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest} AsyncBatchAnnotateImagesRequest + * @returns {google.cloud.vision.v1.BatchAnnotateFilesRequest} BatchAnnotateFilesRequest */ - AsyncBatchAnnotateImagesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest) + BatchAnnotateFilesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.BatchAnnotateFilesRequest) return object; - var message = new $root.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest(); + var message = new $root.google.cloud.vision.v1.BatchAnnotateFilesRequest(); if (object.requests) { if (!Array.isArray(object.requests)) - throw TypeError(".google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest.requests: array expected"); + throw TypeError(".google.cloud.vision.v1.BatchAnnotateFilesRequest.requests: array expected"); message.requests = []; for (var i = 0; i < object.requests.length; ++i) { if (typeof object.requests[i] !== "object") - throw TypeError(".google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest.requests: object expected"); - message.requests[i] = $root.google.cloud.vision.v1.AnnotateImageRequest.fromObject(object.requests[i]); + throw TypeError(".google.cloud.vision.v1.BatchAnnotateFilesRequest.requests: object expected"); + message.requests[i] = $root.google.cloud.vision.v1.AnnotateFileRequest.fromObject(object.requests[i]); } } - if (object.outputConfig != null) { - if (typeof object.outputConfig !== "object") - throw TypeError(".google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest.outputConfig: object expected"); - message.outputConfig = $root.google.cloud.vision.v1.OutputConfig.fromObject(object.outputConfig); - } if (object.parent != null) message.parent = String(object.parent); return message; }; /** - * Creates a plain object from an AsyncBatchAnnotateImagesRequest message. Also converts values to other types if specified. + * Creates a plain object from a BatchAnnotateFilesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest * @static - * @param {google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest} message AsyncBatchAnnotateImagesRequest + * @param {google.cloud.vision.v1.BatchAnnotateFilesRequest} message BatchAnnotateFilesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AsyncBatchAnnotateImagesRequest.toObject = function toObject(message, options) { + BatchAnnotateFilesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) object.requests = []; - if (options.defaults) { - object.outputConfig = null; + if (options.defaults) object.parent = ""; - } if (message.requests && message.requests.length) { object.requests = []; for (var j = 0; j < message.requests.length; ++j) - object.requests[j] = $root.google.cloud.vision.v1.AnnotateImageRequest.toObject(message.requests[j], options); + object.requests[j] = $root.google.cloud.vision.v1.AnnotateFileRequest.toObject(message.requests[j], options); } - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) - object.outputConfig = $root.google.cloud.vision.v1.OutputConfig.toObject(message.outputConfig, options); if (message.parent != null && message.hasOwnProperty("parent")) object.parent = message.parent; return object; }; /** - * Converts this AsyncBatchAnnotateImagesRequest to JSON. + * Converts this BatchAnnotateFilesRequest to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1.BatchAnnotateFilesRequest * @instance * @returns {Object.} JSON object */ - AsyncBatchAnnotateImagesRequest.prototype.toJSON = function toJSON() { + BatchAnnotateFilesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AsyncBatchAnnotateImagesRequest; + return BatchAnnotateFilesRequest; })(); - v1.AsyncBatchAnnotateImagesResponse = (function() { + v1.BatchAnnotateFilesResponse = (function() { /** - * Properties of an AsyncBatchAnnotateImagesResponse. + * Properties of a BatchAnnotateFilesResponse. * @memberof google.cloud.vision.v1 - * @interface IAsyncBatchAnnotateImagesResponse - * @property {google.cloud.vision.v1.IOutputConfig|null} [outputConfig] AsyncBatchAnnotateImagesResponse outputConfig + * @interface IBatchAnnotateFilesResponse + * @property {Array.|null} [responses] BatchAnnotateFilesResponse responses */ /** - * Constructs a new AsyncBatchAnnotateImagesResponse. + * Constructs a new BatchAnnotateFilesResponse. * @memberof google.cloud.vision.v1 - * @classdesc Represents an AsyncBatchAnnotateImagesResponse. - * @implements IAsyncBatchAnnotateImagesResponse + * @classdesc Represents a BatchAnnotateFilesResponse. + * @implements IBatchAnnotateFilesResponse * @constructor - * @param {google.cloud.vision.v1.IAsyncBatchAnnotateImagesResponse=} [properties] Properties to set + * @param {google.cloud.vision.v1.IBatchAnnotateFilesResponse=} [properties] Properties to set */ - function AsyncBatchAnnotateImagesResponse(properties) { + function BatchAnnotateFilesResponse(properties) { + this.responses = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -9333,75 +9288,78 @@ } /** - * AsyncBatchAnnotateImagesResponse outputConfig. - * @member {google.cloud.vision.v1.IOutputConfig|null|undefined} outputConfig - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse + * BatchAnnotateFilesResponse responses. + * @member {Array.} responses + * @memberof google.cloud.vision.v1.BatchAnnotateFilesResponse * @instance */ - AsyncBatchAnnotateImagesResponse.prototype.outputConfig = null; + BatchAnnotateFilesResponse.prototype.responses = $util.emptyArray; /** - * Creates a new AsyncBatchAnnotateImagesResponse instance using the specified properties. + * Creates a new BatchAnnotateFilesResponse instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1.BatchAnnotateFilesResponse * @static - * @param {google.cloud.vision.v1.IAsyncBatchAnnotateImagesResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse} AsyncBatchAnnotateImagesResponse instance + * @param {google.cloud.vision.v1.IBatchAnnotateFilesResponse=} [properties] Properties to set + * @returns {google.cloud.vision.v1.BatchAnnotateFilesResponse} BatchAnnotateFilesResponse instance */ - AsyncBatchAnnotateImagesResponse.create = function create(properties) { - return new AsyncBatchAnnotateImagesResponse(properties); + BatchAnnotateFilesResponse.create = function create(properties) { + return new BatchAnnotateFilesResponse(properties); }; /** - * Encodes the specified AsyncBatchAnnotateImagesResponse message. Does not implicitly {@link google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse.verify|verify} messages. + * Encodes the specified BatchAnnotateFilesResponse message. Does not implicitly {@link google.cloud.vision.v1.BatchAnnotateFilesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1.BatchAnnotateFilesResponse * @static - * @param {google.cloud.vision.v1.IAsyncBatchAnnotateImagesResponse} message AsyncBatchAnnotateImagesResponse message or plain object to encode + * @param {google.cloud.vision.v1.IBatchAnnotateFilesResponse} message BatchAnnotateFilesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncBatchAnnotateImagesResponse.encode = function encode(message, writer) { + BatchAnnotateFilesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) - $root.google.cloud.vision.v1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.responses != null && message.responses.length) + for (var i = 0; i < message.responses.length; ++i) + $root.google.cloud.vision.v1.AnnotateFileResponse.encode(message.responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified AsyncBatchAnnotateImagesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse.verify|verify} messages. + * Encodes the specified BatchAnnotateFilesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.BatchAnnotateFilesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1.BatchAnnotateFilesResponse * @static - * @param {google.cloud.vision.v1.IAsyncBatchAnnotateImagesResponse} message AsyncBatchAnnotateImagesResponse message or plain object to encode + * @param {google.cloud.vision.v1.IBatchAnnotateFilesResponse} message BatchAnnotateFilesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncBatchAnnotateImagesResponse.encodeDelimited = function encodeDelimited(message, writer) { + BatchAnnotateFilesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AsyncBatchAnnotateImagesResponse message from the specified reader or buffer. + * Decodes a BatchAnnotateFilesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1.BatchAnnotateFilesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse} AsyncBatchAnnotateImagesResponse + * @returns {google.cloud.vision.v1.BatchAnnotateFilesResponse} BatchAnnotateFilesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncBatchAnnotateImagesResponse.decode = function decode(reader, length) { + BatchAnnotateFilesResponse.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.vision.v1.AsyncBatchAnnotateImagesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.BatchAnnotateFilesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.outputConfig = $root.google.cloud.vision.v1.OutputConfig.decode(reader, reader.uint32()); + if (!(message.responses && message.responses.length)) + message.responses = []; + message.responses.push($root.google.cloud.vision.v1.AnnotateFileResponse.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -9412,114 +9370,128 @@ }; /** - * Decodes an AsyncBatchAnnotateImagesResponse message from the specified reader or buffer, length delimited. + * Decodes a BatchAnnotateFilesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1.BatchAnnotateFilesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse} AsyncBatchAnnotateImagesResponse + * @returns {google.cloud.vision.v1.BatchAnnotateFilesResponse} BatchAnnotateFilesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncBatchAnnotateImagesResponse.decodeDelimited = function decodeDelimited(reader) { + BatchAnnotateFilesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AsyncBatchAnnotateImagesResponse message. + * Verifies a BatchAnnotateFilesResponse message. * @function verify - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1.BatchAnnotateFilesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AsyncBatchAnnotateImagesResponse.verify = function verify(message) { + BatchAnnotateFilesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { - var error = $root.google.cloud.vision.v1.OutputConfig.verify(message.outputConfig); - if (error) - return "outputConfig." + error; + if (message.responses != null && message.hasOwnProperty("responses")) { + if (!Array.isArray(message.responses)) + return "responses: array expected"; + for (var i = 0; i < message.responses.length; ++i) { + var error = $root.google.cloud.vision.v1.AnnotateFileResponse.verify(message.responses[i]); + if (error) + return "responses." + error; + } } return null; }; /** - * Creates an AsyncBatchAnnotateImagesResponse message from a plain object. Also converts values to their respective internal types. + * Creates a BatchAnnotateFilesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1.BatchAnnotateFilesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse} AsyncBatchAnnotateImagesResponse + * @returns {google.cloud.vision.v1.BatchAnnotateFilesResponse} BatchAnnotateFilesResponse */ - AsyncBatchAnnotateImagesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse) + BatchAnnotateFilesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.BatchAnnotateFilesResponse) return object; - var message = new $root.google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse(); - if (object.outputConfig != null) { - if (typeof object.outputConfig !== "object") - throw TypeError(".google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse.outputConfig: object expected"); - message.outputConfig = $root.google.cloud.vision.v1.OutputConfig.fromObject(object.outputConfig); + var message = new $root.google.cloud.vision.v1.BatchAnnotateFilesResponse(); + if (object.responses) { + if (!Array.isArray(object.responses)) + throw TypeError(".google.cloud.vision.v1.BatchAnnotateFilesResponse.responses: array expected"); + message.responses = []; + for (var i = 0; i < object.responses.length; ++i) { + if (typeof object.responses[i] !== "object") + throw TypeError(".google.cloud.vision.v1.BatchAnnotateFilesResponse.responses: object expected"); + message.responses[i] = $root.google.cloud.vision.v1.AnnotateFileResponse.fromObject(object.responses[i]); + } } return message; }; /** - * Creates a plain object from an AsyncBatchAnnotateImagesResponse message. Also converts values to other types if specified. + * Creates a plain object from a BatchAnnotateFilesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1.BatchAnnotateFilesResponse * @static - * @param {google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse} message AsyncBatchAnnotateImagesResponse + * @param {google.cloud.vision.v1.BatchAnnotateFilesResponse} message BatchAnnotateFilesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AsyncBatchAnnotateImagesResponse.toObject = function toObject(message, options) { + BatchAnnotateFilesResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.outputConfig = null; - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) - object.outputConfig = $root.google.cloud.vision.v1.OutputConfig.toObject(message.outputConfig, options); + if (options.arrays || options.defaults) + object.responses = []; + if (message.responses && message.responses.length) { + object.responses = []; + for (var j = 0; j < message.responses.length; ++j) + object.responses[j] = $root.google.cloud.vision.v1.AnnotateFileResponse.toObject(message.responses[j], options); + } return object; }; /** - * Converts this AsyncBatchAnnotateImagesResponse to JSON. + * Converts this BatchAnnotateFilesResponse to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1.BatchAnnotateFilesResponse * @instance * @returns {Object.} JSON object */ - AsyncBatchAnnotateImagesResponse.prototype.toJSON = function toJSON() { + BatchAnnotateFilesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AsyncBatchAnnotateImagesResponse; + return BatchAnnotateFilesResponse; })(); - v1.AsyncBatchAnnotateFilesRequest = (function() { + v1.AsyncAnnotateFileRequest = (function() { /** - * Properties of an AsyncBatchAnnotateFilesRequest. + * Properties of an AsyncAnnotateFileRequest. * @memberof google.cloud.vision.v1 - * @interface IAsyncBatchAnnotateFilesRequest - * @property {Array.|null} [requests] AsyncBatchAnnotateFilesRequest requests - * @property {string|null} [parent] AsyncBatchAnnotateFilesRequest parent + * @interface IAsyncAnnotateFileRequest + * @property {google.cloud.vision.v1.IInputConfig|null} [inputConfig] AsyncAnnotateFileRequest inputConfig + * @property {Array.|null} [features] AsyncAnnotateFileRequest features + * @property {google.cloud.vision.v1.IImageContext|null} [imageContext] AsyncAnnotateFileRequest imageContext + * @property {google.cloud.vision.v1.IOutputConfig|null} [outputConfig] AsyncAnnotateFileRequest outputConfig */ /** - * Constructs a new AsyncBatchAnnotateFilesRequest. + * Constructs a new AsyncAnnotateFileRequest. * @memberof google.cloud.vision.v1 - * @classdesc Represents an AsyncBatchAnnotateFilesRequest. - * @implements IAsyncBatchAnnotateFilesRequest + * @classdesc Represents an AsyncAnnotateFileRequest. + * @implements IAsyncAnnotateFileRequest * @constructor - * @param {google.cloud.vision.v1.IAsyncBatchAnnotateFilesRequest=} [properties] Properties to set + * @param {google.cloud.vision.v1.IAsyncAnnotateFileRequest=} [properties] Properties to set */ - function AsyncBatchAnnotateFilesRequest(properties) { - this.requests = []; + function AsyncAnnotateFileRequest(properties) { + this.features = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -9527,91 +9499,117 @@ } /** - * AsyncBatchAnnotateFilesRequest requests. - * @member {Array.} requests - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest + * AsyncAnnotateFileRequest inputConfig. + * @member {google.cloud.vision.v1.IInputConfig|null|undefined} inputConfig + * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest * @instance */ - AsyncBatchAnnotateFilesRequest.prototype.requests = $util.emptyArray; + AsyncAnnotateFileRequest.prototype.inputConfig = null; /** - * AsyncBatchAnnotateFilesRequest parent. - * @member {string} parent - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest + * AsyncAnnotateFileRequest features. + * @member {Array.} features + * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest * @instance */ - AsyncBatchAnnotateFilesRequest.prototype.parent = ""; + AsyncAnnotateFileRequest.prototype.features = $util.emptyArray; /** - * Creates a new AsyncBatchAnnotateFilesRequest instance using the specified properties. + * AsyncAnnotateFileRequest imageContext. + * @member {google.cloud.vision.v1.IImageContext|null|undefined} imageContext + * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest + * @instance + */ + AsyncAnnotateFileRequest.prototype.imageContext = null; + + /** + * AsyncAnnotateFileRequest outputConfig. + * @member {google.cloud.vision.v1.IOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest + * @instance + */ + AsyncAnnotateFileRequest.prototype.outputConfig = null; + + /** + * Creates a new AsyncAnnotateFileRequest instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest * @static - * @param {google.cloud.vision.v1.IAsyncBatchAnnotateFilesRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest instance + * @param {google.cloud.vision.v1.IAsyncAnnotateFileRequest=} [properties] Properties to set + * @returns {google.cloud.vision.v1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest instance */ - AsyncBatchAnnotateFilesRequest.create = function create(properties) { - return new AsyncBatchAnnotateFilesRequest(properties); + AsyncAnnotateFileRequest.create = function create(properties) { + return new AsyncAnnotateFileRequest(properties); }; /** - * Encodes the specified AsyncBatchAnnotateFilesRequest message. Does not implicitly {@link google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest.verify|verify} messages. + * Encodes the specified AsyncAnnotateFileRequest message. Does not implicitly {@link google.cloud.vision.v1.AsyncAnnotateFileRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest * @static - * @param {google.cloud.vision.v1.IAsyncBatchAnnotateFilesRequest} message AsyncBatchAnnotateFilesRequest message or plain object to encode + * @param {google.cloud.vision.v1.IAsyncAnnotateFileRequest} message AsyncAnnotateFileRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncBatchAnnotateFilesRequest.encode = function encode(message, writer) { + AsyncAnnotateFileRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.requests != null && message.requests.length) - for (var i = 0; i < message.requests.length; ++i) - $root.google.cloud.vision.v1.AsyncAnnotateFileRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.parent != null && message.hasOwnProperty("parent")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.parent); + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + $root.google.cloud.vision.v1.InputConfig.encode(message.inputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.features != null && message.features.length) + for (var i = 0; i < message.features.length; ++i) + $root.google.cloud.vision.v1.Feature.encode(message.features[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.imageContext != null && message.hasOwnProperty("imageContext")) + $root.google.cloud.vision.v1.ImageContext.encode(message.imageContext, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + $root.google.cloud.vision.v1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); return writer; }; /** - * Encodes the specified AsyncBatchAnnotateFilesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest.verify|verify} messages. + * Encodes the specified AsyncAnnotateFileRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.AsyncAnnotateFileRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest * @static - * @param {google.cloud.vision.v1.IAsyncBatchAnnotateFilesRequest} message AsyncBatchAnnotateFilesRequest message or plain object to encode + * @param {google.cloud.vision.v1.IAsyncAnnotateFileRequest} message AsyncAnnotateFileRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncBatchAnnotateFilesRequest.encodeDelimited = function encodeDelimited(message, writer) { + AsyncAnnotateFileRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AsyncBatchAnnotateFilesRequest message from the specified reader or buffer. + * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest + * @returns {google.cloud.vision.v1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncBatchAnnotateFilesRequest.decode = function decode(reader, length) { + AsyncAnnotateFileRequest.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.vision.v1.AsyncBatchAnnotateFilesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.AsyncAnnotateFileRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.requests && message.requests.length)) - message.requests = []; - message.requests.push($root.google.cloud.vision.v1.AsyncAnnotateFileRequest.decode(reader, reader.uint32())); + message.inputConfig = $root.google.cloud.vision.v1.InputConfig.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.features && message.features.length)) + message.features = []; + message.features.push($root.google.cloud.vision.v1.Feature.decode(reader, reader.uint32())); + break; + case 3: + message.imageContext = $root.google.cloud.vision.v1.ImageContext.decode(reader, reader.uint32()); break; case 4: - message.parent = reader.string(); + message.outputConfig = $root.google.cloud.vision.v1.OutputConfig.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -9622,134 +9620,165 @@ }; /** - * Decodes an AsyncBatchAnnotateFilesRequest message from the specified reader or buffer, length delimited. + * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest + * @returns {google.cloud.vision.v1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncBatchAnnotateFilesRequest.decodeDelimited = function decodeDelimited(reader) { + AsyncAnnotateFileRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AsyncBatchAnnotateFilesRequest message. + * Verifies an AsyncAnnotateFileRequest message. * @function verify - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AsyncBatchAnnotateFilesRequest.verify = function verify(message) { + AsyncAnnotateFileRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.requests != null && message.hasOwnProperty("requests")) { - if (!Array.isArray(message.requests)) - return "requests: array expected"; - for (var i = 0; i < message.requests.length; ++i) { - var error = $root.google.cloud.vision.v1.AsyncAnnotateFileRequest.verify(message.requests[i]); + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.vision.v1.InputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; + } + if (message.features != null && message.hasOwnProperty("features")) { + if (!Array.isArray(message.features)) + return "features: array expected"; + for (var i = 0; i < message.features.length; ++i) { + var error = $root.google.cloud.vision.v1.Feature.verify(message.features[i]); if (error) - return "requests." + error; + return "features." + error; } } - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; + if (message.imageContext != null && message.hasOwnProperty("imageContext")) { + var error = $root.google.cloud.vision.v1.ImageContext.verify(message.imageContext); + if (error) + return "imageContext." + error; + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + var error = $root.google.cloud.vision.v1.OutputConfig.verify(message.outputConfig); + if (error) + return "outputConfig." + error; + } return null; }; /** - * Creates an AsyncBatchAnnotateFilesRequest message from a plain object. Also converts values to their respective internal types. + * Creates an AsyncAnnotateFileRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest + * @returns {google.cloud.vision.v1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest */ - AsyncBatchAnnotateFilesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest) + AsyncAnnotateFileRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.AsyncAnnotateFileRequest) return object; - var message = new $root.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest(); - if (object.requests) { - if (!Array.isArray(object.requests)) - throw TypeError(".google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest.requests: array expected"); - message.requests = []; - for (var i = 0; i < object.requests.length; ++i) { - if (typeof object.requests[i] !== "object") - throw TypeError(".google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest.requests: object expected"); - message.requests[i] = $root.google.cloud.vision.v1.AsyncAnnotateFileRequest.fromObject(object.requests[i]); + var message = new $root.google.cloud.vision.v1.AsyncAnnotateFileRequest(); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.vision.v1.AsyncAnnotateFileRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.vision.v1.InputConfig.fromObject(object.inputConfig); + } + if (object.features) { + if (!Array.isArray(object.features)) + throw TypeError(".google.cloud.vision.v1.AsyncAnnotateFileRequest.features: array expected"); + message.features = []; + for (var i = 0; i < object.features.length; ++i) { + if (typeof object.features[i] !== "object") + throw TypeError(".google.cloud.vision.v1.AsyncAnnotateFileRequest.features: object expected"); + message.features[i] = $root.google.cloud.vision.v1.Feature.fromObject(object.features[i]); } } - if (object.parent != null) - message.parent = String(object.parent); + if (object.imageContext != null) { + if (typeof object.imageContext !== "object") + throw TypeError(".google.cloud.vision.v1.AsyncAnnotateFileRequest.imageContext: object expected"); + message.imageContext = $root.google.cloud.vision.v1.ImageContext.fromObject(object.imageContext); + } + if (object.outputConfig != null) { + if (typeof object.outputConfig !== "object") + throw TypeError(".google.cloud.vision.v1.AsyncAnnotateFileRequest.outputConfig: object expected"); + message.outputConfig = $root.google.cloud.vision.v1.OutputConfig.fromObject(object.outputConfig); + } return message; }; /** - * Creates a plain object from an AsyncBatchAnnotateFilesRequest message. Also converts values to other types if specified. + * Creates a plain object from an AsyncAnnotateFileRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest * @static - * @param {google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest} message AsyncBatchAnnotateFilesRequest + * @param {google.cloud.vision.v1.AsyncAnnotateFileRequest} message AsyncAnnotateFileRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AsyncBatchAnnotateFilesRequest.toObject = function toObject(message, options) { + AsyncAnnotateFileRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.requests = []; - if (options.defaults) - object.parent = ""; - if (message.requests && message.requests.length) { - object.requests = []; - for (var j = 0; j < message.requests.length; ++j) - object.requests[j] = $root.google.cloud.vision.v1.AsyncAnnotateFileRequest.toObject(message.requests[j], options); + object.features = []; + if (options.defaults) { + object.inputConfig = null; + object.imageContext = null; + object.outputConfig = null; } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.vision.v1.InputConfig.toObject(message.inputConfig, options); + if (message.features && message.features.length) { + object.features = []; + for (var j = 0; j < message.features.length; ++j) + object.features[j] = $root.google.cloud.vision.v1.Feature.toObject(message.features[j], options); + } + if (message.imageContext != null && message.hasOwnProperty("imageContext")) + object.imageContext = $root.google.cloud.vision.v1.ImageContext.toObject(message.imageContext, options); + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + object.outputConfig = $root.google.cloud.vision.v1.OutputConfig.toObject(message.outputConfig, options); return object; }; /** - * Converts this AsyncBatchAnnotateFilesRequest to JSON. + * Converts this AsyncAnnotateFileRequest to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1.AsyncAnnotateFileRequest * @instance * @returns {Object.} JSON object */ - AsyncBatchAnnotateFilesRequest.prototype.toJSON = function toJSON() { + AsyncAnnotateFileRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AsyncBatchAnnotateFilesRequest; + return AsyncAnnotateFileRequest; })(); - v1.AsyncBatchAnnotateFilesResponse = (function() { + v1.AsyncAnnotateFileResponse = (function() { /** - * Properties of an AsyncBatchAnnotateFilesResponse. + * Properties of an AsyncAnnotateFileResponse. * @memberof google.cloud.vision.v1 - * @interface IAsyncBatchAnnotateFilesResponse - * @property {Array.|null} [responses] AsyncBatchAnnotateFilesResponse responses + * @interface IAsyncAnnotateFileResponse + * @property {google.cloud.vision.v1.IOutputConfig|null} [outputConfig] AsyncAnnotateFileResponse outputConfig */ /** - * Constructs a new AsyncBatchAnnotateFilesResponse. + * Constructs a new AsyncAnnotateFileResponse. * @memberof google.cloud.vision.v1 - * @classdesc Represents an AsyncBatchAnnotateFilesResponse. - * @implements IAsyncBatchAnnotateFilesResponse + * @classdesc Represents an AsyncAnnotateFileResponse. + * @implements IAsyncAnnotateFileResponse * @constructor - * @param {google.cloud.vision.v1.IAsyncBatchAnnotateFilesResponse=} [properties] Properties to set + * @param {google.cloud.vision.v1.IAsyncAnnotateFileResponse=} [properties] Properties to set */ - function AsyncBatchAnnotateFilesResponse(properties) { - this.responses = []; + function AsyncAnnotateFileResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -9757,78 +9786,75 @@ } /** - * AsyncBatchAnnotateFilesResponse responses. - * @member {Array.} responses - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse + * AsyncAnnotateFileResponse outputConfig. + * @member {google.cloud.vision.v1.IOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.vision.v1.AsyncAnnotateFileResponse * @instance */ - AsyncBatchAnnotateFilesResponse.prototype.responses = $util.emptyArray; + AsyncAnnotateFileResponse.prototype.outputConfig = null; /** - * Creates a new AsyncBatchAnnotateFilesResponse instance using the specified properties. + * Creates a new AsyncAnnotateFileResponse instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1.AsyncAnnotateFileResponse * @static - * @param {google.cloud.vision.v1.IAsyncBatchAnnotateFilesResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse instance + * @param {google.cloud.vision.v1.IAsyncAnnotateFileResponse=} [properties] Properties to set + * @returns {google.cloud.vision.v1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse instance */ - AsyncBatchAnnotateFilesResponse.create = function create(properties) { - return new AsyncBatchAnnotateFilesResponse(properties); + AsyncAnnotateFileResponse.create = function create(properties) { + return new AsyncAnnotateFileResponse(properties); }; /** - * Encodes the specified AsyncBatchAnnotateFilesResponse message. Does not implicitly {@link google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse.verify|verify} messages. + * Encodes the specified AsyncAnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1.AsyncAnnotateFileResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1.AsyncAnnotateFileResponse * @static - * @param {google.cloud.vision.v1.IAsyncBatchAnnotateFilesResponse} message AsyncBatchAnnotateFilesResponse message or plain object to encode + * @param {google.cloud.vision.v1.IAsyncAnnotateFileResponse} message AsyncAnnotateFileResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncBatchAnnotateFilesResponse.encode = function encode(message, writer) { + AsyncAnnotateFileResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.responses != null && message.responses.length) - for (var i = 0; i < message.responses.length; ++i) - $root.google.cloud.vision.v1.AsyncAnnotateFileResponse.encode(message.responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + $root.google.cloud.vision.v1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified AsyncBatchAnnotateFilesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse.verify|verify} messages. + * Encodes the specified AsyncAnnotateFileResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.AsyncAnnotateFileResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1.AsyncAnnotateFileResponse * @static - * @param {google.cloud.vision.v1.IAsyncBatchAnnotateFilesResponse} message AsyncBatchAnnotateFilesResponse message or plain object to encode + * @param {google.cloud.vision.v1.IAsyncAnnotateFileResponse} message AsyncAnnotateFileResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncBatchAnnotateFilesResponse.encodeDelimited = function encodeDelimited(message, writer) { + AsyncAnnotateFileResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AsyncBatchAnnotateFilesResponse message from the specified reader or buffer. + * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1.AsyncAnnotateFileResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse + * @returns {google.cloud.vision.v1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncBatchAnnotateFilesResponse.decode = function decode(reader, length) { + AsyncAnnotateFileResponse.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.vision.v1.AsyncBatchAnnotateFilesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.AsyncAnnotateFileResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.responses && message.responses.length)) - message.responses = []; - message.responses.push($root.google.cloud.vision.v1.AsyncAnnotateFileResponse.decode(reader, reader.uint32())); + message.outputConfig = $root.google.cloud.vision.v1.OutputConfig.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -9839,126 +9865,115 @@ }; /** - * Decodes an AsyncBatchAnnotateFilesResponse message from the specified reader or buffer, length delimited. + * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1.AsyncAnnotateFileResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse + * @returns {google.cloud.vision.v1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncBatchAnnotateFilesResponse.decodeDelimited = function decodeDelimited(reader) { + AsyncAnnotateFileResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AsyncBatchAnnotateFilesResponse message. + * Verifies an AsyncAnnotateFileResponse message. * @function verify - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1.AsyncAnnotateFileResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AsyncBatchAnnotateFilesResponse.verify = function verify(message) { + AsyncAnnotateFileResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.responses != null && message.hasOwnProperty("responses")) { - if (!Array.isArray(message.responses)) - return "responses: array expected"; - for (var i = 0; i < message.responses.length; ++i) { - var error = $root.google.cloud.vision.v1.AsyncAnnotateFileResponse.verify(message.responses[i]); - if (error) - return "responses." + error; - } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + var error = $root.google.cloud.vision.v1.OutputConfig.verify(message.outputConfig); + if (error) + return "outputConfig." + error; } return null; }; /** - * Creates an AsyncBatchAnnotateFilesResponse message from a plain object. Also converts values to their respective internal types. + * Creates an AsyncAnnotateFileResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1.AsyncAnnotateFileResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse + * @returns {google.cloud.vision.v1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse */ - AsyncBatchAnnotateFilesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse) + AsyncAnnotateFileResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.AsyncAnnotateFileResponse) return object; - var message = new $root.google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse(); - if (object.responses) { - if (!Array.isArray(object.responses)) - throw TypeError(".google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse.responses: array expected"); - message.responses = []; - for (var i = 0; i < object.responses.length; ++i) { - if (typeof object.responses[i] !== "object") - throw TypeError(".google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse.responses: object expected"); - message.responses[i] = $root.google.cloud.vision.v1.AsyncAnnotateFileResponse.fromObject(object.responses[i]); - } + var message = new $root.google.cloud.vision.v1.AsyncAnnotateFileResponse(); + if (object.outputConfig != null) { + if (typeof object.outputConfig !== "object") + throw TypeError(".google.cloud.vision.v1.AsyncAnnotateFileResponse.outputConfig: object expected"); + message.outputConfig = $root.google.cloud.vision.v1.OutputConfig.fromObject(object.outputConfig); } return message; }; /** - * Creates a plain object from an AsyncBatchAnnotateFilesResponse message. Also converts values to other types if specified. + * Creates a plain object from an AsyncAnnotateFileResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1.AsyncAnnotateFileResponse * @static - * @param {google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse} message AsyncBatchAnnotateFilesResponse + * @param {google.cloud.vision.v1.AsyncAnnotateFileResponse} message AsyncAnnotateFileResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AsyncBatchAnnotateFilesResponse.toObject = function toObject(message, options) { + AsyncAnnotateFileResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.responses = []; - if (message.responses && message.responses.length) { - object.responses = []; - for (var j = 0; j < message.responses.length; ++j) - object.responses[j] = $root.google.cloud.vision.v1.AsyncAnnotateFileResponse.toObject(message.responses[j], options); - } + if (options.defaults) + object.outputConfig = null; + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + object.outputConfig = $root.google.cloud.vision.v1.OutputConfig.toObject(message.outputConfig, options); return object; }; /** - * Converts this AsyncBatchAnnotateFilesResponse to JSON. + * Converts this AsyncAnnotateFileResponse to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1.AsyncAnnotateFileResponse * @instance * @returns {Object.} JSON object */ - AsyncBatchAnnotateFilesResponse.prototype.toJSON = function toJSON() { + AsyncAnnotateFileResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AsyncBatchAnnotateFilesResponse; + return AsyncAnnotateFileResponse; })(); - v1.InputConfig = (function() { + v1.AsyncBatchAnnotateImagesRequest = (function() { /** - * Properties of an InputConfig. + * Properties of an AsyncBatchAnnotateImagesRequest. * @memberof google.cloud.vision.v1 - * @interface IInputConfig - * @property {google.cloud.vision.v1.IGcsSource|null} [gcsSource] InputConfig gcsSource - * @property {Uint8Array|null} [content] InputConfig content - * @property {string|null} [mimeType] InputConfig mimeType + * @interface IAsyncBatchAnnotateImagesRequest + * @property {Array.|null} [requests] AsyncBatchAnnotateImagesRequest requests + * @property {google.cloud.vision.v1.IOutputConfig|null} [outputConfig] AsyncBatchAnnotateImagesRequest outputConfig + * @property {string|null} [parent] AsyncBatchAnnotateImagesRequest parent */ /** - * Constructs a new InputConfig. + * Constructs a new AsyncBatchAnnotateImagesRequest. * @memberof google.cloud.vision.v1 - * @classdesc Represents an InputConfig. - * @implements IInputConfig + * @classdesc Represents an AsyncBatchAnnotateImagesRequest. + * @implements IAsyncBatchAnnotateImagesRequest * @constructor - * @param {google.cloud.vision.v1.IInputConfig=} [properties] Properties to set + * @param {google.cloud.vision.v1.IAsyncBatchAnnotateImagesRequest=} [properties] Properties to set */ - function InputConfig(properties) { + function AsyncBatchAnnotateImagesRequest(properties) { + this.requests = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -9966,101 +9981,104 @@ } /** - * InputConfig gcsSource. - * @member {google.cloud.vision.v1.IGcsSource|null|undefined} gcsSource - * @memberof google.cloud.vision.v1.InputConfig + * AsyncBatchAnnotateImagesRequest requests. + * @member {Array.} requests + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest * @instance */ - InputConfig.prototype.gcsSource = null; + AsyncBatchAnnotateImagesRequest.prototype.requests = $util.emptyArray; /** - * InputConfig content. - * @member {Uint8Array} content - * @memberof google.cloud.vision.v1.InputConfig + * AsyncBatchAnnotateImagesRequest outputConfig. + * @member {google.cloud.vision.v1.IOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest * @instance */ - InputConfig.prototype.content = $util.newBuffer([]); + AsyncBatchAnnotateImagesRequest.prototype.outputConfig = null; /** - * InputConfig mimeType. - * @member {string} mimeType - * @memberof google.cloud.vision.v1.InputConfig + * AsyncBatchAnnotateImagesRequest parent. + * @member {string} parent + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest * @instance */ - InputConfig.prototype.mimeType = ""; + AsyncBatchAnnotateImagesRequest.prototype.parent = ""; /** - * Creates a new InputConfig instance using the specified properties. + * Creates a new AsyncBatchAnnotateImagesRequest instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.InputConfig + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest * @static - * @param {google.cloud.vision.v1.IInputConfig=} [properties] Properties to set - * @returns {google.cloud.vision.v1.InputConfig} InputConfig instance + * @param {google.cloud.vision.v1.IAsyncBatchAnnotateImagesRequest=} [properties] Properties to set + * @returns {google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest} AsyncBatchAnnotateImagesRequest instance */ - InputConfig.create = function create(properties) { - return new InputConfig(properties); + AsyncBatchAnnotateImagesRequest.create = function create(properties) { + return new AsyncBatchAnnotateImagesRequest(properties); }; /** - * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.vision.v1.InputConfig.verify|verify} messages. + * Encodes the specified AsyncBatchAnnotateImagesRequest message. Does not implicitly {@link google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.InputConfig + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest * @static - * @param {google.cloud.vision.v1.IInputConfig} message InputConfig message or plain object to encode + * @param {google.cloud.vision.v1.IAsyncBatchAnnotateImagesRequest} message AsyncBatchAnnotateImagesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - InputConfig.encode = function encode(message, writer) { + AsyncBatchAnnotateImagesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) - $root.google.cloud.vision.v1.GcsSource.encode(message.gcsSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.mimeType != null && message.hasOwnProperty("mimeType")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimeType); - if (message.content != null && message.hasOwnProperty("content")) - writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.content); + if (message.requests != null && message.requests.length) + for (var i = 0; i < message.requests.length; ++i) + $root.google.cloud.vision.v1.AnnotateImageRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + $root.google.cloud.vision.v1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.parent != null && message.hasOwnProperty("parent")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.parent); return writer; }; /** - * Encodes the specified InputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1.InputConfig.verify|verify} messages. + * Encodes the specified AsyncBatchAnnotateImagesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.InputConfig + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest * @static - * @param {google.cloud.vision.v1.IInputConfig} message InputConfig message or plain object to encode + * @param {google.cloud.vision.v1.IAsyncBatchAnnotateImagesRequest} message AsyncBatchAnnotateImagesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - InputConfig.encodeDelimited = function encodeDelimited(message, writer) { + AsyncBatchAnnotateImagesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an InputConfig message from the specified reader or buffer. + * Decodes an AsyncBatchAnnotateImagesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.InputConfig + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.InputConfig} InputConfig + * @returns {google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest} AsyncBatchAnnotateImagesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - InputConfig.decode = function decode(reader, length) { + AsyncBatchAnnotateImagesRequest.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.vision.v1.InputConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.gcsSource = $root.google.cloud.vision.v1.GcsSource.decode(reader, reader.uint32()); - break; - case 3: - message.content = reader.bytes(); + if (!(message.requests && message.requests.length)) + message.requests = []; + message.requests.push($root.google.cloud.vision.v1.AnnotateImageRequest.decode(reader, reader.uint32())); break; case 2: - message.mimeType = reader.string(); + message.outputConfig = $root.google.cloud.vision.v1.OutputConfig.decode(reader, reader.uint32()); + break; + case 4: + message.parent = reader.string(); break; default: reader.skipType(tag & 7); @@ -10071,139 +10089,147 @@ }; /** - * Decodes an InputConfig message from the specified reader or buffer, length delimited. + * Decodes an AsyncBatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.InputConfig + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.InputConfig} InputConfig + * @returns {google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest} AsyncBatchAnnotateImagesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - InputConfig.decodeDelimited = function decodeDelimited(reader) { + AsyncBatchAnnotateImagesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an InputConfig message. + * Verifies an AsyncBatchAnnotateImagesRequest message. * @function verify - * @memberof google.cloud.vision.v1.InputConfig + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - InputConfig.verify = function verify(message) { + AsyncBatchAnnotateImagesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - var error = $root.google.cloud.vision.v1.GcsSource.verify(message.gcsSource); + if (message.requests != null && message.hasOwnProperty("requests")) { + if (!Array.isArray(message.requests)) + return "requests: array expected"; + for (var i = 0; i < message.requests.length; ++i) { + var error = $root.google.cloud.vision.v1.AnnotateImageRequest.verify(message.requests[i]); + if (error) + return "requests." + error; + } + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + var error = $root.google.cloud.vision.v1.OutputConfig.verify(message.outputConfig); if (error) - return "gcsSource." + error; + return "outputConfig." + error; } - if (message.content != null && message.hasOwnProperty("content")) - if (!(message.content && typeof message.content.length === "number" || $util.isString(message.content))) - return "content: buffer expected"; - if (message.mimeType != null && message.hasOwnProperty("mimeType")) - if (!$util.isString(message.mimeType)) - return "mimeType: string expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; return null; }; /** - * Creates an InputConfig message from a plain object. Also converts values to their respective internal types. + * Creates an AsyncBatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.InputConfig + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.InputConfig} InputConfig + * @returns {google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest} AsyncBatchAnnotateImagesRequest */ - InputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.InputConfig) + AsyncBatchAnnotateImagesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest) return object; - var message = new $root.google.cloud.vision.v1.InputConfig(); - if (object.gcsSource != null) { - if (typeof object.gcsSource !== "object") - throw TypeError(".google.cloud.vision.v1.InputConfig.gcsSource: object expected"); - message.gcsSource = $root.google.cloud.vision.v1.GcsSource.fromObject(object.gcsSource); + var message = new $root.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest(); + if (object.requests) { + if (!Array.isArray(object.requests)) + throw TypeError(".google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest.requests: array expected"); + message.requests = []; + for (var i = 0; i < object.requests.length; ++i) { + if (typeof object.requests[i] !== "object") + throw TypeError(".google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest.requests: object expected"); + message.requests[i] = $root.google.cloud.vision.v1.AnnotateImageRequest.fromObject(object.requests[i]); + } } - if (object.content != null) - if (typeof object.content === "string") - $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); - else if (object.content.length) - message.content = object.content; - if (object.mimeType != null) - message.mimeType = String(object.mimeType); + if (object.outputConfig != null) { + if (typeof object.outputConfig !== "object") + throw TypeError(".google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest.outputConfig: object expected"); + message.outputConfig = $root.google.cloud.vision.v1.OutputConfig.fromObject(object.outputConfig); + } + if (object.parent != null) + message.parent = String(object.parent); return message; }; /** - * Creates a plain object from an InputConfig message. Also converts values to other types if specified. + * Creates a plain object from an AsyncBatchAnnotateImagesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.InputConfig + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest * @static - * @param {google.cloud.vision.v1.InputConfig} message InputConfig + * @param {google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest} message AsyncBatchAnnotateImagesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - InputConfig.toObject = function toObject(message, options) { + AsyncBatchAnnotateImagesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.requests = []; if (options.defaults) { - object.gcsSource = null; - object.mimeType = ""; - if (options.bytes === String) - object.content = ""; - else { - object.content = []; - if (options.bytes !== Array) - object.content = $util.newBuffer(object.content); - } + object.outputConfig = null; + object.parent = ""; } - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) - object.gcsSource = $root.google.cloud.vision.v1.GcsSource.toObject(message.gcsSource, options); - if (message.mimeType != null && message.hasOwnProperty("mimeType")) - object.mimeType = message.mimeType; - if (message.content != null && message.hasOwnProperty("content")) - object.content = options.bytes === String ? $util.base64.encode(message.content, 0, message.content.length) : options.bytes === Array ? Array.prototype.slice.call(message.content) : message.content; + if (message.requests && message.requests.length) { + object.requests = []; + for (var j = 0; j < message.requests.length; ++j) + object.requests[j] = $root.google.cloud.vision.v1.AnnotateImageRequest.toObject(message.requests[j], options); + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + object.outputConfig = $root.google.cloud.vision.v1.OutputConfig.toObject(message.outputConfig, options); + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; return object; }; /** - * Converts this InputConfig to JSON. + * Converts this AsyncBatchAnnotateImagesRequest to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.InputConfig + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest * @instance * @returns {Object.} JSON object */ - InputConfig.prototype.toJSON = function toJSON() { + AsyncBatchAnnotateImagesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return InputConfig; + return AsyncBatchAnnotateImagesRequest; })(); - v1.OutputConfig = (function() { + v1.AsyncBatchAnnotateImagesResponse = (function() { /** - * Properties of an OutputConfig. + * Properties of an AsyncBatchAnnotateImagesResponse. * @memberof google.cloud.vision.v1 - * @interface IOutputConfig - * @property {google.cloud.vision.v1.IGcsDestination|null} [gcsDestination] OutputConfig gcsDestination - * @property {number|null} [batchSize] OutputConfig batchSize + * @interface IAsyncBatchAnnotateImagesResponse + * @property {google.cloud.vision.v1.IOutputConfig|null} [outputConfig] AsyncBatchAnnotateImagesResponse outputConfig */ /** - * Constructs a new OutputConfig. + * Constructs a new AsyncBatchAnnotateImagesResponse. * @memberof google.cloud.vision.v1 - * @classdesc Represents an OutputConfig. - * @implements IOutputConfig + * @classdesc Represents an AsyncBatchAnnotateImagesResponse. + * @implements IAsyncBatchAnnotateImagesResponse * @constructor - * @param {google.cloud.vision.v1.IOutputConfig=} [properties] Properties to set + * @param {google.cloud.vision.v1.IAsyncBatchAnnotateImagesResponse=} [properties] Properties to set */ - function OutputConfig(properties) { + function AsyncBatchAnnotateImagesResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -10211,88 +10237,75 @@ } /** - * OutputConfig gcsDestination. - * @member {google.cloud.vision.v1.IGcsDestination|null|undefined} gcsDestination - * @memberof google.cloud.vision.v1.OutputConfig - * @instance - */ - OutputConfig.prototype.gcsDestination = null; - - /** - * OutputConfig batchSize. - * @member {number} batchSize - * @memberof google.cloud.vision.v1.OutputConfig + * AsyncBatchAnnotateImagesResponse outputConfig. + * @member {google.cloud.vision.v1.IOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse * @instance */ - OutputConfig.prototype.batchSize = 0; + AsyncBatchAnnotateImagesResponse.prototype.outputConfig = null; /** - * Creates a new OutputConfig instance using the specified properties. + * Creates a new AsyncBatchAnnotateImagesResponse instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.OutputConfig + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse * @static - * @param {google.cloud.vision.v1.IOutputConfig=} [properties] Properties to set - * @returns {google.cloud.vision.v1.OutputConfig} OutputConfig instance + * @param {google.cloud.vision.v1.IAsyncBatchAnnotateImagesResponse=} [properties] Properties to set + * @returns {google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse} AsyncBatchAnnotateImagesResponse instance */ - OutputConfig.create = function create(properties) { - return new OutputConfig(properties); + AsyncBatchAnnotateImagesResponse.create = function create(properties) { + return new AsyncBatchAnnotateImagesResponse(properties); }; /** - * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.vision.v1.OutputConfig.verify|verify} messages. + * Encodes the specified AsyncBatchAnnotateImagesResponse message. Does not implicitly {@link google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.OutputConfig + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse * @static - * @param {google.cloud.vision.v1.IOutputConfig} message OutputConfig message or plain object to encode + * @param {google.cloud.vision.v1.IAsyncBatchAnnotateImagesResponse} message AsyncBatchAnnotateImagesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OutputConfig.encode = function encode(message, writer) { + AsyncBatchAnnotateImagesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) - $root.google.cloud.vision.v1.GcsDestination.encode(message.gcsDestination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.batchSize != null && message.hasOwnProperty("batchSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.batchSize); + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + $root.google.cloud.vision.v1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified OutputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1.OutputConfig.verify|verify} messages. + * Encodes the specified AsyncBatchAnnotateImagesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.OutputConfig + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse * @static - * @param {google.cloud.vision.v1.IOutputConfig} message OutputConfig message or plain object to encode + * @param {google.cloud.vision.v1.IAsyncBatchAnnotateImagesResponse} message AsyncBatchAnnotateImagesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OutputConfig.encodeDelimited = function encodeDelimited(message, writer) { + AsyncBatchAnnotateImagesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an OutputConfig message from the specified reader or buffer. + * Decodes an AsyncBatchAnnotateImagesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.OutputConfig + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.OutputConfig} OutputConfig + * @returns {google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse} AsyncBatchAnnotateImagesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OutputConfig.decode = function decode(reader, length) { + AsyncBatchAnnotateImagesResponse.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.vision.v1.OutputConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.gcsDestination = $root.google.cloud.vision.v1.GcsDestination.decode(reader, reader.uint32()); - break; - case 2: - message.batchSize = reader.int32(); + message.outputConfig = $root.google.cloud.vision.v1.OutputConfig.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -10303,121 +10316,114 @@ }; /** - * Decodes an OutputConfig message from the specified reader or buffer, length delimited. + * Decodes an AsyncBatchAnnotateImagesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.OutputConfig + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.OutputConfig} OutputConfig + * @returns {google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse} AsyncBatchAnnotateImagesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OutputConfig.decodeDelimited = function decodeDelimited(reader) { + AsyncBatchAnnotateImagesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an OutputConfig message. + * Verifies an AsyncBatchAnnotateImagesResponse message. * @function verify - * @memberof google.cloud.vision.v1.OutputConfig + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - OutputConfig.verify = function verify(message) { + AsyncBatchAnnotateImagesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { - var error = $root.google.cloud.vision.v1.GcsDestination.verify(message.gcsDestination); + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + var error = $root.google.cloud.vision.v1.OutputConfig.verify(message.outputConfig); if (error) - return "gcsDestination." + error; + return "outputConfig." + error; } - if (message.batchSize != null && message.hasOwnProperty("batchSize")) - if (!$util.isInteger(message.batchSize)) - return "batchSize: integer expected"; return null; }; /** - * Creates an OutputConfig message from a plain object. Also converts values to their respective internal types. + * Creates an AsyncBatchAnnotateImagesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.OutputConfig + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.OutputConfig} OutputConfig + * @returns {google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse} AsyncBatchAnnotateImagesResponse */ - OutputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.OutputConfig) + AsyncBatchAnnotateImagesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse) return object; - var message = new $root.google.cloud.vision.v1.OutputConfig(); - if (object.gcsDestination != null) { - if (typeof object.gcsDestination !== "object") - throw TypeError(".google.cloud.vision.v1.OutputConfig.gcsDestination: object expected"); - message.gcsDestination = $root.google.cloud.vision.v1.GcsDestination.fromObject(object.gcsDestination); + var message = new $root.google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse(); + if (object.outputConfig != null) { + if (typeof object.outputConfig !== "object") + throw TypeError(".google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse.outputConfig: object expected"); + message.outputConfig = $root.google.cloud.vision.v1.OutputConfig.fromObject(object.outputConfig); } - if (object.batchSize != null) - message.batchSize = object.batchSize | 0; return message; }; /** - * Creates a plain object from an OutputConfig message. Also converts values to other types if specified. + * Creates a plain object from an AsyncBatchAnnotateImagesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.OutputConfig + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse * @static - * @param {google.cloud.vision.v1.OutputConfig} message OutputConfig + * @param {google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse} message AsyncBatchAnnotateImagesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - OutputConfig.toObject = function toObject(message, options) { + AsyncBatchAnnotateImagesResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.gcsDestination = null; - object.batchSize = 0; - } - if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) - object.gcsDestination = $root.google.cloud.vision.v1.GcsDestination.toObject(message.gcsDestination, options); - if (message.batchSize != null && message.hasOwnProperty("batchSize")) - object.batchSize = message.batchSize; + if (options.defaults) + object.outputConfig = null; + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + object.outputConfig = $root.google.cloud.vision.v1.OutputConfig.toObject(message.outputConfig, options); return object; }; /** - * Converts this OutputConfig to JSON. + * Converts this AsyncBatchAnnotateImagesResponse to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.OutputConfig + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse * @instance * @returns {Object.} JSON object */ - OutputConfig.prototype.toJSON = function toJSON() { + AsyncBatchAnnotateImagesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return OutputConfig; + return AsyncBatchAnnotateImagesResponse; })(); - v1.GcsSource = (function() { + v1.AsyncBatchAnnotateFilesRequest = (function() { /** - * Properties of a GcsSource. + * Properties of an AsyncBatchAnnotateFilesRequest. * @memberof google.cloud.vision.v1 - * @interface IGcsSource - * @property {string|null} [uri] GcsSource uri + * @interface IAsyncBatchAnnotateFilesRequest + * @property {Array.|null} [requests] AsyncBatchAnnotateFilesRequest requests + * @property {string|null} [parent] AsyncBatchAnnotateFilesRequest parent */ /** - * Constructs a new GcsSource. + * Constructs a new AsyncBatchAnnotateFilesRequest. * @memberof google.cloud.vision.v1 - * @classdesc Represents a GcsSource. - * @implements IGcsSource + * @classdesc Represents an AsyncBatchAnnotateFilesRequest. + * @implements IAsyncBatchAnnotateFilesRequest * @constructor - * @param {google.cloud.vision.v1.IGcsSource=} [properties] Properties to set + * @param {google.cloud.vision.v1.IAsyncBatchAnnotateFilesRequest=} [properties] Properties to set */ - function GcsSource(properties) { + function AsyncBatchAnnotateFilesRequest(properties) { + this.requests = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -10425,75 +10431,91 @@ } /** - * GcsSource uri. - * @member {string} uri - * @memberof google.cloud.vision.v1.GcsSource + * AsyncBatchAnnotateFilesRequest requests. + * @member {Array.} requests + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest * @instance */ - GcsSource.prototype.uri = ""; + AsyncBatchAnnotateFilesRequest.prototype.requests = $util.emptyArray; /** - * Creates a new GcsSource instance using the specified properties. + * AsyncBatchAnnotateFilesRequest parent. + * @member {string} parent + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest + * @instance + */ + AsyncBatchAnnotateFilesRequest.prototype.parent = ""; + + /** + * Creates a new AsyncBatchAnnotateFilesRequest instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.GcsSource + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest * @static - * @param {google.cloud.vision.v1.IGcsSource=} [properties] Properties to set - * @returns {google.cloud.vision.v1.GcsSource} GcsSource instance + * @param {google.cloud.vision.v1.IAsyncBatchAnnotateFilesRequest=} [properties] Properties to set + * @returns {google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest instance */ - GcsSource.create = function create(properties) { - return new GcsSource(properties); + AsyncBatchAnnotateFilesRequest.create = function create(properties) { + return new AsyncBatchAnnotateFilesRequest(properties); }; /** - * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.vision.v1.GcsSource.verify|verify} messages. + * Encodes the specified AsyncBatchAnnotateFilesRequest message. Does not implicitly {@link google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.GcsSource + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest * @static - * @param {google.cloud.vision.v1.IGcsSource} message GcsSource message or plain object to encode + * @param {google.cloud.vision.v1.IAsyncBatchAnnotateFilesRequest} message AsyncBatchAnnotateFilesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsSource.encode = function encode(message, writer) { + AsyncBatchAnnotateFilesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.uri != null && message.hasOwnProperty("uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.requests != null && message.requests.length) + for (var i = 0; i < message.requests.length; ++i) + $root.google.cloud.vision.v1.AsyncAnnotateFileRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.parent != null && message.hasOwnProperty("parent")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.parent); return writer; }; /** - * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1.GcsSource.verify|verify} messages. + * Encodes the specified AsyncBatchAnnotateFilesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.GcsSource + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest * @static - * @param {google.cloud.vision.v1.IGcsSource} message GcsSource message or plain object to encode + * @param {google.cloud.vision.v1.IAsyncBatchAnnotateFilesRequest} message AsyncBatchAnnotateFilesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsSource.encodeDelimited = function encodeDelimited(message, writer) { + AsyncBatchAnnotateFilesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GcsSource message from the specified reader or buffer. + * Decodes an AsyncBatchAnnotateFilesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.GcsSource + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.GcsSource} GcsSource + * @returns {google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsSource.decode = function decode(reader, length) { + AsyncBatchAnnotateFilesRequest.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.vision.v1.GcsSource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.uri = reader.string(); + if (!(message.requests && message.requests.length)) + message.requests = []; + message.requests.push($root.google.cloud.vision.v1.AsyncAnnotateFileRequest.decode(reader, reader.uint32())); + break; + case 4: + message.parent = reader.string(); break; default: reader.skipType(tag & 7); @@ -10504,107 +10526,134 @@ }; /** - * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * Decodes an AsyncBatchAnnotateFilesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.GcsSource + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.GcsSource} GcsSource + * @returns {google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsSource.decodeDelimited = function decodeDelimited(reader) { + AsyncBatchAnnotateFilesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GcsSource message. + * Verifies an AsyncBatchAnnotateFilesRequest message. * @function verify - * @memberof google.cloud.vision.v1.GcsSource + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GcsSource.verify = function verify(message) { + AsyncBatchAnnotateFilesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; + if (message.requests != null && message.hasOwnProperty("requests")) { + if (!Array.isArray(message.requests)) + return "requests: array expected"; + for (var i = 0; i < message.requests.length; ++i) { + var error = $root.google.cloud.vision.v1.AsyncAnnotateFileRequest.verify(message.requests[i]); + if (error) + return "requests." + error; + } + } + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; return null; }; /** - * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * Creates an AsyncBatchAnnotateFilesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.GcsSource + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.GcsSource} GcsSource + * @returns {google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest */ - GcsSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.GcsSource) + AsyncBatchAnnotateFilesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest) return object; - var message = new $root.google.cloud.vision.v1.GcsSource(); - if (object.uri != null) - message.uri = String(object.uri); + var message = new $root.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest(); + if (object.requests) { + if (!Array.isArray(object.requests)) + throw TypeError(".google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest.requests: array expected"); + message.requests = []; + for (var i = 0; i < object.requests.length; ++i) { + if (typeof object.requests[i] !== "object") + throw TypeError(".google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest.requests: object expected"); + message.requests[i] = $root.google.cloud.vision.v1.AsyncAnnotateFileRequest.fromObject(object.requests[i]); + } + } + if (object.parent != null) + message.parent = String(object.parent); return message; }; /** - * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * Creates a plain object from an AsyncBatchAnnotateFilesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.GcsSource + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest * @static - * @param {google.cloud.vision.v1.GcsSource} message GcsSource + * @param {google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest} message AsyncBatchAnnotateFilesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GcsSource.toObject = function toObject(message, options) { + AsyncBatchAnnotateFilesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.requests = []; if (options.defaults) - object.uri = ""; - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; + object.parent = ""; + if (message.requests && message.requests.length) { + object.requests = []; + for (var j = 0; j < message.requests.length; ++j) + object.requests[j] = $root.google.cloud.vision.v1.AsyncAnnotateFileRequest.toObject(message.requests[j], options); + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; return object; }; /** - * Converts this GcsSource to JSON. + * Converts this AsyncBatchAnnotateFilesRequest to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.GcsSource + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest * @instance * @returns {Object.} JSON object */ - GcsSource.prototype.toJSON = function toJSON() { + AsyncBatchAnnotateFilesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GcsSource; + return AsyncBatchAnnotateFilesRequest; })(); - v1.GcsDestination = (function() { + v1.AsyncBatchAnnotateFilesResponse = (function() { /** - * Properties of a GcsDestination. + * Properties of an AsyncBatchAnnotateFilesResponse. * @memberof google.cloud.vision.v1 - * @interface IGcsDestination - * @property {string|null} [uri] GcsDestination uri + * @interface IAsyncBatchAnnotateFilesResponse + * @property {Array.|null} [responses] AsyncBatchAnnotateFilesResponse responses */ /** - * Constructs a new GcsDestination. + * Constructs a new AsyncBatchAnnotateFilesResponse. * @memberof google.cloud.vision.v1 - * @classdesc Represents a GcsDestination. - * @implements IGcsDestination + * @classdesc Represents an AsyncBatchAnnotateFilesResponse. + * @implements IAsyncBatchAnnotateFilesResponse * @constructor - * @param {google.cloud.vision.v1.IGcsDestination=} [properties] Properties to set + * @param {google.cloud.vision.v1.IAsyncBatchAnnotateFilesResponse=} [properties] Properties to set */ - function GcsDestination(properties) { + function AsyncBatchAnnotateFilesResponse(properties) { + this.responses = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -10612,75 +10661,78 @@ } /** - * GcsDestination uri. - * @member {string} uri - * @memberof google.cloud.vision.v1.GcsDestination + * AsyncBatchAnnotateFilesResponse responses. + * @member {Array.} responses + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse * @instance */ - GcsDestination.prototype.uri = ""; + AsyncBatchAnnotateFilesResponse.prototype.responses = $util.emptyArray; /** - * Creates a new GcsDestination instance using the specified properties. + * Creates a new AsyncBatchAnnotateFilesResponse instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.GcsDestination + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse * @static - * @param {google.cloud.vision.v1.IGcsDestination=} [properties] Properties to set - * @returns {google.cloud.vision.v1.GcsDestination} GcsDestination instance + * @param {google.cloud.vision.v1.IAsyncBatchAnnotateFilesResponse=} [properties] Properties to set + * @returns {google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse instance */ - GcsDestination.create = function create(properties) { - return new GcsDestination(properties); + AsyncBatchAnnotateFilesResponse.create = function create(properties) { + return new AsyncBatchAnnotateFilesResponse(properties); }; /** - * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.vision.v1.GcsDestination.verify|verify} messages. + * Encodes the specified AsyncBatchAnnotateFilesResponse message. Does not implicitly {@link google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.GcsDestination + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse * @static - * @param {google.cloud.vision.v1.IGcsDestination} message GcsDestination message or plain object to encode + * @param {google.cloud.vision.v1.IAsyncBatchAnnotateFilesResponse} message AsyncBatchAnnotateFilesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsDestination.encode = function encode(message, writer) { + AsyncBatchAnnotateFilesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.uri != null && message.hasOwnProperty("uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.responses != null && message.responses.length) + for (var i = 0; i < message.responses.length; ++i) + $root.google.cloud.vision.v1.AsyncAnnotateFileResponse.encode(message.responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.vision.v1.GcsDestination.verify|verify} messages. + * Encodes the specified AsyncBatchAnnotateFilesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.GcsDestination + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse * @static - * @param {google.cloud.vision.v1.IGcsDestination} message GcsDestination message or plain object to encode + * @param {google.cloud.vision.v1.IAsyncBatchAnnotateFilesResponse} message AsyncBatchAnnotateFilesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsDestination.encodeDelimited = function encodeDelimited(message, writer) { + AsyncBatchAnnotateFilesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GcsDestination message from the specified reader or buffer. + * Decodes an AsyncBatchAnnotateFilesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.GcsDestination + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.GcsDestination} GcsDestination + * @returns {google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsDestination.decode = function decode(reader, length) { + AsyncBatchAnnotateFilesResponse.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.vision.v1.GcsDestination(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.uri = reader.string(); + if (!(message.responses && message.responses.length)) + message.responses = []; + message.responses.push($root.google.cloud.vision.v1.AsyncAnnotateFileResponse.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -10691,109 +10743,126 @@ }; /** - * Decodes a GcsDestination message from the specified reader or buffer, length delimited. + * Decodes an AsyncBatchAnnotateFilesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.GcsDestination + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.GcsDestination} GcsDestination + * @returns {google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsDestination.decodeDelimited = function decodeDelimited(reader) { + AsyncBatchAnnotateFilesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GcsDestination message. + * Verifies an AsyncBatchAnnotateFilesResponse message. * @function verify - * @memberof google.cloud.vision.v1.GcsDestination + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GcsDestination.verify = function verify(message) { + AsyncBatchAnnotateFilesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; + if (message.responses != null && message.hasOwnProperty("responses")) { + if (!Array.isArray(message.responses)) + return "responses: array expected"; + for (var i = 0; i < message.responses.length; ++i) { + var error = $root.google.cloud.vision.v1.AsyncAnnotateFileResponse.verify(message.responses[i]); + if (error) + return "responses." + error; + } + } return null; }; /** - * Creates a GcsDestination message from a plain object. Also converts values to their respective internal types. + * Creates an AsyncBatchAnnotateFilesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.GcsDestination + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.GcsDestination} GcsDestination + * @returns {google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse */ - GcsDestination.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.GcsDestination) + AsyncBatchAnnotateFilesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse) return object; - var message = new $root.google.cloud.vision.v1.GcsDestination(); - if (object.uri != null) - message.uri = String(object.uri); + var message = new $root.google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse(); + if (object.responses) { + if (!Array.isArray(object.responses)) + throw TypeError(".google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse.responses: array expected"); + message.responses = []; + for (var i = 0; i < object.responses.length; ++i) { + if (typeof object.responses[i] !== "object") + throw TypeError(".google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse.responses: object expected"); + message.responses[i] = $root.google.cloud.vision.v1.AsyncAnnotateFileResponse.fromObject(object.responses[i]); + } + } return message; }; /** - * Creates a plain object from a GcsDestination message. Also converts values to other types if specified. + * Creates a plain object from an AsyncBatchAnnotateFilesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.GcsDestination + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse * @static - * @param {google.cloud.vision.v1.GcsDestination} message GcsDestination + * @param {google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse} message AsyncBatchAnnotateFilesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GcsDestination.toObject = function toObject(message, options) { + AsyncBatchAnnotateFilesResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.uri = ""; - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; + if (options.arrays || options.defaults) + object.responses = []; + if (message.responses && message.responses.length) { + object.responses = []; + for (var j = 0; j < message.responses.length; ++j) + object.responses[j] = $root.google.cloud.vision.v1.AsyncAnnotateFileResponse.toObject(message.responses[j], options); + } return object; }; /** - * Converts this GcsDestination to JSON. + * Converts this AsyncBatchAnnotateFilesResponse to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.GcsDestination + * @memberof google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse * @instance * @returns {Object.} JSON object */ - GcsDestination.prototype.toJSON = function toJSON() { + AsyncBatchAnnotateFilesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GcsDestination; + return AsyncBatchAnnotateFilesResponse; })(); - v1.OperationMetadata = (function() { + v1.InputConfig = (function() { /** - * Properties of an OperationMetadata. + * Properties of an InputConfig. * @memberof google.cloud.vision.v1 - * @interface IOperationMetadata - * @property {google.cloud.vision.v1.OperationMetadata.State|null} [state] OperationMetadata state - * @property {google.protobuf.ITimestamp|null} [createTime] OperationMetadata createTime - * @property {google.protobuf.ITimestamp|null} [updateTime] OperationMetadata updateTime + * @interface IInputConfig + * @property {google.cloud.vision.v1.IGcsSource|null} [gcsSource] InputConfig gcsSource + * @property {Uint8Array|null} [content] InputConfig content + * @property {string|null} [mimeType] InputConfig mimeType */ /** - * Constructs a new OperationMetadata. + * Constructs a new InputConfig. * @memberof google.cloud.vision.v1 - * @classdesc Represents an OperationMetadata. - * @implements IOperationMetadata + * @classdesc Represents an InputConfig. + * @implements IInputConfig * @constructor - * @param {google.cloud.vision.v1.IOperationMetadata=} [properties] Properties to set + * @param {google.cloud.vision.v1.IInputConfig=} [properties] Properties to set */ - function OperationMetadata(properties) { + function InputConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -10801,101 +10870,101 @@ } /** - * OperationMetadata state. - * @member {google.cloud.vision.v1.OperationMetadata.State} state - * @memberof google.cloud.vision.v1.OperationMetadata + * InputConfig gcsSource. + * @member {google.cloud.vision.v1.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.vision.v1.InputConfig * @instance */ - OperationMetadata.prototype.state = 0; + InputConfig.prototype.gcsSource = null; /** - * OperationMetadata createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.vision.v1.OperationMetadata + * InputConfig content. + * @member {Uint8Array} content + * @memberof google.cloud.vision.v1.InputConfig * @instance */ - OperationMetadata.prototype.createTime = null; + InputConfig.prototype.content = $util.newBuffer([]); /** - * OperationMetadata updateTime. - * @member {google.protobuf.ITimestamp|null|undefined} updateTime - * @memberof google.cloud.vision.v1.OperationMetadata + * InputConfig mimeType. + * @member {string} mimeType + * @memberof google.cloud.vision.v1.InputConfig * @instance */ - OperationMetadata.prototype.updateTime = null; + InputConfig.prototype.mimeType = ""; /** - * Creates a new OperationMetadata instance using the specified properties. + * Creates a new InputConfig instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.OperationMetadata + * @memberof google.cloud.vision.v1.InputConfig * @static - * @param {google.cloud.vision.v1.IOperationMetadata=} [properties] Properties to set - * @returns {google.cloud.vision.v1.OperationMetadata} OperationMetadata instance + * @param {google.cloud.vision.v1.IInputConfig=} [properties] Properties to set + * @returns {google.cloud.vision.v1.InputConfig} InputConfig instance */ - OperationMetadata.create = function create(properties) { - return new OperationMetadata(properties); + InputConfig.create = function create(properties) { + return new InputConfig(properties); }; /** - * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.vision.v1.OperationMetadata.verify|verify} messages. + * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.vision.v1.InputConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.OperationMetadata + * @memberof google.cloud.vision.v1.InputConfig * @static - * @param {google.cloud.vision.v1.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {google.cloud.vision.v1.IInputConfig} message InputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OperationMetadata.encode = function encode(message, writer) { + InputConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.state != null && message.hasOwnProperty("state")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); - if (message.createTime != null && message.hasOwnProperty("createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.updateTime != null && message.hasOwnProperty("updateTime")) - $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) + $root.google.cloud.vision.v1.GcsSource.encode(message.gcsSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimeType); + if (message.content != null && message.hasOwnProperty("content")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.content); return writer; }; /** - * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.vision.v1.OperationMetadata.verify|verify} messages. + * Encodes the specified InputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1.InputConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.OperationMetadata + * @memberof google.cloud.vision.v1.InputConfig * @static - * @param {google.cloud.vision.v1.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {google.cloud.vision.v1.IInputConfig} message InputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + InputConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an OperationMetadata message from the specified reader or buffer. + * Decodes an InputConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.OperationMetadata + * @memberof google.cloud.vision.v1.InputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.OperationMetadata} OperationMetadata + * @returns {google.cloud.vision.v1.InputConfig} InputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OperationMetadata.decode = function decode(reader, length) { + InputConfig.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.vision.v1.OperationMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.InputConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.state = reader.int32(); + message.gcsSource = $root.google.cloud.vision.v1.GcsSource.decode(reader, reader.uint32()); break; - case 5: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + case 3: + message.content = reader.bytes(); break; - case 6: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + case 2: + message.mimeType = reader.string(); break; default: reader.skipType(tag & 7); @@ -10906,183 +10975,139 @@ }; /** - * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. + * Decodes an InputConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.OperationMetadata + * @memberof google.cloud.vision.v1.InputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.OperationMetadata} OperationMetadata + * @returns {google.cloud.vision.v1.InputConfig} InputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OperationMetadata.decodeDelimited = function decodeDelimited(reader) { + InputConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an OperationMetadata message. + * Verifies an InputConfig message. * @function verify - * @memberof google.cloud.vision.v1.OperationMetadata + * @memberof google.cloud.vision.v1.InputConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - OperationMetadata.verify = function verify(message) { + InputConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.state != null && message.hasOwnProperty("state")) - switch (message.state) { - default: - return "state: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; - } - if (message.createTime != null && message.hasOwnProperty("createTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.createTime); - if (error) - return "createTime." + error; - } - if (message.updateTime != null && message.hasOwnProperty("updateTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + var error = $root.google.cloud.vision.v1.GcsSource.verify(message.gcsSource); if (error) - return "updateTime." + error; + return "gcsSource." + error; } + if (message.content != null && message.hasOwnProperty("content")) + if (!(message.content && typeof message.content.length === "number" || $util.isString(message.content))) + return "content: buffer expected"; + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; return null; }; /** - * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. + * Creates an InputConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.OperationMetadata + * @memberof google.cloud.vision.v1.InputConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.OperationMetadata} OperationMetadata + * @returns {google.cloud.vision.v1.InputConfig} InputConfig */ - OperationMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.OperationMetadata) + InputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.InputConfig) return object; - var message = new $root.google.cloud.vision.v1.OperationMetadata(); - switch (object.state) { - case "STATE_UNSPECIFIED": - case 0: - message.state = 0; - break; - case "CREATED": - case 1: - message.state = 1; - break; - case "RUNNING": - case 2: - message.state = 2; - break; - case "DONE": - case 3: - message.state = 3; - break; - case "CANCELLED": - case 4: - message.state = 4; - break; - } - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.vision.v1.OperationMetadata.createTime: object expected"); - message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); - } - if (object.updateTime != null) { - if (typeof object.updateTime !== "object") - throw TypeError(".google.cloud.vision.v1.OperationMetadata.updateTime: object expected"); - message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + var message = new $root.google.cloud.vision.v1.InputConfig(); + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.vision.v1.InputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.vision.v1.GcsSource.fromObject(object.gcsSource); } + if (object.content != null) + if (typeof object.content === "string") + $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); + else if (object.content.length) + message.content = object.content; + if (object.mimeType != null) + message.mimeType = String(object.mimeType); return message; }; /** - * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. + * Creates a plain object from an InputConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.OperationMetadata + * @memberof google.cloud.vision.v1.InputConfig * @static - * @param {google.cloud.vision.v1.OperationMetadata} message OperationMetadata + * @param {google.cloud.vision.v1.InputConfig} message InputConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - OperationMetadata.toObject = function toObject(message, options) { + InputConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; - object.createTime = null; - object.updateTime = null; + object.gcsSource = null; + object.mimeType = ""; + if (options.bytes === String) + object.content = ""; + else { + object.content = []; + if (options.bytes !== Array) + object.content = $util.newBuffer(object.content); + } } - if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.vision.v1.OperationMetadata.State[message.state] : message.state; - if (message.createTime != null && message.hasOwnProperty("createTime")) - object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); - if (message.updateTime != null && message.hasOwnProperty("updateTime")) - object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) + object.gcsSource = $root.google.cloud.vision.v1.GcsSource.toObject(message.gcsSource, options); + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + if (message.content != null && message.hasOwnProperty("content")) + object.content = options.bytes === String ? $util.base64.encode(message.content, 0, message.content.length) : options.bytes === Array ? Array.prototype.slice.call(message.content) : message.content; return object; }; /** - * Converts this OperationMetadata to JSON. + * Converts this InputConfig to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.OperationMetadata + * @memberof google.cloud.vision.v1.InputConfig * @instance * @returns {Object.} JSON object */ - OperationMetadata.prototype.toJSON = function toJSON() { + InputConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * State enum. - * @name google.cloud.vision.v1.OperationMetadata.State - * @enum {string} - * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value - * @property {number} CREATED=1 CREATED value - * @property {number} RUNNING=2 RUNNING value - * @property {number} DONE=3 DONE value - * @property {number} CANCELLED=4 CANCELLED value - */ - OperationMetadata.State = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; - values[valuesById[1] = "CREATED"] = 1; - values[valuesById[2] = "RUNNING"] = 2; - values[valuesById[3] = "DONE"] = 3; - values[valuesById[4] = "CANCELLED"] = 4; - return values; - })(); - - return OperationMetadata; + return InputConfig; })(); - v1.Vertex = (function() { + v1.OutputConfig = (function() { /** - * Properties of a Vertex. + * Properties of an OutputConfig. * @memberof google.cloud.vision.v1 - * @interface IVertex - * @property {number|null} [x] Vertex x - * @property {number|null} [y] Vertex y + * @interface IOutputConfig + * @property {google.cloud.vision.v1.IGcsDestination|null} [gcsDestination] OutputConfig gcsDestination + * @property {number|null} [batchSize] OutputConfig batchSize */ /** - * Constructs a new Vertex. + * Constructs a new OutputConfig. * @memberof google.cloud.vision.v1 - * @classdesc Represents a Vertex. - * @implements IVertex + * @classdesc Represents an OutputConfig. + * @implements IOutputConfig * @constructor - * @param {google.cloud.vision.v1.IVertex=} [properties] Properties to set + * @param {google.cloud.vision.v1.IOutputConfig=} [properties] Properties to set */ - function Vertex(properties) { + function OutputConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -11090,88 +11115,88 @@ } /** - * Vertex x. - * @member {number} x - * @memberof google.cloud.vision.v1.Vertex + * OutputConfig gcsDestination. + * @member {google.cloud.vision.v1.IGcsDestination|null|undefined} gcsDestination + * @memberof google.cloud.vision.v1.OutputConfig * @instance */ - Vertex.prototype.x = 0; + OutputConfig.prototype.gcsDestination = null; /** - * Vertex y. - * @member {number} y - * @memberof google.cloud.vision.v1.Vertex + * OutputConfig batchSize. + * @member {number} batchSize + * @memberof google.cloud.vision.v1.OutputConfig * @instance */ - Vertex.prototype.y = 0; + OutputConfig.prototype.batchSize = 0; /** - * Creates a new Vertex instance using the specified properties. + * Creates a new OutputConfig instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.Vertex + * @memberof google.cloud.vision.v1.OutputConfig * @static - * @param {google.cloud.vision.v1.IVertex=} [properties] Properties to set - * @returns {google.cloud.vision.v1.Vertex} Vertex instance + * @param {google.cloud.vision.v1.IOutputConfig=} [properties] Properties to set + * @returns {google.cloud.vision.v1.OutputConfig} OutputConfig instance */ - Vertex.create = function create(properties) { - return new Vertex(properties); + OutputConfig.create = function create(properties) { + return new OutputConfig(properties); }; /** - * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.vision.v1.Vertex.verify|verify} messages. + * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.vision.v1.OutputConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.Vertex + * @memberof google.cloud.vision.v1.OutputConfig * @static - * @param {google.cloud.vision.v1.IVertex} message Vertex message or plain object to encode + * @param {google.cloud.vision.v1.IOutputConfig} message OutputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Vertex.encode = function encode(message, writer) { + OutputConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.x != null && message.hasOwnProperty("x")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.x); - if (message.y != null && message.hasOwnProperty("y")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.y); + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) + $root.google.cloud.vision.v1.GcsDestination.encode(message.gcsDestination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.batchSize != null && message.hasOwnProperty("batchSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.batchSize); return writer; }; /** - * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1.Vertex.verify|verify} messages. + * Encodes the specified OutputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1.OutputConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.Vertex + * @memberof google.cloud.vision.v1.OutputConfig * @static - * @param {google.cloud.vision.v1.IVertex} message Vertex message or plain object to encode + * @param {google.cloud.vision.v1.IOutputConfig} message OutputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Vertex.encodeDelimited = function encodeDelimited(message, writer) { + OutputConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Vertex message from the specified reader or buffer. + * Decodes an OutputConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.Vertex + * @memberof google.cloud.vision.v1.OutputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.Vertex} Vertex + * @returns {google.cloud.vision.v1.OutputConfig} OutputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Vertex.decode = function decode(reader, length) { + OutputConfig.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.vision.v1.Vertex(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.OutputConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.x = reader.int32(); + message.gcsDestination = $root.google.cloud.vision.v1.GcsDestination.decode(reader, reader.uint32()); break; case 2: - message.y = reader.int32(); + message.batchSize = reader.int32(); break; default: reader.skipType(tag & 7); @@ -11182,117 +11207,121 @@ }; /** - * Decodes a Vertex message from the specified reader or buffer, length delimited. + * Decodes an OutputConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.Vertex + * @memberof google.cloud.vision.v1.OutputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.Vertex} Vertex + * @returns {google.cloud.vision.v1.OutputConfig} OutputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Vertex.decodeDelimited = function decodeDelimited(reader) { + OutputConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Vertex message. + * Verifies an OutputConfig message. * @function verify - * @memberof google.cloud.vision.v1.Vertex + * @memberof google.cloud.vision.v1.OutputConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Vertex.verify = function verify(message) { + OutputConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.x != null && message.hasOwnProperty("x")) - if (!$util.isInteger(message.x)) - return "x: integer expected"; - if (message.y != null && message.hasOwnProperty("y")) - if (!$util.isInteger(message.y)) - return "y: integer expected"; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { + var error = $root.google.cloud.vision.v1.GcsDestination.verify(message.gcsDestination); + if (error) + return "gcsDestination." + error; + } + if (message.batchSize != null && message.hasOwnProperty("batchSize")) + if (!$util.isInteger(message.batchSize)) + return "batchSize: integer expected"; return null; }; /** - * Creates a Vertex message from a plain object. Also converts values to their respective internal types. + * Creates an OutputConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.Vertex + * @memberof google.cloud.vision.v1.OutputConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.Vertex} Vertex + * @returns {google.cloud.vision.v1.OutputConfig} OutputConfig */ - Vertex.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.Vertex) + OutputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.OutputConfig) return object; - var message = new $root.google.cloud.vision.v1.Vertex(); - if (object.x != null) - message.x = object.x | 0; - if (object.y != null) - message.y = object.y | 0; + var message = new $root.google.cloud.vision.v1.OutputConfig(); + if (object.gcsDestination != null) { + if (typeof object.gcsDestination !== "object") + throw TypeError(".google.cloud.vision.v1.OutputConfig.gcsDestination: object expected"); + message.gcsDestination = $root.google.cloud.vision.v1.GcsDestination.fromObject(object.gcsDestination); + } + if (object.batchSize != null) + message.batchSize = object.batchSize | 0; return message; }; /** - * Creates a plain object from a Vertex message. Also converts values to other types if specified. + * Creates a plain object from an OutputConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.Vertex + * @memberof google.cloud.vision.v1.OutputConfig * @static - * @param {google.cloud.vision.v1.Vertex} message Vertex + * @param {google.cloud.vision.v1.OutputConfig} message OutputConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Vertex.toObject = function toObject(message, options) { + OutputConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.x = 0; - object.y = 0; + object.gcsDestination = null; + object.batchSize = 0; } - if (message.x != null && message.hasOwnProperty("x")) - object.x = message.x; - if (message.y != null && message.hasOwnProperty("y")) - object.y = message.y; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) + object.gcsDestination = $root.google.cloud.vision.v1.GcsDestination.toObject(message.gcsDestination, options); + if (message.batchSize != null && message.hasOwnProperty("batchSize")) + object.batchSize = message.batchSize; return object; }; /** - * Converts this Vertex to JSON. + * Converts this OutputConfig to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.Vertex + * @memberof google.cloud.vision.v1.OutputConfig * @instance * @returns {Object.} JSON object */ - Vertex.prototype.toJSON = function toJSON() { + OutputConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Vertex; + return OutputConfig; })(); - v1.NormalizedVertex = (function() { + v1.GcsSource = (function() { /** - * Properties of a NormalizedVertex. + * Properties of a GcsSource. * @memberof google.cloud.vision.v1 - * @interface INormalizedVertex - * @property {number|null} [x] NormalizedVertex x - * @property {number|null} [y] NormalizedVertex y + * @interface IGcsSource + * @property {string|null} [uri] GcsSource uri */ /** - * Constructs a new NormalizedVertex. + * Constructs a new GcsSource. * @memberof google.cloud.vision.v1 - * @classdesc Represents a NormalizedVertex. - * @implements INormalizedVertex + * @classdesc Represents a GcsSource. + * @implements IGcsSource * @constructor - * @param {google.cloud.vision.v1.INormalizedVertex=} [properties] Properties to set + * @param {google.cloud.vision.v1.IGcsSource=} [properties] Properties to set */ - function NormalizedVertex(properties) { + function GcsSource(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -11300,88 +11329,75 @@ } /** - * NormalizedVertex x. - * @member {number} x - * @memberof google.cloud.vision.v1.NormalizedVertex - * @instance - */ - NormalizedVertex.prototype.x = 0; - - /** - * NormalizedVertex y. - * @member {number} y - * @memberof google.cloud.vision.v1.NormalizedVertex + * GcsSource uri. + * @member {string} uri + * @memberof google.cloud.vision.v1.GcsSource * @instance */ - NormalizedVertex.prototype.y = 0; + GcsSource.prototype.uri = ""; /** - * Creates a new NormalizedVertex instance using the specified properties. + * Creates a new GcsSource instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.NormalizedVertex + * @memberof google.cloud.vision.v1.GcsSource * @static - * @param {google.cloud.vision.v1.INormalizedVertex=} [properties] Properties to set - * @returns {google.cloud.vision.v1.NormalizedVertex} NormalizedVertex instance + * @param {google.cloud.vision.v1.IGcsSource=} [properties] Properties to set + * @returns {google.cloud.vision.v1.GcsSource} GcsSource instance */ - NormalizedVertex.create = function create(properties) { - return new NormalizedVertex(properties); + GcsSource.create = function create(properties) { + return new GcsSource(properties); }; /** - * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.vision.v1.NormalizedVertex.verify|verify} messages. + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.vision.v1.GcsSource.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.NormalizedVertex + * @memberof google.cloud.vision.v1.GcsSource * @static - * @param {google.cloud.vision.v1.INormalizedVertex} message NormalizedVertex message or plain object to encode + * @param {google.cloud.vision.v1.IGcsSource} message GcsSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - NormalizedVertex.encode = function encode(message, writer) { + GcsSource.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.x != null && message.hasOwnProperty("x")) - writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); - if (message.y != null && message.hasOwnProperty("y")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); + if (message.uri != null && message.hasOwnProperty("uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); return writer; }; /** - * Encodes the specified NormalizedVertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1.NormalizedVertex.verify|verify} messages. + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1.GcsSource.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.NormalizedVertex + * @memberof google.cloud.vision.v1.GcsSource * @static - * @param {google.cloud.vision.v1.INormalizedVertex} message NormalizedVertex message or plain object to encode + * @param {google.cloud.vision.v1.IGcsSource} message GcsSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - NormalizedVertex.encodeDelimited = function encodeDelimited(message, writer) { + GcsSource.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a NormalizedVertex message from the specified reader or buffer. + * Decodes a GcsSource message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.NormalizedVertex + * @memberof google.cloud.vision.v1.GcsSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.NormalizedVertex} NormalizedVertex + * @returns {google.cloud.vision.v1.GcsSource} GcsSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - NormalizedVertex.decode = function decode(reader, length) { + GcsSource.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.vision.v1.NormalizedVertex(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.GcsSource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.x = reader.float(); - break; - case 2: - message.y = reader.float(); + message.uri = reader.string(); break; default: reader.skipType(tag & 7); @@ -11392,119 +11408,107 @@ }; /** - * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. + * Decodes a GcsSource message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.NormalizedVertex + * @memberof google.cloud.vision.v1.GcsSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.NormalizedVertex} NormalizedVertex + * @returns {google.cloud.vision.v1.GcsSource} GcsSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - NormalizedVertex.decodeDelimited = function decodeDelimited(reader) { + GcsSource.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a NormalizedVertex message. + * Verifies a GcsSource message. * @function verify - * @memberof google.cloud.vision.v1.NormalizedVertex + * @memberof google.cloud.vision.v1.GcsSource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - NormalizedVertex.verify = function verify(message) { + GcsSource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.x != null && message.hasOwnProperty("x")) - if (typeof message.x !== "number") - return "x: number expected"; - if (message.y != null && message.hasOwnProperty("y")) - if (typeof message.y !== "number") - return "y: number expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; return null; }; /** - * Creates a NormalizedVertex message from a plain object. Also converts values to their respective internal types. + * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.NormalizedVertex + * @memberof google.cloud.vision.v1.GcsSource * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.NormalizedVertex} NormalizedVertex + * @returns {google.cloud.vision.v1.GcsSource} GcsSource */ - NormalizedVertex.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.NormalizedVertex) + GcsSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.GcsSource) return object; - var message = new $root.google.cloud.vision.v1.NormalizedVertex(); - if (object.x != null) - message.x = Number(object.x); - if (object.y != null) - message.y = Number(object.y); + var message = new $root.google.cloud.vision.v1.GcsSource(); + if (object.uri != null) + message.uri = String(object.uri); return message; }; /** - * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. + * Creates a plain object from a GcsSource message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.NormalizedVertex + * @memberof google.cloud.vision.v1.GcsSource * @static - * @param {google.cloud.vision.v1.NormalizedVertex} message NormalizedVertex + * @param {google.cloud.vision.v1.GcsSource} message GcsSource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - NormalizedVertex.toObject = function toObject(message, options) { + GcsSource.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.x = 0; - object.y = 0; - } - if (message.x != null && message.hasOwnProperty("x")) - object.x = options.json && !isFinite(message.x) ? String(message.x) : message.x; - if (message.y != null && message.hasOwnProperty("y")) - object.y = options.json && !isFinite(message.y) ? String(message.y) : message.y; + if (options.defaults) + object.uri = ""; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; return object; }; /** - * Converts this NormalizedVertex to JSON. + * Converts this GcsSource to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.NormalizedVertex + * @memberof google.cloud.vision.v1.GcsSource * @instance * @returns {Object.} JSON object */ - NormalizedVertex.prototype.toJSON = function toJSON() { + GcsSource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return NormalizedVertex; + return GcsSource; })(); - v1.BoundingPoly = (function() { + v1.GcsDestination = (function() { /** - * Properties of a BoundingPoly. + * Properties of a GcsDestination. * @memberof google.cloud.vision.v1 - * @interface IBoundingPoly - * @property {Array.|null} [vertices] BoundingPoly vertices - * @property {Array.|null} [normalizedVertices] BoundingPoly normalizedVertices + * @interface IGcsDestination + * @property {string|null} [uri] GcsDestination uri */ /** - * Constructs a new BoundingPoly. + * Constructs a new GcsDestination. * @memberof google.cloud.vision.v1 - * @classdesc Represents a BoundingPoly. - * @implements IBoundingPoly + * @classdesc Represents a GcsDestination. + * @implements IGcsDestination * @constructor - * @param {google.cloud.vision.v1.IBoundingPoly=} [properties] Properties to set + * @param {google.cloud.vision.v1.IGcsDestination=} [properties] Properties to set */ - function BoundingPoly(properties) { - this.vertices = []; - this.normalizedVertices = []; + function GcsDestination(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -11512,94 +11516,75 @@ } /** - * BoundingPoly vertices. - * @member {Array.} vertices - * @memberof google.cloud.vision.v1.BoundingPoly - * @instance - */ - BoundingPoly.prototype.vertices = $util.emptyArray; - - /** - * BoundingPoly normalizedVertices. - * @member {Array.} normalizedVertices - * @memberof google.cloud.vision.v1.BoundingPoly + * GcsDestination uri. + * @member {string} uri + * @memberof google.cloud.vision.v1.GcsDestination * @instance */ - BoundingPoly.prototype.normalizedVertices = $util.emptyArray; + GcsDestination.prototype.uri = ""; /** - * Creates a new BoundingPoly instance using the specified properties. + * Creates a new GcsDestination instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.BoundingPoly + * @memberof google.cloud.vision.v1.GcsDestination * @static - * @param {google.cloud.vision.v1.IBoundingPoly=} [properties] Properties to set - * @returns {google.cloud.vision.v1.BoundingPoly} BoundingPoly instance + * @param {google.cloud.vision.v1.IGcsDestination=} [properties] Properties to set + * @returns {google.cloud.vision.v1.GcsDestination} GcsDestination instance */ - BoundingPoly.create = function create(properties) { - return new BoundingPoly(properties); + GcsDestination.create = function create(properties) { + return new GcsDestination(properties); }; /** - * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.vision.v1.BoundingPoly.verify|verify} messages. + * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.vision.v1.GcsDestination.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.BoundingPoly + * @memberof google.cloud.vision.v1.GcsDestination * @static - * @param {google.cloud.vision.v1.IBoundingPoly} message BoundingPoly message or plain object to encode + * @param {google.cloud.vision.v1.IGcsDestination} message GcsDestination message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BoundingPoly.encode = function encode(message, writer) { + GcsDestination.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.vertices != null && message.vertices.length) - for (var i = 0; i < message.vertices.length; ++i) - $root.google.cloud.vision.v1.Vertex.encode(message.vertices[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.normalizedVertices != null && message.normalizedVertices.length) - for (var i = 0; i < message.normalizedVertices.length; ++i) - $root.google.cloud.vision.v1.NormalizedVertex.encode(message.normalizedVertices[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.uri != null && message.hasOwnProperty("uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); return writer; }; /** - * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.vision.v1.BoundingPoly.verify|verify} messages. + * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.vision.v1.GcsDestination.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.BoundingPoly + * @memberof google.cloud.vision.v1.GcsDestination * @static - * @param {google.cloud.vision.v1.IBoundingPoly} message BoundingPoly message or plain object to encode + * @param {google.cloud.vision.v1.IGcsDestination} message GcsDestination message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BoundingPoly.encodeDelimited = function encodeDelimited(message, writer) { + GcsDestination.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BoundingPoly message from the specified reader or buffer. + * Decodes a GcsDestination message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.BoundingPoly + * @memberof google.cloud.vision.v1.GcsDestination * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.BoundingPoly} BoundingPoly + * @returns {google.cloud.vision.v1.GcsDestination} GcsDestination * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BoundingPoly.decode = function decode(reader, length) { + GcsDestination.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.vision.v1.BoundingPoly(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.GcsDestination(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.vertices && message.vertices.length)) - message.vertices = []; - message.vertices.push($root.google.cloud.vision.v1.Vertex.decode(reader, reader.uint32())); - break; - case 2: - if (!(message.normalizedVertices && message.normalizedVertices.length)) - message.normalizedVertices = []; - message.normalizedVertices.push($root.google.cloud.vision.v1.NormalizedVertex.decode(reader, reader.uint32())); + message.uri = reader.string(); break; default: reader.skipType(tag & 7); @@ -11610,152 +11595,109 @@ }; /** - * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. + * Decodes a GcsDestination message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.BoundingPoly + * @memberof google.cloud.vision.v1.GcsDestination * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.BoundingPoly} BoundingPoly + * @returns {google.cloud.vision.v1.GcsDestination} GcsDestination * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BoundingPoly.decodeDelimited = function decodeDelimited(reader) { + GcsDestination.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BoundingPoly message. + * Verifies a GcsDestination message. * @function verify - * @memberof google.cloud.vision.v1.BoundingPoly + * @memberof google.cloud.vision.v1.GcsDestination * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BoundingPoly.verify = function verify(message) { + GcsDestination.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.vertices != null && message.hasOwnProperty("vertices")) { - if (!Array.isArray(message.vertices)) - return "vertices: array expected"; - for (var i = 0; i < message.vertices.length; ++i) { - var error = $root.google.cloud.vision.v1.Vertex.verify(message.vertices[i]); - if (error) - return "vertices." + error; - } - } - if (message.normalizedVertices != null && message.hasOwnProperty("normalizedVertices")) { - if (!Array.isArray(message.normalizedVertices)) - return "normalizedVertices: array expected"; - for (var i = 0; i < message.normalizedVertices.length; ++i) { - var error = $root.google.cloud.vision.v1.NormalizedVertex.verify(message.normalizedVertices[i]); - if (error) - return "normalizedVertices." + error; - } - } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; return null; }; /** - * Creates a BoundingPoly message from a plain object. Also converts values to their respective internal types. + * Creates a GcsDestination message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.BoundingPoly + * @memberof google.cloud.vision.v1.GcsDestination * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.BoundingPoly} BoundingPoly + * @returns {google.cloud.vision.v1.GcsDestination} GcsDestination */ - BoundingPoly.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.BoundingPoly) + GcsDestination.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.GcsDestination) return object; - var message = new $root.google.cloud.vision.v1.BoundingPoly(); - if (object.vertices) { - if (!Array.isArray(object.vertices)) - throw TypeError(".google.cloud.vision.v1.BoundingPoly.vertices: array expected"); - message.vertices = []; - for (var i = 0; i < object.vertices.length; ++i) { - if (typeof object.vertices[i] !== "object") - throw TypeError(".google.cloud.vision.v1.BoundingPoly.vertices: object expected"); - message.vertices[i] = $root.google.cloud.vision.v1.Vertex.fromObject(object.vertices[i]); - } - } - if (object.normalizedVertices) { - if (!Array.isArray(object.normalizedVertices)) - throw TypeError(".google.cloud.vision.v1.BoundingPoly.normalizedVertices: array expected"); - message.normalizedVertices = []; - for (var i = 0; i < object.normalizedVertices.length; ++i) { - if (typeof object.normalizedVertices[i] !== "object") - throw TypeError(".google.cloud.vision.v1.BoundingPoly.normalizedVertices: object expected"); - message.normalizedVertices[i] = $root.google.cloud.vision.v1.NormalizedVertex.fromObject(object.normalizedVertices[i]); - } - } + var message = new $root.google.cloud.vision.v1.GcsDestination(); + if (object.uri != null) + message.uri = String(object.uri); return message; }; /** - * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. + * Creates a plain object from a GcsDestination message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.BoundingPoly + * @memberof google.cloud.vision.v1.GcsDestination * @static - * @param {google.cloud.vision.v1.BoundingPoly} message BoundingPoly + * @param {google.cloud.vision.v1.GcsDestination} message GcsDestination * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BoundingPoly.toObject = function toObject(message, options) { + GcsDestination.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.vertices = []; - object.normalizedVertices = []; - } - if (message.vertices && message.vertices.length) { - object.vertices = []; - for (var j = 0; j < message.vertices.length; ++j) - object.vertices[j] = $root.google.cloud.vision.v1.Vertex.toObject(message.vertices[j], options); - } - if (message.normalizedVertices && message.normalizedVertices.length) { - object.normalizedVertices = []; - for (var j = 0; j < message.normalizedVertices.length; ++j) - object.normalizedVertices[j] = $root.google.cloud.vision.v1.NormalizedVertex.toObject(message.normalizedVertices[j], options); - } + if (options.defaults) + object.uri = ""; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; return object; }; /** - * Converts this BoundingPoly to JSON. + * Converts this GcsDestination to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.BoundingPoly + * @memberof google.cloud.vision.v1.GcsDestination * @instance * @returns {Object.} JSON object */ - BoundingPoly.prototype.toJSON = function toJSON() { + GcsDestination.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BoundingPoly; + return GcsDestination; })(); - v1.Position = (function() { + v1.OperationMetadata = (function() { /** - * Properties of a Position. + * Properties of an OperationMetadata. * @memberof google.cloud.vision.v1 - * @interface IPosition - * @property {number|null} [x] Position x - * @property {number|null} [y] Position y - * @property {number|null} [z] Position z + * @interface IOperationMetadata + * @property {google.cloud.vision.v1.OperationMetadata.State|null} [state] OperationMetadata state + * @property {google.protobuf.ITimestamp|null} [createTime] OperationMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] OperationMetadata updateTime */ /** - * Constructs a new Position. + * Constructs a new OperationMetadata. * @memberof google.cloud.vision.v1 - * @classdesc Represents a Position. - * @implements IPosition + * @classdesc Represents an OperationMetadata. + * @implements IOperationMetadata * @constructor - * @param {google.cloud.vision.v1.IPosition=} [properties] Properties to set + * @param {google.cloud.vision.v1.IOperationMetadata=} [properties] Properties to set */ - function Position(properties) { + function OperationMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -11763,101 +11705,101 @@ } /** - * Position x. - * @member {number} x - * @memberof google.cloud.vision.v1.Position + * OperationMetadata state. + * @member {google.cloud.vision.v1.OperationMetadata.State} state + * @memberof google.cloud.vision.v1.OperationMetadata * @instance */ - Position.prototype.x = 0; + OperationMetadata.prototype.state = 0; /** - * Position y. - * @member {number} y - * @memberof google.cloud.vision.v1.Position + * OperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.vision.v1.OperationMetadata * @instance */ - Position.prototype.y = 0; + OperationMetadata.prototype.createTime = null; /** - * Position z. - * @member {number} z - * @memberof google.cloud.vision.v1.Position + * OperationMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.vision.v1.OperationMetadata * @instance */ - Position.prototype.z = 0; + OperationMetadata.prototype.updateTime = null; /** - * Creates a new Position instance using the specified properties. + * Creates a new OperationMetadata instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1.Position + * @memberof google.cloud.vision.v1.OperationMetadata * @static - * @param {google.cloud.vision.v1.IPosition=} [properties] Properties to set - * @returns {google.cloud.vision.v1.Position} Position instance + * @param {google.cloud.vision.v1.IOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.vision.v1.OperationMetadata} OperationMetadata instance */ - Position.create = function create(properties) { - return new Position(properties); + OperationMetadata.create = function create(properties) { + return new OperationMetadata(properties); }; /** - * Encodes the specified Position message. Does not implicitly {@link google.cloud.vision.v1.Position.verify|verify} messages. + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.vision.v1.OperationMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1.Position + * @memberof google.cloud.vision.v1.OperationMetadata * @static - * @param {google.cloud.vision.v1.IPosition} message Position message or plain object to encode + * @param {google.cloud.vision.v1.IOperationMetadata} message OperationMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Position.encode = function encode(message, writer) { + OperationMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.x != null && message.hasOwnProperty("x")) - writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); - if (message.y != null && message.hasOwnProperty("y")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); - if (message.z != null && message.hasOwnProperty("z")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.z); + if (message.state != null && message.hasOwnProperty("state")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); + if (message.createTime != null && message.hasOwnProperty("createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); return writer; }; /** - * Encodes the specified Position message, length delimited. Does not implicitly {@link google.cloud.vision.v1.Position.verify|verify} messages. + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.vision.v1.OperationMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1.Position + * @memberof google.cloud.vision.v1.OperationMetadata * @static - * @param {google.cloud.vision.v1.IPosition} message Position message or plain object to encode + * @param {google.cloud.vision.v1.IOperationMetadata} message OperationMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Position.encodeDelimited = function encodeDelimited(message, writer) { + OperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Position message from the specified reader or buffer. + * Decodes an OperationMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1.Position + * @memberof google.cloud.vision.v1.OperationMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1.Position} Position + * @returns {google.cloud.vision.v1.OperationMetadata} OperationMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Position.decode = function decode(reader, length) { + OperationMetadata.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.vision.v1.Position(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1.OperationMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.x = reader.float(); + message.state = reader.int32(); break; - case 2: - message.y = reader.float(); + case 5: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; - case 3: - message.z = reader.float(); + case 6: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -11868,104 +11810,162 @@ }; /** - * Decodes a Position message from the specified reader or buffer, length delimited. + * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1.Position + * @memberof google.cloud.vision.v1.OperationMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1.Position} Position + * @returns {google.cloud.vision.v1.OperationMetadata} OperationMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Position.decodeDelimited = function decodeDelimited(reader) { + OperationMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Position message. + * Verifies an OperationMetadata message. * @function verify - * @memberof google.cloud.vision.v1.Position + * @memberof google.cloud.vision.v1.OperationMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Position.verify = function verify(message) { + OperationMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.x != null && message.hasOwnProperty("x")) - if (typeof message.x !== "number") - return "x: number expected"; - if (message.y != null && message.hasOwnProperty("y")) - if (typeof message.y !== "number") - return "y: number expected"; - if (message.z != null && message.hasOwnProperty("z")) - if (typeof message.z !== "number") - return "z: number expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } return null; }; /** - * Creates a Position message from a plain object. Also converts values to their respective internal types. + * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1.Position + * @memberof google.cloud.vision.v1.OperationMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1.Position} Position + * @returns {google.cloud.vision.v1.OperationMetadata} OperationMetadata */ - Position.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1.Position) + OperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1.OperationMetadata) return object; - var message = new $root.google.cloud.vision.v1.Position(); - if (object.x != null) - message.x = Number(object.x); - if (object.y != null) - message.y = Number(object.y); - if (object.z != null) - message.z = Number(object.z); + var message = new $root.google.cloud.vision.v1.OperationMetadata(); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "CREATED": + case 1: + message.state = 1; + break; + case "RUNNING": + case 2: + message.state = 2; + break; + case "DONE": + case 3: + message.state = 3; + break; + case "CANCELLED": + case 4: + message.state = 4; + break; + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.vision.v1.OperationMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.vision.v1.OperationMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } return message; }; /** - * Creates a plain object from a Position message. Also converts values to other types if specified. + * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1.Position + * @memberof google.cloud.vision.v1.OperationMetadata * @static - * @param {google.cloud.vision.v1.Position} message Position + * @param {google.cloud.vision.v1.OperationMetadata} message OperationMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Position.toObject = function toObject(message, options) { + OperationMetadata.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.x = 0; - object.y = 0; - object.z = 0; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.createTime = null; + object.updateTime = null; } - if (message.x != null && message.hasOwnProperty("x")) - object.x = options.json && !isFinite(message.x) ? String(message.x) : message.x; - if (message.y != null && message.hasOwnProperty("y")) - object.y = options.json && !isFinite(message.y) ? String(message.y) : message.y; - if (message.z != null && message.hasOwnProperty("z")) - object.z = options.json && !isFinite(message.z) ? String(message.z) : message.z; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.vision.v1.OperationMetadata.State[message.state] : message.state; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); return object; }; /** - * Converts this Position to JSON. + * Converts this OperationMetadata to JSON. * @function toJSON - * @memberof google.cloud.vision.v1.Position + * @memberof google.cloud.vision.v1.OperationMetadata * @instance * @returns {Object.} JSON object */ - Position.prototype.toJSON = function toJSON() { + OperationMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Position; + /** + * State enum. + * @name google.cloud.vision.v1.OperationMetadata.State + * @enum {string} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} CREATED=1 CREATED value + * @property {number} RUNNING=2 RUNNING value + * @property {number} DONE=3 DONE value + * @property {number} CANCELLED=4 CANCELLED value + */ + OperationMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "CREATED"] = 1; + values[valuesById[2] = "RUNNING"] = 2; + values[valuesById[3] = "DONE"] = 3; + values[valuesById[4] = "CANCELLED"] = 4; + return values; + })(); + + return OperationMetadata; })(); v1.ProductSearchParams = (function() { @@ -25030,94 +25030,25 @@ */ var v1p1beta1 = {}; - v1p1beta1.ImageAnnotator = (function() { - - /** - * Constructs a new ImageAnnotator service. - * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents an ImageAnnotator - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function ImageAnnotator(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (ImageAnnotator.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ImageAnnotator; - - /** - * Creates new ImageAnnotator service using the specified rpc implementation. - * @function create - * @memberof google.cloud.vision.v1p1beta1.ImageAnnotator - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {ImageAnnotator} RPC service. Useful where requests and/or responses are streamed. - */ - ImageAnnotator.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.vision.v1p1beta1.ImageAnnotator#batchAnnotateImages}. - * @memberof google.cloud.vision.v1p1beta1.ImageAnnotator - * @typedef BatchAnnotateImagesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse} [response] BatchAnnotateImagesResponse - */ - - /** - * Calls BatchAnnotateImages. - * @function batchAnnotateImages - * @memberof google.cloud.vision.v1p1beta1.ImageAnnotator - * @instance - * @param {google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest} request BatchAnnotateImagesRequest message or plain object - * @param {google.cloud.vision.v1p1beta1.ImageAnnotator.BatchAnnotateImagesCallback} callback Node-style callback called with the error, if any, and BatchAnnotateImagesResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ImageAnnotator.prototype.batchAnnotateImages = function batchAnnotateImages(request, callback) { - return this.rpcCall(batchAnnotateImages, $root.google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest, $root.google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse, request, callback); - }, "name", { value: "BatchAnnotateImages" }); - - /** - * Calls BatchAnnotateImages. - * @function batchAnnotateImages - * @memberof google.cloud.vision.v1p1beta1.ImageAnnotator - * @instance - * @param {google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest} request BatchAnnotateImagesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return ImageAnnotator; - })(); - - v1p1beta1.Feature = (function() { + v1p1beta1.Vertex = (function() { /** - * Properties of a Feature. + * Properties of a Vertex. * @memberof google.cloud.vision.v1p1beta1 - * @interface IFeature - * @property {google.cloud.vision.v1p1beta1.Feature.Type|null} [type] Feature type - * @property {number|null} [maxResults] Feature maxResults - * @property {string|null} [model] Feature model + * @interface IVertex + * @property {number|null} [x] Vertex x + * @property {number|null} [y] Vertex y */ /** - * Constructs a new Feature. + * Constructs a new Vertex. * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a Feature. - * @implements IFeature + * @classdesc Represents a Vertex. + * @implements IVertex * @constructor - * @param {google.cloud.vision.v1p1beta1.IFeature=} [properties] Properties to set + * @param {google.cloud.vision.v1p1beta1.IVertex=} [properties] Properties to set */ - function Feature(properties) { + function Vertex(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -25125,101 +25056,88 @@ } /** - * Feature type. - * @member {google.cloud.vision.v1p1beta1.Feature.Type} type - * @memberof google.cloud.vision.v1p1beta1.Feature - * @instance - */ - Feature.prototype.type = 0; - - /** - * Feature maxResults. - * @member {number} maxResults - * @memberof google.cloud.vision.v1p1beta1.Feature + * Vertex x. + * @member {number} x + * @memberof google.cloud.vision.v1p1beta1.Vertex * @instance */ - Feature.prototype.maxResults = 0; + Vertex.prototype.x = 0; /** - * Feature model. - * @member {string} model - * @memberof google.cloud.vision.v1p1beta1.Feature + * Vertex y. + * @member {number} y + * @memberof google.cloud.vision.v1p1beta1.Vertex * @instance */ - Feature.prototype.model = ""; + Vertex.prototype.y = 0; /** - * Creates a new Feature instance using the specified properties. + * Creates a new Vertex instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p1beta1.Feature + * @memberof google.cloud.vision.v1p1beta1.Vertex * @static - * @param {google.cloud.vision.v1p1beta1.IFeature=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.Feature} Feature instance + * @param {google.cloud.vision.v1p1beta1.IVertex=} [properties] Properties to set + * @returns {google.cloud.vision.v1p1beta1.Vertex} Vertex instance */ - Feature.create = function create(properties) { - return new Feature(properties); + Vertex.create = function create(properties) { + return new Vertex(properties); }; /** - * Encodes the specified Feature message. Does not implicitly {@link google.cloud.vision.v1p1beta1.Feature.verify|verify} messages. + * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.vision.v1p1beta1.Vertex.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p1beta1.Feature + * @memberof google.cloud.vision.v1p1beta1.Vertex * @static - * @param {google.cloud.vision.v1p1beta1.IFeature} message Feature message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IVertex} message Vertex message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Feature.encode = function encode(message, writer) { + Vertex.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.type != null && message.hasOwnProperty("type")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); - if (message.maxResults != null && message.hasOwnProperty("maxResults")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.maxResults); - if (message.model != null && message.hasOwnProperty("model")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.model); + if (message.x != null && message.hasOwnProperty("x")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.x); + if (message.y != null && message.hasOwnProperty("y")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.y); return writer; }; /** - * Encodes the specified Feature message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.Feature.verify|verify} messages. + * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.Vertex.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.Feature + * @memberof google.cloud.vision.v1p1beta1.Vertex * @static - * @param {google.cloud.vision.v1p1beta1.IFeature} message Feature message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IVertex} message Vertex message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Feature.encodeDelimited = function encodeDelimited(message, writer) { + Vertex.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Feature message from the specified reader or buffer. + * Decodes a Vertex message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p1beta1.Feature + * @memberof google.cloud.vision.v1p1beta1.Vertex * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p1beta1.Feature} Feature + * @returns {google.cloud.vision.v1p1beta1.Vertex} Vertex * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Feature.decode = function decode(reader, length) { + Vertex.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.vision.v1p1beta1.Feature(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p1beta1.Vertex(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.type = reader.int32(); + message.x = reader.int32(); break; case 2: - message.maxResults = reader.int32(); - break; - case 3: - message.model = reader.string(); + message.y = reader.int32(); break; default: reader.skipType(tag & 7); @@ -25230,215 +25148,117 @@ }; /** - * Decodes a Feature message from the specified reader or buffer, length delimited. + * Decodes a Vertex message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.Feature + * @memberof google.cloud.vision.v1p1beta1.Vertex * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.Feature} Feature + * @returns {google.cloud.vision.v1p1beta1.Vertex} Vertex * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Feature.decodeDelimited = function decodeDelimited(reader) { + Vertex.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Feature message. + * Verifies a Vertex message. * @function verify - * @memberof google.cloud.vision.v1p1beta1.Feature + * @memberof google.cloud.vision.v1p1beta1.Vertex * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Feature.verify = function verify(message) { + Vertex.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 11: - case 6: - case 7: - case 9: - case 10: - break; - } - if (message.maxResults != null && message.hasOwnProperty("maxResults")) - if (!$util.isInteger(message.maxResults)) - return "maxResults: integer expected"; - if (message.model != null && message.hasOwnProperty("model")) - if (!$util.isString(message.model)) - return "model: string expected"; + if (message.x != null && message.hasOwnProperty("x")) + if (!$util.isInteger(message.x)) + return "x: integer expected"; + if (message.y != null && message.hasOwnProperty("y")) + if (!$util.isInteger(message.y)) + return "y: integer expected"; return null; }; /** - * Creates a Feature message from a plain object. Also converts values to their respective internal types. + * Creates a Vertex message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.Feature + * @memberof google.cloud.vision.v1p1beta1.Vertex * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.Feature} Feature + * @returns {google.cloud.vision.v1p1beta1.Vertex} Vertex */ - Feature.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.Feature) + Vertex.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p1beta1.Vertex) return object; - var message = new $root.google.cloud.vision.v1p1beta1.Feature(); - switch (object.type) { - case "TYPE_UNSPECIFIED": - case 0: - message.type = 0; - break; - case "FACE_DETECTION": - case 1: - message.type = 1; - break; - case "LANDMARK_DETECTION": - case 2: - message.type = 2; - break; - case "LOGO_DETECTION": - case 3: - message.type = 3; - break; - case "LABEL_DETECTION": - case 4: - message.type = 4; - break; - case "TEXT_DETECTION": - case 5: - message.type = 5; - break; - case "DOCUMENT_TEXT_DETECTION": - case 11: - message.type = 11; - break; - case "SAFE_SEARCH_DETECTION": - case 6: - message.type = 6; - break; - case "IMAGE_PROPERTIES": - case 7: - message.type = 7; - break; - case "CROP_HINTS": - case 9: - message.type = 9; - break; - case "WEB_DETECTION": - case 10: - message.type = 10; - break; - } - if (object.maxResults != null) - message.maxResults = object.maxResults | 0; - if (object.model != null) - message.model = String(object.model); + var message = new $root.google.cloud.vision.v1p1beta1.Vertex(); + if (object.x != null) + message.x = object.x | 0; + if (object.y != null) + message.y = object.y | 0; return message; }; /** - * Creates a plain object from a Feature message. Also converts values to other types if specified. + * Creates a plain object from a Vertex message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p1beta1.Feature + * @memberof google.cloud.vision.v1p1beta1.Vertex * @static - * @param {google.cloud.vision.v1p1beta1.Feature} message Feature + * @param {google.cloud.vision.v1p1beta1.Vertex} message Vertex * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Feature.toObject = function toObject(message, options) { + Vertex.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; - object.maxResults = 0; - object.model = ""; + object.x = 0; + object.y = 0; } - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.vision.v1p1beta1.Feature.Type[message.type] : message.type; - if (message.maxResults != null && message.hasOwnProperty("maxResults")) - object.maxResults = message.maxResults; - if (message.model != null && message.hasOwnProperty("model")) - object.model = message.model; + if (message.x != null && message.hasOwnProperty("x")) + object.x = message.x; + if (message.y != null && message.hasOwnProperty("y")) + object.y = message.y; return object; }; /** - * Converts this Feature to JSON. + * Converts this Vertex to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.Feature + * @memberof google.cloud.vision.v1p1beta1.Vertex * @instance * @returns {Object.} JSON object */ - Feature.prototype.toJSON = function toJSON() { + Vertex.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * Type enum. - * @name google.cloud.vision.v1p1beta1.Feature.Type - * @enum {string} - * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value - * @property {number} FACE_DETECTION=1 FACE_DETECTION value - * @property {number} LANDMARK_DETECTION=2 LANDMARK_DETECTION value - * @property {number} LOGO_DETECTION=3 LOGO_DETECTION value - * @property {number} LABEL_DETECTION=4 LABEL_DETECTION value - * @property {number} TEXT_DETECTION=5 TEXT_DETECTION value - * @property {number} DOCUMENT_TEXT_DETECTION=11 DOCUMENT_TEXT_DETECTION value - * @property {number} SAFE_SEARCH_DETECTION=6 SAFE_SEARCH_DETECTION value - * @property {number} IMAGE_PROPERTIES=7 IMAGE_PROPERTIES value - * @property {number} CROP_HINTS=9 CROP_HINTS value - * @property {number} WEB_DETECTION=10 WEB_DETECTION value - */ - Feature.Type = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "FACE_DETECTION"] = 1; - values[valuesById[2] = "LANDMARK_DETECTION"] = 2; - values[valuesById[3] = "LOGO_DETECTION"] = 3; - values[valuesById[4] = "LABEL_DETECTION"] = 4; - values[valuesById[5] = "TEXT_DETECTION"] = 5; - values[valuesById[11] = "DOCUMENT_TEXT_DETECTION"] = 11; - values[valuesById[6] = "SAFE_SEARCH_DETECTION"] = 6; - values[valuesById[7] = "IMAGE_PROPERTIES"] = 7; - values[valuesById[9] = "CROP_HINTS"] = 9; - values[valuesById[10] = "WEB_DETECTION"] = 10; - return values; - })(); - - return Feature; + return Vertex; })(); - v1p1beta1.ImageSource = (function() { + v1p1beta1.BoundingPoly = (function() { /** - * Properties of an ImageSource. + * Properties of a BoundingPoly. * @memberof google.cloud.vision.v1p1beta1 - * @interface IImageSource - * @property {string|null} [gcsImageUri] ImageSource gcsImageUri - * @property {string|null} [imageUri] ImageSource imageUri + * @interface IBoundingPoly + * @property {Array.|null} [vertices] BoundingPoly vertices */ /** - * Constructs a new ImageSource. + * Constructs a new BoundingPoly. * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents an ImageSource. - * @implements IImageSource + * @classdesc Represents a BoundingPoly. + * @implements IBoundingPoly * @constructor - * @param {google.cloud.vision.v1p1beta1.IImageSource=} [properties] Properties to set + * @param {google.cloud.vision.v1p1beta1.IBoundingPoly=} [properties] Properties to set */ - function ImageSource(properties) { + function BoundingPoly(properties) { + this.vertices = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -25446,88 +25266,78 @@ } /** - * ImageSource gcsImageUri. - * @member {string} gcsImageUri - * @memberof google.cloud.vision.v1p1beta1.ImageSource - * @instance - */ - ImageSource.prototype.gcsImageUri = ""; - - /** - * ImageSource imageUri. - * @member {string} imageUri - * @memberof google.cloud.vision.v1p1beta1.ImageSource + * BoundingPoly vertices. + * @member {Array.} vertices + * @memberof google.cloud.vision.v1p1beta1.BoundingPoly * @instance */ - ImageSource.prototype.imageUri = ""; + BoundingPoly.prototype.vertices = $util.emptyArray; /** - * Creates a new ImageSource instance using the specified properties. + * Creates a new BoundingPoly instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p1beta1.ImageSource + * @memberof google.cloud.vision.v1p1beta1.BoundingPoly * @static - * @param {google.cloud.vision.v1p1beta1.IImageSource=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.ImageSource} ImageSource instance + * @param {google.cloud.vision.v1p1beta1.IBoundingPoly=} [properties] Properties to set + * @returns {google.cloud.vision.v1p1beta1.BoundingPoly} BoundingPoly instance */ - ImageSource.create = function create(properties) { - return new ImageSource(properties); + BoundingPoly.create = function create(properties) { + return new BoundingPoly(properties); }; /** - * Encodes the specified ImageSource message. Does not implicitly {@link google.cloud.vision.v1p1beta1.ImageSource.verify|verify} messages. + * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.vision.v1p1beta1.BoundingPoly.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p1beta1.ImageSource + * @memberof google.cloud.vision.v1p1beta1.BoundingPoly * @static - * @param {google.cloud.vision.v1p1beta1.IImageSource} message ImageSource message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IBoundingPoly} message BoundingPoly message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageSource.encode = function encode(message, writer) { + BoundingPoly.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.gcsImageUri != null && message.hasOwnProperty("gcsImageUri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsImageUri); - if (message.imageUri != null && message.hasOwnProperty("imageUri")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.imageUri); + if (message.vertices != null && message.vertices.length) + for (var i = 0; i < message.vertices.length; ++i) + $root.google.cloud.vision.v1p1beta1.Vertex.encode(message.vertices[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified ImageSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.ImageSource.verify|verify} messages. + * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.BoundingPoly.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.ImageSource + * @memberof google.cloud.vision.v1p1beta1.BoundingPoly * @static - * @param {google.cloud.vision.v1p1beta1.IImageSource} message ImageSource message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IBoundingPoly} message BoundingPoly message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageSource.encodeDelimited = function encodeDelimited(message, writer) { + BoundingPoly.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImageSource message from the specified reader or buffer. + * Decodes a BoundingPoly message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p1beta1.ImageSource + * @memberof google.cloud.vision.v1p1beta1.BoundingPoly * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p1beta1.ImageSource} ImageSource + * @returns {google.cloud.vision.v1p1beta1.BoundingPoly} BoundingPoly * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageSource.decode = function decode(reader, length) { + BoundingPoly.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.vision.v1p1beta1.ImageSource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p1beta1.BoundingPoly(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.gcsImageUri = reader.string(); - break; - case 2: - message.imageUri = reader.string(); + if (!(message.vertices && message.vertices.length)) + message.vertices = []; + message.vertices.push($root.google.cloud.vision.v1p1beta1.Vertex.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -25538,117 +25348,126 @@ }; /** - * Decodes an ImageSource message from the specified reader or buffer, length delimited. + * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.ImageSource + * @memberof google.cloud.vision.v1p1beta1.BoundingPoly * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.ImageSource} ImageSource + * @returns {google.cloud.vision.v1p1beta1.BoundingPoly} BoundingPoly * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageSource.decodeDelimited = function decodeDelimited(reader) { + BoundingPoly.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImageSource message. + * Verifies a BoundingPoly message. * @function verify - * @memberof google.cloud.vision.v1p1beta1.ImageSource + * @memberof google.cloud.vision.v1p1beta1.BoundingPoly * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImageSource.verify = function verify(message) { + BoundingPoly.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.gcsImageUri != null && message.hasOwnProperty("gcsImageUri")) - if (!$util.isString(message.gcsImageUri)) - return "gcsImageUri: string expected"; - if (message.imageUri != null && message.hasOwnProperty("imageUri")) - if (!$util.isString(message.imageUri)) - return "imageUri: string expected"; + if (message.vertices != null && message.hasOwnProperty("vertices")) { + if (!Array.isArray(message.vertices)) + return "vertices: array expected"; + for (var i = 0; i < message.vertices.length; ++i) { + var error = $root.google.cloud.vision.v1p1beta1.Vertex.verify(message.vertices[i]); + if (error) + return "vertices." + error; + } + } return null; }; /** - * Creates an ImageSource message from a plain object. Also converts values to their respective internal types. + * Creates a BoundingPoly message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.ImageSource + * @memberof google.cloud.vision.v1p1beta1.BoundingPoly * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.ImageSource} ImageSource + * @returns {google.cloud.vision.v1p1beta1.BoundingPoly} BoundingPoly */ - ImageSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.ImageSource) + BoundingPoly.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p1beta1.BoundingPoly) return object; - var message = new $root.google.cloud.vision.v1p1beta1.ImageSource(); - if (object.gcsImageUri != null) - message.gcsImageUri = String(object.gcsImageUri); - if (object.imageUri != null) - message.imageUri = String(object.imageUri); + var message = new $root.google.cloud.vision.v1p1beta1.BoundingPoly(); + if (object.vertices) { + if (!Array.isArray(object.vertices)) + throw TypeError(".google.cloud.vision.v1p1beta1.BoundingPoly.vertices: array expected"); + message.vertices = []; + for (var i = 0; i < object.vertices.length; ++i) { + if (typeof object.vertices[i] !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.BoundingPoly.vertices: object expected"); + message.vertices[i] = $root.google.cloud.vision.v1p1beta1.Vertex.fromObject(object.vertices[i]); + } + } return message; }; /** - * Creates a plain object from an ImageSource message. Also converts values to other types if specified. + * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p1beta1.ImageSource + * @memberof google.cloud.vision.v1p1beta1.BoundingPoly * @static - * @param {google.cloud.vision.v1p1beta1.ImageSource} message ImageSource + * @param {google.cloud.vision.v1p1beta1.BoundingPoly} message BoundingPoly * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImageSource.toObject = function toObject(message, options) { + BoundingPoly.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.gcsImageUri = ""; - object.imageUri = ""; + if (options.arrays || options.defaults) + object.vertices = []; + if (message.vertices && message.vertices.length) { + object.vertices = []; + for (var j = 0; j < message.vertices.length; ++j) + object.vertices[j] = $root.google.cloud.vision.v1p1beta1.Vertex.toObject(message.vertices[j], options); } - if (message.gcsImageUri != null && message.hasOwnProperty("gcsImageUri")) - object.gcsImageUri = message.gcsImageUri; - if (message.imageUri != null && message.hasOwnProperty("imageUri")) - object.imageUri = message.imageUri; return object; }; /** - * Converts this ImageSource to JSON. + * Converts this BoundingPoly to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.ImageSource + * @memberof google.cloud.vision.v1p1beta1.BoundingPoly * @instance * @returns {Object.} JSON object */ - ImageSource.prototype.toJSON = function toJSON() { + BoundingPoly.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImageSource; + return BoundingPoly; })(); - v1p1beta1.Image = (function() { + v1p1beta1.Position = (function() { /** - * Properties of an Image. + * Properties of a Position. * @memberof google.cloud.vision.v1p1beta1 - * @interface IImage - * @property {Uint8Array|null} [content] Image content - * @property {google.cloud.vision.v1p1beta1.IImageSource|null} [source] Image source + * @interface IPosition + * @property {number|null} [x] Position x + * @property {number|null} [y] Position y + * @property {number|null} [z] Position z */ /** - * Constructs a new Image. + * Constructs a new Position. * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents an Image. - * @implements IImage + * @classdesc Represents a Position. + * @implements IPosition * @constructor - * @param {google.cloud.vision.v1p1beta1.IImage=} [properties] Properties to set + * @param {google.cloud.vision.v1p1beta1.IPosition=} [properties] Properties to set */ - function Image(properties) { + function Position(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -25656,88 +25475,101 @@ } /** - * Image content. - * @member {Uint8Array} content - * @memberof google.cloud.vision.v1p1beta1.Image + * Position x. + * @member {number} x + * @memberof google.cloud.vision.v1p1beta1.Position * @instance */ - Image.prototype.content = $util.newBuffer([]); + Position.prototype.x = 0; /** - * Image source. - * @member {google.cloud.vision.v1p1beta1.IImageSource|null|undefined} source - * @memberof google.cloud.vision.v1p1beta1.Image + * Position y. + * @member {number} y + * @memberof google.cloud.vision.v1p1beta1.Position * @instance */ - Image.prototype.source = null; + Position.prototype.y = 0; /** - * Creates a new Image instance using the specified properties. + * Position z. + * @member {number} z + * @memberof google.cloud.vision.v1p1beta1.Position + * @instance + */ + Position.prototype.z = 0; + + /** + * Creates a new Position instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p1beta1.Image + * @memberof google.cloud.vision.v1p1beta1.Position * @static - * @param {google.cloud.vision.v1p1beta1.IImage=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.Image} Image instance + * @param {google.cloud.vision.v1p1beta1.IPosition=} [properties] Properties to set + * @returns {google.cloud.vision.v1p1beta1.Position} Position instance */ - Image.create = function create(properties) { - return new Image(properties); + Position.create = function create(properties) { + return new Position(properties); }; /** - * Encodes the specified Image message. Does not implicitly {@link google.cloud.vision.v1p1beta1.Image.verify|verify} messages. + * Encodes the specified Position message. Does not implicitly {@link google.cloud.vision.v1p1beta1.Position.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p1beta1.Image + * @memberof google.cloud.vision.v1p1beta1.Position * @static - * @param {google.cloud.vision.v1p1beta1.IImage} message Image message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IPosition} message Position message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Image.encode = function encode(message, writer) { + Position.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.content != null && message.hasOwnProperty("content")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.content); - if (message.source != null && message.hasOwnProperty("source")) - $root.google.cloud.vision.v1p1beta1.ImageSource.encode(message.source, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.x != null && message.hasOwnProperty("x")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); + if (message.y != null && message.hasOwnProperty("y")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); + if (message.z != null && message.hasOwnProperty("z")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.z); return writer; }; /** - * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.Image.verify|verify} messages. + * Encodes the specified Position message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.Position.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.Image + * @memberof google.cloud.vision.v1p1beta1.Position * @static - * @param {google.cloud.vision.v1p1beta1.IImage} message Image message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IPosition} message Position message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Image.encodeDelimited = function encodeDelimited(message, writer) { + Position.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Image message from the specified reader or buffer. + * Decodes a Position message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p1beta1.Image + * @memberof google.cloud.vision.v1p1beta1.Position * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p1beta1.Image} Image + * @returns {google.cloud.vision.v1p1beta1.Position} Position * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Image.decode = function decode(reader, length) { + Position.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.vision.v1p1beta1.Image(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p1beta1.Position(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.content = reader.bytes(); + message.x = reader.float(); break; case 2: - message.source = $root.google.cloud.vision.v1p1beta1.ImageSource.decode(reader, reader.uint32()); + message.y = reader.float(); + break; + case 3: + message.z = reader.float(); break; default: reader.skipType(tag & 7); @@ -25748,406 +25580,296 @@ }; /** - * Decodes an Image message from the specified reader or buffer, length delimited. + * Decodes a Position message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.Image + * @memberof google.cloud.vision.v1p1beta1.Position * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.Image} Image + * @returns {google.cloud.vision.v1p1beta1.Position} Position * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Image.decodeDelimited = function decodeDelimited(reader) { + Position.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Image message. + * Verifies a Position message. * @function verify - * @memberof google.cloud.vision.v1p1beta1.Image + * @memberof google.cloud.vision.v1p1beta1.Position * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Image.verify = function verify(message) { + Position.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.content != null && message.hasOwnProperty("content")) - if (!(message.content && typeof message.content.length === "number" || $util.isString(message.content))) - return "content: buffer expected"; - if (message.source != null && message.hasOwnProperty("source")) { - var error = $root.google.cloud.vision.v1p1beta1.ImageSource.verify(message.source); - if (error) - return "source." + error; - } + if (message.x != null && message.hasOwnProperty("x")) + if (typeof message.x !== "number") + return "x: number expected"; + if (message.y != null && message.hasOwnProperty("y")) + if (typeof message.y !== "number") + return "y: number expected"; + if (message.z != null && message.hasOwnProperty("z")) + if (typeof message.z !== "number") + return "z: number expected"; return null; }; /** - * Creates an Image message from a plain object. Also converts values to their respective internal types. + * Creates a Position message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.Image + * @memberof google.cloud.vision.v1p1beta1.Position * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.Image} Image + * @returns {google.cloud.vision.v1p1beta1.Position} Position */ - Image.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.Image) + Position.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p1beta1.Position) return object; - var message = new $root.google.cloud.vision.v1p1beta1.Image(); - if (object.content != null) - if (typeof object.content === "string") - $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); - else if (object.content.length) - message.content = object.content; - if (object.source != null) { - if (typeof object.source !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.Image.source: object expected"); - message.source = $root.google.cloud.vision.v1p1beta1.ImageSource.fromObject(object.source); - } + var message = new $root.google.cloud.vision.v1p1beta1.Position(); + if (object.x != null) + message.x = Number(object.x); + if (object.y != null) + message.y = Number(object.y); + if (object.z != null) + message.z = Number(object.z); return message; }; /** - * Creates a plain object from an Image message. Also converts values to other types if specified. + * Creates a plain object from a Position message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p1beta1.Image + * @memberof google.cloud.vision.v1p1beta1.Position * @static - * @param {google.cloud.vision.v1p1beta1.Image} message Image + * @param {google.cloud.vision.v1p1beta1.Position} message Position * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Image.toObject = function toObject(message, options) { + Position.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - if (options.bytes === String) - object.content = ""; - else { - object.content = []; - if (options.bytes !== Array) - object.content = $util.newBuffer(object.content); - } - object.source = null; + object.x = 0; + object.y = 0; + object.z = 0; } - if (message.content != null && message.hasOwnProperty("content")) - object.content = options.bytes === String ? $util.base64.encode(message.content, 0, message.content.length) : options.bytes === Array ? Array.prototype.slice.call(message.content) : message.content; - if (message.source != null && message.hasOwnProperty("source")) - object.source = $root.google.cloud.vision.v1p1beta1.ImageSource.toObject(message.source, options); + if (message.x != null && message.hasOwnProperty("x")) + object.x = options.json && !isFinite(message.x) ? String(message.x) : message.x; + if (message.y != null && message.hasOwnProperty("y")) + object.y = options.json && !isFinite(message.y) ? String(message.y) : message.y; + if (message.z != null && message.hasOwnProperty("z")) + object.z = options.json && !isFinite(message.z) ? String(message.z) : message.z; return object; }; /** - * Converts this Image to JSON. + * Converts this Position to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.Image + * @memberof google.cloud.vision.v1p1beta1.Position * @instance * @returns {Object.} JSON object */ - Image.prototype.toJSON = function toJSON() { + Position.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Image; + return Position; })(); - v1p1beta1.FaceAnnotation = (function() { - - /** - * Properties of a FaceAnnotation. - * @memberof google.cloud.vision.v1p1beta1 - * @interface IFaceAnnotation - * @property {google.cloud.vision.v1p1beta1.IBoundingPoly|null} [boundingPoly] FaceAnnotation boundingPoly - * @property {google.cloud.vision.v1p1beta1.IBoundingPoly|null} [fdBoundingPoly] FaceAnnotation fdBoundingPoly - * @property {Array.|null} [landmarks] FaceAnnotation landmarks - * @property {number|null} [rollAngle] FaceAnnotation rollAngle - * @property {number|null} [panAngle] FaceAnnotation panAngle - * @property {number|null} [tiltAngle] FaceAnnotation tiltAngle - * @property {number|null} [detectionConfidence] FaceAnnotation detectionConfidence - * @property {number|null} [landmarkingConfidence] FaceAnnotation landmarkingConfidence - * @property {google.cloud.vision.v1p1beta1.Likelihood|null} [joyLikelihood] FaceAnnotation joyLikelihood - * @property {google.cloud.vision.v1p1beta1.Likelihood|null} [sorrowLikelihood] FaceAnnotation sorrowLikelihood - * @property {google.cloud.vision.v1p1beta1.Likelihood|null} [angerLikelihood] FaceAnnotation angerLikelihood - * @property {google.cloud.vision.v1p1beta1.Likelihood|null} [surpriseLikelihood] FaceAnnotation surpriseLikelihood - * @property {google.cloud.vision.v1p1beta1.Likelihood|null} [underExposedLikelihood] FaceAnnotation underExposedLikelihood - * @property {google.cloud.vision.v1p1beta1.Likelihood|null} [blurredLikelihood] FaceAnnotation blurredLikelihood - * @property {google.cloud.vision.v1p1beta1.Likelihood|null} [headwearLikelihood] FaceAnnotation headwearLikelihood - */ + v1p1beta1.ImageAnnotator = (function() { /** - * Constructs a new FaceAnnotation. + * Constructs a new ImageAnnotator service. * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a FaceAnnotation. - * @implements IFaceAnnotation + * @classdesc Represents an ImageAnnotator + * @extends $protobuf.rpc.Service * @constructor - * @param {google.cloud.vision.v1p1beta1.IFaceAnnotation=} [properties] Properties to set + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited */ - function FaceAnnotation(properties) { - this.landmarks = []; - 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]]; + function ImageAnnotator(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); } - /** - * FaceAnnotation boundingPoly. - * @member {google.cloud.vision.v1p1beta1.IBoundingPoly|null|undefined} boundingPoly - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.boundingPoly = null; - - /** - * FaceAnnotation fdBoundingPoly. - * @member {google.cloud.vision.v1p1beta1.IBoundingPoly|null|undefined} fdBoundingPoly - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.fdBoundingPoly = null; - - /** - * FaceAnnotation landmarks. - * @member {Array.} landmarks - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.landmarks = $util.emptyArray; - - /** - * FaceAnnotation rollAngle. - * @member {number} rollAngle - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.rollAngle = 0; + (ImageAnnotator.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ImageAnnotator; /** - * FaceAnnotation panAngle. - * @member {number} panAngle - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation - * @instance + * Creates new ImageAnnotator service using the specified rpc implementation. + * @function create + * @memberof google.cloud.vision.v1p1beta1.ImageAnnotator + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {ImageAnnotator} RPC service. Useful where requests and/or responses are streamed. */ - FaceAnnotation.prototype.panAngle = 0; + ImageAnnotator.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; /** - * FaceAnnotation tiltAngle. - * @member {number} tiltAngle - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation - * @instance + * Callback as used by {@link google.cloud.vision.v1p1beta1.ImageAnnotator#batchAnnotateImages}. + * @memberof google.cloud.vision.v1p1beta1.ImageAnnotator + * @typedef BatchAnnotateImagesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse} [response] BatchAnnotateImagesResponse */ - FaceAnnotation.prototype.tiltAngle = 0; /** - * FaceAnnotation detectionConfidence. - * @member {number} detectionConfidence - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation + * Calls BatchAnnotateImages. + * @function batchAnnotateImages + * @memberof google.cloud.vision.v1p1beta1.ImageAnnotator * @instance + * @param {google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest} request BatchAnnotateImagesRequest message or plain object + * @param {google.cloud.vision.v1p1beta1.ImageAnnotator.BatchAnnotateImagesCallback} callback Node-style callback called with the error, if any, and BatchAnnotateImagesResponse + * @returns {undefined} + * @variation 1 */ - FaceAnnotation.prototype.detectionConfidence = 0; + Object.defineProperty(ImageAnnotator.prototype.batchAnnotateImages = function batchAnnotateImages(request, callback) { + return this.rpcCall(batchAnnotateImages, $root.google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest, $root.google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse, request, callback); + }, "name", { value: "BatchAnnotateImages" }); /** - * FaceAnnotation landmarkingConfidence. - * @member {number} landmarkingConfidence - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation + * Calls BatchAnnotateImages. + * @function batchAnnotateImages + * @memberof google.cloud.vision.v1p1beta1.ImageAnnotator * @instance + * @param {google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest} request BatchAnnotateImagesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - FaceAnnotation.prototype.landmarkingConfidence = 0; - /** - * FaceAnnotation joyLikelihood. - * @member {google.cloud.vision.v1p1beta1.Likelihood} joyLikelihood - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.joyLikelihood = 0; + return ImageAnnotator; + })(); - /** - * FaceAnnotation sorrowLikelihood. - * @member {google.cloud.vision.v1p1beta1.Likelihood} sorrowLikelihood - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.sorrowLikelihood = 0; + v1p1beta1.Feature = (function() { /** - * FaceAnnotation angerLikelihood. - * @member {google.cloud.vision.v1p1beta1.Likelihood} angerLikelihood - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation - * @instance + * Properties of a Feature. + * @memberof google.cloud.vision.v1p1beta1 + * @interface IFeature + * @property {google.cloud.vision.v1p1beta1.Feature.Type|null} [type] Feature type + * @property {number|null} [maxResults] Feature maxResults + * @property {string|null} [model] Feature model */ - FaceAnnotation.prototype.angerLikelihood = 0; /** - * FaceAnnotation surpriseLikelihood. - * @member {google.cloud.vision.v1p1beta1.Likelihood} surpriseLikelihood - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation - * @instance + * Constructs a new Feature. + * @memberof google.cloud.vision.v1p1beta1 + * @classdesc Represents a Feature. + * @implements IFeature + * @constructor + * @param {google.cloud.vision.v1p1beta1.IFeature=} [properties] Properties to set */ - FaceAnnotation.prototype.surpriseLikelihood = 0; + function Feature(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]]; + } /** - * FaceAnnotation underExposedLikelihood. - * @member {google.cloud.vision.v1p1beta1.Likelihood} underExposedLikelihood - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation + * Feature type. + * @member {google.cloud.vision.v1p1beta1.Feature.Type} type + * @memberof google.cloud.vision.v1p1beta1.Feature * @instance */ - FaceAnnotation.prototype.underExposedLikelihood = 0; + Feature.prototype.type = 0; /** - * FaceAnnotation blurredLikelihood. - * @member {google.cloud.vision.v1p1beta1.Likelihood} blurredLikelihood - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation + * Feature maxResults. + * @member {number} maxResults + * @memberof google.cloud.vision.v1p1beta1.Feature * @instance */ - FaceAnnotation.prototype.blurredLikelihood = 0; + Feature.prototype.maxResults = 0; /** - * FaceAnnotation headwearLikelihood. - * @member {google.cloud.vision.v1p1beta1.Likelihood} headwearLikelihood - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation + * Feature model. + * @member {string} model + * @memberof google.cloud.vision.v1p1beta1.Feature * @instance */ - FaceAnnotation.prototype.headwearLikelihood = 0; + Feature.prototype.model = ""; /** - * Creates a new FaceAnnotation instance using the specified properties. + * Creates a new Feature instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p1beta1.Feature * @static - * @param {google.cloud.vision.v1p1beta1.IFaceAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.FaceAnnotation} FaceAnnotation instance + * @param {google.cloud.vision.v1p1beta1.IFeature=} [properties] Properties to set + * @returns {google.cloud.vision.v1p1beta1.Feature} Feature instance */ - FaceAnnotation.create = function create(properties) { - return new FaceAnnotation(properties); + Feature.create = function create(properties) { + return new Feature(properties); }; /** - * Encodes the specified FaceAnnotation message. Does not implicitly {@link google.cloud.vision.v1p1beta1.FaceAnnotation.verify|verify} messages. + * Encodes the specified Feature message. Does not implicitly {@link google.cloud.vision.v1p1beta1.Feature.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p1beta1.Feature * @static - * @param {google.cloud.vision.v1p1beta1.IFaceAnnotation} message FaceAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IFeature} message Feature message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FaceAnnotation.encode = function encode(message, writer) { + Feature.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - $root.google.cloud.vision.v1p1beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.fdBoundingPoly != null && message.hasOwnProperty("fdBoundingPoly")) - $root.google.cloud.vision.v1p1beta1.BoundingPoly.encode(message.fdBoundingPoly, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.landmarks != null && message.landmarks.length) - for (var i = 0; i < message.landmarks.length; ++i) - $root.google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.encode(message.landmarks[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.rollAngle != null && message.hasOwnProperty("rollAngle")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.rollAngle); - if (message.panAngle != null && message.hasOwnProperty("panAngle")) - writer.uint32(/* id 5, wireType 5 =*/45).float(message.panAngle); - if (message.tiltAngle != null && message.hasOwnProperty("tiltAngle")) - writer.uint32(/* id 6, wireType 5 =*/53).float(message.tiltAngle); - if (message.detectionConfidence != null && message.hasOwnProperty("detectionConfidence")) - writer.uint32(/* id 7, wireType 5 =*/61).float(message.detectionConfidence); - if (message.landmarkingConfidence != null && message.hasOwnProperty("landmarkingConfidence")) - writer.uint32(/* id 8, wireType 5 =*/69).float(message.landmarkingConfidence); - if (message.joyLikelihood != null && message.hasOwnProperty("joyLikelihood")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.joyLikelihood); - if (message.sorrowLikelihood != null && message.hasOwnProperty("sorrowLikelihood")) - writer.uint32(/* id 10, wireType 0 =*/80).int32(message.sorrowLikelihood); - if (message.angerLikelihood != null && message.hasOwnProperty("angerLikelihood")) - writer.uint32(/* id 11, wireType 0 =*/88).int32(message.angerLikelihood); - if (message.surpriseLikelihood != null && message.hasOwnProperty("surpriseLikelihood")) - writer.uint32(/* id 12, wireType 0 =*/96).int32(message.surpriseLikelihood); - if (message.underExposedLikelihood != null && message.hasOwnProperty("underExposedLikelihood")) - writer.uint32(/* id 13, wireType 0 =*/104).int32(message.underExposedLikelihood); - if (message.blurredLikelihood != null && message.hasOwnProperty("blurredLikelihood")) - writer.uint32(/* id 14, wireType 0 =*/112).int32(message.blurredLikelihood); - if (message.headwearLikelihood != null && message.hasOwnProperty("headwearLikelihood")) - writer.uint32(/* id 15, wireType 0 =*/120).int32(message.headwearLikelihood); + if (message.type != null && message.hasOwnProperty("type")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.maxResults); + if (message.model != null && message.hasOwnProperty("model")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.model); return writer; }; /** - * Encodes the specified FaceAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.FaceAnnotation.verify|verify} messages. + * Encodes the specified Feature message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.Feature.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p1beta1.Feature * @static - * @param {google.cloud.vision.v1p1beta1.IFaceAnnotation} message FaceAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IFeature} message Feature message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FaceAnnotation.encodeDelimited = function encodeDelimited(message, writer) { + Feature.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FaceAnnotation message from the specified reader or buffer. + * Decodes a Feature message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p1beta1.Feature * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p1beta1.FaceAnnotation} FaceAnnotation + * @returns {google.cloud.vision.v1p1beta1.Feature} Feature * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FaceAnnotation.decode = function decode(reader, length) { + Feature.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.vision.v1p1beta1.FaceAnnotation(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p1beta1.Feature(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.boundingPoly = $root.google.cloud.vision.v1p1beta1.BoundingPoly.decode(reader, reader.uint32()); + message.type = reader.int32(); break; case 2: - message.fdBoundingPoly = $root.google.cloud.vision.v1p1beta1.BoundingPoly.decode(reader, reader.uint32()); + message.maxResults = reader.int32(); break; case 3: - if (!(message.landmarks && message.landmarks.length)) - message.landmarks = []; - message.landmarks.push($root.google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.decode(reader, reader.uint32())); - break; - case 4: - message.rollAngle = reader.float(); - break; - case 5: - message.panAngle = reader.float(); - break; - case 6: - message.tiltAngle = reader.float(); - break; - case 7: - message.detectionConfidence = reader.float(); - break; - case 8: - message.landmarkingConfidence = reader.float(); - break; - case 9: - message.joyLikelihood = reader.int32(); - break; - case 10: - message.sorrowLikelihood = reader.int32(); - break; - case 11: - message.angerLikelihood = reader.int32(); - break; - case 12: - message.surpriseLikelihood = reader.int32(); - break; - case 13: - message.underExposedLikelihood = reader.int32(); - break; - case 14: - message.blurredLikelihood = reader.int32(); - break; - case 15: - message.headwearLikelihood = reader.int32(); + message.model = reader.string(); break; default: reader.skipType(tag & 7); @@ -26158,952 +25880,215 @@ }; /** - * Decodes a FaceAnnotation message from the specified reader or buffer, length delimited. + * Decodes a Feature message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p1beta1.Feature * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.FaceAnnotation} FaceAnnotation + * @returns {google.cloud.vision.v1p1beta1.Feature} Feature * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FaceAnnotation.decodeDelimited = function decodeDelimited(reader) { + Feature.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FaceAnnotation message. + * Verifies a Feature message. * @function verify - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p1beta1.Feature * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FaceAnnotation.verify = function verify(message) { + Feature.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { - var error = $root.google.cloud.vision.v1p1beta1.BoundingPoly.verify(message.boundingPoly); - if (error) - return "boundingPoly." + error; - } - if (message.fdBoundingPoly != null && message.hasOwnProperty("fdBoundingPoly")) { - var error = $root.google.cloud.vision.v1p1beta1.BoundingPoly.verify(message.fdBoundingPoly); - if (error) - return "fdBoundingPoly." + error; - } - if (message.landmarks != null && message.hasOwnProperty("landmarks")) { - if (!Array.isArray(message.landmarks)) - return "landmarks: array expected"; - for (var i = 0; i < message.landmarks.length; ++i) { - var error = $root.google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.verify(message.landmarks[i]); - if (error) - return "landmarks." + error; - } - } - if (message.rollAngle != null && message.hasOwnProperty("rollAngle")) - if (typeof message.rollAngle !== "number") - return "rollAngle: number expected"; - if (message.panAngle != null && message.hasOwnProperty("panAngle")) - if (typeof message.panAngle !== "number") - return "panAngle: number expected"; - if (message.tiltAngle != null && message.hasOwnProperty("tiltAngle")) - if (typeof message.tiltAngle !== "number") - return "tiltAngle: number expected"; - if (message.detectionConfidence != null && message.hasOwnProperty("detectionConfidence")) - if (typeof message.detectionConfidence !== "number") - return "detectionConfidence: number expected"; - if (message.landmarkingConfidence != null && message.hasOwnProperty("landmarkingConfidence")) - if (typeof message.landmarkingConfidence !== "number") - return "landmarkingConfidence: number expected"; - if (message.joyLikelihood != null && message.hasOwnProperty("joyLikelihood")) - switch (message.joyLikelihood) { - default: - return "joyLikelihood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.sorrowLikelihood != null && message.hasOwnProperty("sorrowLikelihood")) - switch (message.sorrowLikelihood) { - default: - return "sorrowLikelihood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.angerLikelihood != null && message.hasOwnProperty("angerLikelihood")) - switch (message.angerLikelihood) { - default: - return "angerLikelihood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.surpriseLikelihood != null && message.hasOwnProperty("surpriseLikelihood")) - switch (message.surpriseLikelihood) { - default: - return "surpriseLikelihood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.underExposedLikelihood != null && message.hasOwnProperty("underExposedLikelihood")) - switch (message.underExposedLikelihood) { - default: - return "underExposedLikelihood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.blurredLikelihood != null && message.hasOwnProperty("blurredLikelihood")) - switch (message.blurredLikelihood) { - default: - return "blurredLikelihood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.headwearLikelihood != null && message.hasOwnProperty("headwearLikelihood")) - switch (message.headwearLikelihood) { + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { default: - return "headwearLikelihood: enum value expected"; + return "type: enum value expected"; case 0: case 1: case 2: case 3: case 4: case 5: + case 11: + case 6: + case 7: + case 9: + case 10: break; } + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + if (!$util.isInteger(message.maxResults)) + return "maxResults: integer expected"; + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; return null; }; /** - * Creates a FaceAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates a Feature message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p1beta1.Feature * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.FaceAnnotation} FaceAnnotation + * @returns {google.cloud.vision.v1p1beta1.Feature} Feature */ - FaceAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.FaceAnnotation) + Feature.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p1beta1.Feature) return object; - var message = new $root.google.cloud.vision.v1p1beta1.FaceAnnotation(); - if (object.boundingPoly != null) { - if (typeof object.boundingPoly !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.FaceAnnotation.boundingPoly: object expected"); - message.boundingPoly = $root.google.cloud.vision.v1p1beta1.BoundingPoly.fromObject(object.boundingPoly); - } - if (object.fdBoundingPoly != null) { - if (typeof object.fdBoundingPoly !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.FaceAnnotation.fdBoundingPoly: object expected"); - message.fdBoundingPoly = $root.google.cloud.vision.v1p1beta1.BoundingPoly.fromObject(object.fdBoundingPoly); - } - if (object.landmarks) { - if (!Array.isArray(object.landmarks)) - throw TypeError(".google.cloud.vision.v1p1beta1.FaceAnnotation.landmarks: array expected"); - message.landmarks = []; - for (var i = 0; i < object.landmarks.length; ++i) { - if (typeof object.landmarks[i] !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.FaceAnnotation.landmarks: object expected"); - message.landmarks[i] = $root.google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.fromObject(object.landmarks[i]); - } - } - if (object.rollAngle != null) - message.rollAngle = Number(object.rollAngle); - if (object.panAngle != null) - message.panAngle = Number(object.panAngle); - if (object.tiltAngle != null) - message.tiltAngle = Number(object.tiltAngle); - if (object.detectionConfidence != null) - message.detectionConfidence = Number(object.detectionConfidence); - if (object.landmarkingConfidence != null) - message.landmarkingConfidence = Number(object.landmarkingConfidence); - switch (object.joyLikelihood) { - case "UNKNOWN": - case 0: - message.joyLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.joyLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.joyLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.joyLikelihood = 3; - break; - case "LIKELY": - case 4: - message.joyLikelihood = 4; - break; - case "VERY_LIKELY": - case 5: - message.joyLikelihood = 5; - break; - } - switch (object.sorrowLikelihood) { - case "UNKNOWN": - case 0: - message.sorrowLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.sorrowLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.sorrowLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.sorrowLikelihood = 3; - break; - case "LIKELY": - case 4: - message.sorrowLikelihood = 4; - break; - case "VERY_LIKELY": - case 5: - message.sorrowLikelihood = 5; - break; - } - switch (object.angerLikelihood) { - case "UNKNOWN": - case 0: - message.angerLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.angerLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.angerLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.angerLikelihood = 3; - break; - case "LIKELY": - case 4: - message.angerLikelihood = 4; - break; - case "VERY_LIKELY": - case 5: - message.angerLikelihood = 5; - break; - } - switch (object.surpriseLikelihood) { - case "UNKNOWN": - case 0: - message.surpriseLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.surpriseLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.surpriseLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.surpriseLikelihood = 3; - break; - case "LIKELY": - case 4: - message.surpriseLikelihood = 4; - break; - case "VERY_LIKELY": - case 5: - message.surpriseLikelihood = 5; - break; - } - switch (object.underExposedLikelihood) { - case "UNKNOWN": - case 0: - message.underExposedLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.underExposedLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.underExposedLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.underExposedLikelihood = 3; - break; - case "LIKELY": - case 4: - message.underExposedLikelihood = 4; - break; - case "VERY_LIKELY": - case 5: - message.underExposedLikelihood = 5; - break; - } - switch (object.blurredLikelihood) { - case "UNKNOWN": + var message = new $root.google.cloud.vision.v1p1beta1.Feature(); + switch (object.type) { + case "TYPE_UNSPECIFIED": case 0: - message.blurredLikelihood = 0; + message.type = 0; break; - case "VERY_UNLIKELY": + case "FACE_DETECTION": case 1: - message.blurredLikelihood = 1; + message.type = 1; break; - case "UNLIKELY": + case "LANDMARK_DETECTION": case 2: - message.blurredLikelihood = 2; + message.type = 2; break; - case "POSSIBLE": + case "LOGO_DETECTION": case 3: - message.blurredLikelihood = 3; + message.type = 3; break; - case "LIKELY": + case "LABEL_DETECTION": case 4: - message.blurredLikelihood = 4; + message.type = 4; break; - case "VERY_LIKELY": + case "TEXT_DETECTION": case 5: - message.blurredLikelihood = 5; - break; - } - switch (object.headwearLikelihood) { - case "UNKNOWN": - case 0: - message.headwearLikelihood = 0; + message.type = 5; break; - case "VERY_UNLIKELY": - case 1: - message.headwearLikelihood = 1; + case "DOCUMENT_TEXT_DETECTION": + case 11: + message.type = 11; break; - case "UNLIKELY": - case 2: - message.headwearLikelihood = 2; + case "SAFE_SEARCH_DETECTION": + case 6: + message.type = 6; break; - case "POSSIBLE": - case 3: - message.headwearLikelihood = 3; + case "IMAGE_PROPERTIES": + case 7: + message.type = 7; break; - case "LIKELY": - case 4: - message.headwearLikelihood = 4; + case "CROP_HINTS": + case 9: + message.type = 9; break; - case "VERY_LIKELY": - case 5: - message.headwearLikelihood = 5; + case "WEB_DETECTION": + case 10: + message.type = 10; break; } + if (object.maxResults != null) + message.maxResults = object.maxResults | 0; + if (object.model != null) + message.model = String(object.model); return message; }; /** - * Creates a plain object from a FaceAnnotation message. Also converts values to other types if specified. + * Creates a plain object from a Feature message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p1beta1.Feature * @static - * @param {google.cloud.vision.v1p1beta1.FaceAnnotation} message FaceAnnotation + * @param {google.cloud.vision.v1p1beta1.Feature} message Feature * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FaceAnnotation.toObject = function toObject(message, options) { + Feature.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.landmarks = []; if (options.defaults) { - object.boundingPoly = null; - object.fdBoundingPoly = null; - object.rollAngle = 0; - object.panAngle = 0; - object.tiltAngle = 0; - object.detectionConfidence = 0; - object.landmarkingConfidence = 0; - object.joyLikelihood = options.enums === String ? "UNKNOWN" : 0; - object.sorrowLikelihood = options.enums === String ? "UNKNOWN" : 0; - object.angerLikelihood = options.enums === String ? "UNKNOWN" : 0; - object.surpriseLikelihood = options.enums === String ? "UNKNOWN" : 0; - object.underExposedLikelihood = options.enums === String ? "UNKNOWN" : 0; - object.blurredLikelihood = options.enums === String ? "UNKNOWN" : 0; - object.headwearLikelihood = options.enums === String ? "UNKNOWN" : 0; - } - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - object.boundingPoly = $root.google.cloud.vision.v1p1beta1.BoundingPoly.toObject(message.boundingPoly, options); - if (message.fdBoundingPoly != null && message.hasOwnProperty("fdBoundingPoly")) - object.fdBoundingPoly = $root.google.cloud.vision.v1p1beta1.BoundingPoly.toObject(message.fdBoundingPoly, options); - if (message.landmarks && message.landmarks.length) { - object.landmarks = []; - for (var j = 0; j < message.landmarks.length; ++j) - object.landmarks[j] = $root.google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.toObject(message.landmarks[j], options); + object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + object.maxResults = 0; + object.model = ""; } - if (message.rollAngle != null && message.hasOwnProperty("rollAngle")) - object.rollAngle = options.json && !isFinite(message.rollAngle) ? String(message.rollAngle) : message.rollAngle; - if (message.panAngle != null && message.hasOwnProperty("panAngle")) - object.panAngle = options.json && !isFinite(message.panAngle) ? String(message.panAngle) : message.panAngle; - if (message.tiltAngle != null && message.hasOwnProperty("tiltAngle")) - object.tiltAngle = options.json && !isFinite(message.tiltAngle) ? String(message.tiltAngle) : message.tiltAngle; - if (message.detectionConfidence != null && message.hasOwnProperty("detectionConfidence")) - object.detectionConfidence = options.json && !isFinite(message.detectionConfidence) ? String(message.detectionConfidence) : message.detectionConfidence; - if (message.landmarkingConfidence != null && message.hasOwnProperty("landmarkingConfidence")) - object.landmarkingConfidence = options.json && !isFinite(message.landmarkingConfidence) ? String(message.landmarkingConfidence) : message.landmarkingConfidence; - if (message.joyLikelihood != null && message.hasOwnProperty("joyLikelihood")) - object.joyLikelihood = options.enums === String ? $root.google.cloud.vision.v1p1beta1.Likelihood[message.joyLikelihood] : message.joyLikelihood; - if (message.sorrowLikelihood != null && message.hasOwnProperty("sorrowLikelihood")) - object.sorrowLikelihood = options.enums === String ? $root.google.cloud.vision.v1p1beta1.Likelihood[message.sorrowLikelihood] : message.sorrowLikelihood; - if (message.angerLikelihood != null && message.hasOwnProperty("angerLikelihood")) - object.angerLikelihood = options.enums === String ? $root.google.cloud.vision.v1p1beta1.Likelihood[message.angerLikelihood] : message.angerLikelihood; - if (message.surpriseLikelihood != null && message.hasOwnProperty("surpriseLikelihood")) - object.surpriseLikelihood = options.enums === String ? $root.google.cloud.vision.v1p1beta1.Likelihood[message.surpriseLikelihood] : message.surpriseLikelihood; - if (message.underExposedLikelihood != null && message.hasOwnProperty("underExposedLikelihood")) - object.underExposedLikelihood = options.enums === String ? $root.google.cloud.vision.v1p1beta1.Likelihood[message.underExposedLikelihood] : message.underExposedLikelihood; - if (message.blurredLikelihood != null && message.hasOwnProperty("blurredLikelihood")) - object.blurredLikelihood = options.enums === String ? $root.google.cloud.vision.v1p1beta1.Likelihood[message.blurredLikelihood] : message.blurredLikelihood; - if (message.headwearLikelihood != null && message.hasOwnProperty("headwearLikelihood")) - object.headwearLikelihood = options.enums === String ? $root.google.cloud.vision.v1p1beta1.Likelihood[message.headwearLikelihood] : message.headwearLikelihood; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.vision.v1p1beta1.Feature.Type[message.type] : message.type; + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + object.maxResults = message.maxResults; + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; return object; }; /** - * Converts this FaceAnnotation to JSON. + * Converts this Feature to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p1beta1.Feature * @instance * @returns {Object.} JSON object */ - FaceAnnotation.prototype.toJSON = function toJSON() { + Feature.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - FaceAnnotation.Landmark = (function() { - - /** - * Properties of a Landmark. - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation - * @interface ILandmark - * @property {google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.Type|null} [type] Landmark type - * @property {google.cloud.vision.v1p1beta1.IPosition|null} [position] Landmark position - */ + /** + * Type enum. + * @name google.cloud.vision.v1p1beta1.Feature.Type + * @enum {string} + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} FACE_DETECTION=1 FACE_DETECTION value + * @property {number} LANDMARK_DETECTION=2 LANDMARK_DETECTION value + * @property {number} LOGO_DETECTION=3 LOGO_DETECTION value + * @property {number} LABEL_DETECTION=4 LABEL_DETECTION value + * @property {number} TEXT_DETECTION=5 TEXT_DETECTION value + * @property {number} DOCUMENT_TEXT_DETECTION=11 DOCUMENT_TEXT_DETECTION value + * @property {number} SAFE_SEARCH_DETECTION=6 SAFE_SEARCH_DETECTION value + * @property {number} IMAGE_PROPERTIES=7 IMAGE_PROPERTIES value + * @property {number} CROP_HINTS=9 CROP_HINTS value + * @property {number} WEB_DETECTION=10 WEB_DETECTION value + */ + Feature.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "FACE_DETECTION"] = 1; + values[valuesById[2] = "LANDMARK_DETECTION"] = 2; + values[valuesById[3] = "LOGO_DETECTION"] = 3; + values[valuesById[4] = "LABEL_DETECTION"] = 4; + values[valuesById[5] = "TEXT_DETECTION"] = 5; + values[valuesById[11] = "DOCUMENT_TEXT_DETECTION"] = 11; + values[valuesById[6] = "SAFE_SEARCH_DETECTION"] = 6; + values[valuesById[7] = "IMAGE_PROPERTIES"] = 7; + values[valuesById[9] = "CROP_HINTS"] = 9; + values[valuesById[10] = "WEB_DETECTION"] = 10; + return values; + })(); - /** - * Constructs a new Landmark. - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation - * @classdesc Represents a Landmark. - * @implements ILandmark - * @constructor - * @param {google.cloud.vision.v1p1beta1.FaceAnnotation.ILandmark=} [properties] Properties to set - */ - function Landmark(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]]; - } + return Feature; + })(); - /** - * Landmark type. - * @member {google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.Type} type - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark - * @instance - */ - Landmark.prototype.type = 0; - - /** - * Landmark position. - * @member {google.cloud.vision.v1p1beta1.IPosition|null|undefined} position - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark - * @instance - */ - Landmark.prototype.position = null; - - /** - * Creates a new Landmark instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark - * @static - * @param {google.cloud.vision.v1p1beta1.FaceAnnotation.ILandmark=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark} Landmark instance - */ - Landmark.create = function create(properties) { - return new Landmark(properties); - }; - - /** - * Encodes the specified Landmark message. Does not implicitly {@link google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark - * @static - * @param {google.cloud.vision.v1p1beta1.FaceAnnotation.ILandmark} message Landmark message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Landmark.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.type != null && message.hasOwnProperty("type")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); - if (message.position != null && message.hasOwnProperty("position")) - $root.google.cloud.vision.v1p1beta1.Position.encode(message.position, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Landmark message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark - * @static - * @param {google.cloud.vision.v1p1beta1.FaceAnnotation.ILandmark} message Landmark message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Landmark.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Landmark message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark} Landmark - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Landmark.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.vision.v1p1beta1.FaceAnnotation.Landmark(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 3: - message.type = reader.int32(); - break; - case 4: - message.position = $root.google.cloud.vision.v1p1beta1.Position.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Landmark message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark} Landmark - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Landmark.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Landmark message. - * @function verify - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Landmark.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - case 30: - case 31: - case 32: - case 33: - case 34: - break; - } - if (message.position != null && message.hasOwnProperty("position")) { - var error = $root.google.cloud.vision.v1p1beta1.Position.verify(message.position); - if (error) - return "position." + error; - } - return null; - }; - - /** - * Creates a Landmark message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark} Landmark - */ - Landmark.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark) - return object; - var message = new $root.google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark(); - switch (object.type) { - case "UNKNOWN_LANDMARK": - case 0: - message.type = 0; - break; - case "LEFT_EYE": - case 1: - message.type = 1; - break; - case "RIGHT_EYE": - case 2: - message.type = 2; - break; - case "LEFT_OF_LEFT_EYEBROW": - case 3: - message.type = 3; - break; - case "RIGHT_OF_LEFT_EYEBROW": - case 4: - message.type = 4; - break; - case "LEFT_OF_RIGHT_EYEBROW": - case 5: - message.type = 5; - break; - case "RIGHT_OF_RIGHT_EYEBROW": - case 6: - message.type = 6; - break; - case "MIDPOINT_BETWEEN_EYES": - case 7: - message.type = 7; - break; - case "NOSE_TIP": - case 8: - message.type = 8; - break; - case "UPPER_LIP": - case 9: - message.type = 9; - break; - case "LOWER_LIP": - case 10: - message.type = 10; - break; - case "MOUTH_LEFT": - case 11: - message.type = 11; - break; - case "MOUTH_RIGHT": - case 12: - message.type = 12; - break; - case "MOUTH_CENTER": - case 13: - message.type = 13; - break; - case "NOSE_BOTTOM_RIGHT": - case 14: - message.type = 14; - break; - case "NOSE_BOTTOM_LEFT": - case 15: - message.type = 15; - break; - case "NOSE_BOTTOM_CENTER": - case 16: - message.type = 16; - break; - case "LEFT_EYE_TOP_BOUNDARY": - case 17: - message.type = 17; - break; - case "LEFT_EYE_RIGHT_CORNER": - case 18: - message.type = 18; - break; - case "LEFT_EYE_BOTTOM_BOUNDARY": - case 19: - message.type = 19; - break; - case "LEFT_EYE_LEFT_CORNER": - case 20: - message.type = 20; - break; - case "RIGHT_EYE_TOP_BOUNDARY": - case 21: - message.type = 21; - break; - case "RIGHT_EYE_RIGHT_CORNER": - case 22: - message.type = 22; - break; - case "RIGHT_EYE_BOTTOM_BOUNDARY": - case 23: - message.type = 23; - break; - case "RIGHT_EYE_LEFT_CORNER": - case 24: - message.type = 24; - break; - case "LEFT_EYEBROW_UPPER_MIDPOINT": - case 25: - message.type = 25; - break; - case "RIGHT_EYEBROW_UPPER_MIDPOINT": - case 26: - message.type = 26; - break; - case "LEFT_EAR_TRAGION": - case 27: - message.type = 27; - break; - case "RIGHT_EAR_TRAGION": - case 28: - message.type = 28; - break; - case "LEFT_EYE_PUPIL": - case 29: - message.type = 29; - break; - case "RIGHT_EYE_PUPIL": - case 30: - message.type = 30; - break; - case "FOREHEAD_GLABELLA": - case 31: - message.type = 31; - break; - case "CHIN_GNATHION": - case 32: - message.type = 32; - break; - case "CHIN_LEFT_GONION": - case 33: - message.type = 33; - break; - case "CHIN_RIGHT_GONION": - case 34: - message.type = 34; - break; - } - if (object.position != null) { - if (typeof object.position !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.position: object expected"); - message.position = $root.google.cloud.vision.v1p1beta1.Position.fromObject(object.position); - } - return message; - }; - - /** - * Creates a plain object from a Landmark message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark - * @static - * @param {google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark} message Landmark - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Landmark.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.type = options.enums === String ? "UNKNOWN_LANDMARK" : 0; - object.position = null; - } - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.Type[message.type] : message.type; - if (message.position != null && message.hasOwnProperty("position")) - object.position = $root.google.cloud.vision.v1p1beta1.Position.toObject(message.position, options); - return object; - }; - - /** - * Converts this Landmark to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark - * @instance - * @returns {Object.} JSON object - */ - Landmark.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Type enum. - * @name google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.Type - * @enum {string} - * @property {number} UNKNOWN_LANDMARK=0 UNKNOWN_LANDMARK value - * @property {number} LEFT_EYE=1 LEFT_EYE value - * @property {number} RIGHT_EYE=2 RIGHT_EYE value - * @property {number} LEFT_OF_LEFT_EYEBROW=3 LEFT_OF_LEFT_EYEBROW value - * @property {number} RIGHT_OF_LEFT_EYEBROW=4 RIGHT_OF_LEFT_EYEBROW value - * @property {number} LEFT_OF_RIGHT_EYEBROW=5 LEFT_OF_RIGHT_EYEBROW value - * @property {number} RIGHT_OF_RIGHT_EYEBROW=6 RIGHT_OF_RIGHT_EYEBROW value - * @property {number} MIDPOINT_BETWEEN_EYES=7 MIDPOINT_BETWEEN_EYES value - * @property {number} NOSE_TIP=8 NOSE_TIP value - * @property {number} UPPER_LIP=9 UPPER_LIP value - * @property {number} LOWER_LIP=10 LOWER_LIP value - * @property {number} MOUTH_LEFT=11 MOUTH_LEFT value - * @property {number} MOUTH_RIGHT=12 MOUTH_RIGHT value - * @property {number} MOUTH_CENTER=13 MOUTH_CENTER value - * @property {number} NOSE_BOTTOM_RIGHT=14 NOSE_BOTTOM_RIGHT value - * @property {number} NOSE_BOTTOM_LEFT=15 NOSE_BOTTOM_LEFT value - * @property {number} NOSE_BOTTOM_CENTER=16 NOSE_BOTTOM_CENTER value - * @property {number} LEFT_EYE_TOP_BOUNDARY=17 LEFT_EYE_TOP_BOUNDARY value - * @property {number} LEFT_EYE_RIGHT_CORNER=18 LEFT_EYE_RIGHT_CORNER value - * @property {number} LEFT_EYE_BOTTOM_BOUNDARY=19 LEFT_EYE_BOTTOM_BOUNDARY value - * @property {number} LEFT_EYE_LEFT_CORNER=20 LEFT_EYE_LEFT_CORNER value - * @property {number} RIGHT_EYE_TOP_BOUNDARY=21 RIGHT_EYE_TOP_BOUNDARY value - * @property {number} RIGHT_EYE_RIGHT_CORNER=22 RIGHT_EYE_RIGHT_CORNER value - * @property {number} RIGHT_EYE_BOTTOM_BOUNDARY=23 RIGHT_EYE_BOTTOM_BOUNDARY value - * @property {number} RIGHT_EYE_LEFT_CORNER=24 RIGHT_EYE_LEFT_CORNER value - * @property {number} LEFT_EYEBROW_UPPER_MIDPOINT=25 LEFT_EYEBROW_UPPER_MIDPOINT value - * @property {number} RIGHT_EYEBROW_UPPER_MIDPOINT=26 RIGHT_EYEBROW_UPPER_MIDPOINT value - * @property {number} LEFT_EAR_TRAGION=27 LEFT_EAR_TRAGION value - * @property {number} RIGHT_EAR_TRAGION=28 RIGHT_EAR_TRAGION value - * @property {number} LEFT_EYE_PUPIL=29 LEFT_EYE_PUPIL value - * @property {number} RIGHT_EYE_PUPIL=30 RIGHT_EYE_PUPIL value - * @property {number} FOREHEAD_GLABELLA=31 FOREHEAD_GLABELLA value - * @property {number} CHIN_GNATHION=32 CHIN_GNATHION value - * @property {number} CHIN_LEFT_GONION=33 CHIN_LEFT_GONION value - * @property {number} CHIN_RIGHT_GONION=34 CHIN_RIGHT_GONION value - */ - Landmark.Type = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "UNKNOWN_LANDMARK"] = 0; - values[valuesById[1] = "LEFT_EYE"] = 1; - values[valuesById[2] = "RIGHT_EYE"] = 2; - values[valuesById[3] = "LEFT_OF_LEFT_EYEBROW"] = 3; - values[valuesById[4] = "RIGHT_OF_LEFT_EYEBROW"] = 4; - values[valuesById[5] = "LEFT_OF_RIGHT_EYEBROW"] = 5; - values[valuesById[6] = "RIGHT_OF_RIGHT_EYEBROW"] = 6; - values[valuesById[7] = "MIDPOINT_BETWEEN_EYES"] = 7; - values[valuesById[8] = "NOSE_TIP"] = 8; - values[valuesById[9] = "UPPER_LIP"] = 9; - values[valuesById[10] = "LOWER_LIP"] = 10; - values[valuesById[11] = "MOUTH_LEFT"] = 11; - values[valuesById[12] = "MOUTH_RIGHT"] = 12; - values[valuesById[13] = "MOUTH_CENTER"] = 13; - values[valuesById[14] = "NOSE_BOTTOM_RIGHT"] = 14; - values[valuesById[15] = "NOSE_BOTTOM_LEFT"] = 15; - values[valuesById[16] = "NOSE_BOTTOM_CENTER"] = 16; - values[valuesById[17] = "LEFT_EYE_TOP_BOUNDARY"] = 17; - values[valuesById[18] = "LEFT_EYE_RIGHT_CORNER"] = 18; - values[valuesById[19] = "LEFT_EYE_BOTTOM_BOUNDARY"] = 19; - values[valuesById[20] = "LEFT_EYE_LEFT_CORNER"] = 20; - values[valuesById[21] = "RIGHT_EYE_TOP_BOUNDARY"] = 21; - values[valuesById[22] = "RIGHT_EYE_RIGHT_CORNER"] = 22; - values[valuesById[23] = "RIGHT_EYE_BOTTOM_BOUNDARY"] = 23; - values[valuesById[24] = "RIGHT_EYE_LEFT_CORNER"] = 24; - values[valuesById[25] = "LEFT_EYEBROW_UPPER_MIDPOINT"] = 25; - values[valuesById[26] = "RIGHT_EYEBROW_UPPER_MIDPOINT"] = 26; - values[valuesById[27] = "LEFT_EAR_TRAGION"] = 27; - values[valuesById[28] = "RIGHT_EAR_TRAGION"] = 28; - values[valuesById[29] = "LEFT_EYE_PUPIL"] = 29; - values[valuesById[30] = "RIGHT_EYE_PUPIL"] = 30; - values[valuesById[31] = "FOREHEAD_GLABELLA"] = 31; - values[valuesById[32] = "CHIN_GNATHION"] = 32; - values[valuesById[33] = "CHIN_LEFT_GONION"] = 33; - values[valuesById[34] = "CHIN_RIGHT_GONION"] = 34; - return values; - })(); - - return Landmark; - })(); - - return FaceAnnotation; - })(); - - v1p1beta1.LocationInfo = (function() { + v1p1beta1.ImageSource = (function() { /** - * Properties of a LocationInfo. + * Properties of an ImageSource. * @memberof google.cloud.vision.v1p1beta1 - * @interface ILocationInfo - * @property {google.type.ILatLng|null} [latLng] LocationInfo latLng + * @interface IImageSource + * @property {string|null} [gcsImageUri] ImageSource gcsImageUri + * @property {string|null} [imageUri] ImageSource imageUri */ /** - * Constructs a new LocationInfo. + * Constructs a new ImageSource. * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a LocationInfo. - * @implements ILocationInfo + * @classdesc Represents an ImageSource. + * @implements IImageSource * @constructor - * @param {google.cloud.vision.v1p1beta1.ILocationInfo=} [properties] Properties to set + * @param {google.cloud.vision.v1p1beta1.IImageSource=} [properties] Properties to set */ - function LocationInfo(properties) { + function ImageSource(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -27111,75 +26096,88 @@ } /** - * LocationInfo latLng. - * @member {google.type.ILatLng|null|undefined} latLng - * @memberof google.cloud.vision.v1p1beta1.LocationInfo + * ImageSource gcsImageUri. + * @member {string} gcsImageUri + * @memberof google.cloud.vision.v1p1beta1.ImageSource * @instance */ - LocationInfo.prototype.latLng = null; + ImageSource.prototype.gcsImageUri = ""; /** - * Creates a new LocationInfo instance using the specified properties. + * ImageSource imageUri. + * @member {string} imageUri + * @memberof google.cloud.vision.v1p1beta1.ImageSource + * @instance + */ + ImageSource.prototype.imageUri = ""; + + /** + * Creates a new ImageSource instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p1beta1.LocationInfo + * @memberof google.cloud.vision.v1p1beta1.ImageSource * @static - * @param {google.cloud.vision.v1p1beta1.ILocationInfo=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.LocationInfo} LocationInfo instance + * @param {google.cloud.vision.v1p1beta1.IImageSource=} [properties] Properties to set + * @returns {google.cloud.vision.v1p1beta1.ImageSource} ImageSource instance */ - LocationInfo.create = function create(properties) { - return new LocationInfo(properties); + ImageSource.create = function create(properties) { + return new ImageSource(properties); }; /** - * Encodes the specified LocationInfo message. Does not implicitly {@link google.cloud.vision.v1p1beta1.LocationInfo.verify|verify} messages. + * Encodes the specified ImageSource message. Does not implicitly {@link google.cloud.vision.v1p1beta1.ImageSource.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p1beta1.LocationInfo + * @memberof google.cloud.vision.v1p1beta1.ImageSource * @static - * @param {google.cloud.vision.v1p1beta1.ILocationInfo} message LocationInfo message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IImageSource} message ImageSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - LocationInfo.encode = function encode(message, writer) { + ImageSource.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.latLng != null && message.hasOwnProperty("latLng")) - $root.google.type.LatLng.encode(message.latLng, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.gcsImageUri != null && message.hasOwnProperty("gcsImageUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsImageUri); + if (message.imageUri != null && message.hasOwnProperty("imageUri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.imageUri); return writer; }; /** - * Encodes the specified LocationInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.LocationInfo.verify|verify} messages. + * Encodes the specified ImageSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.ImageSource.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.LocationInfo + * @memberof google.cloud.vision.v1p1beta1.ImageSource * @static - * @param {google.cloud.vision.v1p1beta1.ILocationInfo} message LocationInfo message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IImageSource} message ImageSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - LocationInfo.encodeDelimited = function encodeDelimited(message, writer) { + ImageSource.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a LocationInfo message from the specified reader or buffer. + * Decodes an ImageSource message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p1beta1.LocationInfo + * @memberof google.cloud.vision.v1p1beta1.ImageSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p1beta1.LocationInfo} LocationInfo + * @returns {google.cloud.vision.v1p1beta1.ImageSource} ImageSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - LocationInfo.decode = function decode(reader, length) { + ImageSource.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.vision.v1p1beta1.LocationInfo(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p1beta1.ImageSource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.latLng = $root.google.type.LatLng.decode(reader, reader.uint32()); + message.gcsImageUri = reader.string(); + break; + case 2: + message.imageUri = reader.string(); break; default: reader.skipType(tag & 7); @@ -27190,114 +26188,117 @@ }; /** - * Decodes a LocationInfo message from the specified reader or buffer, length delimited. + * Decodes an ImageSource message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.LocationInfo + * @memberof google.cloud.vision.v1p1beta1.ImageSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.LocationInfo} LocationInfo + * @returns {google.cloud.vision.v1p1beta1.ImageSource} ImageSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - LocationInfo.decodeDelimited = function decodeDelimited(reader) { + ImageSource.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a LocationInfo message. + * Verifies an ImageSource message. * @function verify - * @memberof google.cloud.vision.v1p1beta1.LocationInfo + * @memberof google.cloud.vision.v1p1beta1.ImageSource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - LocationInfo.verify = function verify(message) { + ImageSource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.latLng != null && message.hasOwnProperty("latLng")) { - var error = $root.google.type.LatLng.verify(message.latLng); - if (error) - return "latLng." + error; - } + if (message.gcsImageUri != null && message.hasOwnProperty("gcsImageUri")) + if (!$util.isString(message.gcsImageUri)) + return "gcsImageUri: string expected"; + if (message.imageUri != null && message.hasOwnProperty("imageUri")) + if (!$util.isString(message.imageUri)) + return "imageUri: string expected"; return null; }; /** - * Creates a LocationInfo message from a plain object. Also converts values to their respective internal types. + * Creates an ImageSource message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.LocationInfo + * @memberof google.cloud.vision.v1p1beta1.ImageSource * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.LocationInfo} LocationInfo + * @returns {google.cloud.vision.v1p1beta1.ImageSource} ImageSource */ - LocationInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.LocationInfo) + ImageSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p1beta1.ImageSource) return object; - var message = new $root.google.cloud.vision.v1p1beta1.LocationInfo(); - if (object.latLng != null) { - if (typeof object.latLng !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.LocationInfo.latLng: object expected"); - message.latLng = $root.google.type.LatLng.fromObject(object.latLng); - } + var message = new $root.google.cloud.vision.v1p1beta1.ImageSource(); + if (object.gcsImageUri != null) + message.gcsImageUri = String(object.gcsImageUri); + if (object.imageUri != null) + message.imageUri = String(object.imageUri); return message; }; /** - * Creates a plain object from a LocationInfo message. Also converts values to other types if specified. + * Creates a plain object from an ImageSource message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p1beta1.LocationInfo + * @memberof google.cloud.vision.v1p1beta1.ImageSource * @static - * @param {google.cloud.vision.v1p1beta1.LocationInfo} message LocationInfo + * @param {google.cloud.vision.v1p1beta1.ImageSource} message ImageSource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - LocationInfo.toObject = function toObject(message, options) { + ImageSource.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.latLng = null; - if (message.latLng != null && message.hasOwnProperty("latLng")) - object.latLng = $root.google.type.LatLng.toObject(message.latLng, options); + if (options.defaults) { + object.gcsImageUri = ""; + object.imageUri = ""; + } + if (message.gcsImageUri != null && message.hasOwnProperty("gcsImageUri")) + object.gcsImageUri = message.gcsImageUri; + if (message.imageUri != null && message.hasOwnProperty("imageUri")) + object.imageUri = message.imageUri; return object; }; /** - * Converts this LocationInfo to JSON. + * Converts this ImageSource to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.LocationInfo + * @memberof google.cloud.vision.v1p1beta1.ImageSource * @instance * @returns {Object.} JSON object */ - LocationInfo.prototype.toJSON = function toJSON() { + ImageSource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return LocationInfo; + return ImageSource; })(); - v1p1beta1.Property = (function() { + v1p1beta1.Image = (function() { /** - * Properties of a Property. + * Properties of an Image. * @memberof google.cloud.vision.v1p1beta1 - * @interface IProperty - * @property {string|null} [name] Property name - * @property {string|null} [value] Property value - * @property {number|Long|null} [uint64Value] Property uint64Value + * @interface IImage + * @property {Uint8Array|null} [content] Image content + * @property {google.cloud.vision.v1p1beta1.IImageSource|null} [source] Image source */ /** - * Constructs a new Property. + * Constructs a new Image. * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a Property. - * @implements IProperty + * @classdesc Represents an Image. + * @implements IImage * @constructor - * @param {google.cloud.vision.v1p1beta1.IProperty=} [properties] Properties to set + * @param {google.cloud.vision.v1p1beta1.IImage=} [properties] Properties to set */ - function Property(properties) { + function Image(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -27305,101 +26306,88 @@ } /** - * Property name. - * @member {string} name - * @memberof google.cloud.vision.v1p1beta1.Property - * @instance - */ - Property.prototype.name = ""; - - /** - * Property value. - * @member {string} value - * @memberof google.cloud.vision.v1p1beta1.Property + * Image content. + * @member {Uint8Array} content + * @memberof google.cloud.vision.v1p1beta1.Image * @instance */ - Property.prototype.value = ""; + Image.prototype.content = $util.newBuffer([]); /** - * Property uint64Value. - * @member {number|Long} uint64Value - * @memberof google.cloud.vision.v1p1beta1.Property + * Image source. + * @member {google.cloud.vision.v1p1beta1.IImageSource|null|undefined} source + * @memberof google.cloud.vision.v1p1beta1.Image * @instance */ - Property.prototype.uint64Value = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + Image.prototype.source = null; /** - * Creates a new Property instance using the specified properties. + * Creates a new Image instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p1beta1.Property + * @memberof google.cloud.vision.v1p1beta1.Image * @static - * @param {google.cloud.vision.v1p1beta1.IProperty=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.Property} Property instance + * @param {google.cloud.vision.v1p1beta1.IImage=} [properties] Properties to set + * @returns {google.cloud.vision.v1p1beta1.Image} Image instance */ - Property.create = function create(properties) { - return new Property(properties); + Image.create = function create(properties) { + return new Image(properties); }; /** - * Encodes the specified Property message. Does not implicitly {@link google.cloud.vision.v1p1beta1.Property.verify|verify} messages. + * Encodes the specified Image message. Does not implicitly {@link google.cloud.vision.v1p1beta1.Image.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p1beta1.Property + * @memberof google.cloud.vision.v1p1beta1.Image * @static - * @param {google.cloud.vision.v1p1beta1.IProperty} message Property message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IImage} message Image message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Property.encode = function encode(message, writer) { + Image.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.value != null && message.hasOwnProperty("value")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); - if (message.uint64Value != null && message.hasOwnProperty("uint64Value")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.uint64Value); + if (message.content != null && message.hasOwnProperty("content")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.content); + if (message.source != null && message.hasOwnProperty("source")) + $root.google.cloud.vision.v1p1beta1.ImageSource.encode(message.source, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified Property message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.Property.verify|verify} messages. + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.Image.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.Property + * @memberof google.cloud.vision.v1p1beta1.Image * @static - * @param {google.cloud.vision.v1p1beta1.IProperty} message Property message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IImage} message Image message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Property.encodeDelimited = function encodeDelimited(message, writer) { + Image.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Property message from the specified reader or buffer. + * Decodes an Image message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p1beta1.Property + * @memberof google.cloud.vision.v1p1beta1.Image * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p1beta1.Property} Property + * @returns {google.cloud.vision.v1p1beta1.Image} Image * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Property.decode = function decode(reader, length) { + Image.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.vision.v1p1beta1.Property(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p1beta1.Image(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.name = reader.string(); + message.content = reader.bytes(); break; case 2: - message.value = reader.string(); - break; - case 3: - message.uint64Value = reader.uint64(); + message.source = $root.google.cloud.vision.v1p1beta1.ImageSource.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -27410,148 +26398,145 @@ }; /** - * Decodes a Property message from the specified reader or buffer, length delimited. + * Decodes an Image message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.Property + * @memberof google.cloud.vision.v1p1beta1.Image * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.Property} Property + * @returns {google.cloud.vision.v1p1beta1.Image} Image * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Property.decodeDelimited = function decodeDelimited(reader) { + Image.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Property message. + * Verifies an Image message. * @function verify - * @memberof google.cloud.vision.v1p1beta1.Property + * @memberof google.cloud.vision.v1p1beta1.Image * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Property.verify = function verify(message) { + Image.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isString(message.value)) - return "value: string expected"; - if (message.uint64Value != null && message.hasOwnProperty("uint64Value")) - if (!$util.isInteger(message.uint64Value) && !(message.uint64Value && $util.isInteger(message.uint64Value.low) && $util.isInteger(message.uint64Value.high))) - return "uint64Value: integer|Long expected"; + if (message.content != null && message.hasOwnProperty("content")) + if (!(message.content && typeof message.content.length === "number" || $util.isString(message.content))) + return "content: buffer expected"; + if (message.source != null && message.hasOwnProperty("source")) { + var error = $root.google.cloud.vision.v1p1beta1.ImageSource.verify(message.source); + if (error) + return "source." + error; + } return null; }; /** - * Creates a Property message from a plain object. Also converts values to their respective internal types. + * Creates an Image message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.Property + * @memberof google.cloud.vision.v1p1beta1.Image * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.Property} Property + * @returns {google.cloud.vision.v1p1beta1.Image} Image */ - Property.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.Property) + Image.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p1beta1.Image) return object; - var message = new $root.google.cloud.vision.v1p1beta1.Property(); - if (object.name != null) - message.name = String(object.name); - if (object.value != null) - message.value = String(object.value); - if (object.uint64Value != null) - if ($util.Long) - (message.uint64Value = $util.Long.fromValue(object.uint64Value)).unsigned = true; - else if (typeof object.uint64Value === "string") - message.uint64Value = parseInt(object.uint64Value, 10); - else if (typeof object.uint64Value === "number") - message.uint64Value = object.uint64Value; - else if (typeof object.uint64Value === "object") - message.uint64Value = new $util.LongBits(object.uint64Value.low >>> 0, object.uint64Value.high >>> 0).toNumber(true); + var message = new $root.google.cloud.vision.v1p1beta1.Image(); + if (object.content != null) + if (typeof object.content === "string") + $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); + else if (object.content.length) + message.content = object.content; + if (object.source != null) { + if (typeof object.source !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.Image.source: object expected"); + message.source = $root.google.cloud.vision.v1p1beta1.ImageSource.fromObject(object.source); + } return message; }; /** - * Creates a plain object from a Property message. Also converts values to other types if specified. + * Creates a plain object from an Image message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p1beta1.Property + * @memberof google.cloud.vision.v1p1beta1.Image * @static - * @param {google.cloud.vision.v1p1beta1.Property} message Property + * @param {google.cloud.vision.v1p1beta1.Image} message Image * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Property.toObject = function toObject(message, options) { + Image.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.name = ""; - object.value = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, true); - object.uint64Value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.uint64Value = options.longs === String ? "0" : 0; + if (options.bytes === String) + object.content = ""; + else { + object.content = []; + if (options.bytes !== Array) + object.content = $util.newBuffer(object.content); + } + object.source = null; } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - if (message.uint64Value != null && message.hasOwnProperty("uint64Value")) - if (typeof message.uint64Value === "number") - object.uint64Value = options.longs === String ? String(message.uint64Value) : message.uint64Value; - else - object.uint64Value = options.longs === String ? $util.Long.prototype.toString.call(message.uint64Value) : options.longs === Number ? new $util.LongBits(message.uint64Value.low >>> 0, message.uint64Value.high >>> 0).toNumber(true) : message.uint64Value; + if (message.content != null && message.hasOwnProperty("content")) + object.content = options.bytes === String ? $util.base64.encode(message.content, 0, message.content.length) : options.bytes === Array ? Array.prototype.slice.call(message.content) : message.content; + if (message.source != null && message.hasOwnProperty("source")) + object.source = $root.google.cloud.vision.v1p1beta1.ImageSource.toObject(message.source, options); return object; }; /** - * Converts this Property to JSON. + * Converts this Image to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.Property + * @memberof google.cloud.vision.v1p1beta1.Image * @instance * @returns {Object.} JSON object */ - Property.prototype.toJSON = function toJSON() { + Image.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Property; + return Image; })(); - v1p1beta1.EntityAnnotation = (function() { + v1p1beta1.FaceAnnotation = (function() { /** - * Properties of an EntityAnnotation. + * Properties of a FaceAnnotation. * @memberof google.cloud.vision.v1p1beta1 - * @interface IEntityAnnotation - * @property {string|null} [mid] EntityAnnotation mid - * @property {string|null} [locale] EntityAnnotation locale - * @property {string|null} [description] EntityAnnotation description - * @property {number|null} [score] EntityAnnotation score - * @property {number|null} [confidence] EntityAnnotation confidence - * @property {number|null} [topicality] EntityAnnotation topicality - * @property {google.cloud.vision.v1p1beta1.IBoundingPoly|null} [boundingPoly] EntityAnnotation boundingPoly - * @property {Array.|null} [locations] EntityAnnotation locations - * @property {Array.|null} [properties] EntityAnnotation properties + * @interface IFaceAnnotation + * @property {google.cloud.vision.v1p1beta1.IBoundingPoly|null} [boundingPoly] FaceAnnotation boundingPoly + * @property {google.cloud.vision.v1p1beta1.IBoundingPoly|null} [fdBoundingPoly] FaceAnnotation fdBoundingPoly + * @property {Array.|null} [landmarks] FaceAnnotation landmarks + * @property {number|null} [rollAngle] FaceAnnotation rollAngle + * @property {number|null} [panAngle] FaceAnnotation panAngle + * @property {number|null} [tiltAngle] FaceAnnotation tiltAngle + * @property {number|null} [detectionConfidence] FaceAnnotation detectionConfidence + * @property {number|null} [landmarkingConfidence] FaceAnnotation landmarkingConfidence + * @property {google.cloud.vision.v1p1beta1.Likelihood|null} [joyLikelihood] FaceAnnotation joyLikelihood + * @property {google.cloud.vision.v1p1beta1.Likelihood|null} [sorrowLikelihood] FaceAnnotation sorrowLikelihood + * @property {google.cloud.vision.v1p1beta1.Likelihood|null} [angerLikelihood] FaceAnnotation angerLikelihood + * @property {google.cloud.vision.v1p1beta1.Likelihood|null} [surpriseLikelihood] FaceAnnotation surpriseLikelihood + * @property {google.cloud.vision.v1p1beta1.Likelihood|null} [underExposedLikelihood] FaceAnnotation underExposedLikelihood + * @property {google.cloud.vision.v1p1beta1.Likelihood|null} [blurredLikelihood] FaceAnnotation blurredLikelihood + * @property {google.cloud.vision.v1p1beta1.Likelihood|null} [headwearLikelihood] FaceAnnotation headwearLikelihood */ /** - * Constructs a new EntityAnnotation. + * Constructs a new FaceAnnotation. * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents an EntityAnnotation. - * @implements IEntityAnnotation + * @classdesc Represents a FaceAnnotation. + * @implements IFaceAnnotation * @constructor - * @param {google.cloud.vision.v1p1beta1.IEntityAnnotation=} [properties] Properties to set + * @param {google.cloud.vision.v1p1beta1.IFaceAnnotation=} [properties] Properties to set */ - function EntityAnnotation(properties) { - this.locations = []; - this.properties = []; + function FaceAnnotation(properties) { + this.landmarks = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -27559,185 +26544,260 @@ } /** - * EntityAnnotation mid. - * @member {string} mid - * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation + * FaceAnnotation boundingPoly. + * @member {google.cloud.vision.v1p1beta1.IBoundingPoly|null|undefined} boundingPoly + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation * @instance */ - EntityAnnotation.prototype.mid = ""; + FaceAnnotation.prototype.boundingPoly = null; /** - * EntityAnnotation locale. - * @member {string} locale - * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation + * FaceAnnotation fdBoundingPoly. + * @member {google.cloud.vision.v1p1beta1.IBoundingPoly|null|undefined} fdBoundingPoly + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation * @instance */ - EntityAnnotation.prototype.locale = ""; + FaceAnnotation.prototype.fdBoundingPoly = null; /** - * EntityAnnotation description. - * @member {string} description - * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation + * FaceAnnotation landmarks. + * @member {Array.} landmarks + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation * @instance */ - EntityAnnotation.prototype.description = ""; + FaceAnnotation.prototype.landmarks = $util.emptyArray; /** - * EntityAnnotation score. - * @member {number} score - * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation + * FaceAnnotation rollAngle. + * @member {number} rollAngle + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation * @instance */ - EntityAnnotation.prototype.score = 0; + FaceAnnotation.prototype.rollAngle = 0; /** - * EntityAnnotation confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation + * FaceAnnotation panAngle. + * @member {number} panAngle + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation * @instance */ - EntityAnnotation.prototype.confidence = 0; + FaceAnnotation.prototype.panAngle = 0; /** - * EntityAnnotation topicality. - * @member {number} topicality - * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation + * FaceAnnotation tiltAngle. + * @member {number} tiltAngle + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation * @instance */ - EntityAnnotation.prototype.topicality = 0; + FaceAnnotation.prototype.tiltAngle = 0; /** - * EntityAnnotation boundingPoly. - * @member {google.cloud.vision.v1p1beta1.IBoundingPoly|null|undefined} boundingPoly - * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation + * FaceAnnotation detectionConfidence. + * @member {number} detectionConfidence + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation * @instance */ - EntityAnnotation.prototype.boundingPoly = null; + FaceAnnotation.prototype.detectionConfidence = 0; /** - * EntityAnnotation locations. - * @member {Array.} locations - * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation + * FaceAnnotation landmarkingConfidence. + * @member {number} landmarkingConfidence + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation * @instance */ - EntityAnnotation.prototype.locations = $util.emptyArray; + FaceAnnotation.prototype.landmarkingConfidence = 0; /** - * EntityAnnotation properties. - * @member {Array.} properties - * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation + * FaceAnnotation joyLikelihood. + * @member {google.cloud.vision.v1p1beta1.Likelihood} joyLikelihood + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation * @instance */ - EntityAnnotation.prototype.properties = $util.emptyArray; + FaceAnnotation.prototype.joyLikelihood = 0; /** - * Creates a new EntityAnnotation instance using the specified properties. + * FaceAnnotation sorrowLikelihood. + * @member {google.cloud.vision.v1p1beta1.Likelihood} sorrowLikelihood + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.sorrowLikelihood = 0; + + /** + * FaceAnnotation angerLikelihood. + * @member {google.cloud.vision.v1p1beta1.Likelihood} angerLikelihood + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.angerLikelihood = 0; + + /** + * FaceAnnotation surpriseLikelihood. + * @member {google.cloud.vision.v1p1beta1.Likelihood} surpriseLikelihood + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.surpriseLikelihood = 0; + + /** + * FaceAnnotation underExposedLikelihood. + * @member {google.cloud.vision.v1p1beta1.Likelihood} underExposedLikelihood + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.underExposedLikelihood = 0; + + /** + * FaceAnnotation blurredLikelihood. + * @member {google.cloud.vision.v1p1beta1.Likelihood} blurredLikelihood + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.blurredLikelihood = 0; + + /** + * FaceAnnotation headwearLikelihood. + * @member {google.cloud.vision.v1p1beta1.Likelihood} headwearLikelihood + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.headwearLikelihood = 0; + + /** + * Creates a new FaceAnnotation instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation * @static - * @param {google.cloud.vision.v1p1beta1.IEntityAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.EntityAnnotation} EntityAnnotation instance + * @param {google.cloud.vision.v1p1beta1.IFaceAnnotation=} [properties] Properties to set + * @returns {google.cloud.vision.v1p1beta1.FaceAnnotation} FaceAnnotation instance */ - EntityAnnotation.create = function create(properties) { - return new EntityAnnotation(properties); + FaceAnnotation.create = function create(properties) { + return new FaceAnnotation(properties); }; /** - * Encodes the specified EntityAnnotation message. Does not implicitly {@link google.cloud.vision.v1p1beta1.EntityAnnotation.verify|verify} messages. + * Encodes the specified FaceAnnotation message. Does not implicitly {@link google.cloud.vision.v1p1beta1.FaceAnnotation.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation * @static - * @param {google.cloud.vision.v1p1beta1.IEntityAnnotation} message EntityAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IFaceAnnotation} message FaceAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EntityAnnotation.encode = function encode(message, writer) { + FaceAnnotation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.mid != null && message.hasOwnProperty("mid")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.mid); - if (message.locale != null && message.hasOwnProperty("locale")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.locale); - if (message.description != null && message.hasOwnProperty("description")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); - if (message.score != null && message.hasOwnProperty("score")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.score); - if (message.confidence != null && message.hasOwnProperty("confidence")) - writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); - if (message.topicality != null && message.hasOwnProperty("topicality")) - writer.uint32(/* id 6, wireType 5 =*/53).float(message.topicality); if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - $root.google.cloud.vision.v1p1beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.locations != null && message.locations.length) - for (var i = 0; i < message.locations.length; ++i) - $root.google.cloud.vision.v1p1beta1.LocationInfo.encode(message.locations[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.properties != null && message.properties.length) - for (var i = 0; i < message.properties.length; ++i) - $root.google.cloud.vision.v1p1beta1.Property.encode(message.properties[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified EntityAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.EntityAnnotation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation - * @static - * @param {google.cloud.vision.v1p1beta1.IEntityAnnotation} message EntityAnnotation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EntityAnnotation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - + $root.google.cloud.vision.v1p1beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.fdBoundingPoly != null && message.hasOwnProperty("fdBoundingPoly")) + $root.google.cloud.vision.v1p1beta1.BoundingPoly.encode(message.fdBoundingPoly, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.landmarks != null && message.landmarks.length) + for (var i = 0; i < message.landmarks.length; ++i) + $root.google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.encode(message.landmarks[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.rollAngle != null && message.hasOwnProperty("rollAngle")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.rollAngle); + if (message.panAngle != null && message.hasOwnProperty("panAngle")) + writer.uint32(/* id 5, wireType 5 =*/45).float(message.panAngle); + if (message.tiltAngle != null && message.hasOwnProperty("tiltAngle")) + writer.uint32(/* id 6, wireType 5 =*/53).float(message.tiltAngle); + if (message.detectionConfidence != null && message.hasOwnProperty("detectionConfidence")) + writer.uint32(/* id 7, wireType 5 =*/61).float(message.detectionConfidence); + if (message.landmarkingConfidence != null && message.hasOwnProperty("landmarkingConfidence")) + writer.uint32(/* id 8, wireType 5 =*/69).float(message.landmarkingConfidence); + if (message.joyLikelihood != null && message.hasOwnProperty("joyLikelihood")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.joyLikelihood); + if (message.sorrowLikelihood != null && message.hasOwnProperty("sorrowLikelihood")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.sorrowLikelihood); + if (message.angerLikelihood != null && message.hasOwnProperty("angerLikelihood")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.angerLikelihood); + if (message.surpriseLikelihood != null && message.hasOwnProperty("surpriseLikelihood")) + writer.uint32(/* id 12, wireType 0 =*/96).int32(message.surpriseLikelihood); + if (message.underExposedLikelihood != null && message.hasOwnProperty("underExposedLikelihood")) + writer.uint32(/* id 13, wireType 0 =*/104).int32(message.underExposedLikelihood); + if (message.blurredLikelihood != null && message.hasOwnProperty("blurredLikelihood")) + writer.uint32(/* id 14, wireType 0 =*/112).int32(message.blurredLikelihood); + if (message.headwearLikelihood != null && message.hasOwnProperty("headwearLikelihood")) + writer.uint32(/* id 15, wireType 0 =*/120).int32(message.headwearLikelihood); + return writer; + }; + /** - * Decodes an EntityAnnotation message from the specified reader or buffer. + * Encodes the specified FaceAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.FaceAnnotation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation + * @static + * @param {google.cloud.vision.v1p1beta1.IFaceAnnotation} message FaceAnnotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FaceAnnotation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FaceAnnotation message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p1beta1.EntityAnnotation} EntityAnnotation + * @returns {google.cloud.vision.v1p1beta1.FaceAnnotation} FaceAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EntityAnnotation.decode = function decode(reader, length) { + FaceAnnotation.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.vision.v1p1beta1.EntityAnnotation(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p1beta1.FaceAnnotation(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.mid = reader.string(); + message.boundingPoly = $root.google.cloud.vision.v1p1beta1.BoundingPoly.decode(reader, reader.uint32()); break; case 2: - message.locale = reader.string(); + message.fdBoundingPoly = $root.google.cloud.vision.v1p1beta1.BoundingPoly.decode(reader, reader.uint32()); break; case 3: - message.description = reader.string(); + if (!(message.landmarks && message.landmarks.length)) + message.landmarks = []; + message.landmarks.push($root.google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.decode(reader, reader.uint32())); break; case 4: - message.score = reader.float(); + message.rollAngle = reader.float(); break; case 5: - message.confidence = reader.float(); + message.panAngle = reader.float(); break; case 6: - message.topicality = reader.float(); + message.tiltAngle = reader.float(); break; case 7: - message.boundingPoly = $root.google.cloud.vision.v1p1beta1.BoundingPoly.decode(reader, reader.uint32()); + message.detectionConfidence = reader.float(); break; case 8: - if (!(message.locations && message.locations.length)) - message.locations = []; - message.locations.push($root.google.cloud.vision.v1p1beta1.LocationInfo.decode(reader, reader.uint32())); + message.landmarkingConfidence = reader.float(); break; case 9: - if (!(message.properties && message.properties.length)) - message.properties = []; - message.properties.push($root.google.cloud.vision.v1p1beta1.Property.decode(reader, reader.uint32())); + message.joyLikelihood = reader.int32(); + break; + case 10: + message.sorrowLikelihood = reader.int32(); + break; + case 11: + message.angerLikelihood = reader.int32(); + break; + case 12: + message.surpriseLikelihood = reader.int32(); + break; + case 13: + message.underExposedLikelihood = reader.int32(); + break; + case 14: + message.blurredLikelihood = reader.int32(); + break; + case 15: + message.headwearLikelihood = reader.int32(); break; default: reader.skipType(tag & 7); @@ -27748,385 +26808,82 @@ }; /** - * Decodes an EntityAnnotation message from the specified reader or buffer, length delimited. + * Decodes a FaceAnnotation message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.EntityAnnotation} EntityAnnotation + * @returns {google.cloud.vision.v1p1beta1.FaceAnnotation} FaceAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EntityAnnotation.decodeDelimited = function decodeDelimited(reader) { + FaceAnnotation.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an EntityAnnotation message. + * Verifies a FaceAnnotation message. * @function verify - * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - EntityAnnotation.verify = function verify(message) { + FaceAnnotation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.mid != null && message.hasOwnProperty("mid")) - if (!$util.isString(message.mid)) - return "mid: string expected"; - if (message.locale != null && message.hasOwnProperty("locale")) - if (!$util.isString(message.locale)) - return "locale: string expected"; - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; - if (message.confidence != null && message.hasOwnProperty("confidence")) - if (typeof message.confidence !== "number") - return "confidence: number expected"; - if (message.topicality != null && message.hasOwnProperty("topicality")) - if (typeof message.topicality !== "number") - return "topicality: number expected"; if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { var error = $root.google.cloud.vision.v1p1beta1.BoundingPoly.verify(message.boundingPoly); if (error) return "boundingPoly." + error; } - if (message.locations != null && message.hasOwnProperty("locations")) { - if (!Array.isArray(message.locations)) - return "locations: array expected"; - for (var i = 0; i < message.locations.length; ++i) { - var error = $root.google.cloud.vision.v1p1beta1.LocationInfo.verify(message.locations[i]); - if (error) - return "locations." + error; - } + if (message.fdBoundingPoly != null && message.hasOwnProperty("fdBoundingPoly")) { + var error = $root.google.cloud.vision.v1p1beta1.BoundingPoly.verify(message.fdBoundingPoly); + if (error) + return "fdBoundingPoly." + error; } - if (message.properties != null && message.hasOwnProperty("properties")) { - if (!Array.isArray(message.properties)) - return "properties: array expected"; - for (var i = 0; i < message.properties.length; ++i) { - var error = $root.google.cloud.vision.v1p1beta1.Property.verify(message.properties[i]); + if (message.landmarks != null && message.hasOwnProperty("landmarks")) { + if (!Array.isArray(message.landmarks)) + return "landmarks: array expected"; + for (var i = 0; i < message.landmarks.length; ++i) { + var error = $root.google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.verify(message.landmarks[i]); if (error) - return "properties." + error; - } - } - return null; - }; - - /** - * Creates an EntityAnnotation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.EntityAnnotation} EntityAnnotation - */ - EntityAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.EntityAnnotation) - return object; - var message = new $root.google.cloud.vision.v1p1beta1.EntityAnnotation(); - if (object.mid != null) - message.mid = String(object.mid); - if (object.locale != null) - message.locale = String(object.locale); - if (object.description != null) - message.description = String(object.description); - if (object.score != null) - message.score = Number(object.score); - if (object.confidence != null) - message.confidence = Number(object.confidence); - if (object.topicality != null) - message.topicality = Number(object.topicality); - if (object.boundingPoly != null) { - if (typeof object.boundingPoly !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.EntityAnnotation.boundingPoly: object expected"); - message.boundingPoly = $root.google.cloud.vision.v1p1beta1.BoundingPoly.fromObject(object.boundingPoly); - } - if (object.locations) { - if (!Array.isArray(object.locations)) - throw TypeError(".google.cloud.vision.v1p1beta1.EntityAnnotation.locations: array expected"); - message.locations = []; - for (var i = 0; i < object.locations.length; ++i) { - if (typeof object.locations[i] !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.EntityAnnotation.locations: object expected"); - message.locations[i] = $root.google.cloud.vision.v1p1beta1.LocationInfo.fromObject(object.locations[i]); - } - } - if (object.properties) { - if (!Array.isArray(object.properties)) - throw TypeError(".google.cloud.vision.v1p1beta1.EntityAnnotation.properties: array expected"); - message.properties = []; - for (var i = 0; i < object.properties.length; ++i) { - if (typeof object.properties[i] !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.EntityAnnotation.properties: object expected"); - message.properties[i] = $root.google.cloud.vision.v1p1beta1.Property.fromObject(object.properties[i]); + return "landmarks." + error; } } - return message; - }; - - /** - * Creates a plain object from an EntityAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation - * @static - * @param {google.cloud.vision.v1p1beta1.EntityAnnotation} message EntityAnnotation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - EntityAnnotation.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.locations = []; - object.properties = []; - } - if (options.defaults) { - object.mid = ""; - object.locale = ""; - object.description = ""; - object.score = 0; - object.confidence = 0; - object.topicality = 0; - object.boundingPoly = null; - } - if (message.mid != null && message.hasOwnProperty("mid")) - object.mid = message.mid; - if (message.locale != null && message.hasOwnProperty("locale")) - object.locale = message.locale; - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - if (message.confidence != null && message.hasOwnProperty("confidence")) - object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; - if (message.topicality != null && message.hasOwnProperty("topicality")) - object.topicality = options.json && !isFinite(message.topicality) ? String(message.topicality) : message.topicality; - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - object.boundingPoly = $root.google.cloud.vision.v1p1beta1.BoundingPoly.toObject(message.boundingPoly, options); - if (message.locations && message.locations.length) { - object.locations = []; - for (var j = 0; j < message.locations.length; ++j) - object.locations[j] = $root.google.cloud.vision.v1p1beta1.LocationInfo.toObject(message.locations[j], options); - } - if (message.properties && message.properties.length) { - object.properties = []; - for (var j = 0; j < message.properties.length; ++j) - object.properties[j] = $root.google.cloud.vision.v1p1beta1.Property.toObject(message.properties[j], options); - } - return object; - }; - - /** - * Converts this EntityAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation - * @instance - * @returns {Object.} JSON object - */ - EntityAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return EntityAnnotation; - })(); - - v1p1beta1.SafeSearchAnnotation = (function() { - - /** - * Properties of a SafeSearchAnnotation. - * @memberof google.cloud.vision.v1p1beta1 - * @interface ISafeSearchAnnotation - * @property {google.cloud.vision.v1p1beta1.Likelihood|null} [adult] SafeSearchAnnotation adult - * @property {google.cloud.vision.v1p1beta1.Likelihood|null} [spoof] SafeSearchAnnotation spoof - * @property {google.cloud.vision.v1p1beta1.Likelihood|null} [medical] SafeSearchAnnotation medical - * @property {google.cloud.vision.v1p1beta1.Likelihood|null} [violence] SafeSearchAnnotation violence - * @property {google.cloud.vision.v1p1beta1.Likelihood|null} [racy] SafeSearchAnnotation racy - */ - - /** - * Constructs a new SafeSearchAnnotation. - * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a SafeSearchAnnotation. - * @implements ISafeSearchAnnotation - * @constructor - * @param {google.cloud.vision.v1p1beta1.ISafeSearchAnnotation=} [properties] Properties to set - */ - function SafeSearchAnnotation(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]]; - } - - /** - * SafeSearchAnnotation adult. - * @member {google.cloud.vision.v1p1beta1.Likelihood} adult - * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation - * @instance - */ - SafeSearchAnnotation.prototype.adult = 0; - - /** - * SafeSearchAnnotation spoof. - * @member {google.cloud.vision.v1p1beta1.Likelihood} spoof - * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation - * @instance - */ - SafeSearchAnnotation.prototype.spoof = 0; - - /** - * SafeSearchAnnotation medical. - * @member {google.cloud.vision.v1p1beta1.Likelihood} medical - * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation - * @instance - */ - SafeSearchAnnotation.prototype.medical = 0; - - /** - * SafeSearchAnnotation violence. - * @member {google.cloud.vision.v1p1beta1.Likelihood} violence - * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation - * @instance - */ - SafeSearchAnnotation.prototype.violence = 0; - - /** - * SafeSearchAnnotation racy. - * @member {google.cloud.vision.v1p1beta1.Likelihood} racy - * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation - * @instance - */ - SafeSearchAnnotation.prototype.racy = 0; - - /** - * Creates a new SafeSearchAnnotation instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation - * @static - * @param {google.cloud.vision.v1p1beta1.ISafeSearchAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.SafeSearchAnnotation} SafeSearchAnnotation instance - */ - SafeSearchAnnotation.create = function create(properties) { - return new SafeSearchAnnotation(properties); - }; - - /** - * Encodes the specified SafeSearchAnnotation message. Does not implicitly {@link google.cloud.vision.v1p1beta1.SafeSearchAnnotation.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation - * @static - * @param {google.cloud.vision.v1p1beta1.ISafeSearchAnnotation} message SafeSearchAnnotation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SafeSearchAnnotation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.adult != null && message.hasOwnProperty("adult")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.adult); - if (message.spoof != null && message.hasOwnProperty("spoof")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.spoof); - if (message.medical != null && message.hasOwnProperty("medical")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.medical); - if (message.violence != null && message.hasOwnProperty("violence")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.violence); - if (message.racy != null && message.hasOwnProperty("racy")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.racy); - return writer; - }; - - /** - * Encodes the specified SafeSearchAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.SafeSearchAnnotation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation - * @static - * @param {google.cloud.vision.v1p1beta1.ISafeSearchAnnotation} message SafeSearchAnnotation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SafeSearchAnnotation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SafeSearchAnnotation message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p1beta1.SafeSearchAnnotation} SafeSearchAnnotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SafeSearchAnnotation.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.vision.v1p1beta1.SafeSearchAnnotation(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { + if (message.rollAngle != null && message.hasOwnProperty("rollAngle")) + if (typeof message.rollAngle !== "number") + return "rollAngle: number expected"; + if (message.panAngle != null && message.hasOwnProperty("panAngle")) + if (typeof message.panAngle !== "number") + return "panAngle: number expected"; + if (message.tiltAngle != null && message.hasOwnProperty("tiltAngle")) + if (typeof message.tiltAngle !== "number") + return "tiltAngle: number expected"; + if (message.detectionConfidence != null && message.hasOwnProperty("detectionConfidence")) + if (typeof message.detectionConfidence !== "number") + return "detectionConfidence: number expected"; + if (message.landmarkingConfidence != null && message.hasOwnProperty("landmarkingConfidence")) + if (typeof message.landmarkingConfidence !== "number") + return "landmarkingConfidence: number expected"; + if (message.joyLikelihood != null && message.hasOwnProperty("joyLikelihood")) + switch (message.joyLikelihood) { + default: + return "joyLikelihood: enum value expected"; + case 0: case 1: - message.adult = reader.int32(); - break; case 2: - message.spoof = reader.int32(); - break; case 3: - message.medical = reader.int32(); - break; case 4: - message.violence = reader.int32(); - break; - case 9: - message.racy = reader.int32(); - break; - default: - reader.skipType(tag & 7); + case 5: break; } - } - return message; - }; - - /** - * Decodes a SafeSearchAnnotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.SafeSearchAnnotation} SafeSearchAnnotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SafeSearchAnnotation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SafeSearchAnnotation message. - * @function verify - * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SafeSearchAnnotation.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.adult != null && message.hasOwnProperty("adult")) - switch (message.adult) { + if (message.sorrowLikelihood != null && message.hasOwnProperty("sorrowLikelihood")) + switch (message.sorrowLikelihood) { default: - return "adult: enum value expected"; + return "sorrowLikelihood: enum value expected"; case 0: case 1: case 2: @@ -28135,10 +26892,10 @@ case 5: break; } - if (message.spoof != null && message.hasOwnProperty("spoof")) - switch (message.spoof) { + if (message.angerLikelihood != null && message.hasOwnProperty("angerLikelihood")) + switch (message.angerLikelihood) { default: - return "spoof: enum value expected"; + return "angerLikelihood: enum value expected"; case 0: case 1: case 2: @@ -28147,10 +26904,10 @@ case 5: break; } - if (message.medical != null && message.hasOwnProperty("medical")) - switch (message.medical) { + if (message.surpriseLikelihood != null && message.hasOwnProperty("surpriseLikelihood")) + switch (message.surpriseLikelihood) { default: - return "medical: enum value expected"; + return "surpriseLikelihood: enum value expected"; case 0: case 1: case 2: @@ -28159,10 +26916,10 @@ case 5: break; } - if (message.violence != null && message.hasOwnProperty("violence")) - switch (message.violence) { + if (message.underExposedLikelihood != null && message.hasOwnProperty("underExposedLikelihood")) + switch (message.underExposedLikelihood) { default: - return "violence: enum value expected"; + return "underExposedLikelihood: enum value expected"; case 0: case 1: case 2: @@ -28171,10 +26928,10 @@ case 5: break; } - if (message.racy != null && message.hasOwnProperty("racy")) - switch (message.racy) { + if (message.blurredLikelihood != null && message.hasOwnProperty("blurredLikelihood")) + switch (message.blurredLikelihood) { default: - return "racy: enum value expected"; + return "blurredLikelihood: enum value expected"; case 0: case 1: case 2: @@ -28183,441 +26940,820 @@ case 5: break; } - return null; - }; - - /** - * Creates a SafeSearchAnnotation message from a plain object. Also converts values to their respective internal types. + if (message.headwearLikelihood != null && message.hasOwnProperty("headwearLikelihood")) + switch (message.headwearLikelihood) { + default: + return "headwearLikelihood: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + return null; + }; + + /** + * Creates a FaceAnnotation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.SafeSearchAnnotation} SafeSearchAnnotation + * @returns {google.cloud.vision.v1p1beta1.FaceAnnotation} FaceAnnotation */ - SafeSearchAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.SafeSearchAnnotation) + FaceAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p1beta1.FaceAnnotation) return object; - var message = new $root.google.cloud.vision.v1p1beta1.SafeSearchAnnotation(); - switch (object.adult) { + var message = new $root.google.cloud.vision.v1p1beta1.FaceAnnotation(); + if (object.boundingPoly != null) { + if (typeof object.boundingPoly !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.FaceAnnotation.boundingPoly: object expected"); + message.boundingPoly = $root.google.cloud.vision.v1p1beta1.BoundingPoly.fromObject(object.boundingPoly); + } + if (object.fdBoundingPoly != null) { + if (typeof object.fdBoundingPoly !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.FaceAnnotation.fdBoundingPoly: object expected"); + message.fdBoundingPoly = $root.google.cloud.vision.v1p1beta1.BoundingPoly.fromObject(object.fdBoundingPoly); + } + if (object.landmarks) { + if (!Array.isArray(object.landmarks)) + throw TypeError(".google.cloud.vision.v1p1beta1.FaceAnnotation.landmarks: array expected"); + message.landmarks = []; + for (var i = 0; i < object.landmarks.length; ++i) { + if (typeof object.landmarks[i] !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.FaceAnnotation.landmarks: object expected"); + message.landmarks[i] = $root.google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.fromObject(object.landmarks[i]); + } + } + if (object.rollAngle != null) + message.rollAngle = Number(object.rollAngle); + if (object.panAngle != null) + message.panAngle = Number(object.panAngle); + if (object.tiltAngle != null) + message.tiltAngle = Number(object.tiltAngle); + if (object.detectionConfidence != null) + message.detectionConfidence = Number(object.detectionConfidence); + if (object.landmarkingConfidence != null) + message.landmarkingConfidence = Number(object.landmarkingConfidence); + switch (object.joyLikelihood) { case "UNKNOWN": case 0: - message.adult = 0; + message.joyLikelihood = 0; break; case "VERY_UNLIKELY": case 1: - message.adult = 1; + message.joyLikelihood = 1; break; case "UNLIKELY": case 2: - message.adult = 2; + message.joyLikelihood = 2; break; case "POSSIBLE": case 3: - message.adult = 3; + message.joyLikelihood = 3; break; case "LIKELY": case 4: - message.adult = 4; + message.joyLikelihood = 4; break; case "VERY_LIKELY": case 5: - message.adult = 5; + message.joyLikelihood = 5; break; } - switch (object.spoof) { + switch (object.sorrowLikelihood) { case "UNKNOWN": case 0: - message.spoof = 0; + message.sorrowLikelihood = 0; break; case "VERY_UNLIKELY": case 1: - message.spoof = 1; + message.sorrowLikelihood = 1; break; case "UNLIKELY": case 2: - message.spoof = 2; + message.sorrowLikelihood = 2; break; case "POSSIBLE": case 3: - message.spoof = 3; + message.sorrowLikelihood = 3; break; case "LIKELY": case 4: - message.spoof = 4; + message.sorrowLikelihood = 4; break; case "VERY_LIKELY": case 5: - message.spoof = 5; + message.sorrowLikelihood = 5; break; } - switch (object.medical) { + switch (object.angerLikelihood) { case "UNKNOWN": case 0: - message.medical = 0; + message.angerLikelihood = 0; break; case "VERY_UNLIKELY": case 1: - message.medical = 1; + message.angerLikelihood = 1; break; case "UNLIKELY": case 2: - message.medical = 2; + message.angerLikelihood = 2; break; case "POSSIBLE": case 3: - message.medical = 3; + message.angerLikelihood = 3; break; case "LIKELY": case 4: - message.medical = 4; + message.angerLikelihood = 4; break; case "VERY_LIKELY": case 5: - message.medical = 5; + message.angerLikelihood = 5; break; } - switch (object.violence) { + switch (object.surpriseLikelihood) { case "UNKNOWN": case 0: - message.violence = 0; + message.surpriseLikelihood = 0; break; case "VERY_UNLIKELY": case 1: - message.violence = 1; + message.surpriseLikelihood = 1; break; case "UNLIKELY": case 2: - message.violence = 2; + message.surpriseLikelihood = 2; break; case "POSSIBLE": case 3: - message.violence = 3; + message.surpriseLikelihood = 3; break; case "LIKELY": case 4: - message.violence = 4; + message.surpriseLikelihood = 4; break; case "VERY_LIKELY": case 5: - message.violence = 5; + message.surpriseLikelihood = 5; break; } - switch (object.racy) { + switch (object.underExposedLikelihood) { case "UNKNOWN": case 0: - message.racy = 0; + message.underExposedLikelihood = 0; break; case "VERY_UNLIKELY": case 1: - message.racy = 1; + message.underExposedLikelihood = 1; break; case "UNLIKELY": case 2: - message.racy = 2; + message.underExposedLikelihood = 2; break; case "POSSIBLE": case 3: - message.racy = 3; + message.underExposedLikelihood = 3; break; case "LIKELY": case 4: - message.racy = 4; + message.underExposedLikelihood = 4; break; case "VERY_LIKELY": case 5: - message.racy = 5; + message.underExposedLikelihood = 5; + break; + } + switch (object.blurredLikelihood) { + case "UNKNOWN": + case 0: + message.blurredLikelihood = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.blurredLikelihood = 1; + break; + case "UNLIKELY": + case 2: + message.blurredLikelihood = 2; + break; + case "POSSIBLE": + case 3: + message.blurredLikelihood = 3; + break; + case "LIKELY": + case 4: + message.blurredLikelihood = 4; + break; + case "VERY_LIKELY": + case 5: + message.blurredLikelihood = 5; + break; + } + switch (object.headwearLikelihood) { + case "UNKNOWN": + case 0: + message.headwearLikelihood = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.headwearLikelihood = 1; + break; + case "UNLIKELY": + case 2: + message.headwearLikelihood = 2; + break; + case "POSSIBLE": + case 3: + message.headwearLikelihood = 3; + break; + case "LIKELY": + case 4: + message.headwearLikelihood = 4; + break; + case "VERY_LIKELY": + case 5: + message.headwearLikelihood = 5; break; } return message; }; /** - * Creates a plain object from a SafeSearchAnnotation message. Also converts values to other types if specified. + * Creates a plain object from a FaceAnnotation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation * @static - * @param {google.cloud.vision.v1p1beta1.SafeSearchAnnotation} message SafeSearchAnnotation + * @param {google.cloud.vision.v1p1beta1.FaceAnnotation} message FaceAnnotation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SafeSearchAnnotation.toObject = function toObject(message, options) { + FaceAnnotation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.landmarks = []; if (options.defaults) { - object.adult = options.enums === String ? "UNKNOWN" : 0; - object.spoof = options.enums === String ? "UNKNOWN" : 0; - object.medical = options.enums === String ? "UNKNOWN" : 0; - object.violence = options.enums === String ? "UNKNOWN" : 0; - object.racy = options.enums === String ? "UNKNOWN" : 0; + object.boundingPoly = null; + object.fdBoundingPoly = null; + object.rollAngle = 0; + object.panAngle = 0; + object.tiltAngle = 0; + object.detectionConfidence = 0; + object.landmarkingConfidence = 0; + object.joyLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.sorrowLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.angerLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.surpriseLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.underExposedLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.blurredLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.headwearLikelihood = options.enums === String ? "UNKNOWN" : 0; } - if (message.adult != null && message.hasOwnProperty("adult")) - object.adult = options.enums === String ? $root.google.cloud.vision.v1p1beta1.Likelihood[message.adult] : message.adult; - if (message.spoof != null && message.hasOwnProperty("spoof")) - object.spoof = options.enums === String ? $root.google.cloud.vision.v1p1beta1.Likelihood[message.spoof] : message.spoof; - if (message.medical != null && message.hasOwnProperty("medical")) - object.medical = options.enums === String ? $root.google.cloud.vision.v1p1beta1.Likelihood[message.medical] : message.medical; - if (message.violence != null && message.hasOwnProperty("violence")) - object.violence = options.enums === String ? $root.google.cloud.vision.v1p1beta1.Likelihood[message.violence] : message.violence; - if (message.racy != null && message.hasOwnProperty("racy")) - object.racy = options.enums === String ? $root.google.cloud.vision.v1p1beta1.Likelihood[message.racy] : message.racy; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + object.boundingPoly = $root.google.cloud.vision.v1p1beta1.BoundingPoly.toObject(message.boundingPoly, options); + if (message.fdBoundingPoly != null && message.hasOwnProperty("fdBoundingPoly")) + object.fdBoundingPoly = $root.google.cloud.vision.v1p1beta1.BoundingPoly.toObject(message.fdBoundingPoly, options); + if (message.landmarks && message.landmarks.length) { + object.landmarks = []; + for (var j = 0; j < message.landmarks.length; ++j) + object.landmarks[j] = $root.google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.toObject(message.landmarks[j], options); + } + if (message.rollAngle != null && message.hasOwnProperty("rollAngle")) + object.rollAngle = options.json && !isFinite(message.rollAngle) ? String(message.rollAngle) : message.rollAngle; + if (message.panAngle != null && message.hasOwnProperty("panAngle")) + object.panAngle = options.json && !isFinite(message.panAngle) ? String(message.panAngle) : message.panAngle; + if (message.tiltAngle != null && message.hasOwnProperty("tiltAngle")) + object.tiltAngle = options.json && !isFinite(message.tiltAngle) ? String(message.tiltAngle) : message.tiltAngle; + if (message.detectionConfidence != null && message.hasOwnProperty("detectionConfidence")) + object.detectionConfidence = options.json && !isFinite(message.detectionConfidence) ? String(message.detectionConfidence) : message.detectionConfidence; + if (message.landmarkingConfidence != null && message.hasOwnProperty("landmarkingConfidence")) + object.landmarkingConfidence = options.json && !isFinite(message.landmarkingConfidence) ? String(message.landmarkingConfidence) : message.landmarkingConfidence; + if (message.joyLikelihood != null && message.hasOwnProperty("joyLikelihood")) + object.joyLikelihood = options.enums === String ? $root.google.cloud.vision.v1p1beta1.Likelihood[message.joyLikelihood] : message.joyLikelihood; + if (message.sorrowLikelihood != null && message.hasOwnProperty("sorrowLikelihood")) + object.sorrowLikelihood = options.enums === String ? $root.google.cloud.vision.v1p1beta1.Likelihood[message.sorrowLikelihood] : message.sorrowLikelihood; + if (message.angerLikelihood != null && message.hasOwnProperty("angerLikelihood")) + object.angerLikelihood = options.enums === String ? $root.google.cloud.vision.v1p1beta1.Likelihood[message.angerLikelihood] : message.angerLikelihood; + if (message.surpriseLikelihood != null && message.hasOwnProperty("surpriseLikelihood")) + object.surpriseLikelihood = options.enums === String ? $root.google.cloud.vision.v1p1beta1.Likelihood[message.surpriseLikelihood] : message.surpriseLikelihood; + if (message.underExposedLikelihood != null && message.hasOwnProperty("underExposedLikelihood")) + object.underExposedLikelihood = options.enums === String ? $root.google.cloud.vision.v1p1beta1.Likelihood[message.underExposedLikelihood] : message.underExposedLikelihood; + if (message.blurredLikelihood != null && message.hasOwnProperty("blurredLikelihood")) + object.blurredLikelihood = options.enums === String ? $root.google.cloud.vision.v1p1beta1.Likelihood[message.blurredLikelihood] : message.blurredLikelihood; + if (message.headwearLikelihood != null && message.hasOwnProperty("headwearLikelihood")) + object.headwearLikelihood = options.enums === String ? $root.google.cloud.vision.v1p1beta1.Likelihood[message.headwearLikelihood] : message.headwearLikelihood; return object; }; /** - * Converts this SafeSearchAnnotation to JSON. + * Converts this FaceAnnotation to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation * @instance * @returns {Object.} JSON object */ - SafeSearchAnnotation.prototype.toJSON = function toJSON() { + FaceAnnotation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return SafeSearchAnnotation; - })(); - - v1p1beta1.LatLongRect = (function() { + FaceAnnotation.Landmark = (function() { - /** - * Properties of a LatLongRect. - * @memberof google.cloud.vision.v1p1beta1 - * @interface ILatLongRect - * @property {google.type.ILatLng|null} [minLatLng] LatLongRect minLatLng - * @property {google.type.ILatLng|null} [maxLatLng] LatLongRect maxLatLng - */ + /** + * Properties of a Landmark. + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation + * @interface ILandmark + * @property {google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.Type|null} [type] Landmark type + * @property {google.cloud.vision.v1p1beta1.IPosition|null} [position] Landmark position + */ - /** - * Constructs a new LatLongRect. - * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a LatLongRect. - * @implements ILatLongRect - * @constructor - * @param {google.cloud.vision.v1p1beta1.ILatLongRect=} [properties] Properties to set - */ - function LatLongRect(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]]; - } + /** + * Constructs a new Landmark. + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation + * @classdesc Represents a Landmark. + * @implements ILandmark + * @constructor + * @param {google.cloud.vision.v1p1beta1.FaceAnnotation.ILandmark=} [properties] Properties to set + */ + function Landmark(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]]; + } - /** - * LatLongRect minLatLng. - * @member {google.type.ILatLng|null|undefined} minLatLng - * @memberof google.cloud.vision.v1p1beta1.LatLongRect - * @instance - */ - LatLongRect.prototype.minLatLng = null; + /** + * Landmark type. + * @member {google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.Type} type + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark + * @instance + */ + Landmark.prototype.type = 0; - /** - * LatLongRect maxLatLng. - * @member {google.type.ILatLng|null|undefined} maxLatLng - * @memberof google.cloud.vision.v1p1beta1.LatLongRect - * @instance - */ - LatLongRect.prototype.maxLatLng = null; + /** + * Landmark position. + * @member {google.cloud.vision.v1p1beta1.IPosition|null|undefined} position + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark + * @instance + */ + Landmark.prototype.position = null; - /** - * Creates a new LatLongRect instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.LatLongRect - * @static - * @param {google.cloud.vision.v1p1beta1.ILatLongRect=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.LatLongRect} LatLongRect instance - */ - LatLongRect.create = function create(properties) { - return new LatLongRect(properties); - }; + /** + * Creates a new Landmark instance using the specified properties. + * @function create + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark + * @static + * @param {google.cloud.vision.v1p1beta1.FaceAnnotation.ILandmark=} [properties] Properties to set + * @returns {google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark} Landmark instance + */ + Landmark.create = function create(properties) { + return new Landmark(properties); + }; - /** - * Encodes the specified LatLongRect message. Does not implicitly {@link google.cloud.vision.v1p1beta1.LatLongRect.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p1beta1.LatLongRect - * @static - * @param {google.cloud.vision.v1p1beta1.ILatLongRect} message LatLongRect message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LatLongRect.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.minLatLng != null && message.hasOwnProperty("minLatLng")) - $root.google.type.LatLng.encode(message.minLatLng, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.maxLatLng != null && message.hasOwnProperty("maxLatLng")) - $root.google.type.LatLng.encode(message.maxLatLng, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; + /** + * Encodes the specified Landmark message. Does not implicitly {@link google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.verify|verify} messages. + * @function encode + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark + * @static + * @param {google.cloud.vision.v1p1beta1.FaceAnnotation.ILandmark} message Landmark message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Landmark.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && message.hasOwnProperty("type")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); + if (message.position != null && message.hasOwnProperty("position")) + $root.google.cloud.vision.v1p1beta1.Position.encode(message.position, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; - /** - * Encodes the specified LatLongRect message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.LatLongRect.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.LatLongRect - * @static - * @param {google.cloud.vision.v1p1beta1.ILatLongRect} message LatLongRect message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LatLongRect.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified Landmark message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark + * @static + * @param {google.cloud.vision.v1p1beta1.FaceAnnotation.ILandmark} message Landmark message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Landmark.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a LatLongRect message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p1beta1.LatLongRect - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p1beta1.LatLongRect} LatLongRect - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LatLongRect.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.vision.v1p1beta1.LatLongRect(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.minLatLng = $root.google.type.LatLng.decode(reader, reader.uint32()); - break; - case 2: - message.maxLatLng = $root.google.type.LatLng.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Decodes a Landmark message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark} Landmark + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Landmark.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.vision.v1p1beta1.FaceAnnotation.Landmark(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + message.type = reader.int32(); + break; + case 4: + message.position = $root.google.cloud.vision.v1p1beta1.Position.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } } - } - return message; - }; + return message; + }; - /** - * Decodes a LatLongRect message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.LatLongRect - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.LatLongRect} LatLongRect - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LatLongRect.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a Landmark message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark} Landmark + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Landmark.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a LatLongRect message. - * @function verify - * @memberof google.cloud.vision.v1p1beta1.LatLongRect - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - LatLongRect.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.minLatLng != null && message.hasOwnProperty("minLatLng")) { - var error = $root.google.type.LatLng.verify(message.minLatLng); - if (error) - return "minLatLng." + error; - } - if (message.maxLatLng != null && message.hasOwnProperty("maxLatLng")) { - var error = $root.google.type.LatLng.verify(message.maxLatLng); - if (error) - return "maxLatLng." + error; - } - return null; - }; + /** + * Verifies a Landmark message. + * @function verify + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Landmark.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + case 24: + case 25: + case 26: + case 27: + case 28: + case 29: + case 30: + case 31: + case 32: + case 33: + case 34: + break; + } + if (message.position != null && message.hasOwnProperty("position")) { + var error = $root.google.cloud.vision.v1p1beta1.Position.verify(message.position); + if (error) + return "position." + error; + } + return null; + }; - /** - * Creates a LatLongRect message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.LatLongRect - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.LatLongRect} LatLongRect - */ - LatLongRect.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.LatLongRect) + /** + * Creates a Landmark message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark} Landmark + */ + Landmark.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark) + return object; + var message = new $root.google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark(); + switch (object.type) { + case "UNKNOWN_LANDMARK": + case 0: + message.type = 0; + break; + case "LEFT_EYE": + case 1: + message.type = 1; + break; + case "RIGHT_EYE": + case 2: + message.type = 2; + break; + case "LEFT_OF_LEFT_EYEBROW": + case 3: + message.type = 3; + break; + case "RIGHT_OF_LEFT_EYEBROW": + case 4: + message.type = 4; + break; + case "LEFT_OF_RIGHT_EYEBROW": + case 5: + message.type = 5; + break; + case "RIGHT_OF_RIGHT_EYEBROW": + case 6: + message.type = 6; + break; + case "MIDPOINT_BETWEEN_EYES": + case 7: + message.type = 7; + break; + case "NOSE_TIP": + case 8: + message.type = 8; + break; + case "UPPER_LIP": + case 9: + message.type = 9; + break; + case "LOWER_LIP": + case 10: + message.type = 10; + break; + case "MOUTH_LEFT": + case 11: + message.type = 11; + break; + case "MOUTH_RIGHT": + case 12: + message.type = 12; + break; + case "MOUTH_CENTER": + case 13: + message.type = 13; + break; + case "NOSE_BOTTOM_RIGHT": + case 14: + message.type = 14; + break; + case "NOSE_BOTTOM_LEFT": + case 15: + message.type = 15; + break; + case "NOSE_BOTTOM_CENTER": + case 16: + message.type = 16; + break; + case "LEFT_EYE_TOP_BOUNDARY": + case 17: + message.type = 17; + break; + case "LEFT_EYE_RIGHT_CORNER": + case 18: + message.type = 18; + break; + case "LEFT_EYE_BOTTOM_BOUNDARY": + case 19: + message.type = 19; + break; + case "LEFT_EYE_LEFT_CORNER": + case 20: + message.type = 20; + break; + case "RIGHT_EYE_TOP_BOUNDARY": + case 21: + message.type = 21; + break; + case "RIGHT_EYE_RIGHT_CORNER": + case 22: + message.type = 22; + break; + case "RIGHT_EYE_BOTTOM_BOUNDARY": + case 23: + message.type = 23; + break; + case "RIGHT_EYE_LEFT_CORNER": + case 24: + message.type = 24; + break; + case "LEFT_EYEBROW_UPPER_MIDPOINT": + case 25: + message.type = 25; + break; + case "RIGHT_EYEBROW_UPPER_MIDPOINT": + case 26: + message.type = 26; + break; + case "LEFT_EAR_TRAGION": + case 27: + message.type = 27; + break; + case "RIGHT_EAR_TRAGION": + case 28: + message.type = 28; + break; + case "LEFT_EYE_PUPIL": + case 29: + message.type = 29; + break; + case "RIGHT_EYE_PUPIL": + case 30: + message.type = 30; + break; + case "FOREHEAD_GLABELLA": + case 31: + message.type = 31; + break; + case "CHIN_GNATHION": + case 32: + message.type = 32; + break; + case "CHIN_LEFT_GONION": + case 33: + message.type = 33; + break; + case "CHIN_RIGHT_GONION": + case 34: + message.type = 34; + break; + } + if (object.position != null) { + if (typeof object.position !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.position: object expected"); + message.position = $root.google.cloud.vision.v1p1beta1.Position.fromObject(object.position); + } + return message; + }; + + /** + * Creates a plain object from a Landmark message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark + * @static + * @param {google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark} message Landmark + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Landmark.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.type = options.enums === String ? "UNKNOWN_LANDMARK" : 0; + object.position = null; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.Type[message.type] : message.type; + if (message.position != null && message.hasOwnProperty("position")) + object.position = $root.google.cloud.vision.v1p1beta1.Position.toObject(message.position, options); return object; - var message = new $root.google.cloud.vision.v1p1beta1.LatLongRect(); - if (object.minLatLng != null) { - if (typeof object.minLatLng !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.LatLongRect.minLatLng: object expected"); - message.minLatLng = $root.google.type.LatLng.fromObject(object.minLatLng); - } - if (object.maxLatLng != null) { - if (typeof object.maxLatLng !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.LatLongRect.maxLatLng: object expected"); - message.maxLatLng = $root.google.type.LatLng.fromObject(object.maxLatLng); - } - return message; - }; + }; - /** - * Creates a plain object from a LatLongRect message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p1beta1.LatLongRect - * @static - * @param {google.cloud.vision.v1p1beta1.LatLongRect} message LatLongRect - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - LatLongRect.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.minLatLng = null; - object.maxLatLng = null; - } - if (message.minLatLng != null && message.hasOwnProperty("minLatLng")) - object.minLatLng = $root.google.type.LatLng.toObject(message.minLatLng, options); - if (message.maxLatLng != null && message.hasOwnProperty("maxLatLng")) - object.maxLatLng = $root.google.type.LatLng.toObject(message.maxLatLng, options); - return object; - }; + /** + * Converts this Landmark to JSON. + * @function toJSON + * @memberof google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark + * @instance + * @returns {Object.} JSON object + */ + Landmark.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this LatLongRect to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.LatLongRect - * @instance - * @returns {Object.} JSON object - */ - LatLongRect.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Type enum. + * @name google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark.Type + * @enum {string} + * @property {number} UNKNOWN_LANDMARK=0 UNKNOWN_LANDMARK value + * @property {number} LEFT_EYE=1 LEFT_EYE value + * @property {number} RIGHT_EYE=2 RIGHT_EYE value + * @property {number} LEFT_OF_LEFT_EYEBROW=3 LEFT_OF_LEFT_EYEBROW value + * @property {number} RIGHT_OF_LEFT_EYEBROW=4 RIGHT_OF_LEFT_EYEBROW value + * @property {number} LEFT_OF_RIGHT_EYEBROW=5 LEFT_OF_RIGHT_EYEBROW value + * @property {number} RIGHT_OF_RIGHT_EYEBROW=6 RIGHT_OF_RIGHT_EYEBROW value + * @property {number} MIDPOINT_BETWEEN_EYES=7 MIDPOINT_BETWEEN_EYES value + * @property {number} NOSE_TIP=8 NOSE_TIP value + * @property {number} UPPER_LIP=9 UPPER_LIP value + * @property {number} LOWER_LIP=10 LOWER_LIP value + * @property {number} MOUTH_LEFT=11 MOUTH_LEFT value + * @property {number} MOUTH_RIGHT=12 MOUTH_RIGHT value + * @property {number} MOUTH_CENTER=13 MOUTH_CENTER value + * @property {number} NOSE_BOTTOM_RIGHT=14 NOSE_BOTTOM_RIGHT value + * @property {number} NOSE_BOTTOM_LEFT=15 NOSE_BOTTOM_LEFT value + * @property {number} NOSE_BOTTOM_CENTER=16 NOSE_BOTTOM_CENTER value + * @property {number} LEFT_EYE_TOP_BOUNDARY=17 LEFT_EYE_TOP_BOUNDARY value + * @property {number} LEFT_EYE_RIGHT_CORNER=18 LEFT_EYE_RIGHT_CORNER value + * @property {number} LEFT_EYE_BOTTOM_BOUNDARY=19 LEFT_EYE_BOTTOM_BOUNDARY value + * @property {number} LEFT_EYE_LEFT_CORNER=20 LEFT_EYE_LEFT_CORNER value + * @property {number} RIGHT_EYE_TOP_BOUNDARY=21 RIGHT_EYE_TOP_BOUNDARY value + * @property {number} RIGHT_EYE_RIGHT_CORNER=22 RIGHT_EYE_RIGHT_CORNER value + * @property {number} RIGHT_EYE_BOTTOM_BOUNDARY=23 RIGHT_EYE_BOTTOM_BOUNDARY value + * @property {number} RIGHT_EYE_LEFT_CORNER=24 RIGHT_EYE_LEFT_CORNER value + * @property {number} LEFT_EYEBROW_UPPER_MIDPOINT=25 LEFT_EYEBROW_UPPER_MIDPOINT value + * @property {number} RIGHT_EYEBROW_UPPER_MIDPOINT=26 RIGHT_EYEBROW_UPPER_MIDPOINT value + * @property {number} LEFT_EAR_TRAGION=27 LEFT_EAR_TRAGION value + * @property {number} RIGHT_EAR_TRAGION=28 RIGHT_EAR_TRAGION value + * @property {number} LEFT_EYE_PUPIL=29 LEFT_EYE_PUPIL value + * @property {number} RIGHT_EYE_PUPIL=30 RIGHT_EYE_PUPIL value + * @property {number} FOREHEAD_GLABELLA=31 FOREHEAD_GLABELLA value + * @property {number} CHIN_GNATHION=32 CHIN_GNATHION value + * @property {number} CHIN_LEFT_GONION=33 CHIN_LEFT_GONION value + * @property {number} CHIN_RIGHT_GONION=34 CHIN_RIGHT_GONION value + */ + Landmark.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN_LANDMARK"] = 0; + values[valuesById[1] = "LEFT_EYE"] = 1; + values[valuesById[2] = "RIGHT_EYE"] = 2; + values[valuesById[3] = "LEFT_OF_LEFT_EYEBROW"] = 3; + values[valuesById[4] = "RIGHT_OF_LEFT_EYEBROW"] = 4; + values[valuesById[5] = "LEFT_OF_RIGHT_EYEBROW"] = 5; + values[valuesById[6] = "RIGHT_OF_RIGHT_EYEBROW"] = 6; + values[valuesById[7] = "MIDPOINT_BETWEEN_EYES"] = 7; + values[valuesById[8] = "NOSE_TIP"] = 8; + values[valuesById[9] = "UPPER_LIP"] = 9; + values[valuesById[10] = "LOWER_LIP"] = 10; + values[valuesById[11] = "MOUTH_LEFT"] = 11; + values[valuesById[12] = "MOUTH_RIGHT"] = 12; + values[valuesById[13] = "MOUTH_CENTER"] = 13; + values[valuesById[14] = "NOSE_BOTTOM_RIGHT"] = 14; + values[valuesById[15] = "NOSE_BOTTOM_LEFT"] = 15; + values[valuesById[16] = "NOSE_BOTTOM_CENTER"] = 16; + values[valuesById[17] = "LEFT_EYE_TOP_BOUNDARY"] = 17; + values[valuesById[18] = "LEFT_EYE_RIGHT_CORNER"] = 18; + values[valuesById[19] = "LEFT_EYE_BOTTOM_BOUNDARY"] = 19; + values[valuesById[20] = "LEFT_EYE_LEFT_CORNER"] = 20; + values[valuesById[21] = "RIGHT_EYE_TOP_BOUNDARY"] = 21; + values[valuesById[22] = "RIGHT_EYE_RIGHT_CORNER"] = 22; + values[valuesById[23] = "RIGHT_EYE_BOTTOM_BOUNDARY"] = 23; + values[valuesById[24] = "RIGHT_EYE_LEFT_CORNER"] = 24; + values[valuesById[25] = "LEFT_EYEBROW_UPPER_MIDPOINT"] = 25; + values[valuesById[26] = "RIGHT_EYEBROW_UPPER_MIDPOINT"] = 26; + values[valuesById[27] = "LEFT_EAR_TRAGION"] = 27; + values[valuesById[28] = "RIGHT_EAR_TRAGION"] = 28; + values[valuesById[29] = "LEFT_EYE_PUPIL"] = 29; + values[valuesById[30] = "RIGHT_EYE_PUPIL"] = 30; + values[valuesById[31] = "FOREHEAD_GLABELLA"] = 31; + values[valuesById[32] = "CHIN_GNATHION"] = 32; + values[valuesById[33] = "CHIN_LEFT_GONION"] = 33; + values[valuesById[34] = "CHIN_RIGHT_GONION"] = 34; + return values; + })(); - return LatLongRect; + return Landmark; + })(); + + return FaceAnnotation; })(); - v1p1beta1.ColorInfo = (function() { + v1p1beta1.LocationInfo = (function() { /** - * Properties of a ColorInfo. + * Properties of a LocationInfo. * @memberof google.cloud.vision.v1p1beta1 - * @interface IColorInfo - * @property {google.type.IColor|null} [color] ColorInfo color - * @property {number|null} [score] ColorInfo score - * @property {number|null} [pixelFraction] ColorInfo pixelFraction + * @interface ILocationInfo + * @property {google.type.ILatLng|null} [latLng] LocationInfo latLng */ /** - * Constructs a new ColorInfo. + * Constructs a new LocationInfo. * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a ColorInfo. - * @implements IColorInfo + * @classdesc Represents a LocationInfo. + * @implements ILocationInfo * @constructor - * @param {google.cloud.vision.v1p1beta1.IColorInfo=} [properties] Properties to set + * @param {google.cloud.vision.v1p1beta1.ILocationInfo=} [properties] Properties to set */ - function ColorInfo(properties) { + function LocationInfo(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -28625,101 +27761,75 @@ } /** - * ColorInfo color. - * @member {google.type.IColor|null|undefined} color - * @memberof google.cloud.vision.v1p1beta1.ColorInfo - * @instance - */ - ColorInfo.prototype.color = null; - - /** - * ColorInfo score. - * @member {number} score - * @memberof google.cloud.vision.v1p1beta1.ColorInfo - * @instance - */ - ColorInfo.prototype.score = 0; - - /** - * ColorInfo pixelFraction. - * @member {number} pixelFraction - * @memberof google.cloud.vision.v1p1beta1.ColorInfo + * LocationInfo latLng. + * @member {google.type.ILatLng|null|undefined} latLng + * @memberof google.cloud.vision.v1p1beta1.LocationInfo * @instance */ - ColorInfo.prototype.pixelFraction = 0; + LocationInfo.prototype.latLng = null; /** - * Creates a new ColorInfo instance using the specified properties. + * Creates a new LocationInfo instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p1beta1.ColorInfo + * @memberof google.cloud.vision.v1p1beta1.LocationInfo * @static - * @param {google.cloud.vision.v1p1beta1.IColorInfo=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.ColorInfo} ColorInfo instance + * @param {google.cloud.vision.v1p1beta1.ILocationInfo=} [properties] Properties to set + * @returns {google.cloud.vision.v1p1beta1.LocationInfo} LocationInfo instance */ - ColorInfo.create = function create(properties) { - return new ColorInfo(properties); + LocationInfo.create = function create(properties) { + return new LocationInfo(properties); }; /** - * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.vision.v1p1beta1.ColorInfo.verify|verify} messages. + * Encodes the specified LocationInfo message. Does not implicitly {@link google.cloud.vision.v1p1beta1.LocationInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p1beta1.ColorInfo + * @memberof google.cloud.vision.v1p1beta1.LocationInfo * @static - * @param {google.cloud.vision.v1p1beta1.IColorInfo} message ColorInfo message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.ILocationInfo} message LocationInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ColorInfo.encode = function encode(message, writer) { + LocationInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.color != null && message.hasOwnProperty("color")) - $root.google.type.Color.encode(message.color, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.score != null && message.hasOwnProperty("score")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); - if (message.pixelFraction != null && message.hasOwnProperty("pixelFraction")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.pixelFraction); + if (message.latLng != null && message.hasOwnProperty("latLng")) + $root.google.type.LatLng.encode(message.latLng, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.ColorInfo.verify|verify} messages. + * Encodes the specified LocationInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.LocationInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.ColorInfo + * @memberof google.cloud.vision.v1p1beta1.LocationInfo * @static - * @param {google.cloud.vision.v1p1beta1.IColorInfo} message ColorInfo message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.ILocationInfo} message LocationInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ColorInfo.encodeDelimited = function encodeDelimited(message, writer) { + LocationInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ColorInfo message from the specified reader or buffer. + * Decodes a LocationInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p1beta1.ColorInfo + * @memberof google.cloud.vision.v1p1beta1.LocationInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p1beta1.ColorInfo} ColorInfo + * @returns {google.cloud.vision.v1p1beta1.LocationInfo} LocationInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ColorInfo.decode = function decode(reader, length) { + LocationInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p1beta1.ColorInfo(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p1beta1.LocationInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.color = $root.google.type.Color.decode(reader, reader.uint32()); - break; - case 2: - message.score = reader.float(); - break; - case 3: - message.pixelFraction = reader.float(); + message.latLng = $root.google.type.LatLng.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -28730,130 +27840,114 @@ }; /** - * Decodes a ColorInfo message from the specified reader or buffer, length delimited. + * Decodes a LocationInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.ColorInfo + * @memberof google.cloud.vision.v1p1beta1.LocationInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.ColorInfo} ColorInfo + * @returns {google.cloud.vision.v1p1beta1.LocationInfo} LocationInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ColorInfo.decodeDelimited = function decodeDelimited(reader) { + LocationInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ColorInfo message. + * Verifies a LocationInfo message. * @function verify - * @memberof google.cloud.vision.v1p1beta1.ColorInfo + * @memberof google.cloud.vision.v1p1beta1.LocationInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ColorInfo.verify = function verify(message) { + LocationInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.color != null && message.hasOwnProperty("color")) { - var error = $root.google.type.Color.verify(message.color); + if (message.latLng != null && message.hasOwnProperty("latLng")) { + var error = $root.google.type.LatLng.verify(message.latLng); if (error) - return "color." + error; + return "latLng." + error; } - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; - if (message.pixelFraction != null && message.hasOwnProperty("pixelFraction")) - if (typeof message.pixelFraction !== "number") - return "pixelFraction: number expected"; return null; }; /** - * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. + * Creates a LocationInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.ColorInfo + * @memberof google.cloud.vision.v1p1beta1.LocationInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.ColorInfo} ColorInfo + * @returns {google.cloud.vision.v1p1beta1.LocationInfo} LocationInfo */ - ColorInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.ColorInfo) + LocationInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p1beta1.LocationInfo) return object; - var message = new $root.google.cloud.vision.v1p1beta1.ColorInfo(); - if (object.color != null) { - if (typeof object.color !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.ColorInfo.color: object expected"); - message.color = $root.google.type.Color.fromObject(object.color); + var message = new $root.google.cloud.vision.v1p1beta1.LocationInfo(); + if (object.latLng != null) { + if (typeof object.latLng !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.LocationInfo.latLng: object expected"); + message.latLng = $root.google.type.LatLng.fromObject(object.latLng); } - if (object.score != null) - message.score = Number(object.score); - if (object.pixelFraction != null) - message.pixelFraction = Number(object.pixelFraction); return message; }; /** - * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. + * Creates a plain object from a LocationInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p1beta1.ColorInfo + * @memberof google.cloud.vision.v1p1beta1.LocationInfo * @static - * @param {google.cloud.vision.v1p1beta1.ColorInfo} message ColorInfo + * @param {google.cloud.vision.v1p1beta1.LocationInfo} message LocationInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ColorInfo.toObject = function toObject(message, options) { + LocationInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.color = null; - object.score = 0; - object.pixelFraction = 0; - } - if (message.color != null && message.hasOwnProperty("color")) - object.color = $root.google.type.Color.toObject(message.color, options); - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - if (message.pixelFraction != null && message.hasOwnProperty("pixelFraction")) - object.pixelFraction = options.json && !isFinite(message.pixelFraction) ? String(message.pixelFraction) : message.pixelFraction; + if (options.defaults) + object.latLng = null; + if (message.latLng != null && message.hasOwnProperty("latLng")) + object.latLng = $root.google.type.LatLng.toObject(message.latLng, options); return object; }; /** - * Converts this ColorInfo to JSON. + * Converts this LocationInfo to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.ColorInfo + * @memberof google.cloud.vision.v1p1beta1.LocationInfo * @instance * @returns {Object.} JSON object */ - ColorInfo.prototype.toJSON = function toJSON() { + LocationInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ColorInfo; + return LocationInfo; })(); - v1p1beta1.DominantColorsAnnotation = (function() { + v1p1beta1.Property = (function() { /** - * Properties of a DominantColorsAnnotation. + * Properties of a Property. * @memberof google.cloud.vision.v1p1beta1 - * @interface IDominantColorsAnnotation - * @property {Array.|null} [colors] DominantColorsAnnotation colors + * @interface IProperty + * @property {string|null} [name] Property name + * @property {string|null} [value] Property value + * @property {number|Long|null} [uint64Value] Property uint64Value */ /** - * Constructs a new DominantColorsAnnotation. + * Constructs a new Property. * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a DominantColorsAnnotation. - * @implements IDominantColorsAnnotation + * @classdesc Represents a Property. + * @implements IProperty * @constructor - * @param {google.cloud.vision.v1p1beta1.IDominantColorsAnnotation=} [properties] Properties to set + * @param {google.cloud.vision.v1p1beta1.IProperty=} [properties] Properties to set */ - function DominantColorsAnnotation(properties) { - this.colors = []; + function Property(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -28861,78 +27955,101 @@ } /** - * DominantColorsAnnotation colors. - * @member {Array.} colors - * @memberof google.cloud.vision.v1p1beta1.DominantColorsAnnotation + * Property name. + * @member {string} name + * @memberof google.cloud.vision.v1p1beta1.Property * @instance */ - DominantColorsAnnotation.prototype.colors = $util.emptyArray; + Property.prototype.name = ""; /** - * Creates a new DominantColorsAnnotation instance using the specified properties. + * Property value. + * @member {string} value + * @memberof google.cloud.vision.v1p1beta1.Property + * @instance + */ + Property.prototype.value = ""; + + /** + * Property uint64Value. + * @member {number|Long} uint64Value + * @memberof google.cloud.vision.v1p1beta1.Property + * @instance + */ + Property.prototype.uint64Value = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Creates a new Property instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p1beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p1beta1.Property * @static - * @param {google.cloud.vision.v1p1beta1.IDominantColorsAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.DominantColorsAnnotation} DominantColorsAnnotation instance + * @param {google.cloud.vision.v1p1beta1.IProperty=} [properties] Properties to set + * @returns {google.cloud.vision.v1p1beta1.Property} Property instance */ - DominantColorsAnnotation.create = function create(properties) { - return new DominantColorsAnnotation(properties); + Property.create = function create(properties) { + return new Property(properties); }; /** - * Encodes the specified DominantColorsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p1beta1.DominantColorsAnnotation.verify|verify} messages. + * Encodes the specified Property message. Does not implicitly {@link google.cloud.vision.v1p1beta1.Property.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p1beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p1beta1.Property * @static - * @param {google.cloud.vision.v1p1beta1.IDominantColorsAnnotation} message DominantColorsAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IProperty} message Property message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DominantColorsAnnotation.encode = function encode(message, writer) { + Property.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.colors != null && message.colors.length) - for (var i = 0; i < message.colors.length; ++i) - $root.google.cloud.vision.v1p1beta1.ColorInfo.encode(message.colors[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.value != null && message.hasOwnProperty("value")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); + if (message.uint64Value != null && message.hasOwnProperty("uint64Value")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.uint64Value); return writer; }; /** - * Encodes the specified DominantColorsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.DominantColorsAnnotation.verify|verify} messages. + * Encodes the specified Property message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.Property.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p1beta1.Property * @static - * @param {google.cloud.vision.v1p1beta1.IDominantColorsAnnotation} message DominantColorsAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IProperty} message Property message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DominantColorsAnnotation.encodeDelimited = function encodeDelimited(message, writer) { + Property.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a DominantColorsAnnotation message from the specified reader or buffer. + * Decodes a Property message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p1beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p1beta1.Property * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p1beta1.DominantColorsAnnotation} DominantColorsAnnotation + * @returns {google.cloud.vision.v1p1beta1.Property} Property * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DominantColorsAnnotation.decode = function decode(reader, length) { + Property.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p1beta1.DominantColorsAnnotation(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p1beta1.Property(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.colors && message.colors.length)) - message.colors = []; - message.colors.push($root.google.cloud.vision.v1p1beta1.ColorInfo.decode(reader, reader.uint32())); + message.name = reader.string(); + break; + case 2: + message.value = reader.string(); + break; + case 3: + message.uint64Value = reader.uint64(); break; default: reader.skipType(tag & 7); @@ -28943,124 +28060,148 @@ }; /** - * Decodes a DominantColorsAnnotation message from the specified reader or buffer, length delimited. + * Decodes a Property message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p1beta1.Property * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.DominantColorsAnnotation} DominantColorsAnnotation + * @returns {google.cloud.vision.v1p1beta1.Property} Property * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DominantColorsAnnotation.decodeDelimited = function decodeDelimited(reader) { + Property.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a DominantColorsAnnotation message. + * Verifies a Property message. * @function verify - * @memberof google.cloud.vision.v1p1beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p1beta1.Property * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DominantColorsAnnotation.verify = function verify(message) { + Property.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.colors != null && message.hasOwnProperty("colors")) { - if (!Array.isArray(message.colors)) - return "colors: array expected"; - for (var i = 0; i < message.colors.length; ++i) { - var error = $root.google.cloud.vision.v1p1beta1.ColorInfo.verify(message.colors[i]); - if (error) - return "colors." + error; - } - } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + if (message.uint64Value != null && message.hasOwnProperty("uint64Value")) + if (!$util.isInteger(message.uint64Value) && !(message.uint64Value && $util.isInteger(message.uint64Value.low) && $util.isInteger(message.uint64Value.high))) + return "uint64Value: integer|Long expected"; return null; }; /** - * Creates a DominantColorsAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates a Property message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p1beta1.Property * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.DominantColorsAnnotation} DominantColorsAnnotation + * @returns {google.cloud.vision.v1p1beta1.Property} Property */ - DominantColorsAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.DominantColorsAnnotation) + Property.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p1beta1.Property) return object; - var message = new $root.google.cloud.vision.v1p1beta1.DominantColorsAnnotation(); - if (object.colors) { - if (!Array.isArray(object.colors)) - throw TypeError(".google.cloud.vision.v1p1beta1.DominantColorsAnnotation.colors: array expected"); - message.colors = []; - for (var i = 0; i < object.colors.length; ++i) { - if (typeof object.colors[i] !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.DominantColorsAnnotation.colors: object expected"); - message.colors[i] = $root.google.cloud.vision.v1p1beta1.ColorInfo.fromObject(object.colors[i]); - } - } + var message = new $root.google.cloud.vision.v1p1beta1.Property(); + if (object.name != null) + message.name = String(object.name); + if (object.value != null) + message.value = String(object.value); + if (object.uint64Value != null) + if ($util.Long) + (message.uint64Value = $util.Long.fromValue(object.uint64Value)).unsigned = true; + else if (typeof object.uint64Value === "string") + message.uint64Value = parseInt(object.uint64Value, 10); + else if (typeof object.uint64Value === "number") + message.uint64Value = object.uint64Value; + else if (typeof object.uint64Value === "object") + message.uint64Value = new $util.LongBits(object.uint64Value.low >>> 0, object.uint64Value.high >>> 0).toNumber(true); return message; }; /** - * Creates a plain object from a DominantColorsAnnotation message. Also converts values to other types if specified. + * Creates a plain object from a Property message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p1beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p1beta1.Property * @static - * @param {google.cloud.vision.v1p1beta1.DominantColorsAnnotation} message DominantColorsAnnotation + * @param {google.cloud.vision.v1p1beta1.Property} message Property * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DominantColorsAnnotation.toObject = function toObject(message, options) { + Property.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.colors = []; - if (message.colors && message.colors.length) { - object.colors = []; - for (var j = 0; j < message.colors.length; ++j) - object.colors[j] = $root.google.cloud.vision.v1p1beta1.ColorInfo.toObject(message.colors[j], options); + if (options.defaults) { + object.name = ""; + object.value = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.uint64Value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.uint64Value = options.longs === String ? "0" : 0; } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.uint64Value != null && message.hasOwnProperty("uint64Value")) + if (typeof message.uint64Value === "number") + object.uint64Value = options.longs === String ? String(message.uint64Value) : message.uint64Value; + else + object.uint64Value = options.longs === String ? $util.Long.prototype.toString.call(message.uint64Value) : options.longs === Number ? new $util.LongBits(message.uint64Value.low >>> 0, message.uint64Value.high >>> 0).toNumber(true) : message.uint64Value; return object; }; /** - * Converts this DominantColorsAnnotation to JSON. + * Converts this Property to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p1beta1.Property * @instance * @returns {Object.} JSON object */ - DominantColorsAnnotation.prototype.toJSON = function toJSON() { + Property.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return DominantColorsAnnotation; + return Property; })(); - v1p1beta1.ImageProperties = (function() { + v1p1beta1.EntityAnnotation = (function() { /** - * Properties of an ImageProperties. + * Properties of an EntityAnnotation. * @memberof google.cloud.vision.v1p1beta1 - * @interface IImageProperties - * @property {google.cloud.vision.v1p1beta1.IDominantColorsAnnotation|null} [dominantColors] ImageProperties dominantColors + * @interface IEntityAnnotation + * @property {string|null} [mid] EntityAnnotation mid + * @property {string|null} [locale] EntityAnnotation locale + * @property {string|null} [description] EntityAnnotation description + * @property {number|null} [score] EntityAnnotation score + * @property {number|null} [confidence] EntityAnnotation confidence + * @property {number|null} [topicality] EntityAnnotation topicality + * @property {google.cloud.vision.v1p1beta1.IBoundingPoly|null} [boundingPoly] EntityAnnotation boundingPoly + * @property {Array.|null} [locations] EntityAnnotation locations + * @property {Array.|null} [properties] EntityAnnotation properties */ /** - * Constructs a new ImageProperties. + * Constructs a new EntityAnnotation. * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents an ImageProperties. - * @implements IImageProperties + * @classdesc Represents an EntityAnnotation. + * @implements IEntityAnnotation * @constructor - * @param {google.cloud.vision.v1p1beta1.IImageProperties=} [properties] Properties to set + * @param {google.cloud.vision.v1p1beta1.IEntityAnnotation=} [properties] Properties to set */ - function ImageProperties(properties) { + function EntityAnnotation(properties) { + this.locations = []; + this.properties = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -29068,75 +28209,185 @@ } /** - * ImageProperties dominantColors. - * @member {google.cloud.vision.v1p1beta1.IDominantColorsAnnotation|null|undefined} dominantColors - * @memberof google.cloud.vision.v1p1beta1.ImageProperties + * EntityAnnotation mid. + * @member {string} mid + * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation * @instance */ - ImageProperties.prototype.dominantColors = null; + EntityAnnotation.prototype.mid = ""; /** - * Creates a new ImageProperties instance using the specified properties. + * EntityAnnotation locale. + * @member {string} locale + * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.locale = ""; + + /** + * EntityAnnotation description. + * @member {string} description + * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.description = ""; + + /** + * EntityAnnotation score. + * @member {number} score + * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.score = 0; + + /** + * EntityAnnotation confidence. + * @member {number} confidence + * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.confidence = 0; + + /** + * EntityAnnotation topicality. + * @member {number} topicality + * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.topicality = 0; + + /** + * EntityAnnotation boundingPoly. + * @member {google.cloud.vision.v1p1beta1.IBoundingPoly|null|undefined} boundingPoly + * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.boundingPoly = null; + + /** + * EntityAnnotation locations. + * @member {Array.} locations + * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.locations = $util.emptyArray; + + /** + * EntityAnnotation properties. + * @member {Array.} properties + * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.properties = $util.emptyArray; + + /** + * Creates a new EntityAnnotation instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p1beta1.ImageProperties + * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation * @static - * @param {google.cloud.vision.v1p1beta1.IImageProperties=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.ImageProperties} ImageProperties instance + * @param {google.cloud.vision.v1p1beta1.IEntityAnnotation=} [properties] Properties to set + * @returns {google.cloud.vision.v1p1beta1.EntityAnnotation} EntityAnnotation instance */ - ImageProperties.create = function create(properties) { - return new ImageProperties(properties); + EntityAnnotation.create = function create(properties) { + return new EntityAnnotation(properties); }; /** - * Encodes the specified ImageProperties message. Does not implicitly {@link google.cloud.vision.v1p1beta1.ImageProperties.verify|verify} messages. + * Encodes the specified EntityAnnotation message. Does not implicitly {@link google.cloud.vision.v1p1beta1.EntityAnnotation.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p1beta1.ImageProperties + * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation * @static - * @param {google.cloud.vision.v1p1beta1.IImageProperties} message ImageProperties message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IEntityAnnotation} message EntityAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageProperties.encode = function encode(message, writer) { + EntityAnnotation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.dominantColors != null && message.hasOwnProperty("dominantColors")) - $root.google.cloud.vision.v1p1beta1.DominantColorsAnnotation.encode(message.dominantColors, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.mid != null && message.hasOwnProperty("mid")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.mid); + if (message.locale != null && message.hasOwnProperty("locale")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.locale); + if (message.description != null && message.hasOwnProperty("description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + if (message.score != null && message.hasOwnProperty("score")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.score); + if (message.confidence != null && message.hasOwnProperty("confidence")) + writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); + if (message.topicality != null && message.hasOwnProperty("topicality")) + writer.uint32(/* id 6, wireType 5 =*/53).float(message.topicality); + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + $root.google.cloud.vision.v1p1beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.locations != null && message.locations.length) + for (var i = 0; i < message.locations.length; ++i) + $root.google.cloud.vision.v1p1beta1.LocationInfo.encode(message.locations[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.properties != null && message.properties.length) + for (var i = 0; i < message.properties.length; ++i) + $root.google.cloud.vision.v1p1beta1.Property.encode(message.properties[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); return writer; }; /** - * Encodes the specified ImageProperties message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.ImageProperties.verify|verify} messages. + * Encodes the specified EntityAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.EntityAnnotation.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.ImageProperties + * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation * @static - * @param {google.cloud.vision.v1p1beta1.IImageProperties} message ImageProperties message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IEntityAnnotation} message EntityAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageProperties.encodeDelimited = function encodeDelimited(message, writer) { + EntityAnnotation.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImageProperties message from the specified reader or buffer. + * Decodes an EntityAnnotation message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p1beta1.ImageProperties + * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p1beta1.ImageProperties} ImageProperties + * @returns {google.cloud.vision.v1p1beta1.EntityAnnotation} EntityAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageProperties.decode = function decode(reader, length) { + EntityAnnotation.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.vision.v1p1beta1.ImageProperties(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p1beta1.EntityAnnotation(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.dominantColors = $root.google.cloud.vision.v1p1beta1.DominantColorsAnnotation.decode(reader, reader.uint32()); + message.mid = reader.string(); + break; + case 2: + message.locale = reader.string(); + break; + case 3: + message.description = reader.string(); + break; + case 4: + message.score = reader.float(); + break; + case 5: + message.confidence = reader.float(); + break; + case 6: + message.topicality = reader.float(); + break; + case 7: + message.boundingPoly = $root.google.cloud.vision.v1p1beta1.BoundingPoly.decode(reader, reader.uint32()); + break; + case 8: + if (!(message.locations && message.locations.length)) + message.locations = []; + message.locations.push($root.google.cloud.vision.v1p1beta1.LocationInfo.decode(reader, reader.uint32())); + break; + case 9: + if (!(message.properties && message.properties.length)) + message.properties = []; + message.properties.push($root.google.cloud.vision.v1p1beta1.Property.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -29147,114 +28398,217 @@ }; /** - * Decodes an ImageProperties message from the specified reader or buffer, length delimited. + * Decodes an EntityAnnotation message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.ImageProperties + * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.ImageProperties} ImageProperties + * @returns {google.cloud.vision.v1p1beta1.EntityAnnotation} EntityAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageProperties.decodeDelimited = function decodeDelimited(reader) { + EntityAnnotation.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImageProperties message. + * Verifies an EntityAnnotation message. * @function verify - * @memberof google.cloud.vision.v1p1beta1.ImageProperties + * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImageProperties.verify = function verify(message) { + EntityAnnotation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.dominantColors != null && message.hasOwnProperty("dominantColors")) { - var error = $root.google.cloud.vision.v1p1beta1.DominantColorsAnnotation.verify(message.dominantColors); + if (message.mid != null && message.hasOwnProperty("mid")) + if (!$util.isString(message.mid)) + return "mid: string expected"; + if (message.locale != null && message.hasOwnProperty("locale")) + if (!$util.isString(message.locale)) + return "locale: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.score != null && message.hasOwnProperty("score")) + if (typeof message.score !== "number") + return "score: number expected"; + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + if (message.topicality != null && message.hasOwnProperty("topicality")) + if (typeof message.topicality !== "number") + return "topicality: number expected"; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { + var error = $root.google.cloud.vision.v1p1beta1.BoundingPoly.verify(message.boundingPoly); if (error) - return "dominantColors." + error; + return "boundingPoly." + error; } - return null; + if (message.locations != null && message.hasOwnProperty("locations")) { + if (!Array.isArray(message.locations)) + return "locations: array expected"; + for (var i = 0; i < message.locations.length; ++i) { + var error = $root.google.cloud.vision.v1p1beta1.LocationInfo.verify(message.locations[i]); + if (error) + return "locations." + error; + } + } + if (message.properties != null && message.hasOwnProperty("properties")) { + if (!Array.isArray(message.properties)) + return "properties: array expected"; + for (var i = 0; i < message.properties.length; ++i) { + var error = $root.google.cloud.vision.v1p1beta1.Property.verify(message.properties[i]); + if (error) + return "properties." + error; + } + } + return null; }; /** - * Creates an ImageProperties message from a plain object. Also converts values to their respective internal types. + * Creates an EntityAnnotation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.ImageProperties + * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.ImageProperties} ImageProperties + * @returns {google.cloud.vision.v1p1beta1.EntityAnnotation} EntityAnnotation */ - ImageProperties.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.ImageProperties) + EntityAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p1beta1.EntityAnnotation) return object; - var message = new $root.google.cloud.vision.v1p1beta1.ImageProperties(); - if (object.dominantColors != null) { - if (typeof object.dominantColors !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.ImageProperties.dominantColors: object expected"); - message.dominantColors = $root.google.cloud.vision.v1p1beta1.DominantColorsAnnotation.fromObject(object.dominantColors); + var message = new $root.google.cloud.vision.v1p1beta1.EntityAnnotation(); + if (object.mid != null) + message.mid = String(object.mid); + if (object.locale != null) + message.locale = String(object.locale); + if (object.description != null) + message.description = String(object.description); + if (object.score != null) + message.score = Number(object.score); + if (object.confidence != null) + message.confidence = Number(object.confidence); + if (object.topicality != null) + message.topicality = Number(object.topicality); + if (object.boundingPoly != null) { + if (typeof object.boundingPoly !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.EntityAnnotation.boundingPoly: object expected"); + message.boundingPoly = $root.google.cloud.vision.v1p1beta1.BoundingPoly.fromObject(object.boundingPoly); + } + if (object.locations) { + if (!Array.isArray(object.locations)) + throw TypeError(".google.cloud.vision.v1p1beta1.EntityAnnotation.locations: array expected"); + message.locations = []; + for (var i = 0; i < object.locations.length; ++i) { + if (typeof object.locations[i] !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.EntityAnnotation.locations: object expected"); + message.locations[i] = $root.google.cloud.vision.v1p1beta1.LocationInfo.fromObject(object.locations[i]); + } + } + if (object.properties) { + if (!Array.isArray(object.properties)) + throw TypeError(".google.cloud.vision.v1p1beta1.EntityAnnotation.properties: array expected"); + message.properties = []; + for (var i = 0; i < object.properties.length; ++i) { + if (typeof object.properties[i] !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.EntityAnnotation.properties: object expected"); + message.properties[i] = $root.google.cloud.vision.v1p1beta1.Property.fromObject(object.properties[i]); + } } return message; }; /** - * Creates a plain object from an ImageProperties message. Also converts values to other types if specified. + * Creates a plain object from an EntityAnnotation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p1beta1.ImageProperties + * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation * @static - * @param {google.cloud.vision.v1p1beta1.ImageProperties} message ImageProperties + * @param {google.cloud.vision.v1p1beta1.EntityAnnotation} message EntityAnnotation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImageProperties.toObject = function toObject(message, options) { + EntityAnnotation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.dominantColors = null; - if (message.dominantColors != null && message.hasOwnProperty("dominantColors")) - object.dominantColors = $root.google.cloud.vision.v1p1beta1.DominantColorsAnnotation.toObject(message.dominantColors, options); + if (options.arrays || options.defaults) { + object.locations = []; + object.properties = []; + } + if (options.defaults) { + object.mid = ""; + object.locale = ""; + object.description = ""; + object.score = 0; + object.confidence = 0; + object.topicality = 0; + object.boundingPoly = null; + } + if (message.mid != null && message.hasOwnProperty("mid")) + object.mid = message.mid; + if (message.locale != null && message.hasOwnProperty("locale")) + object.locale = message.locale; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.score != null && message.hasOwnProperty("score")) + object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + if (message.topicality != null && message.hasOwnProperty("topicality")) + object.topicality = options.json && !isFinite(message.topicality) ? String(message.topicality) : message.topicality; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + object.boundingPoly = $root.google.cloud.vision.v1p1beta1.BoundingPoly.toObject(message.boundingPoly, options); + if (message.locations && message.locations.length) { + object.locations = []; + for (var j = 0; j < message.locations.length; ++j) + object.locations[j] = $root.google.cloud.vision.v1p1beta1.LocationInfo.toObject(message.locations[j], options); + } + if (message.properties && message.properties.length) { + object.properties = []; + for (var j = 0; j < message.properties.length; ++j) + object.properties[j] = $root.google.cloud.vision.v1p1beta1.Property.toObject(message.properties[j], options); + } return object; }; /** - * Converts this ImageProperties to JSON. + * Converts this EntityAnnotation to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.ImageProperties + * @memberof google.cloud.vision.v1p1beta1.EntityAnnotation * @instance * @returns {Object.} JSON object */ - ImageProperties.prototype.toJSON = function toJSON() { + EntityAnnotation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImageProperties; + return EntityAnnotation; })(); - v1p1beta1.CropHint = (function() { + v1p1beta1.SafeSearchAnnotation = (function() { /** - * Properties of a CropHint. + * Properties of a SafeSearchAnnotation. * @memberof google.cloud.vision.v1p1beta1 - * @interface ICropHint - * @property {google.cloud.vision.v1p1beta1.IBoundingPoly|null} [boundingPoly] CropHint boundingPoly - * @property {number|null} [confidence] CropHint confidence - * @property {number|null} [importanceFraction] CropHint importanceFraction + * @interface ISafeSearchAnnotation + * @property {google.cloud.vision.v1p1beta1.Likelihood|null} [adult] SafeSearchAnnotation adult + * @property {google.cloud.vision.v1p1beta1.Likelihood|null} [spoof] SafeSearchAnnotation spoof + * @property {google.cloud.vision.v1p1beta1.Likelihood|null} [medical] SafeSearchAnnotation medical + * @property {google.cloud.vision.v1p1beta1.Likelihood|null} [violence] SafeSearchAnnotation violence + * @property {google.cloud.vision.v1p1beta1.Likelihood|null} [racy] SafeSearchAnnotation racy */ /** - * Constructs a new CropHint. + * Constructs a new SafeSearchAnnotation. * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a CropHint. - * @implements ICropHint + * @classdesc Represents a SafeSearchAnnotation. + * @implements ISafeSearchAnnotation * @constructor - * @param {google.cloud.vision.v1p1beta1.ICropHint=} [properties] Properties to set + * @param {google.cloud.vision.v1p1beta1.ISafeSearchAnnotation=} [properties] Properties to set */ - function CropHint(properties) { + function SafeSearchAnnotation(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -29262,101 +28616,127 @@ } /** - * CropHint boundingPoly. - * @member {google.cloud.vision.v1p1beta1.IBoundingPoly|null|undefined} boundingPoly - * @memberof google.cloud.vision.v1p1beta1.CropHint + * SafeSearchAnnotation adult. + * @member {google.cloud.vision.v1p1beta1.Likelihood} adult + * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation * @instance */ - CropHint.prototype.boundingPoly = null; + SafeSearchAnnotation.prototype.adult = 0; /** - * CropHint confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p1beta1.CropHint + * SafeSearchAnnotation spoof. + * @member {google.cloud.vision.v1p1beta1.Likelihood} spoof + * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation * @instance */ - CropHint.prototype.confidence = 0; + SafeSearchAnnotation.prototype.spoof = 0; /** - * CropHint importanceFraction. - * @member {number} importanceFraction - * @memberof google.cloud.vision.v1p1beta1.CropHint + * SafeSearchAnnotation medical. + * @member {google.cloud.vision.v1p1beta1.Likelihood} medical + * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation * @instance */ - CropHint.prototype.importanceFraction = 0; + SafeSearchAnnotation.prototype.medical = 0; /** - * Creates a new CropHint instance using the specified properties. + * SafeSearchAnnotation violence. + * @member {google.cloud.vision.v1p1beta1.Likelihood} violence + * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation + * @instance + */ + SafeSearchAnnotation.prototype.violence = 0; + + /** + * SafeSearchAnnotation racy. + * @member {google.cloud.vision.v1p1beta1.Likelihood} racy + * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation + * @instance + */ + SafeSearchAnnotation.prototype.racy = 0; + + /** + * Creates a new SafeSearchAnnotation instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p1beta1.CropHint + * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation * @static - * @param {google.cloud.vision.v1p1beta1.ICropHint=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.CropHint} CropHint instance + * @param {google.cloud.vision.v1p1beta1.ISafeSearchAnnotation=} [properties] Properties to set + * @returns {google.cloud.vision.v1p1beta1.SafeSearchAnnotation} SafeSearchAnnotation instance */ - CropHint.create = function create(properties) { - return new CropHint(properties); + SafeSearchAnnotation.create = function create(properties) { + return new SafeSearchAnnotation(properties); }; /** - * Encodes the specified CropHint message. Does not implicitly {@link google.cloud.vision.v1p1beta1.CropHint.verify|verify} messages. + * Encodes the specified SafeSearchAnnotation message. Does not implicitly {@link google.cloud.vision.v1p1beta1.SafeSearchAnnotation.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p1beta1.CropHint + * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation * @static - * @param {google.cloud.vision.v1p1beta1.ICropHint} message CropHint message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.ISafeSearchAnnotation} message SafeSearchAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CropHint.encode = function encode(message, writer) { + SafeSearchAnnotation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - $root.google.cloud.vision.v1p1beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.confidence != null && message.hasOwnProperty("confidence")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); - if (message.importanceFraction != null && message.hasOwnProperty("importanceFraction")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.importanceFraction); + if (message.adult != null && message.hasOwnProperty("adult")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.adult); + if (message.spoof != null && message.hasOwnProperty("spoof")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.spoof); + if (message.medical != null && message.hasOwnProperty("medical")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.medical); + if (message.violence != null && message.hasOwnProperty("violence")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.violence); + if (message.racy != null && message.hasOwnProperty("racy")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.racy); return writer; }; /** - * Encodes the specified CropHint message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.CropHint.verify|verify} messages. + * Encodes the specified SafeSearchAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.SafeSearchAnnotation.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.CropHint + * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation * @static - * @param {google.cloud.vision.v1p1beta1.ICropHint} message CropHint message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.ISafeSearchAnnotation} message SafeSearchAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CropHint.encodeDelimited = function encodeDelimited(message, writer) { + SafeSearchAnnotation.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CropHint message from the specified reader or buffer. + * Decodes a SafeSearchAnnotation message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p1beta1.CropHint + * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p1beta1.CropHint} CropHint + * @returns {google.cloud.vision.v1p1beta1.SafeSearchAnnotation} SafeSearchAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CropHint.decode = function decode(reader, length) { + SafeSearchAnnotation.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.vision.v1p1beta1.CropHint(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p1beta1.SafeSearchAnnotation(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.boundingPoly = $root.google.cloud.vision.v1p1beta1.BoundingPoly.decode(reader, reader.uint32()); + message.adult = reader.int32(); break; case 2: - message.confidence = reader.float(); + message.spoof = reader.int32(); break; case 3: - message.importanceFraction = reader.float(); + message.medical = reader.int32(); + break; + case 4: + message.violence = reader.int32(); + break; + case 9: + message.racy = reader.int32(); break; default: reader.skipType(tag & 7); @@ -29367,130 +28747,306 @@ }; /** - * Decodes a CropHint message from the specified reader or buffer, length delimited. + * Decodes a SafeSearchAnnotation message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.CropHint + * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.CropHint} CropHint + * @returns {google.cloud.vision.v1p1beta1.SafeSearchAnnotation} SafeSearchAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CropHint.decodeDelimited = function decodeDelimited(reader) { + SafeSearchAnnotation.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CropHint message. + * Verifies a SafeSearchAnnotation message. * @function verify - * @memberof google.cloud.vision.v1p1beta1.CropHint + * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CropHint.verify = function verify(message) { + SafeSearchAnnotation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { - var error = $root.google.cloud.vision.v1p1beta1.BoundingPoly.verify(message.boundingPoly); - if (error) - return "boundingPoly." + error; - } - if (message.confidence != null && message.hasOwnProperty("confidence")) - if (typeof message.confidence !== "number") - return "confidence: number expected"; - if (message.importanceFraction != null && message.hasOwnProperty("importanceFraction")) - if (typeof message.importanceFraction !== "number") - return "importanceFraction: number expected"; + if (message.adult != null && message.hasOwnProperty("adult")) + switch (message.adult) { + default: + return "adult: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.spoof != null && message.hasOwnProperty("spoof")) + switch (message.spoof) { + default: + return "spoof: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.medical != null && message.hasOwnProperty("medical")) + switch (message.medical) { + default: + return "medical: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.violence != null && message.hasOwnProperty("violence")) + switch (message.violence) { + default: + return "violence: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.racy != null && message.hasOwnProperty("racy")) + switch (message.racy) { + default: + return "racy: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } return null; }; /** - * Creates a CropHint message from a plain object. Also converts values to their respective internal types. + * Creates a SafeSearchAnnotation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.CropHint + * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.CropHint} CropHint + * @returns {google.cloud.vision.v1p1beta1.SafeSearchAnnotation} SafeSearchAnnotation */ - CropHint.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.CropHint) + SafeSearchAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p1beta1.SafeSearchAnnotation) return object; - var message = new $root.google.cloud.vision.v1p1beta1.CropHint(); - if (object.boundingPoly != null) { - if (typeof object.boundingPoly !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.CropHint.boundingPoly: object expected"); - message.boundingPoly = $root.google.cloud.vision.v1p1beta1.BoundingPoly.fromObject(object.boundingPoly); + var message = new $root.google.cloud.vision.v1p1beta1.SafeSearchAnnotation(); + switch (object.adult) { + case "UNKNOWN": + case 0: + message.adult = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.adult = 1; + break; + case "UNLIKELY": + case 2: + message.adult = 2; + break; + case "POSSIBLE": + case 3: + message.adult = 3; + break; + case "LIKELY": + case 4: + message.adult = 4; + break; + case "VERY_LIKELY": + case 5: + message.adult = 5; + break; + } + switch (object.spoof) { + case "UNKNOWN": + case 0: + message.spoof = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.spoof = 1; + break; + case "UNLIKELY": + case 2: + message.spoof = 2; + break; + case "POSSIBLE": + case 3: + message.spoof = 3; + break; + case "LIKELY": + case 4: + message.spoof = 4; + break; + case "VERY_LIKELY": + case 5: + message.spoof = 5; + break; + } + switch (object.medical) { + case "UNKNOWN": + case 0: + message.medical = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.medical = 1; + break; + case "UNLIKELY": + case 2: + message.medical = 2; + break; + case "POSSIBLE": + case 3: + message.medical = 3; + break; + case "LIKELY": + case 4: + message.medical = 4; + break; + case "VERY_LIKELY": + case 5: + message.medical = 5; + break; + } + switch (object.violence) { + case "UNKNOWN": + case 0: + message.violence = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.violence = 1; + break; + case "UNLIKELY": + case 2: + message.violence = 2; + break; + case "POSSIBLE": + case 3: + message.violence = 3; + break; + case "LIKELY": + case 4: + message.violence = 4; + break; + case "VERY_LIKELY": + case 5: + message.violence = 5; + break; + } + switch (object.racy) { + case "UNKNOWN": + case 0: + message.racy = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.racy = 1; + break; + case "UNLIKELY": + case 2: + message.racy = 2; + break; + case "POSSIBLE": + case 3: + message.racy = 3; + break; + case "LIKELY": + case 4: + message.racy = 4; + break; + case "VERY_LIKELY": + case 5: + message.racy = 5; + break; } - if (object.confidence != null) - message.confidence = Number(object.confidence); - if (object.importanceFraction != null) - message.importanceFraction = Number(object.importanceFraction); return message; }; /** - * Creates a plain object from a CropHint message. Also converts values to other types if specified. + * Creates a plain object from a SafeSearchAnnotation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p1beta1.CropHint + * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation * @static - * @param {google.cloud.vision.v1p1beta1.CropHint} message CropHint + * @param {google.cloud.vision.v1p1beta1.SafeSearchAnnotation} message SafeSearchAnnotation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CropHint.toObject = function toObject(message, options) { + SafeSearchAnnotation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.boundingPoly = null; - object.confidence = 0; - object.importanceFraction = 0; + object.adult = options.enums === String ? "UNKNOWN" : 0; + object.spoof = options.enums === String ? "UNKNOWN" : 0; + object.medical = options.enums === String ? "UNKNOWN" : 0; + object.violence = options.enums === String ? "UNKNOWN" : 0; + object.racy = options.enums === String ? "UNKNOWN" : 0; } - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - object.boundingPoly = $root.google.cloud.vision.v1p1beta1.BoundingPoly.toObject(message.boundingPoly, options); - if (message.confidence != null && message.hasOwnProperty("confidence")) - object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; - if (message.importanceFraction != null && message.hasOwnProperty("importanceFraction")) - object.importanceFraction = options.json && !isFinite(message.importanceFraction) ? String(message.importanceFraction) : message.importanceFraction; + if (message.adult != null && message.hasOwnProperty("adult")) + object.adult = options.enums === String ? $root.google.cloud.vision.v1p1beta1.Likelihood[message.adult] : message.adult; + if (message.spoof != null && message.hasOwnProperty("spoof")) + object.spoof = options.enums === String ? $root.google.cloud.vision.v1p1beta1.Likelihood[message.spoof] : message.spoof; + if (message.medical != null && message.hasOwnProperty("medical")) + object.medical = options.enums === String ? $root.google.cloud.vision.v1p1beta1.Likelihood[message.medical] : message.medical; + if (message.violence != null && message.hasOwnProperty("violence")) + object.violence = options.enums === String ? $root.google.cloud.vision.v1p1beta1.Likelihood[message.violence] : message.violence; + if (message.racy != null && message.hasOwnProperty("racy")) + object.racy = options.enums === String ? $root.google.cloud.vision.v1p1beta1.Likelihood[message.racy] : message.racy; return object; }; /** - * Converts this CropHint to JSON. + * Converts this SafeSearchAnnotation to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.CropHint + * @memberof google.cloud.vision.v1p1beta1.SafeSearchAnnotation * @instance * @returns {Object.} JSON object */ - CropHint.prototype.toJSON = function toJSON() { + SafeSearchAnnotation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CropHint; + return SafeSearchAnnotation; })(); - v1p1beta1.CropHintsAnnotation = (function() { + v1p1beta1.LatLongRect = (function() { /** - * Properties of a CropHintsAnnotation. + * Properties of a LatLongRect. * @memberof google.cloud.vision.v1p1beta1 - * @interface ICropHintsAnnotation - * @property {Array.|null} [cropHints] CropHintsAnnotation cropHints + * @interface ILatLongRect + * @property {google.type.ILatLng|null} [minLatLng] LatLongRect minLatLng + * @property {google.type.ILatLng|null} [maxLatLng] LatLongRect maxLatLng */ /** - * Constructs a new CropHintsAnnotation. + * Constructs a new LatLongRect. * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a CropHintsAnnotation. - * @implements ICropHintsAnnotation + * @classdesc Represents a LatLongRect. + * @implements ILatLongRect * @constructor - * @param {google.cloud.vision.v1p1beta1.ICropHintsAnnotation=} [properties] Properties to set + * @param {google.cloud.vision.v1p1beta1.ILatLongRect=} [properties] Properties to set */ - function CropHintsAnnotation(properties) { - this.cropHints = []; + function LatLongRect(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -29498,78 +29054,88 @@ } /** - * CropHintsAnnotation cropHints. - * @member {Array.} cropHints - * @memberof google.cloud.vision.v1p1beta1.CropHintsAnnotation + * LatLongRect minLatLng. + * @member {google.type.ILatLng|null|undefined} minLatLng + * @memberof google.cloud.vision.v1p1beta1.LatLongRect * @instance */ - CropHintsAnnotation.prototype.cropHints = $util.emptyArray; + LatLongRect.prototype.minLatLng = null; /** - * Creates a new CropHintsAnnotation instance using the specified properties. + * LatLongRect maxLatLng. + * @member {google.type.ILatLng|null|undefined} maxLatLng + * @memberof google.cloud.vision.v1p1beta1.LatLongRect + * @instance + */ + LatLongRect.prototype.maxLatLng = null; + + /** + * Creates a new LatLongRect instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p1beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p1beta1.LatLongRect * @static - * @param {google.cloud.vision.v1p1beta1.ICropHintsAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.CropHintsAnnotation} CropHintsAnnotation instance + * @param {google.cloud.vision.v1p1beta1.ILatLongRect=} [properties] Properties to set + * @returns {google.cloud.vision.v1p1beta1.LatLongRect} LatLongRect instance */ - CropHintsAnnotation.create = function create(properties) { - return new CropHintsAnnotation(properties); + LatLongRect.create = function create(properties) { + return new LatLongRect(properties); }; /** - * Encodes the specified CropHintsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p1beta1.CropHintsAnnotation.verify|verify} messages. + * Encodes the specified LatLongRect message. Does not implicitly {@link google.cloud.vision.v1p1beta1.LatLongRect.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p1beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p1beta1.LatLongRect * @static - * @param {google.cloud.vision.v1p1beta1.ICropHintsAnnotation} message CropHintsAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.ILatLongRect} message LatLongRect message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CropHintsAnnotation.encode = function encode(message, writer) { + LatLongRect.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.cropHints != null && message.cropHints.length) - for (var i = 0; i < message.cropHints.length; ++i) - $root.google.cloud.vision.v1p1beta1.CropHint.encode(message.cropHints[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.minLatLng != null && message.hasOwnProperty("minLatLng")) + $root.google.type.LatLng.encode(message.minLatLng, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.maxLatLng != null && message.hasOwnProperty("maxLatLng")) + $root.google.type.LatLng.encode(message.maxLatLng, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified CropHintsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.CropHintsAnnotation.verify|verify} messages. + * Encodes the specified LatLongRect message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.LatLongRect.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p1beta1.LatLongRect * @static - * @param {google.cloud.vision.v1p1beta1.ICropHintsAnnotation} message CropHintsAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.ILatLongRect} message LatLongRect message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CropHintsAnnotation.encodeDelimited = function encodeDelimited(message, writer) { + LatLongRect.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CropHintsAnnotation message from the specified reader or buffer. + * Decodes a LatLongRect message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p1beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p1beta1.LatLongRect * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p1beta1.CropHintsAnnotation} CropHintsAnnotation + * @returns {google.cloud.vision.v1p1beta1.LatLongRect} LatLongRect * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CropHintsAnnotation.decode = function decode(reader, length) { + LatLongRect.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.vision.v1p1beta1.CropHintsAnnotation(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p1beta1.LatLongRect(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.cropHints && message.cropHints.length)) - message.cropHints = []; - message.cropHints.push($root.google.cloud.vision.v1p1beta1.CropHint.decode(reader, reader.uint32())); + message.minLatLng = $root.google.type.LatLng.decode(reader, reader.uint32()); + break; + case 2: + message.maxLatLng = $root.google.type.LatLng.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -29580,125 +29146,128 @@ }; /** - * Decodes a CropHintsAnnotation message from the specified reader or buffer, length delimited. + * Decodes a LatLongRect message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p1beta1.LatLongRect * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.CropHintsAnnotation} CropHintsAnnotation + * @returns {google.cloud.vision.v1p1beta1.LatLongRect} LatLongRect * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CropHintsAnnotation.decodeDelimited = function decodeDelimited(reader) { + LatLongRect.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CropHintsAnnotation message. + * Verifies a LatLongRect message. * @function verify - * @memberof google.cloud.vision.v1p1beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p1beta1.LatLongRect * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CropHintsAnnotation.verify = function verify(message) { + LatLongRect.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.cropHints != null && message.hasOwnProperty("cropHints")) { - if (!Array.isArray(message.cropHints)) - return "cropHints: array expected"; - for (var i = 0; i < message.cropHints.length; ++i) { - var error = $root.google.cloud.vision.v1p1beta1.CropHint.verify(message.cropHints[i]); - if (error) - return "cropHints." + error; - } + if (message.minLatLng != null && message.hasOwnProperty("minLatLng")) { + var error = $root.google.type.LatLng.verify(message.minLatLng); + if (error) + return "minLatLng." + error; + } + if (message.maxLatLng != null && message.hasOwnProperty("maxLatLng")) { + var error = $root.google.type.LatLng.verify(message.maxLatLng); + if (error) + return "maxLatLng." + error; } return null; }; /** - * Creates a CropHintsAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates a LatLongRect message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p1beta1.LatLongRect * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.CropHintsAnnotation} CropHintsAnnotation + * @returns {google.cloud.vision.v1p1beta1.LatLongRect} LatLongRect */ - CropHintsAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.CropHintsAnnotation) + LatLongRect.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p1beta1.LatLongRect) return object; - var message = new $root.google.cloud.vision.v1p1beta1.CropHintsAnnotation(); - if (object.cropHints) { - if (!Array.isArray(object.cropHints)) - throw TypeError(".google.cloud.vision.v1p1beta1.CropHintsAnnotation.cropHints: array expected"); - message.cropHints = []; - for (var i = 0; i < object.cropHints.length; ++i) { - if (typeof object.cropHints[i] !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.CropHintsAnnotation.cropHints: object expected"); - message.cropHints[i] = $root.google.cloud.vision.v1p1beta1.CropHint.fromObject(object.cropHints[i]); - } + var message = new $root.google.cloud.vision.v1p1beta1.LatLongRect(); + if (object.minLatLng != null) { + if (typeof object.minLatLng !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.LatLongRect.minLatLng: object expected"); + message.minLatLng = $root.google.type.LatLng.fromObject(object.minLatLng); + } + if (object.maxLatLng != null) { + if (typeof object.maxLatLng !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.LatLongRect.maxLatLng: object expected"); + message.maxLatLng = $root.google.type.LatLng.fromObject(object.maxLatLng); } return message; }; /** - * Creates a plain object from a CropHintsAnnotation message. Also converts values to other types if specified. + * Creates a plain object from a LatLongRect message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p1beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p1beta1.LatLongRect * @static - * @param {google.cloud.vision.v1p1beta1.CropHintsAnnotation} message CropHintsAnnotation + * @param {google.cloud.vision.v1p1beta1.LatLongRect} message LatLongRect * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CropHintsAnnotation.toObject = function toObject(message, options) { + LatLongRect.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.cropHints = []; - if (message.cropHints && message.cropHints.length) { - object.cropHints = []; - for (var j = 0; j < message.cropHints.length; ++j) - object.cropHints[j] = $root.google.cloud.vision.v1p1beta1.CropHint.toObject(message.cropHints[j], options); + if (options.defaults) { + object.minLatLng = null; + object.maxLatLng = null; } + if (message.minLatLng != null && message.hasOwnProperty("minLatLng")) + object.minLatLng = $root.google.type.LatLng.toObject(message.minLatLng, options); + if (message.maxLatLng != null && message.hasOwnProperty("maxLatLng")) + object.maxLatLng = $root.google.type.LatLng.toObject(message.maxLatLng, options); return object; }; /** - * Converts this CropHintsAnnotation to JSON. + * Converts this LatLongRect to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p1beta1.LatLongRect * @instance * @returns {Object.} JSON object */ - CropHintsAnnotation.prototype.toJSON = function toJSON() { + LatLongRect.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CropHintsAnnotation; + return LatLongRect; })(); - v1p1beta1.CropHintsParams = (function() { + v1p1beta1.ColorInfo = (function() { /** - * Properties of a CropHintsParams. + * Properties of a ColorInfo. * @memberof google.cloud.vision.v1p1beta1 - * @interface ICropHintsParams - * @property {Array.|null} [aspectRatios] CropHintsParams aspectRatios + * @interface IColorInfo + * @property {google.type.IColor|null} [color] ColorInfo color + * @property {number|null} [score] ColorInfo score + * @property {number|null} [pixelFraction] ColorInfo pixelFraction */ /** - * Constructs a new CropHintsParams. + * Constructs a new ColorInfo. * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a CropHintsParams. - * @implements ICropHintsParams + * @classdesc Represents a ColorInfo. + * @implements IColorInfo * @constructor - * @param {google.cloud.vision.v1p1beta1.ICropHintsParams=} [properties] Properties to set + * @param {google.cloud.vision.v1p1beta1.IColorInfo=} [properties] Properties to set */ - function CropHintsParams(properties) { - this.aspectRatios = []; + function ColorInfo(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -29706,86 +29275,101 @@ } /** - * CropHintsParams aspectRatios. - * @member {Array.} aspectRatios - * @memberof google.cloud.vision.v1p1beta1.CropHintsParams + * ColorInfo color. + * @member {google.type.IColor|null|undefined} color + * @memberof google.cloud.vision.v1p1beta1.ColorInfo * @instance */ - CropHintsParams.prototype.aspectRatios = $util.emptyArray; + ColorInfo.prototype.color = null; /** - * Creates a new CropHintsParams instance using the specified properties. + * ColorInfo score. + * @member {number} score + * @memberof google.cloud.vision.v1p1beta1.ColorInfo + * @instance + */ + ColorInfo.prototype.score = 0; + + /** + * ColorInfo pixelFraction. + * @member {number} pixelFraction + * @memberof google.cloud.vision.v1p1beta1.ColorInfo + * @instance + */ + ColorInfo.prototype.pixelFraction = 0; + + /** + * Creates a new ColorInfo instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p1beta1.CropHintsParams + * @memberof google.cloud.vision.v1p1beta1.ColorInfo * @static - * @param {google.cloud.vision.v1p1beta1.ICropHintsParams=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.CropHintsParams} CropHintsParams instance + * @param {google.cloud.vision.v1p1beta1.IColorInfo=} [properties] Properties to set + * @returns {google.cloud.vision.v1p1beta1.ColorInfo} ColorInfo instance */ - CropHintsParams.create = function create(properties) { - return new CropHintsParams(properties); + ColorInfo.create = function create(properties) { + return new ColorInfo(properties); }; /** - * Encodes the specified CropHintsParams message. Does not implicitly {@link google.cloud.vision.v1p1beta1.CropHintsParams.verify|verify} messages. + * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.vision.v1p1beta1.ColorInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p1beta1.CropHintsParams + * @memberof google.cloud.vision.v1p1beta1.ColorInfo * @static - * @param {google.cloud.vision.v1p1beta1.ICropHintsParams} message CropHintsParams message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IColorInfo} message ColorInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CropHintsParams.encode = function encode(message, writer) { + ColorInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.aspectRatios != null && message.aspectRatios.length) { - writer.uint32(/* id 1, wireType 2 =*/10).fork(); - for (var i = 0; i < message.aspectRatios.length; ++i) - writer.float(message.aspectRatios[i]); - writer.ldelim(); - } + if (message.color != null && message.hasOwnProperty("color")) + $root.google.type.Color.encode(message.color, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.score != null && message.hasOwnProperty("score")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); + if (message.pixelFraction != null && message.hasOwnProperty("pixelFraction")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.pixelFraction); return writer; }; /** - * Encodes the specified CropHintsParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.CropHintsParams.verify|verify} messages. + * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.ColorInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.CropHintsParams + * @memberof google.cloud.vision.v1p1beta1.ColorInfo * @static - * @param {google.cloud.vision.v1p1beta1.ICropHintsParams} message CropHintsParams message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IColorInfo} message ColorInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CropHintsParams.encodeDelimited = function encodeDelimited(message, writer) { + ColorInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CropHintsParams message from the specified reader or buffer. + * Decodes a ColorInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p1beta1.CropHintsParams + * @memberof google.cloud.vision.v1p1beta1.ColorInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p1beta1.CropHintsParams} CropHintsParams + * @returns {google.cloud.vision.v1p1beta1.ColorInfo} ColorInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CropHintsParams.decode = function decode(reader, length) { + ColorInfo.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.vision.v1p1beta1.CropHintsParams(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p1beta1.ColorInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.aspectRatios && message.aspectRatios.length)) - message.aspectRatios = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.aspectRatios.push(reader.float()); - } else - message.aspectRatios.push(reader.float()); + message.color = $root.google.type.Color.decode(reader, reader.uint32()); + break; + case 2: + message.score = reader.float(); + break; + case 3: + message.pixelFraction = reader.float(); break; default: reader.skipType(tag & 7); @@ -29796,119 +29380,130 @@ }; /** - * Decodes a CropHintsParams message from the specified reader or buffer, length delimited. + * Decodes a ColorInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.CropHintsParams + * @memberof google.cloud.vision.v1p1beta1.ColorInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.CropHintsParams} CropHintsParams + * @returns {google.cloud.vision.v1p1beta1.ColorInfo} ColorInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CropHintsParams.decodeDelimited = function decodeDelimited(reader) { + ColorInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CropHintsParams message. + * Verifies a ColorInfo message. * @function verify - * @memberof google.cloud.vision.v1p1beta1.CropHintsParams + * @memberof google.cloud.vision.v1p1beta1.ColorInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CropHintsParams.verify = function verify(message) { + ColorInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.aspectRatios != null && message.hasOwnProperty("aspectRatios")) { - if (!Array.isArray(message.aspectRatios)) - return "aspectRatios: array expected"; - for (var i = 0; i < message.aspectRatios.length; ++i) - if (typeof message.aspectRatios[i] !== "number") - return "aspectRatios: number[] expected"; + if (message.color != null && message.hasOwnProperty("color")) { + var error = $root.google.type.Color.verify(message.color); + if (error) + return "color." + error; } + if (message.score != null && message.hasOwnProperty("score")) + if (typeof message.score !== "number") + return "score: number expected"; + if (message.pixelFraction != null && message.hasOwnProperty("pixelFraction")) + if (typeof message.pixelFraction !== "number") + return "pixelFraction: number expected"; return null; }; /** - * Creates a CropHintsParams message from a plain object. Also converts values to their respective internal types. + * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.CropHintsParams + * @memberof google.cloud.vision.v1p1beta1.ColorInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.CropHintsParams} CropHintsParams + * @returns {google.cloud.vision.v1p1beta1.ColorInfo} ColorInfo */ - CropHintsParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.CropHintsParams) + ColorInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p1beta1.ColorInfo) return object; - var message = new $root.google.cloud.vision.v1p1beta1.CropHintsParams(); - if (object.aspectRatios) { - if (!Array.isArray(object.aspectRatios)) - throw TypeError(".google.cloud.vision.v1p1beta1.CropHintsParams.aspectRatios: array expected"); - message.aspectRatios = []; - for (var i = 0; i < object.aspectRatios.length; ++i) - message.aspectRatios[i] = Number(object.aspectRatios[i]); + var message = new $root.google.cloud.vision.v1p1beta1.ColorInfo(); + if (object.color != null) { + if (typeof object.color !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.ColorInfo.color: object expected"); + message.color = $root.google.type.Color.fromObject(object.color); } + if (object.score != null) + message.score = Number(object.score); + if (object.pixelFraction != null) + message.pixelFraction = Number(object.pixelFraction); return message; }; /** - * Creates a plain object from a CropHintsParams message. Also converts values to other types if specified. + * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p1beta1.CropHintsParams + * @memberof google.cloud.vision.v1p1beta1.ColorInfo * @static - * @param {google.cloud.vision.v1p1beta1.CropHintsParams} message CropHintsParams + * @param {google.cloud.vision.v1p1beta1.ColorInfo} message ColorInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CropHintsParams.toObject = function toObject(message, options) { + ColorInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.aspectRatios = []; - if (message.aspectRatios && message.aspectRatios.length) { - object.aspectRatios = []; - for (var j = 0; j < message.aspectRatios.length; ++j) - object.aspectRatios[j] = options.json && !isFinite(message.aspectRatios[j]) ? String(message.aspectRatios[j]) : message.aspectRatios[j]; + if (options.defaults) { + object.color = null; + object.score = 0; + object.pixelFraction = 0; } + if (message.color != null && message.hasOwnProperty("color")) + object.color = $root.google.type.Color.toObject(message.color, options); + if (message.score != null && message.hasOwnProperty("score")) + object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; + if (message.pixelFraction != null && message.hasOwnProperty("pixelFraction")) + object.pixelFraction = options.json && !isFinite(message.pixelFraction) ? String(message.pixelFraction) : message.pixelFraction; return object; }; /** - * Converts this CropHintsParams to JSON. + * Converts this ColorInfo to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.CropHintsParams + * @memberof google.cloud.vision.v1p1beta1.ColorInfo * @instance * @returns {Object.} JSON object */ - CropHintsParams.prototype.toJSON = function toJSON() { + ColorInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CropHintsParams; + return ColorInfo; })(); - v1p1beta1.WebDetectionParams = (function() { + v1p1beta1.DominantColorsAnnotation = (function() { /** - * Properties of a WebDetectionParams. + * Properties of a DominantColorsAnnotation. * @memberof google.cloud.vision.v1p1beta1 - * @interface IWebDetectionParams - * @property {boolean|null} [includeGeoResults] WebDetectionParams includeGeoResults + * @interface IDominantColorsAnnotation + * @property {Array.|null} [colors] DominantColorsAnnotation colors */ /** - * Constructs a new WebDetectionParams. + * Constructs a new DominantColorsAnnotation. * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a WebDetectionParams. - * @implements IWebDetectionParams + * @classdesc Represents a DominantColorsAnnotation. + * @implements IDominantColorsAnnotation * @constructor - * @param {google.cloud.vision.v1p1beta1.IWebDetectionParams=} [properties] Properties to set + * @param {google.cloud.vision.v1p1beta1.IDominantColorsAnnotation=} [properties] Properties to set */ - function WebDetectionParams(properties) { + function DominantColorsAnnotation(properties) { + this.colors = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -29916,75 +29511,78 @@ } /** - * WebDetectionParams includeGeoResults. - * @member {boolean} includeGeoResults - * @memberof google.cloud.vision.v1p1beta1.WebDetectionParams + * DominantColorsAnnotation colors. + * @member {Array.} colors + * @memberof google.cloud.vision.v1p1beta1.DominantColorsAnnotation * @instance */ - WebDetectionParams.prototype.includeGeoResults = false; + DominantColorsAnnotation.prototype.colors = $util.emptyArray; /** - * Creates a new WebDetectionParams instance using the specified properties. + * Creates a new DominantColorsAnnotation instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p1beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p1beta1.DominantColorsAnnotation * @static - * @param {google.cloud.vision.v1p1beta1.IWebDetectionParams=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.WebDetectionParams} WebDetectionParams instance + * @param {google.cloud.vision.v1p1beta1.IDominantColorsAnnotation=} [properties] Properties to set + * @returns {google.cloud.vision.v1p1beta1.DominantColorsAnnotation} DominantColorsAnnotation instance */ - WebDetectionParams.create = function create(properties) { - return new WebDetectionParams(properties); + DominantColorsAnnotation.create = function create(properties) { + return new DominantColorsAnnotation(properties); }; /** - * Encodes the specified WebDetectionParams message. Does not implicitly {@link google.cloud.vision.v1p1beta1.WebDetectionParams.verify|verify} messages. + * Encodes the specified DominantColorsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p1beta1.DominantColorsAnnotation.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p1beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p1beta1.DominantColorsAnnotation * @static - * @param {google.cloud.vision.v1p1beta1.IWebDetectionParams} message WebDetectionParams message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IDominantColorsAnnotation} message DominantColorsAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WebDetectionParams.encode = function encode(message, writer) { + DominantColorsAnnotation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.includeGeoResults != null && message.hasOwnProperty("includeGeoResults")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.includeGeoResults); + if (message.colors != null && message.colors.length) + for (var i = 0; i < message.colors.length; ++i) + $root.google.cloud.vision.v1p1beta1.ColorInfo.encode(message.colors[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified WebDetectionParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.WebDetectionParams.verify|verify} messages. + * Encodes the specified DominantColorsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.DominantColorsAnnotation.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p1beta1.DominantColorsAnnotation * @static - * @param {google.cloud.vision.v1p1beta1.IWebDetectionParams} message WebDetectionParams message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IDominantColorsAnnotation} message DominantColorsAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WebDetectionParams.encodeDelimited = function encodeDelimited(message, writer) { + DominantColorsAnnotation.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a WebDetectionParams message from the specified reader or buffer. + * Decodes a DominantColorsAnnotation message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p1beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p1beta1.DominantColorsAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p1beta1.WebDetectionParams} WebDetectionParams + * @returns {google.cloud.vision.v1p1beta1.DominantColorsAnnotation} DominantColorsAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WebDetectionParams.decode = function decode(reader, length) { + DominantColorsAnnotation.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.vision.v1p1beta1.WebDetectionParams(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p1beta1.DominantColorsAnnotation(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 2: - message.includeGeoResults = reader.bool(); + case 1: + if (!(message.colors && message.colors.length)) + message.colors = []; + message.colors.push($root.google.cloud.vision.v1p1beta1.ColorInfo.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -29995,111 +29593,124 @@ }; /** - * Decodes a WebDetectionParams message from the specified reader or buffer, length delimited. + * Decodes a DominantColorsAnnotation message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p1beta1.DominantColorsAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.WebDetectionParams} WebDetectionParams + * @returns {google.cloud.vision.v1p1beta1.DominantColorsAnnotation} DominantColorsAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WebDetectionParams.decodeDelimited = function decodeDelimited(reader) { + DominantColorsAnnotation.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a WebDetectionParams message. + * Verifies a DominantColorsAnnotation message. * @function verify - * @memberof google.cloud.vision.v1p1beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p1beta1.DominantColorsAnnotation * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - WebDetectionParams.verify = function verify(message) { + DominantColorsAnnotation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.includeGeoResults != null && message.hasOwnProperty("includeGeoResults")) - if (typeof message.includeGeoResults !== "boolean") - return "includeGeoResults: boolean expected"; + if (message.colors != null && message.hasOwnProperty("colors")) { + if (!Array.isArray(message.colors)) + return "colors: array expected"; + for (var i = 0; i < message.colors.length; ++i) { + var error = $root.google.cloud.vision.v1p1beta1.ColorInfo.verify(message.colors[i]); + if (error) + return "colors." + error; + } + } return null; }; /** - * Creates a WebDetectionParams message from a plain object. Also converts values to their respective internal types. + * Creates a DominantColorsAnnotation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p1beta1.DominantColorsAnnotation * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.WebDetectionParams} WebDetectionParams + * @returns {google.cloud.vision.v1p1beta1.DominantColorsAnnotation} DominantColorsAnnotation */ - WebDetectionParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.WebDetectionParams) + DominantColorsAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p1beta1.DominantColorsAnnotation) return object; - var message = new $root.google.cloud.vision.v1p1beta1.WebDetectionParams(); - if (object.includeGeoResults != null) - message.includeGeoResults = Boolean(object.includeGeoResults); - return message; + var message = new $root.google.cloud.vision.v1p1beta1.DominantColorsAnnotation(); + if (object.colors) { + if (!Array.isArray(object.colors)) + throw TypeError(".google.cloud.vision.v1p1beta1.DominantColorsAnnotation.colors: array expected"); + message.colors = []; + for (var i = 0; i < object.colors.length; ++i) { + if (typeof object.colors[i] !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.DominantColorsAnnotation.colors: object expected"); + message.colors[i] = $root.google.cloud.vision.v1p1beta1.ColorInfo.fromObject(object.colors[i]); + } + } + return message; }; /** - * Creates a plain object from a WebDetectionParams message. Also converts values to other types if specified. + * Creates a plain object from a DominantColorsAnnotation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p1beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p1beta1.DominantColorsAnnotation * @static - * @param {google.cloud.vision.v1p1beta1.WebDetectionParams} message WebDetectionParams + * @param {google.cloud.vision.v1p1beta1.DominantColorsAnnotation} message DominantColorsAnnotation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - WebDetectionParams.toObject = function toObject(message, options) { + DominantColorsAnnotation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.includeGeoResults = false; - if (message.includeGeoResults != null && message.hasOwnProperty("includeGeoResults")) - object.includeGeoResults = message.includeGeoResults; + if (options.arrays || options.defaults) + object.colors = []; + if (message.colors && message.colors.length) { + object.colors = []; + for (var j = 0; j < message.colors.length; ++j) + object.colors[j] = $root.google.cloud.vision.v1p1beta1.ColorInfo.toObject(message.colors[j], options); + } return object; }; /** - * Converts this WebDetectionParams to JSON. + * Converts this DominantColorsAnnotation to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p1beta1.DominantColorsAnnotation * @instance * @returns {Object.} JSON object */ - WebDetectionParams.prototype.toJSON = function toJSON() { + DominantColorsAnnotation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return WebDetectionParams; + return DominantColorsAnnotation; })(); - v1p1beta1.ImageContext = (function() { + v1p1beta1.ImageProperties = (function() { /** - * Properties of an ImageContext. + * Properties of an ImageProperties. * @memberof google.cloud.vision.v1p1beta1 - * @interface IImageContext - * @property {google.cloud.vision.v1p1beta1.ILatLongRect|null} [latLongRect] ImageContext latLongRect - * @property {Array.|null} [languageHints] ImageContext languageHints - * @property {google.cloud.vision.v1p1beta1.ICropHintsParams|null} [cropHintsParams] ImageContext cropHintsParams - * @property {google.cloud.vision.v1p1beta1.IWebDetectionParams|null} [webDetectionParams] ImageContext webDetectionParams + * @interface IImageProperties + * @property {google.cloud.vision.v1p1beta1.IDominantColorsAnnotation|null} [dominantColors] ImageProperties dominantColors */ /** - * Constructs a new ImageContext. + * Constructs a new ImageProperties. * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents an ImageContext. - * @implements IImageContext + * @classdesc Represents an ImageProperties. + * @implements IImageProperties * @constructor - * @param {google.cloud.vision.v1p1beta1.IImageContext=} [properties] Properties to set + * @param {google.cloud.vision.v1p1beta1.IImageProperties=} [properties] Properties to set */ - function ImageContext(properties) { - this.languageHints = []; + function ImageProperties(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -30107,117 +29718,75 @@ } /** - * ImageContext latLongRect. - * @member {google.cloud.vision.v1p1beta1.ILatLongRect|null|undefined} latLongRect - * @memberof google.cloud.vision.v1p1beta1.ImageContext - * @instance - */ - ImageContext.prototype.latLongRect = null; - - /** - * ImageContext languageHints. - * @member {Array.} languageHints - * @memberof google.cloud.vision.v1p1beta1.ImageContext - * @instance - */ - ImageContext.prototype.languageHints = $util.emptyArray; - - /** - * ImageContext cropHintsParams. - * @member {google.cloud.vision.v1p1beta1.ICropHintsParams|null|undefined} cropHintsParams - * @memberof google.cloud.vision.v1p1beta1.ImageContext - * @instance - */ - ImageContext.prototype.cropHintsParams = null; - - /** - * ImageContext webDetectionParams. - * @member {google.cloud.vision.v1p1beta1.IWebDetectionParams|null|undefined} webDetectionParams - * @memberof google.cloud.vision.v1p1beta1.ImageContext + * ImageProperties dominantColors. + * @member {google.cloud.vision.v1p1beta1.IDominantColorsAnnotation|null|undefined} dominantColors + * @memberof google.cloud.vision.v1p1beta1.ImageProperties * @instance */ - ImageContext.prototype.webDetectionParams = null; + ImageProperties.prototype.dominantColors = null; /** - * Creates a new ImageContext instance using the specified properties. + * Creates a new ImageProperties instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p1beta1.ImageContext + * @memberof google.cloud.vision.v1p1beta1.ImageProperties * @static - * @param {google.cloud.vision.v1p1beta1.IImageContext=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.ImageContext} ImageContext instance + * @param {google.cloud.vision.v1p1beta1.IImageProperties=} [properties] Properties to set + * @returns {google.cloud.vision.v1p1beta1.ImageProperties} ImageProperties instance */ - ImageContext.create = function create(properties) { - return new ImageContext(properties); + ImageProperties.create = function create(properties) { + return new ImageProperties(properties); }; /** - * Encodes the specified ImageContext message. Does not implicitly {@link google.cloud.vision.v1p1beta1.ImageContext.verify|verify} messages. + * Encodes the specified ImageProperties message. Does not implicitly {@link google.cloud.vision.v1p1beta1.ImageProperties.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p1beta1.ImageContext + * @memberof google.cloud.vision.v1p1beta1.ImageProperties * @static - * @param {google.cloud.vision.v1p1beta1.IImageContext} message ImageContext message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IImageProperties} message ImageProperties message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageContext.encode = function encode(message, writer) { + ImageProperties.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.latLongRect != null && message.hasOwnProperty("latLongRect")) - $root.google.cloud.vision.v1p1beta1.LatLongRect.encode(message.latLongRect, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.languageHints != null && message.languageHints.length) - for (var i = 0; i < message.languageHints.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageHints[i]); - if (message.cropHintsParams != null && message.hasOwnProperty("cropHintsParams")) - $root.google.cloud.vision.v1p1beta1.CropHintsParams.encode(message.cropHintsParams, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.webDetectionParams != null && message.hasOwnProperty("webDetectionParams")) - $root.google.cloud.vision.v1p1beta1.WebDetectionParams.encode(message.webDetectionParams, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.dominantColors != null && message.hasOwnProperty("dominantColors")) + $root.google.cloud.vision.v1p1beta1.DominantColorsAnnotation.encode(message.dominantColors, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified ImageContext message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.ImageContext.verify|verify} messages. + * Encodes the specified ImageProperties message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.ImageProperties.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.ImageContext + * @memberof google.cloud.vision.v1p1beta1.ImageProperties * @static - * @param {google.cloud.vision.v1p1beta1.IImageContext} message ImageContext message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IImageProperties} message ImageProperties message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageContext.encodeDelimited = function encodeDelimited(message, writer) { + ImageProperties.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImageContext message from the specified reader or buffer. + * Decodes an ImageProperties message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p1beta1.ImageContext + * @memberof google.cloud.vision.v1p1beta1.ImageProperties * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p1beta1.ImageContext} ImageContext + * @returns {google.cloud.vision.v1p1beta1.ImageProperties} ImageProperties * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageContext.decode = function decode(reader, length) { + ImageProperties.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.vision.v1p1beta1.ImageContext(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p1beta1.ImageProperties(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.latLongRect = $root.google.cloud.vision.v1p1beta1.LatLongRect.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.languageHints && message.languageHints.length)) - message.languageHints = []; - message.languageHints.push(reader.string()); - break; - case 4: - message.cropHintsParams = $root.google.cloud.vision.v1p1beta1.CropHintsParams.decode(reader, reader.uint32()); - break; - case 6: - message.webDetectionParams = $root.google.cloud.vision.v1p1beta1.WebDetectionParams.decode(reader, reader.uint32()); + message.dominantColors = $root.google.cloud.vision.v1p1beta1.DominantColorsAnnotation.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -30228,163 +29797,114 @@ }; /** - * Decodes an ImageContext message from the specified reader or buffer, length delimited. + * Decodes an ImageProperties message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.ImageContext + * @memberof google.cloud.vision.v1p1beta1.ImageProperties * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.ImageContext} ImageContext + * @returns {google.cloud.vision.v1p1beta1.ImageProperties} ImageProperties * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageContext.decodeDelimited = function decodeDelimited(reader) { + ImageProperties.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImageContext message. + * Verifies an ImageProperties message. * @function verify - * @memberof google.cloud.vision.v1p1beta1.ImageContext + * @memberof google.cloud.vision.v1p1beta1.ImageProperties * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImageContext.verify = function verify(message) { + ImageProperties.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.latLongRect != null && message.hasOwnProperty("latLongRect")) { - var error = $root.google.cloud.vision.v1p1beta1.LatLongRect.verify(message.latLongRect); - if (error) - return "latLongRect." + error; - } - if (message.languageHints != null && message.hasOwnProperty("languageHints")) { - if (!Array.isArray(message.languageHints)) - return "languageHints: array expected"; - for (var i = 0; i < message.languageHints.length; ++i) - if (!$util.isString(message.languageHints[i])) - return "languageHints: string[] expected"; - } - if (message.cropHintsParams != null && message.hasOwnProperty("cropHintsParams")) { - var error = $root.google.cloud.vision.v1p1beta1.CropHintsParams.verify(message.cropHintsParams); - if (error) - return "cropHintsParams." + error; - } - if (message.webDetectionParams != null && message.hasOwnProperty("webDetectionParams")) { - var error = $root.google.cloud.vision.v1p1beta1.WebDetectionParams.verify(message.webDetectionParams); + if (message.dominantColors != null && message.hasOwnProperty("dominantColors")) { + var error = $root.google.cloud.vision.v1p1beta1.DominantColorsAnnotation.verify(message.dominantColors); if (error) - return "webDetectionParams." + error; + return "dominantColors." + error; } return null; }; /** - * Creates an ImageContext message from a plain object. Also converts values to their respective internal types. + * Creates an ImageProperties message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.ImageContext + * @memberof google.cloud.vision.v1p1beta1.ImageProperties * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.ImageContext} ImageContext + * @returns {google.cloud.vision.v1p1beta1.ImageProperties} ImageProperties */ - ImageContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.ImageContext) + ImageProperties.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p1beta1.ImageProperties) return object; - var message = new $root.google.cloud.vision.v1p1beta1.ImageContext(); - if (object.latLongRect != null) { - if (typeof object.latLongRect !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.ImageContext.latLongRect: object expected"); - message.latLongRect = $root.google.cloud.vision.v1p1beta1.LatLongRect.fromObject(object.latLongRect); - } - if (object.languageHints) { - if (!Array.isArray(object.languageHints)) - throw TypeError(".google.cloud.vision.v1p1beta1.ImageContext.languageHints: array expected"); - message.languageHints = []; - for (var i = 0; i < object.languageHints.length; ++i) - message.languageHints[i] = String(object.languageHints[i]); - } - if (object.cropHintsParams != null) { - if (typeof object.cropHintsParams !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.ImageContext.cropHintsParams: object expected"); - message.cropHintsParams = $root.google.cloud.vision.v1p1beta1.CropHintsParams.fromObject(object.cropHintsParams); - } - if (object.webDetectionParams != null) { - if (typeof object.webDetectionParams !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.ImageContext.webDetectionParams: object expected"); - message.webDetectionParams = $root.google.cloud.vision.v1p1beta1.WebDetectionParams.fromObject(object.webDetectionParams); + var message = new $root.google.cloud.vision.v1p1beta1.ImageProperties(); + if (object.dominantColors != null) { + if (typeof object.dominantColors !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.ImageProperties.dominantColors: object expected"); + message.dominantColors = $root.google.cloud.vision.v1p1beta1.DominantColorsAnnotation.fromObject(object.dominantColors); } return message; }; /** - * Creates a plain object from an ImageContext message. Also converts values to other types if specified. + * Creates a plain object from an ImageProperties message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p1beta1.ImageContext + * @memberof google.cloud.vision.v1p1beta1.ImageProperties * @static - * @param {google.cloud.vision.v1p1beta1.ImageContext} message ImageContext + * @param {google.cloud.vision.v1p1beta1.ImageProperties} message ImageProperties * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImageContext.toObject = function toObject(message, options) { + ImageProperties.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.languageHints = []; - if (options.defaults) { - object.latLongRect = null; - object.cropHintsParams = null; - object.webDetectionParams = null; - } - if (message.latLongRect != null && message.hasOwnProperty("latLongRect")) - object.latLongRect = $root.google.cloud.vision.v1p1beta1.LatLongRect.toObject(message.latLongRect, options); - if (message.languageHints && message.languageHints.length) { - object.languageHints = []; - for (var j = 0; j < message.languageHints.length; ++j) - object.languageHints[j] = message.languageHints[j]; - } - if (message.cropHintsParams != null && message.hasOwnProperty("cropHintsParams")) - object.cropHintsParams = $root.google.cloud.vision.v1p1beta1.CropHintsParams.toObject(message.cropHintsParams, options); - if (message.webDetectionParams != null && message.hasOwnProperty("webDetectionParams")) - object.webDetectionParams = $root.google.cloud.vision.v1p1beta1.WebDetectionParams.toObject(message.webDetectionParams, options); + if (options.defaults) + object.dominantColors = null; + if (message.dominantColors != null && message.hasOwnProperty("dominantColors")) + object.dominantColors = $root.google.cloud.vision.v1p1beta1.DominantColorsAnnotation.toObject(message.dominantColors, options); return object; }; /** - * Converts this ImageContext to JSON. + * Converts this ImageProperties to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.ImageContext + * @memberof google.cloud.vision.v1p1beta1.ImageProperties * @instance * @returns {Object.} JSON object */ - ImageContext.prototype.toJSON = function toJSON() { + ImageProperties.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImageContext; + return ImageProperties; })(); - v1p1beta1.AnnotateImageRequest = (function() { + v1p1beta1.CropHint = (function() { /** - * Properties of an AnnotateImageRequest. + * Properties of a CropHint. * @memberof google.cloud.vision.v1p1beta1 - * @interface IAnnotateImageRequest - * @property {google.cloud.vision.v1p1beta1.IImage|null} [image] AnnotateImageRequest image - * @property {Array.|null} [features] AnnotateImageRequest features - * @property {google.cloud.vision.v1p1beta1.IImageContext|null} [imageContext] AnnotateImageRequest imageContext + * @interface ICropHint + * @property {google.cloud.vision.v1p1beta1.IBoundingPoly|null} [boundingPoly] CropHint boundingPoly + * @property {number|null} [confidence] CropHint confidence + * @property {number|null} [importanceFraction] CropHint importanceFraction */ /** - * Constructs a new AnnotateImageRequest. + * Constructs a new CropHint. * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents an AnnotateImageRequest. - * @implements IAnnotateImageRequest + * @classdesc Represents a CropHint. + * @implements ICropHint * @constructor - * @param {google.cloud.vision.v1p1beta1.IAnnotateImageRequest=} [properties] Properties to set + * @param {google.cloud.vision.v1p1beta1.ICropHint=} [properties] Properties to set */ - function AnnotateImageRequest(properties) { - this.features = []; + function CropHint(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -30392,104 +29912,101 @@ } /** - * AnnotateImageRequest image. - * @member {google.cloud.vision.v1p1beta1.IImage|null|undefined} image - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest + * CropHint boundingPoly. + * @member {google.cloud.vision.v1p1beta1.IBoundingPoly|null|undefined} boundingPoly + * @memberof google.cloud.vision.v1p1beta1.CropHint * @instance */ - AnnotateImageRequest.prototype.image = null; + CropHint.prototype.boundingPoly = null; /** - * AnnotateImageRequest features. - * @member {Array.} features - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest + * CropHint confidence. + * @member {number} confidence + * @memberof google.cloud.vision.v1p1beta1.CropHint * @instance */ - AnnotateImageRequest.prototype.features = $util.emptyArray; + CropHint.prototype.confidence = 0; /** - * AnnotateImageRequest imageContext. - * @member {google.cloud.vision.v1p1beta1.IImageContext|null|undefined} imageContext - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest + * CropHint importanceFraction. + * @member {number} importanceFraction + * @memberof google.cloud.vision.v1p1beta1.CropHint * @instance */ - AnnotateImageRequest.prototype.imageContext = null; + CropHint.prototype.importanceFraction = 0; /** - * Creates a new AnnotateImageRequest instance using the specified properties. + * Creates a new CropHint instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p1beta1.CropHint * @static - * @param {google.cloud.vision.v1p1beta1.IAnnotateImageRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.AnnotateImageRequest} AnnotateImageRequest instance + * @param {google.cloud.vision.v1p1beta1.ICropHint=} [properties] Properties to set + * @returns {google.cloud.vision.v1p1beta1.CropHint} CropHint instance */ - AnnotateImageRequest.create = function create(properties) { - return new AnnotateImageRequest(properties); + CropHint.create = function create(properties) { + return new CropHint(properties); }; /** - * Encodes the specified AnnotateImageRequest message. Does not implicitly {@link google.cloud.vision.v1p1beta1.AnnotateImageRequest.verify|verify} messages. + * Encodes the specified CropHint message. Does not implicitly {@link google.cloud.vision.v1p1beta1.CropHint.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p1beta1.CropHint * @static - * @param {google.cloud.vision.v1p1beta1.IAnnotateImageRequest} message AnnotateImageRequest message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.ICropHint} message CropHint message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateImageRequest.encode = function encode(message, writer) { + CropHint.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.image != null && message.hasOwnProperty("image")) - $root.google.cloud.vision.v1p1beta1.Image.encode(message.image, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.features != null && message.features.length) - for (var i = 0; i < message.features.length; ++i) - $root.google.cloud.vision.v1p1beta1.Feature.encode(message.features[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.imageContext != null && message.hasOwnProperty("imageContext")) - $root.google.cloud.vision.v1p1beta1.ImageContext.encode(message.imageContext, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + $root.google.cloud.vision.v1p1beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.confidence != null && message.hasOwnProperty("confidence")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); + if (message.importanceFraction != null && message.hasOwnProperty("importanceFraction")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.importanceFraction); return writer; }; /** - * Encodes the specified AnnotateImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.AnnotateImageRequest.verify|verify} messages. + * Encodes the specified CropHint message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.CropHint.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p1beta1.CropHint * @static - * @param {google.cloud.vision.v1p1beta1.IAnnotateImageRequest} message AnnotateImageRequest message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.ICropHint} message CropHint message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateImageRequest.encodeDelimited = function encodeDelimited(message, writer) { + CropHint.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AnnotateImageRequest message from the specified reader or buffer. + * Decodes a CropHint message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p1beta1.CropHint * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p1beta1.AnnotateImageRequest} AnnotateImageRequest + * @returns {google.cloud.vision.v1p1beta1.CropHint} CropHint * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateImageRequest.decode = function decode(reader, length) { + CropHint.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.vision.v1p1beta1.AnnotateImageRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p1beta1.CropHint(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.image = $root.google.cloud.vision.v1p1beta1.Image.decode(reader, reader.uint32()); + message.boundingPoly = $root.google.cloud.vision.v1p1beta1.BoundingPoly.decode(reader, reader.uint32()); break; case 2: - if (!(message.features && message.features.length)) - message.features = []; - message.features.push($root.google.cloud.vision.v1p1beta1.Feature.decode(reader, reader.uint32())); + message.confidence = reader.float(); break; case 3: - message.imageContext = $root.google.cloud.vision.v1p1beta1.ImageContext.decode(reader, reader.uint32()); + message.importanceFraction = reader.float(); break; default: reader.skipType(tag & 7); @@ -30500,167 +30017,130 @@ }; /** - * Decodes an AnnotateImageRequest message from the specified reader or buffer, length delimited. + * Decodes a CropHint message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p1beta1.CropHint * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.AnnotateImageRequest} AnnotateImageRequest + * @returns {google.cloud.vision.v1p1beta1.CropHint} CropHint * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateImageRequest.decodeDelimited = function decodeDelimited(reader) { + CropHint.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AnnotateImageRequest message. + * Verifies a CropHint message. * @function verify - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p1beta1.CropHint * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AnnotateImageRequest.verify = function verify(message) { + CropHint.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.image != null && message.hasOwnProperty("image")) { - var error = $root.google.cloud.vision.v1p1beta1.Image.verify(message.image); - if (error) - return "image." + error; - } - if (message.features != null && message.hasOwnProperty("features")) { - if (!Array.isArray(message.features)) - return "features: array expected"; - for (var i = 0; i < message.features.length; ++i) { - var error = $root.google.cloud.vision.v1p1beta1.Feature.verify(message.features[i]); - if (error) - return "features." + error; - } - } - if (message.imageContext != null && message.hasOwnProperty("imageContext")) { - var error = $root.google.cloud.vision.v1p1beta1.ImageContext.verify(message.imageContext); + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { + var error = $root.google.cloud.vision.v1p1beta1.BoundingPoly.verify(message.boundingPoly); if (error) - return "imageContext." + error; + return "boundingPoly." + error; } + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + if (message.importanceFraction != null && message.hasOwnProperty("importanceFraction")) + if (typeof message.importanceFraction !== "number") + return "importanceFraction: number expected"; return null; }; /** - * Creates an AnnotateImageRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CropHint message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p1beta1.CropHint * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.AnnotateImageRequest} AnnotateImageRequest + * @returns {google.cloud.vision.v1p1beta1.CropHint} CropHint */ - AnnotateImageRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.AnnotateImageRequest) + CropHint.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p1beta1.CropHint) return object; - var message = new $root.google.cloud.vision.v1p1beta1.AnnotateImageRequest(); - if (object.image != null) { - if (typeof object.image !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageRequest.image: object expected"); - message.image = $root.google.cloud.vision.v1p1beta1.Image.fromObject(object.image); - } - if (object.features) { - if (!Array.isArray(object.features)) - throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageRequest.features: array expected"); - message.features = []; - for (var i = 0; i < object.features.length; ++i) { - if (typeof object.features[i] !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageRequest.features: object expected"); - message.features[i] = $root.google.cloud.vision.v1p1beta1.Feature.fromObject(object.features[i]); - } - } - if (object.imageContext != null) { - if (typeof object.imageContext !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageRequest.imageContext: object expected"); - message.imageContext = $root.google.cloud.vision.v1p1beta1.ImageContext.fromObject(object.imageContext); + var message = new $root.google.cloud.vision.v1p1beta1.CropHint(); + if (object.boundingPoly != null) { + if (typeof object.boundingPoly !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.CropHint.boundingPoly: object expected"); + message.boundingPoly = $root.google.cloud.vision.v1p1beta1.BoundingPoly.fromObject(object.boundingPoly); } + if (object.confidence != null) + message.confidence = Number(object.confidence); + if (object.importanceFraction != null) + message.importanceFraction = Number(object.importanceFraction); return message; }; /** - * Creates a plain object from an AnnotateImageRequest message. Also converts values to other types if specified. + * Creates a plain object from a CropHint message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p1beta1.CropHint * @static - * @param {google.cloud.vision.v1p1beta1.AnnotateImageRequest} message AnnotateImageRequest + * @param {google.cloud.vision.v1p1beta1.CropHint} message CropHint * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AnnotateImageRequest.toObject = function toObject(message, options) { + CropHint.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.features = []; if (options.defaults) { - object.image = null; - object.imageContext = null; - } - if (message.image != null && message.hasOwnProperty("image")) - object.image = $root.google.cloud.vision.v1p1beta1.Image.toObject(message.image, options); - if (message.features && message.features.length) { - object.features = []; - for (var j = 0; j < message.features.length; ++j) - object.features[j] = $root.google.cloud.vision.v1p1beta1.Feature.toObject(message.features[j], options); + object.boundingPoly = null; + object.confidence = 0; + object.importanceFraction = 0; } - if (message.imageContext != null && message.hasOwnProperty("imageContext")) - object.imageContext = $root.google.cloud.vision.v1p1beta1.ImageContext.toObject(message.imageContext, options); + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + object.boundingPoly = $root.google.cloud.vision.v1p1beta1.BoundingPoly.toObject(message.boundingPoly, options); + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + if (message.importanceFraction != null && message.hasOwnProperty("importanceFraction")) + object.importanceFraction = options.json && !isFinite(message.importanceFraction) ? String(message.importanceFraction) : message.importanceFraction; return object; }; /** - * Converts this AnnotateImageRequest to JSON. + * Converts this CropHint to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p1beta1.CropHint * @instance * @returns {Object.} JSON object */ - AnnotateImageRequest.prototype.toJSON = function toJSON() { + CropHint.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AnnotateImageRequest; + return CropHint; })(); - v1p1beta1.AnnotateImageResponse = (function() { + v1p1beta1.CropHintsAnnotation = (function() { /** - * Properties of an AnnotateImageResponse. + * Properties of a CropHintsAnnotation. * @memberof google.cloud.vision.v1p1beta1 - * @interface IAnnotateImageResponse - * @property {Array.|null} [faceAnnotations] AnnotateImageResponse faceAnnotations - * @property {Array.|null} [landmarkAnnotations] AnnotateImageResponse landmarkAnnotations - * @property {Array.|null} [logoAnnotations] AnnotateImageResponse logoAnnotations - * @property {Array.|null} [labelAnnotations] AnnotateImageResponse labelAnnotations - * @property {Array.|null} [textAnnotations] AnnotateImageResponse textAnnotations - * @property {google.cloud.vision.v1p1beta1.ITextAnnotation|null} [fullTextAnnotation] AnnotateImageResponse fullTextAnnotation - * @property {google.cloud.vision.v1p1beta1.ISafeSearchAnnotation|null} [safeSearchAnnotation] AnnotateImageResponse safeSearchAnnotation - * @property {google.cloud.vision.v1p1beta1.IImageProperties|null} [imagePropertiesAnnotation] AnnotateImageResponse imagePropertiesAnnotation - * @property {google.cloud.vision.v1p1beta1.ICropHintsAnnotation|null} [cropHintsAnnotation] AnnotateImageResponse cropHintsAnnotation - * @property {google.cloud.vision.v1p1beta1.IWebDetection|null} [webDetection] AnnotateImageResponse webDetection - * @property {google.rpc.IStatus|null} [error] AnnotateImageResponse error + * @interface ICropHintsAnnotation + * @property {Array.|null} [cropHints] CropHintsAnnotation cropHints */ /** - * Constructs a new AnnotateImageResponse. + * Constructs a new CropHintsAnnotation. * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents an AnnotateImageResponse. - * @implements IAnnotateImageResponse + * @classdesc Represents a CropHintsAnnotation. + * @implements ICropHintsAnnotation * @constructor - * @param {google.cloud.vision.v1p1beta1.IAnnotateImageResponse=} [properties] Properties to set + * @param {google.cloud.vision.v1p1beta1.ICropHintsAnnotation=} [properties] Properties to set */ - function AnnotateImageResponse(properties) { - this.faceAnnotations = []; - this.landmarkAnnotations = []; - this.logoAnnotations = []; - this.labelAnnotations = []; - this.textAnnotations = []; + function CropHintsAnnotation(properties) { + this.cropHints = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -30668,220 +30148,78 @@ } /** - * AnnotateImageResponse faceAnnotations. - * @member {Array.} faceAnnotations - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.faceAnnotations = $util.emptyArray; - - /** - * AnnotateImageResponse landmarkAnnotations. - * @member {Array.} landmarkAnnotations - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.landmarkAnnotations = $util.emptyArray; - - /** - * AnnotateImageResponse logoAnnotations. - * @member {Array.} logoAnnotations - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.logoAnnotations = $util.emptyArray; - - /** - * AnnotateImageResponse labelAnnotations. - * @member {Array.} labelAnnotations - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.labelAnnotations = $util.emptyArray; - - /** - * AnnotateImageResponse textAnnotations. - * @member {Array.} textAnnotations - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.textAnnotations = $util.emptyArray; - - /** - * AnnotateImageResponse fullTextAnnotation. - * @member {google.cloud.vision.v1p1beta1.ITextAnnotation|null|undefined} fullTextAnnotation - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.fullTextAnnotation = null; - - /** - * AnnotateImageResponse safeSearchAnnotation. - * @member {google.cloud.vision.v1p1beta1.ISafeSearchAnnotation|null|undefined} safeSearchAnnotation - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.safeSearchAnnotation = null; - - /** - * AnnotateImageResponse imagePropertiesAnnotation. - * @member {google.cloud.vision.v1p1beta1.IImageProperties|null|undefined} imagePropertiesAnnotation - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.imagePropertiesAnnotation = null; - - /** - * AnnotateImageResponse cropHintsAnnotation. - * @member {google.cloud.vision.v1p1beta1.ICropHintsAnnotation|null|undefined} cropHintsAnnotation - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.cropHintsAnnotation = null; - - /** - * AnnotateImageResponse webDetection. - * @member {google.cloud.vision.v1p1beta1.IWebDetection|null|undefined} webDetection - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.webDetection = null; - - /** - * AnnotateImageResponse error. - * @member {google.rpc.IStatus|null|undefined} error - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse + * CropHintsAnnotation cropHints. + * @member {Array.} cropHints + * @memberof google.cloud.vision.v1p1beta1.CropHintsAnnotation * @instance */ - AnnotateImageResponse.prototype.error = null; + CropHintsAnnotation.prototype.cropHints = $util.emptyArray; /** - * Creates a new AnnotateImageResponse instance using the specified properties. + * Creates a new CropHintsAnnotation instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p1beta1.CropHintsAnnotation * @static - * @param {google.cloud.vision.v1p1beta1.IAnnotateImageResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.AnnotateImageResponse} AnnotateImageResponse instance + * @param {google.cloud.vision.v1p1beta1.ICropHintsAnnotation=} [properties] Properties to set + * @returns {google.cloud.vision.v1p1beta1.CropHintsAnnotation} CropHintsAnnotation instance */ - AnnotateImageResponse.create = function create(properties) { - return new AnnotateImageResponse(properties); + CropHintsAnnotation.create = function create(properties) { + return new CropHintsAnnotation(properties); }; /** - * Encodes the specified AnnotateImageResponse message. Does not implicitly {@link google.cloud.vision.v1p1beta1.AnnotateImageResponse.verify|verify} messages. + * Encodes the specified CropHintsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p1beta1.CropHintsAnnotation.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p1beta1.CropHintsAnnotation * @static - * @param {google.cloud.vision.v1p1beta1.IAnnotateImageResponse} message AnnotateImageResponse message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.ICropHintsAnnotation} message CropHintsAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateImageResponse.encode = function encode(message, writer) { + CropHintsAnnotation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.faceAnnotations != null && message.faceAnnotations.length) - for (var i = 0; i < message.faceAnnotations.length; ++i) - $root.google.cloud.vision.v1p1beta1.FaceAnnotation.encode(message.faceAnnotations[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.landmarkAnnotations != null && message.landmarkAnnotations.length) - for (var i = 0; i < message.landmarkAnnotations.length; ++i) - $root.google.cloud.vision.v1p1beta1.EntityAnnotation.encode(message.landmarkAnnotations[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.logoAnnotations != null && message.logoAnnotations.length) - for (var i = 0; i < message.logoAnnotations.length; ++i) - $root.google.cloud.vision.v1p1beta1.EntityAnnotation.encode(message.logoAnnotations[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.labelAnnotations != null && message.labelAnnotations.length) - for (var i = 0; i < message.labelAnnotations.length; ++i) - $root.google.cloud.vision.v1p1beta1.EntityAnnotation.encode(message.labelAnnotations[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.textAnnotations != null && message.textAnnotations.length) - for (var i = 0; i < message.textAnnotations.length; ++i) - $root.google.cloud.vision.v1p1beta1.EntityAnnotation.encode(message.textAnnotations[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.safeSearchAnnotation != null && message.hasOwnProperty("safeSearchAnnotation")) - $root.google.cloud.vision.v1p1beta1.SafeSearchAnnotation.encode(message.safeSearchAnnotation, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.imagePropertiesAnnotation != null && message.hasOwnProperty("imagePropertiesAnnotation")) - $root.google.cloud.vision.v1p1beta1.ImageProperties.encode(message.imagePropertiesAnnotation, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.error != null && message.hasOwnProperty("error")) - $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.cropHintsAnnotation != null && message.hasOwnProperty("cropHintsAnnotation")) - $root.google.cloud.vision.v1p1beta1.CropHintsAnnotation.encode(message.cropHintsAnnotation, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.fullTextAnnotation != null && message.hasOwnProperty("fullTextAnnotation")) - $root.google.cloud.vision.v1p1beta1.TextAnnotation.encode(message.fullTextAnnotation, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.webDetection != null && message.hasOwnProperty("webDetection")) - $root.google.cloud.vision.v1p1beta1.WebDetection.encode(message.webDetection, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.cropHints != null && message.cropHints.length) + for (var i = 0; i < message.cropHints.length; ++i) + $root.google.cloud.vision.v1p1beta1.CropHint.encode(message.cropHints[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified AnnotateImageResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.AnnotateImageResponse.verify|verify} messages. + * Encodes the specified CropHintsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.CropHintsAnnotation.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p1beta1.CropHintsAnnotation * @static - * @param {google.cloud.vision.v1p1beta1.IAnnotateImageResponse} message AnnotateImageResponse message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.ICropHintsAnnotation} message CropHintsAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateImageResponse.encodeDelimited = function encodeDelimited(message, writer) { + CropHintsAnnotation.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AnnotateImageResponse message from the specified reader or buffer. + * Decodes a CropHintsAnnotation message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p1beta1.CropHintsAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p1beta1.AnnotateImageResponse} AnnotateImageResponse + * @returns {google.cloud.vision.v1p1beta1.CropHintsAnnotation} CropHintsAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateImageResponse.decode = function decode(reader, length) { + CropHintsAnnotation.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.vision.v1p1beta1.AnnotateImageResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p1beta1.CropHintsAnnotation(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.faceAnnotations && message.faceAnnotations.length)) - message.faceAnnotations = []; - message.faceAnnotations.push($root.google.cloud.vision.v1p1beta1.FaceAnnotation.decode(reader, reader.uint32())); - break; - case 2: - if (!(message.landmarkAnnotations && message.landmarkAnnotations.length)) - message.landmarkAnnotations = []; - message.landmarkAnnotations.push($root.google.cloud.vision.v1p1beta1.EntityAnnotation.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.logoAnnotations && message.logoAnnotations.length)) - message.logoAnnotations = []; - message.logoAnnotations.push($root.google.cloud.vision.v1p1beta1.EntityAnnotation.decode(reader, reader.uint32())); - break; - case 4: - if (!(message.labelAnnotations && message.labelAnnotations.length)) - message.labelAnnotations = []; - message.labelAnnotations.push($root.google.cloud.vision.v1p1beta1.EntityAnnotation.decode(reader, reader.uint32())); - break; - case 5: - if (!(message.textAnnotations && message.textAnnotations.length)) - message.textAnnotations = []; - message.textAnnotations.push($root.google.cloud.vision.v1p1beta1.EntityAnnotation.decode(reader, reader.uint32())); - break; - case 12: - message.fullTextAnnotation = $root.google.cloud.vision.v1p1beta1.TextAnnotation.decode(reader, reader.uint32()); - break; - case 6: - message.safeSearchAnnotation = $root.google.cloud.vision.v1p1beta1.SafeSearchAnnotation.decode(reader, reader.uint32()); - break; - case 8: - message.imagePropertiesAnnotation = $root.google.cloud.vision.v1p1beta1.ImageProperties.decode(reader, reader.uint32()); - break; - case 11: - message.cropHintsAnnotation = $root.google.cloud.vision.v1p1beta1.CropHintsAnnotation.decode(reader, reader.uint32()); - break; - case 13: - message.webDetection = $root.google.cloud.vision.v1p1beta1.WebDetection.decode(reader, reader.uint32()); - break; - case 9: - message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); + if (!(message.cropHints && message.cropHints.length)) + message.cropHints = []; + message.cropHints.push($root.google.cloud.vision.v1p1beta1.CropHint.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -30892,306 +30230,125 @@ }; /** - * Decodes an AnnotateImageResponse message from the specified reader or buffer, length delimited. + * Decodes a CropHintsAnnotation message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p1beta1.CropHintsAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.AnnotateImageResponse} AnnotateImageResponse + * @returns {google.cloud.vision.v1p1beta1.CropHintsAnnotation} CropHintsAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateImageResponse.decodeDelimited = function decodeDelimited(reader) { + CropHintsAnnotation.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AnnotateImageResponse message. + * Verifies a CropHintsAnnotation message. * @function verify - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p1beta1.CropHintsAnnotation * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AnnotateImageResponse.verify = function verify(message) { + CropHintsAnnotation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.faceAnnotations != null && message.hasOwnProperty("faceAnnotations")) { - if (!Array.isArray(message.faceAnnotations)) - return "faceAnnotations: array expected"; - for (var i = 0; i < message.faceAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1p1beta1.FaceAnnotation.verify(message.faceAnnotations[i]); - if (error) - return "faceAnnotations." + error; - } - } - if (message.landmarkAnnotations != null && message.hasOwnProperty("landmarkAnnotations")) { - if (!Array.isArray(message.landmarkAnnotations)) - return "landmarkAnnotations: array expected"; - for (var i = 0; i < message.landmarkAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1p1beta1.EntityAnnotation.verify(message.landmarkAnnotations[i]); - if (error) - return "landmarkAnnotations." + error; - } - } - if (message.logoAnnotations != null && message.hasOwnProperty("logoAnnotations")) { - if (!Array.isArray(message.logoAnnotations)) - return "logoAnnotations: array expected"; - for (var i = 0; i < message.logoAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1p1beta1.EntityAnnotation.verify(message.logoAnnotations[i]); - if (error) - return "logoAnnotations." + error; - } - } - if (message.labelAnnotations != null && message.hasOwnProperty("labelAnnotations")) { - if (!Array.isArray(message.labelAnnotations)) - return "labelAnnotations: array expected"; - for (var i = 0; i < message.labelAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1p1beta1.EntityAnnotation.verify(message.labelAnnotations[i]); - if (error) - return "labelAnnotations." + error; - } - } - if (message.textAnnotations != null && message.hasOwnProperty("textAnnotations")) { - if (!Array.isArray(message.textAnnotations)) - return "textAnnotations: array expected"; - for (var i = 0; i < message.textAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1p1beta1.EntityAnnotation.verify(message.textAnnotations[i]); + if (message.cropHints != null && message.hasOwnProperty("cropHints")) { + if (!Array.isArray(message.cropHints)) + return "cropHints: array expected"; + for (var i = 0; i < message.cropHints.length; ++i) { + var error = $root.google.cloud.vision.v1p1beta1.CropHint.verify(message.cropHints[i]); if (error) - return "textAnnotations." + error; + return "cropHints." + error; } } - if (message.fullTextAnnotation != null && message.hasOwnProperty("fullTextAnnotation")) { - var error = $root.google.cloud.vision.v1p1beta1.TextAnnotation.verify(message.fullTextAnnotation); - if (error) - return "fullTextAnnotation." + error; - } - if (message.safeSearchAnnotation != null && message.hasOwnProperty("safeSearchAnnotation")) { - var error = $root.google.cloud.vision.v1p1beta1.SafeSearchAnnotation.verify(message.safeSearchAnnotation); - if (error) - return "safeSearchAnnotation." + error; - } - if (message.imagePropertiesAnnotation != null && message.hasOwnProperty("imagePropertiesAnnotation")) { - var error = $root.google.cloud.vision.v1p1beta1.ImageProperties.verify(message.imagePropertiesAnnotation); - if (error) - return "imagePropertiesAnnotation." + error; - } - if (message.cropHintsAnnotation != null && message.hasOwnProperty("cropHintsAnnotation")) { - var error = $root.google.cloud.vision.v1p1beta1.CropHintsAnnotation.verify(message.cropHintsAnnotation); - if (error) - return "cropHintsAnnotation." + error; - } - if (message.webDetection != null && message.hasOwnProperty("webDetection")) { - var error = $root.google.cloud.vision.v1p1beta1.WebDetection.verify(message.webDetection); - if (error) - return "webDetection." + error; - } - if (message.error != null && message.hasOwnProperty("error")) { - var error = $root.google.rpc.Status.verify(message.error); - if (error) - return "error." + error; - } return null; }; /** - * Creates an AnnotateImageResponse message from a plain object. Also converts values to their respective internal types. + * Creates a CropHintsAnnotation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p1beta1.CropHintsAnnotation * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.AnnotateImageResponse} AnnotateImageResponse + * @returns {google.cloud.vision.v1p1beta1.CropHintsAnnotation} CropHintsAnnotation */ - AnnotateImageResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.AnnotateImageResponse) + CropHintsAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p1beta1.CropHintsAnnotation) return object; - var message = new $root.google.cloud.vision.v1p1beta1.AnnotateImageResponse(); - if (object.faceAnnotations) { - if (!Array.isArray(object.faceAnnotations)) - throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.faceAnnotations: array expected"); - message.faceAnnotations = []; - for (var i = 0; i < object.faceAnnotations.length; ++i) { - if (typeof object.faceAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.faceAnnotations: object expected"); - message.faceAnnotations[i] = $root.google.cloud.vision.v1p1beta1.FaceAnnotation.fromObject(object.faceAnnotations[i]); - } - } - if (object.landmarkAnnotations) { - if (!Array.isArray(object.landmarkAnnotations)) - throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.landmarkAnnotations: array expected"); - message.landmarkAnnotations = []; - for (var i = 0; i < object.landmarkAnnotations.length; ++i) { - if (typeof object.landmarkAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.landmarkAnnotations: object expected"); - message.landmarkAnnotations[i] = $root.google.cloud.vision.v1p1beta1.EntityAnnotation.fromObject(object.landmarkAnnotations[i]); - } - } - if (object.logoAnnotations) { - if (!Array.isArray(object.logoAnnotations)) - throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.logoAnnotations: array expected"); - message.logoAnnotations = []; - for (var i = 0; i < object.logoAnnotations.length; ++i) { - if (typeof object.logoAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.logoAnnotations: object expected"); - message.logoAnnotations[i] = $root.google.cloud.vision.v1p1beta1.EntityAnnotation.fromObject(object.logoAnnotations[i]); - } - } - if (object.labelAnnotations) { - if (!Array.isArray(object.labelAnnotations)) - throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.labelAnnotations: array expected"); - message.labelAnnotations = []; - for (var i = 0; i < object.labelAnnotations.length; ++i) { - if (typeof object.labelAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.labelAnnotations: object expected"); - message.labelAnnotations[i] = $root.google.cloud.vision.v1p1beta1.EntityAnnotation.fromObject(object.labelAnnotations[i]); - } - } - if (object.textAnnotations) { - if (!Array.isArray(object.textAnnotations)) - throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.textAnnotations: array expected"); - message.textAnnotations = []; - for (var i = 0; i < object.textAnnotations.length; ++i) { - if (typeof object.textAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.textAnnotations: object expected"); - message.textAnnotations[i] = $root.google.cloud.vision.v1p1beta1.EntityAnnotation.fromObject(object.textAnnotations[i]); + var message = new $root.google.cloud.vision.v1p1beta1.CropHintsAnnotation(); + if (object.cropHints) { + if (!Array.isArray(object.cropHints)) + throw TypeError(".google.cloud.vision.v1p1beta1.CropHintsAnnotation.cropHints: array expected"); + message.cropHints = []; + for (var i = 0; i < object.cropHints.length; ++i) { + if (typeof object.cropHints[i] !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.CropHintsAnnotation.cropHints: object expected"); + message.cropHints[i] = $root.google.cloud.vision.v1p1beta1.CropHint.fromObject(object.cropHints[i]); } } - if (object.fullTextAnnotation != null) { - if (typeof object.fullTextAnnotation !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.fullTextAnnotation: object expected"); - message.fullTextAnnotation = $root.google.cloud.vision.v1p1beta1.TextAnnotation.fromObject(object.fullTextAnnotation); - } - if (object.safeSearchAnnotation != null) { - if (typeof object.safeSearchAnnotation !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.safeSearchAnnotation: object expected"); - message.safeSearchAnnotation = $root.google.cloud.vision.v1p1beta1.SafeSearchAnnotation.fromObject(object.safeSearchAnnotation); - } - if (object.imagePropertiesAnnotation != null) { - if (typeof object.imagePropertiesAnnotation !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.imagePropertiesAnnotation: object expected"); - message.imagePropertiesAnnotation = $root.google.cloud.vision.v1p1beta1.ImageProperties.fromObject(object.imagePropertiesAnnotation); - } - if (object.cropHintsAnnotation != null) { - if (typeof object.cropHintsAnnotation !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.cropHintsAnnotation: object expected"); - message.cropHintsAnnotation = $root.google.cloud.vision.v1p1beta1.CropHintsAnnotation.fromObject(object.cropHintsAnnotation); - } - if (object.webDetection != null) { - if (typeof object.webDetection !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.webDetection: object expected"); - message.webDetection = $root.google.cloud.vision.v1p1beta1.WebDetection.fromObject(object.webDetection); - } - if (object.error != null) { - if (typeof object.error !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.error: object expected"); - message.error = $root.google.rpc.Status.fromObject(object.error); - } return message; }; /** - * Creates a plain object from an AnnotateImageResponse message. Also converts values to other types if specified. + * Creates a plain object from a CropHintsAnnotation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p1beta1.CropHintsAnnotation * @static - * @param {google.cloud.vision.v1p1beta1.AnnotateImageResponse} message AnnotateImageResponse + * @param {google.cloud.vision.v1p1beta1.CropHintsAnnotation} message CropHintsAnnotation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AnnotateImageResponse.toObject = function toObject(message, options) { + CropHintsAnnotation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.faceAnnotations = []; - object.landmarkAnnotations = []; - object.logoAnnotations = []; - object.labelAnnotations = []; - object.textAnnotations = []; - } - if (options.defaults) { - object.safeSearchAnnotation = null; - object.imagePropertiesAnnotation = null; - object.error = null; - object.cropHintsAnnotation = null; - object.fullTextAnnotation = null; - object.webDetection = null; - } - if (message.faceAnnotations && message.faceAnnotations.length) { - object.faceAnnotations = []; - for (var j = 0; j < message.faceAnnotations.length; ++j) - object.faceAnnotations[j] = $root.google.cloud.vision.v1p1beta1.FaceAnnotation.toObject(message.faceAnnotations[j], options); - } - if (message.landmarkAnnotations && message.landmarkAnnotations.length) { - object.landmarkAnnotations = []; - for (var j = 0; j < message.landmarkAnnotations.length; ++j) - object.landmarkAnnotations[j] = $root.google.cloud.vision.v1p1beta1.EntityAnnotation.toObject(message.landmarkAnnotations[j], options); - } - if (message.logoAnnotations && message.logoAnnotations.length) { - object.logoAnnotations = []; - for (var j = 0; j < message.logoAnnotations.length; ++j) - object.logoAnnotations[j] = $root.google.cloud.vision.v1p1beta1.EntityAnnotation.toObject(message.logoAnnotations[j], options); - } - if (message.labelAnnotations && message.labelAnnotations.length) { - object.labelAnnotations = []; - for (var j = 0; j < message.labelAnnotations.length; ++j) - object.labelAnnotations[j] = $root.google.cloud.vision.v1p1beta1.EntityAnnotation.toObject(message.labelAnnotations[j], options); - } - if (message.textAnnotations && message.textAnnotations.length) { - object.textAnnotations = []; - for (var j = 0; j < message.textAnnotations.length; ++j) - object.textAnnotations[j] = $root.google.cloud.vision.v1p1beta1.EntityAnnotation.toObject(message.textAnnotations[j], options); + if (options.arrays || options.defaults) + object.cropHints = []; + if (message.cropHints && message.cropHints.length) { + object.cropHints = []; + for (var j = 0; j < message.cropHints.length; ++j) + object.cropHints[j] = $root.google.cloud.vision.v1p1beta1.CropHint.toObject(message.cropHints[j], options); } - if (message.safeSearchAnnotation != null && message.hasOwnProperty("safeSearchAnnotation")) - object.safeSearchAnnotation = $root.google.cloud.vision.v1p1beta1.SafeSearchAnnotation.toObject(message.safeSearchAnnotation, options); - if (message.imagePropertiesAnnotation != null && message.hasOwnProperty("imagePropertiesAnnotation")) - object.imagePropertiesAnnotation = $root.google.cloud.vision.v1p1beta1.ImageProperties.toObject(message.imagePropertiesAnnotation, options); - if (message.error != null && message.hasOwnProperty("error")) - object.error = $root.google.rpc.Status.toObject(message.error, options); - if (message.cropHintsAnnotation != null && message.hasOwnProperty("cropHintsAnnotation")) - object.cropHintsAnnotation = $root.google.cloud.vision.v1p1beta1.CropHintsAnnotation.toObject(message.cropHintsAnnotation, options); - if (message.fullTextAnnotation != null && message.hasOwnProperty("fullTextAnnotation")) - object.fullTextAnnotation = $root.google.cloud.vision.v1p1beta1.TextAnnotation.toObject(message.fullTextAnnotation, options); - if (message.webDetection != null && message.hasOwnProperty("webDetection")) - object.webDetection = $root.google.cloud.vision.v1p1beta1.WebDetection.toObject(message.webDetection, options); return object; }; /** - * Converts this AnnotateImageResponse to JSON. + * Converts this CropHintsAnnotation to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p1beta1.CropHintsAnnotation * @instance * @returns {Object.} JSON object */ - AnnotateImageResponse.prototype.toJSON = function toJSON() { + CropHintsAnnotation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AnnotateImageResponse; + return CropHintsAnnotation; })(); - v1p1beta1.BatchAnnotateImagesRequest = (function() { + v1p1beta1.CropHintsParams = (function() { /** - * Properties of a BatchAnnotateImagesRequest. + * Properties of a CropHintsParams. * @memberof google.cloud.vision.v1p1beta1 - * @interface IBatchAnnotateImagesRequest - * @property {Array.|null} [requests] BatchAnnotateImagesRequest requests + * @interface ICropHintsParams + * @property {Array.|null} [aspectRatios] CropHintsParams aspectRatios */ /** - * Constructs a new BatchAnnotateImagesRequest. + * Constructs a new CropHintsParams. * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a BatchAnnotateImagesRequest. - * @implements IBatchAnnotateImagesRequest + * @classdesc Represents a CropHintsParams. + * @implements ICropHintsParams * @constructor - * @param {google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest=} [properties] Properties to set + * @param {google.cloud.vision.v1p1beta1.ICropHintsParams=} [properties] Properties to set */ - function BatchAnnotateImagesRequest(properties) { - this.requests = []; + function CropHintsParams(properties) { + this.aspectRatios = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -31199,78 +30356,86 @@ } /** - * BatchAnnotateImagesRequest requests. - * @member {Array.} requests - * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest + * CropHintsParams aspectRatios. + * @member {Array.} aspectRatios + * @memberof google.cloud.vision.v1p1beta1.CropHintsParams * @instance */ - BatchAnnotateImagesRequest.prototype.requests = $util.emptyArray; + CropHintsParams.prototype.aspectRatios = $util.emptyArray; /** - * Creates a new BatchAnnotateImagesRequest instance using the specified properties. + * Creates a new CropHintsParams instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p1beta1.CropHintsParams * @static - * @param {google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest instance + * @param {google.cloud.vision.v1p1beta1.ICropHintsParams=} [properties] Properties to set + * @returns {google.cloud.vision.v1p1beta1.CropHintsParams} CropHintsParams instance */ - BatchAnnotateImagesRequest.create = function create(properties) { - return new BatchAnnotateImagesRequest(properties); + CropHintsParams.create = function create(properties) { + return new CropHintsParams(properties); }; /** - * Encodes the specified BatchAnnotateImagesRequest message. Does not implicitly {@link google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest.verify|verify} messages. + * Encodes the specified CropHintsParams message. Does not implicitly {@link google.cloud.vision.v1p1beta1.CropHintsParams.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p1beta1.CropHintsParams * @static - * @param {google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest} message BatchAnnotateImagesRequest message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.ICropHintsParams} message CropHintsParams message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchAnnotateImagesRequest.encode = function encode(message, writer) { + CropHintsParams.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.requests != null && message.requests.length) - for (var i = 0; i < message.requests.length; ++i) - $root.google.cloud.vision.v1p1beta1.AnnotateImageRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.aspectRatios != null && message.aspectRatios.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.aspectRatios.length; ++i) + writer.float(message.aspectRatios[i]); + writer.ldelim(); + } return writer; }; /** - * Encodes the specified BatchAnnotateImagesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest.verify|verify} messages. + * Encodes the specified CropHintsParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.CropHintsParams.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p1beta1.CropHintsParams * @static - * @param {google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest} message BatchAnnotateImagesRequest message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.ICropHintsParams} message CropHintsParams message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchAnnotateImagesRequest.encodeDelimited = function encodeDelimited(message, writer) { + CropHintsParams.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer. + * Decodes a CropHintsParams message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p1beta1.CropHintsParams * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest + * @returns {google.cloud.vision.v1p1beta1.CropHintsParams} CropHintsParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchAnnotateImagesRequest.decode = function decode(reader, length) { + CropHintsParams.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.vision.v1p1beta1.BatchAnnotateImagesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p1beta1.CropHintsParams(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.requests && message.requests.length)) - message.requests = []; - message.requests.push($root.google.cloud.vision.v1p1beta1.AnnotateImageRequest.decode(reader, reader.uint32())); + if (!(message.aspectRatios && message.aspectRatios.length)) + message.aspectRatios = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.aspectRatios.push(reader.float()); + } else + message.aspectRatios.push(reader.float()); break; default: reader.skipType(tag & 7); @@ -31281,125 +30446,119 @@ }; /** - * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. + * Decodes a CropHintsParams message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p1beta1.CropHintsParams * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest + * @returns {google.cloud.vision.v1p1beta1.CropHintsParams} CropHintsParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchAnnotateImagesRequest.decodeDelimited = function decodeDelimited(reader) { + CropHintsParams.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BatchAnnotateImagesRequest message. + * Verifies a CropHintsParams message. * @function verify - * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p1beta1.CropHintsParams * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BatchAnnotateImagesRequest.verify = function verify(message) { + CropHintsParams.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.requests != null && message.hasOwnProperty("requests")) { - if (!Array.isArray(message.requests)) - return "requests: array expected"; - for (var i = 0; i < message.requests.length; ++i) { - var error = $root.google.cloud.vision.v1p1beta1.AnnotateImageRequest.verify(message.requests[i]); - if (error) - return "requests." + error; - } + if (message.aspectRatios != null && message.hasOwnProperty("aspectRatios")) { + if (!Array.isArray(message.aspectRatios)) + return "aspectRatios: array expected"; + for (var i = 0; i < message.aspectRatios.length; ++i) + if (typeof message.aspectRatios[i] !== "number") + return "aspectRatios: number[] expected"; } return null; }; /** - * Creates a BatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CropHintsParams message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p1beta1.CropHintsParams * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest + * @returns {google.cloud.vision.v1p1beta1.CropHintsParams} CropHintsParams */ - BatchAnnotateImagesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest) + CropHintsParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p1beta1.CropHintsParams) return object; - var message = new $root.google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest(); - if (object.requests) { - if (!Array.isArray(object.requests)) - throw TypeError(".google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest.requests: array expected"); - message.requests = []; - for (var i = 0; i < object.requests.length; ++i) { - if (typeof object.requests[i] !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest.requests: object expected"); - message.requests[i] = $root.google.cloud.vision.v1p1beta1.AnnotateImageRequest.fromObject(object.requests[i]); - } + var message = new $root.google.cloud.vision.v1p1beta1.CropHintsParams(); + if (object.aspectRatios) { + if (!Array.isArray(object.aspectRatios)) + throw TypeError(".google.cloud.vision.v1p1beta1.CropHintsParams.aspectRatios: array expected"); + message.aspectRatios = []; + for (var i = 0; i < object.aspectRatios.length; ++i) + message.aspectRatios[i] = Number(object.aspectRatios[i]); } return message; }; /** - * Creates a plain object from a BatchAnnotateImagesRequest message. Also converts values to other types if specified. + * Creates a plain object from a CropHintsParams message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p1beta1.CropHintsParams * @static - * @param {google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest} message BatchAnnotateImagesRequest + * @param {google.cloud.vision.v1p1beta1.CropHintsParams} message CropHintsParams * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BatchAnnotateImagesRequest.toObject = function toObject(message, options) { + CropHintsParams.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.requests = []; - if (message.requests && message.requests.length) { - object.requests = []; - for (var j = 0; j < message.requests.length; ++j) - object.requests[j] = $root.google.cloud.vision.v1p1beta1.AnnotateImageRequest.toObject(message.requests[j], options); + object.aspectRatios = []; + if (message.aspectRatios && message.aspectRatios.length) { + object.aspectRatios = []; + for (var j = 0; j < message.aspectRatios.length; ++j) + object.aspectRatios[j] = options.json && !isFinite(message.aspectRatios[j]) ? String(message.aspectRatios[j]) : message.aspectRatios[j]; } return object; }; /** - * Converts this BatchAnnotateImagesRequest to JSON. + * Converts this CropHintsParams to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p1beta1.CropHintsParams * @instance * @returns {Object.} JSON object */ - BatchAnnotateImagesRequest.prototype.toJSON = function toJSON() { + CropHintsParams.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BatchAnnotateImagesRequest; + return CropHintsParams; })(); - v1p1beta1.BatchAnnotateImagesResponse = (function() { + v1p1beta1.WebDetectionParams = (function() { /** - * Properties of a BatchAnnotateImagesResponse. + * Properties of a WebDetectionParams. * @memberof google.cloud.vision.v1p1beta1 - * @interface IBatchAnnotateImagesResponse - * @property {Array.|null} [responses] BatchAnnotateImagesResponse responses + * @interface IWebDetectionParams + * @property {boolean|null} [includeGeoResults] WebDetectionParams includeGeoResults */ /** - * Constructs a new BatchAnnotateImagesResponse. + * Constructs a new WebDetectionParams. * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a BatchAnnotateImagesResponse. - * @implements IBatchAnnotateImagesResponse + * @classdesc Represents a WebDetectionParams. + * @implements IWebDetectionParams * @constructor - * @param {google.cloud.vision.v1p1beta1.IBatchAnnotateImagesResponse=} [properties] Properties to set + * @param {google.cloud.vision.v1p1beta1.IWebDetectionParams=} [properties] Properties to set */ - function BatchAnnotateImagesResponse(properties) { - this.responses = []; + function WebDetectionParams(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -31407,78 +30566,75 @@ } /** - * BatchAnnotateImagesResponse responses. - * @member {Array.} responses - * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse + * WebDetectionParams includeGeoResults. + * @member {boolean} includeGeoResults + * @memberof google.cloud.vision.v1p1beta1.WebDetectionParams * @instance */ - BatchAnnotateImagesResponse.prototype.responses = $util.emptyArray; + WebDetectionParams.prototype.includeGeoResults = false; /** - * Creates a new BatchAnnotateImagesResponse instance using the specified properties. + * Creates a new WebDetectionParams instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p1beta1.WebDetectionParams * @static - * @param {google.cloud.vision.v1p1beta1.IBatchAnnotateImagesResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse instance + * @param {google.cloud.vision.v1p1beta1.IWebDetectionParams=} [properties] Properties to set + * @returns {google.cloud.vision.v1p1beta1.WebDetectionParams} WebDetectionParams instance */ - BatchAnnotateImagesResponse.create = function create(properties) { - return new BatchAnnotateImagesResponse(properties); + WebDetectionParams.create = function create(properties) { + return new WebDetectionParams(properties); }; /** - * Encodes the specified BatchAnnotateImagesResponse message. Does not implicitly {@link google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse.verify|verify} messages. + * Encodes the specified WebDetectionParams message. Does not implicitly {@link google.cloud.vision.v1p1beta1.WebDetectionParams.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p1beta1.WebDetectionParams * @static - * @param {google.cloud.vision.v1p1beta1.IBatchAnnotateImagesResponse} message BatchAnnotateImagesResponse message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IWebDetectionParams} message WebDetectionParams message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchAnnotateImagesResponse.encode = function encode(message, writer) { + WebDetectionParams.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.responses != null && message.responses.length) - for (var i = 0; i < message.responses.length; ++i) - $root.google.cloud.vision.v1p1beta1.AnnotateImageResponse.encode(message.responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.includeGeoResults != null && message.hasOwnProperty("includeGeoResults")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.includeGeoResults); return writer; }; /** - * Encodes the specified BatchAnnotateImagesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse.verify|verify} messages. + * Encodes the specified WebDetectionParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.WebDetectionParams.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p1beta1.WebDetectionParams * @static - * @param {google.cloud.vision.v1p1beta1.IBatchAnnotateImagesResponse} message BatchAnnotateImagesResponse message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IWebDetectionParams} message WebDetectionParams message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchAnnotateImagesResponse.encodeDelimited = function encodeDelimited(message, writer) { + WebDetectionParams.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BatchAnnotateImagesResponse message from the specified reader or buffer. + * Decodes a WebDetectionParams message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p1beta1.WebDetectionParams * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse + * @returns {google.cloud.vision.v1p1beta1.WebDetectionParams} WebDetectionParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchAnnotateImagesResponse.decode = function decode(reader, length) { + WebDetectionParams.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.vision.v1p1beta1.BatchAnnotateImagesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p1beta1.WebDetectionParams(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.responses && message.responses.length)) - message.responses = []; - message.responses.push($root.google.cloud.vision.v1p1beta1.AnnotateImageResponse.decode(reader, reader.uint32())); + case 2: + message.includeGeoResults = reader.bool(); break; default: reader.skipType(tag & 7); @@ -31489,147 +30645,111 @@ }; /** - * Decodes a BatchAnnotateImagesResponse message from the specified reader or buffer, length delimited. + * Decodes a WebDetectionParams message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p1beta1.WebDetectionParams * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse + * @returns {google.cloud.vision.v1p1beta1.WebDetectionParams} WebDetectionParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchAnnotateImagesResponse.decodeDelimited = function decodeDelimited(reader) { + WebDetectionParams.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BatchAnnotateImagesResponse message. + * Verifies a WebDetectionParams message. * @function verify - * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p1beta1.WebDetectionParams * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BatchAnnotateImagesResponse.verify = function verify(message) { + WebDetectionParams.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.responses != null && message.hasOwnProperty("responses")) { - if (!Array.isArray(message.responses)) - return "responses: array expected"; - for (var i = 0; i < message.responses.length; ++i) { - var error = $root.google.cloud.vision.v1p1beta1.AnnotateImageResponse.verify(message.responses[i]); - if (error) - return "responses." + error; - } - } + if (message.includeGeoResults != null && message.hasOwnProperty("includeGeoResults")) + if (typeof message.includeGeoResults !== "boolean") + return "includeGeoResults: boolean expected"; return null; }; /** - * Creates a BatchAnnotateImagesResponse message from a plain object. Also converts values to their respective internal types. + * Creates a WebDetectionParams message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p1beta1.WebDetectionParams * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse + * @returns {google.cloud.vision.v1p1beta1.WebDetectionParams} WebDetectionParams */ - BatchAnnotateImagesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse) + WebDetectionParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p1beta1.WebDetectionParams) return object; - var message = new $root.google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse(); - if (object.responses) { - if (!Array.isArray(object.responses)) - throw TypeError(".google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse.responses: array expected"); - message.responses = []; - for (var i = 0; i < object.responses.length; ++i) { - if (typeof object.responses[i] !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse.responses: object expected"); - message.responses[i] = $root.google.cloud.vision.v1p1beta1.AnnotateImageResponse.fromObject(object.responses[i]); - } - } + var message = new $root.google.cloud.vision.v1p1beta1.WebDetectionParams(); + if (object.includeGeoResults != null) + message.includeGeoResults = Boolean(object.includeGeoResults); return message; }; /** - * Creates a plain object from a BatchAnnotateImagesResponse message. Also converts values to other types if specified. + * Creates a plain object from a WebDetectionParams message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p1beta1.WebDetectionParams * @static - * @param {google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse} message BatchAnnotateImagesResponse + * @param {google.cloud.vision.v1p1beta1.WebDetectionParams} message WebDetectionParams * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BatchAnnotateImagesResponse.toObject = function toObject(message, options) { + WebDetectionParams.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.responses = []; - if (message.responses && message.responses.length) { - object.responses = []; - for (var j = 0; j < message.responses.length; ++j) - object.responses[j] = $root.google.cloud.vision.v1p1beta1.AnnotateImageResponse.toObject(message.responses[j], options); - } + if (options.defaults) + object.includeGeoResults = false; + if (message.includeGeoResults != null && message.hasOwnProperty("includeGeoResults")) + object.includeGeoResults = message.includeGeoResults; return object; }; /** - * Converts this BatchAnnotateImagesResponse to JSON. + * Converts this WebDetectionParams to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p1beta1.WebDetectionParams * @instance * @returns {Object.} JSON object */ - BatchAnnotateImagesResponse.prototype.toJSON = function toJSON() { + WebDetectionParams.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BatchAnnotateImagesResponse; - })(); - - /** - * Likelihood enum. - * @name google.cloud.vision.v1p1beta1.Likelihood - * @enum {string} - * @property {number} UNKNOWN=0 UNKNOWN value - * @property {number} VERY_UNLIKELY=1 VERY_UNLIKELY value - * @property {number} UNLIKELY=2 UNLIKELY value - * @property {number} POSSIBLE=3 POSSIBLE value - * @property {number} LIKELY=4 LIKELY value - * @property {number} VERY_LIKELY=5 VERY_LIKELY value - */ - v1p1beta1.Likelihood = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "UNKNOWN"] = 0; - values[valuesById[1] = "VERY_UNLIKELY"] = 1; - values[valuesById[2] = "UNLIKELY"] = 2; - values[valuesById[3] = "POSSIBLE"] = 3; - values[valuesById[4] = "LIKELY"] = 4; - values[valuesById[5] = "VERY_LIKELY"] = 5; - return values; + return WebDetectionParams; })(); - v1p1beta1.Vertex = (function() { + v1p1beta1.ImageContext = (function() { /** - * Properties of a Vertex. + * Properties of an ImageContext. * @memberof google.cloud.vision.v1p1beta1 - * @interface IVertex - * @property {number|null} [x] Vertex x - * @property {number|null} [y] Vertex y + * @interface IImageContext + * @property {google.cloud.vision.v1p1beta1.ILatLongRect|null} [latLongRect] ImageContext latLongRect + * @property {Array.|null} [languageHints] ImageContext languageHints + * @property {google.cloud.vision.v1p1beta1.ICropHintsParams|null} [cropHintsParams] ImageContext cropHintsParams + * @property {google.cloud.vision.v1p1beta1.IWebDetectionParams|null} [webDetectionParams] ImageContext webDetectionParams */ /** - * Constructs a new Vertex. + * Constructs a new ImageContext. * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a Vertex. - * @implements IVertex + * @classdesc Represents an ImageContext. + * @implements IImageContext * @constructor - * @param {google.cloud.vision.v1p1beta1.IVertex=} [properties] Properties to set + * @param {google.cloud.vision.v1p1beta1.IImageContext=} [properties] Properties to set */ - function Vertex(properties) { + function ImageContext(properties) { + this.languageHints = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -31637,88 +30757,117 @@ } /** - * Vertex x. - * @member {number} x - * @memberof google.cloud.vision.v1p1beta1.Vertex + * ImageContext latLongRect. + * @member {google.cloud.vision.v1p1beta1.ILatLongRect|null|undefined} latLongRect + * @memberof google.cloud.vision.v1p1beta1.ImageContext * @instance */ - Vertex.prototype.x = 0; + ImageContext.prototype.latLongRect = null; /** - * Vertex y. - * @member {number} y - * @memberof google.cloud.vision.v1p1beta1.Vertex + * ImageContext languageHints. + * @member {Array.} languageHints + * @memberof google.cloud.vision.v1p1beta1.ImageContext * @instance */ - Vertex.prototype.y = 0; + ImageContext.prototype.languageHints = $util.emptyArray; /** - * Creates a new Vertex instance using the specified properties. + * ImageContext cropHintsParams. + * @member {google.cloud.vision.v1p1beta1.ICropHintsParams|null|undefined} cropHintsParams + * @memberof google.cloud.vision.v1p1beta1.ImageContext + * @instance + */ + ImageContext.prototype.cropHintsParams = null; + + /** + * ImageContext webDetectionParams. + * @member {google.cloud.vision.v1p1beta1.IWebDetectionParams|null|undefined} webDetectionParams + * @memberof google.cloud.vision.v1p1beta1.ImageContext + * @instance + */ + ImageContext.prototype.webDetectionParams = null; + + /** + * Creates a new ImageContext instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p1beta1.Vertex + * @memberof google.cloud.vision.v1p1beta1.ImageContext * @static - * @param {google.cloud.vision.v1p1beta1.IVertex=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.Vertex} Vertex instance + * @param {google.cloud.vision.v1p1beta1.IImageContext=} [properties] Properties to set + * @returns {google.cloud.vision.v1p1beta1.ImageContext} ImageContext instance */ - Vertex.create = function create(properties) { - return new Vertex(properties); + ImageContext.create = function create(properties) { + return new ImageContext(properties); }; /** - * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.vision.v1p1beta1.Vertex.verify|verify} messages. + * Encodes the specified ImageContext message. Does not implicitly {@link google.cloud.vision.v1p1beta1.ImageContext.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p1beta1.Vertex + * @memberof google.cloud.vision.v1p1beta1.ImageContext * @static - * @param {google.cloud.vision.v1p1beta1.IVertex} message Vertex message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IImageContext} message ImageContext message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Vertex.encode = function encode(message, writer) { + ImageContext.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.x != null && message.hasOwnProperty("x")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.x); - if (message.y != null && message.hasOwnProperty("y")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.y); + if (message.latLongRect != null && message.hasOwnProperty("latLongRect")) + $root.google.cloud.vision.v1p1beta1.LatLongRect.encode(message.latLongRect, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.languageHints != null && message.languageHints.length) + for (var i = 0; i < message.languageHints.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageHints[i]); + if (message.cropHintsParams != null && message.hasOwnProperty("cropHintsParams")) + $root.google.cloud.vision.v1p1beta1.CropHintsParams.encode(message.cropHintsParams, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.webDetectionParams != null && message.hasOwnProperty("webDetectionParams")) + $root.google.cloud.vision.v1p1beta1.WebDetectionParams.encode(message.webDetectionParams, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); return writer; }; /** - * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.Vertex.verify|verify} messages. + * Encodes the specified ImageContext message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.ImageContext.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.Vertex + * @memberof google.cloud.vision.v1p1beta1.ImageContext * @static - * @param {google.cloud.vision.v1p1beta1.IVertex} message Vertex message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IImageContext} message ImageContext message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Vertex.encodeDelimited = function encodeDelimited(message, writer) { + ImageContext.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Vertex message from the specified reader or buffer. + * Decodes an ImageContext message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p1beta1.Vertex + * @memberof google.cloud.vision.v1p1beta1.ImageContext * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p1beta1.Vertex} Vertex + * @returns {google.cloud.vision.v1p1beta1.ImageContext} ImageContext * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Vertex.decode = function decode(reader, length) { + ImageContext.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.vision.v1p1beta1.Vertex(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p1beta1.ImageContext(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.x = reader.int32(); + message.latLongRect = $root.google.cloud.vision.v1p1beta1.LatLongRect.decode(reader, reader.uint32()); break; case 2: - message.y = reader.int32(); + if (!(message.languageHints && message.languageHints.length)) + message.languageHints = []; + message.languageHints.push(reader.string()); + break; + case 4: + message.cropHintsParams = $root.google.cloud.vision.v1p1beta1.CropHintsParams.decode(reader, reader.uint32()); + break; + case 6: + message.webDetectionParams = $root.google.cloud.vision.v1p1beta1.WebDetectionParams.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -31729,117 +30878,163 @@ }; /** - * Decodes a Vertex message from the specified reader or buffer, length delimited. + * Decodes an ImageContext message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.Vertex + * @memberof google.cloud.vision.v1p1beta1.ImageContext * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.Vertex} Vertex + * @returns {google.cloud.vision.v1p1beta1.ImageContext} ImageContext * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Vertex.decodeDelimited = function decodeDelimited(reader) { + ImageContext.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Vertex message. + * Verifies an ImageContext message. * @function verify - * @memberof google.cloud.vision.v1p1beta1.Vertex + * @memberof google.cloud.vision.v1p1beta1.ImageContext * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Vertex.verify = function verify(message) { + ImageContext.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.x != null && message.hasOwnProperty("x")) - if (!$util.isInteger(message.x)) - return "x: integer expected"; - if (message.y != null && message.hasOwnProperty("y")) - if (!$util.isInteger(message.y)) - return "y: integer expected"; + if (message.latLongRect != null && message.hasOwnProperty("latLongRect")) { + var error = $root.google.cloud.vision.v1p1beta1.LatLongRect.verify(message.latLongRect); + if (error) + return "latLongRect." + error; + } + if (message.languageHints != null && message.hasOwnProperty("languageHints")) { + if (!Array.isArray(message.languageHints)) + return "languageHints: array expected"; + for (var i = 0; i < message.languageHints.length; ++i) + if (!$util.isString(message.languageHints[i])) + return "languageHints: string[] expected"; + } + if (message.cropHintsParams != null && message.hasOwnProperty("cropHintsParams")) { + var error = $root.google.cloud.vision.v1p1beta1.CropHintsParams.verify(message.cropHintsParams); + if (error) + return "cropHintsParams." + error; + } + if (message.webDetectionParams != null && message.hasOwnProperty("webDetectionParams")) { + var error = $root.google.cloud.vision.v1p1beta1.WebDetectionParams.verify(message.webDetectionParams); + if (error) + return "webDetectionParams." + error; + } return null; }; /** - * Creates a Vertex message from a plain object. Also converts values to their respective internal types. + * Creates an ImageContext message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.Vertex + * @memberof google.cloud.vision.v1p1beta1.ImageContext * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.Vertex} Vertex + * @returns {google.cloud.vision.v1p1beta1.ImageContext} ImageContext */ - Vertex.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.Vertex) + ImageContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p1beta1.ImageContext) return object; - var message = new $root.google.cloud.vision.v1p1beta1.Vertex(); - if (object.x != null) - message.x = object.x | 0; - if (object.y != null) - message.y = object.y | 0; + var message = new $root.google.cloud.vision.v1p1beta1.ImageContext(); + if (object.latLongRect != null) { + if (typeof object.latLongRect !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.ImageContext.latLongRect: object expected"); + message.latLongRect = $root.google.cloud.vision.v1p1beta1.LatLongRect.fromObject(object.latLongRect); + } + if (object.languageHints) { + if (!Array.isArray(object.languageHints)) + throw TypeError(".google.cloud.vision.v1p1beta1.ImageContext.languageHints: array expected"); + message.languageHints = []; + for (var i = 0; i < object.languageHints.length; ++i) + message.languageHints[i] = String(object.languageHints[i]); + } + if (object.cropHintsParams != null) { + if (typeof object.cropHintsParams !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.ImageContext.cropHintsParams: object expected"); + message.cropHintsParams = $root.google.cloud.vision.v1p1beta1.CropHintsParams.fromObject(object.cropHintsParams); + } + if (object.webDetectionParams != null) { + if (typeof object.webDetectionParams !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.ImageContext.webDetectionParams: object expected"); + message.webDetectionParams = $root.google.cloud.vision.v1p1beta1.WebDetectionParams.fromObject(object.webDetectionParams); + } return message; }; /** - * Creates a plain object from a Vertex message. Also converts values to other types if specified. + * Creates a plain object from an ImageContext message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p1beta1.Vertex + * @memberof google.cloud.vision.v1p1beta1.ImageContext * @static - * @param {google.cloud.vision.v1p1beta1.Vertex} message Vertex + * @param {google.cloud.vision.v1p1beta1.ImageContext} message ImageContext * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Vertex.toObject = function toObject(message, options) { + ImageContext.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.x = 0; - object.y = 0; + if (options.arrays || options.defaults) + object.languageHints = []; + if (options.defaults) { + object.latLongRect = null; + object.cropHintsParams = null; + object.webDetectionParams = null; } - if (message.x != null && message.hasOwnProperty("x")) - object.x = message.x; - if (message.y != null && message.hasOwnProperty("y")) - object.y = message.y; + if (message.latLongRect != null && message.hasOwnProperty("latLongRect")) + object.latLongRect = $root.google.cloud.vision.v1p1beta1.LatLongRect.toObject(message.latLongRect, options); + if (message.languageHints && message.languageHints.length) { + object.languageHints = []; + for (var j = 0; j < message.languageHints.length; ++j) + object.languageHints[j] = message.languageHints[j]; + } + if (message.cropHintsParams != null && message.hasOwnProperty("cropHintsParams")) + object.cropHintsParams = $root.google.cloud.vision.v1p1beta1.CropHintsParams.toObject(message.cropHintsParams, options); + if (message.webDetectionParams != null && message.hasOwnProperty("webDetectionParams")) + object.webDetectionParams = $root.google.cloud.vision.v1p1beta1.WebDetectionParams.toObject(message.webDetectionParams, options); return object; }; /** - * Converts this Vertex to JSON. + * Converts this ImageContext to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.Vertex + * @memberof google.cloud.vision.v1p1beta1.ImageContext * @instance * @returns {Object.} JSON object */ - Vertex.prototype.toJSON = function toJSON() { + ImageContext.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Vertex; + return ImageContext; })(); - v1p1beta1.BoundingPoly = (function() { + v1p1beta1.AnnotateImageRequest = (function() { /** - * Properties of a BoundingPoly. + * Properties of an AnnotateImageRequest. * @memberof google.cloud.vision.v1p1beta1 - * @interface IBoundingPoly - * @property {Array.|null} [vertices] BoundingPoly vertices + * @interface IAnnotateImageRequest + * @property {google.cloud.vision.v1p1beta1.IImage|null} [image] AnnotateImageRequest image + * @property {Array.|null} [features] AnnotateImageRequest features + * @property {google.cloud.vision.v1p1beta1.IImageContext|null} [imageContext] AnnotateImageRequest imageContext */ /** - * Constructs a new BoundingPoly. + * Constructs a new AnnotateImageRequest. * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a BoundingPoly. - * @implements IBoundingPoly + * @classdesc Represents an AnnotateImageRequest. + * @implements IAnnotateImageRequest * @constructor - * @param {google.cloud.vision.v1p1beta1.IBoundingPoly=} [properties] Properties to set + * @param {google.cloud.vision.v1p1beta1.IAnnotateImageRequest=} [properties] Properties to set */ - function BoundingPoly(properties) { - this.vertices = []; + function AnnotateImageRequest(properties) { + this.features = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -31847,78 +31042,104 @@ } /** - * BoundingPoly vertices. - * @member {Array.} vertices - * @memberof google.cloud.vision.v1p1beta1.BoundingPoly + * AnnotateImageRequest image. + * @member {google.cloud.vision.v1p1beta1.IImage|null|undefined} image + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest * @instance */ - BoundingPoly.prototype.vertices = $util.emptyArray; + AnnotateImageRequest.prototype.image = null; /** - * Creates a new BoundingPoly instance using the specified properties. + * AnnotateImageRequest features. + * @member {Array.} features + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest + * @instance + */ + AnnotateImageRequest.prototype.features = $util.emptyArray; + + /** + * AnnotateImageRequest imageContext. + * @member {google.cloud.vision.v1p1beta1.IImageContext|null|undefined} imageContext + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest + * @instance + */ + AnnotateImageRequest.prototype.imageContext = null; + + /** + * Creates a new AnnotateImageRequest instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p1beta1.BoundingPoly + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest * @static - * @param {google.cloud.vision.v1p1beta1.IBoundingPoly=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.BoundingPoly} BoundingPoly instance + * @param {google.cloud.vision.v1p1beta1.IAnnotateImageRequest=} [properties] Properties to set + * @returns {google.cloud.vision.v1p1beta1.AnnotateImageRequest} AnnotateImageRequest instance */ - BoundingPoly.create = function create(properties) { - return new BoundingPoly(properties); + AnnotateImageRequest.create = function create(properties) { + return new AnnotateImageRequest(properties); }; /** - * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.vision.v1p1beta1.BoundingPoly.verify|verify} messages. + * Encodes the specified AnnotateImageRequest message. Does not implicitly {@link google.cloud.vision.v1p1beta1.AnnotateImageRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p1beta1.BoundingPoly + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest * @static - * @param {google.cloud.vision.v1p1beta1.IBoundingPoly} message BoundingPoly message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IAnnotateImageRequest} message AnnotateImageRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BoundingPoly.encode = function encode(message, writer) { + AnnotateImageRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.vertices != null && message.vertices.length) - for (var i = 0; i < message.vertices.length; ++i) - $root.google.cloud.vision.v1p1beta1.Vertex.encode(message.vertices[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.image != null && message.hasOwnProperty("image")) + $root.google.cloud.vision.v1p1beta1.Image.encode(message.image, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.features != null && message.features.length) + for (var i = 0; i < message.features.length; ++i) + $root.google.cloud.vision.v1p1beta1.Feature.encode(message.features[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.imageContext != null && message.hasOwnProperty("imageContext")) + $root.google.cloud.vision.v1p1beta1.ImageContext.encode(message.imageContext, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.BoundingPoly.verify|verify} messages. + * Encodes the specified AnnotateImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.AnnotateImageRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.BoundingPoly + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest * @static - * @param {google.cloud.vision.v1p1beta1.IBoundingPoly} message BoundingPoly message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IAnnotateImageRequest} message AnnotateImageRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BoundingPoly.encodeDelimited = function encodeDelimited(message, writer) { + AnnotateImageRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BoundingPoly message from the specified reader or buffer. + * Decodes an AnnotateImageRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p1beta1.BoundingPoly + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p1beta1.BoundingPoly} BoundingPoly + * @returns {google.cloud.vision.v1p1beta1.AnnotateImageRequest} AnnotateImageRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BoundingPoly.decode = function decode(reader, length) { + AnnotateImageRequest.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.vision.v1p1beta1.BoundingPoly(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p1beta1.AnnotateImageRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.vertices && message.vertices.length)) - message.vertices = []; - message.vertices.push($root.google.cloud.vision.v1p1beta1.Vertex.decode(reader, reader.uint32())); + message.image = $root.google.cloud.vision.v1p1beta1.Image.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.features && message.features.length)) + message.features = []; + message.features.push($root.google.cloud.vision.v1p1beta1.Feature.decode(reader, reader.uint32())); + break; + case 3: + message.imageContext = $root.google.cloud.vision.v1p1beta1.ImageContext.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -31929,126 +31150,167 @@ }; /** - * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. + * Decodes an AnnotateImageRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.BoundingPoly + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.BoundingPoly} BoundingPoly + * @returns {google.cloud.vision.v1p1beta1.AnnotateImageRequest} AnnotateImageRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BoundingPoly.decodeDelimited = function decodeDelimited(reader) { + AnnotateImageRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BoundingPoly message. + * Verifies an AnnotateImageRequest message. * @function verify - * @memberof google.cloud.vision.v1p1beta1.BoundingPoly + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BoundingPoly.verify = function verify(message) { + AnnotateImageRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.vertices != null && message.hasOwnProperty("vertices")) { - if (!Array.isArray(message.vertices)) - return "vertices: array expected"; - for (var i = 0; i < message.vertices.length; ++i) { - var error = $root.google.cloud.vision.v1p1beta1.Vertex.verify(message.vertices[i]); + if (message.image != null && message.hasOwnProperty("image")) { + var error = $root.google.cloud.vision.v1p1beta1.Image.verify(message.image); + if (error) + return "image." + error; + } + if (message.features != null && message.hasOwnProperty("features")) { + if (!Array.isArray(message.features)) + return "features: array expected"; + for (var i = 0; i < message.features.length; ++i) { + var error = $root.google.cloud.vision.v1p1beta1.Feature.verify(message.features[i]); if (error) - return "vertices." + error; + return "features." + error; } } + if (message.imageContext != null && message.hasOwnProperty("imageContext")) { + var error = $root.google.cloud.vision.v1p1beta1.ImageContext.verify(message.imageContext); + if (error) + return "imageContext." + error; + } return null; }; /** - * Creates a BoundingPoly message from a plain object. Also converts values to their respective internal types. + * Creates an AnnotateImageRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.BoundingPoly + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.BoundingPoly} BoundingPoly + * @returns {google.cloud.vision.v1p1beta1.AnnotateImageRequest} AnnotateImageRequest */ - BoundingPoly.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.BoundingPoly) + AnnotateImageRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p1beta1.AnnotateImageRequest) return object; - var message = new $root.google.cloud.vision.v1p1beta1.BoundingPoly(); - if (object.vertices) { - if (!Array.isArray(object.vertices)) - throw TypeError(".google.cloud.vision.v1p1beta1.BoundingPoly.vertices: array expected"); - message.vertices = []; - for (var i = 0; i < object.vertices.length; ++i) { - if (typeof object.vertices[i] !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.BoundingPoly.vertices: object expected"); - message.vertices[i] = $root.google.cloud.vision.v1p1beta1.Vertex.fromObject(object.vertices[i]); + var message = new $root.google.cloud.vision.v1p1beta1.AnnotateImageRequest(); + if (object.image != null) { + if (typeof object.image !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageRequest.image: object expected"); + message.image = $root.google.cloud.vision.v1p1beta1.Image.fromObject(object.image); + } + if (object.features) { + if (!Array.isArray(object.features)) + throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageRequest.features: array expected"); + message.features = []; + for (var i = 0; i < object.features.length; ++i) { + if (typeof object.features[i] !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageRequest.features: object expected"); + message.features[i] = $root.google.cloud.vision.v1p1beta1.Feature.fromObject(object.features[i]); } } + if (object.imageContext != null) { + if (typeof object.imageContext !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageRequest.imageContext: object expected"); + message.imageContext = $root.google.cloud.vision.v1p1beta1.ImageContext.fromObject(object.imageContext); + } return message; }; /** - * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. + * Creates a plain object from an AnnotateImageRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p1beta1.BoundingPoly + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest * @static - * @param {google.cloud.vision.v1p1beta1.BoundingPoly} message BoundingPoly + * @param {google.cloud.vision.v1p1beta1.AnnotateImageRequest} message AnnotateImageRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BoundingPoly.toObject = function toObject(message, options) { + AnnotateImageRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.vertices = []; - if (message.vertices && message.vertices.length) { - object.vertices = []; - for (var j = 0; j < message.vertices.length; ++j) - object.vertices[j] = $root.google.cloud.vision.v1p1beta1.Vertex.toObject(message.vertices[j], options); + object.features = []; + if (options.defaults) { + object.image = null; + object.imageContext = null; + } + if (message.image != null && message.hasOwnProperty("image")) + object.image = $root.google.cloud.vision.v1p1beta1.Image.toObject(message.image, options); + if (message.features && message.features.length) { + object.features = []; + for (var j = 0; j < message.features.length; ++j) + object.features[j] = $root.google.cloud.vision.v1p1beta1.Feature.toObject(message.features[j], options); } + if (message.imageContext != null && message.hasOwnProperty("imageContext")) + object.imageContext = $root.google.cloud.vision.v1p1beta1.ImageContext.toObject(message.imageContext, options); return object; }; /** - * Converts this BoundingPoly to JSON. + * Converts this AnnotateImageRequest to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.BoundingPoly + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageRequest * @instance * @returns {Object.} JSON object */ - BoundingPoly.prototype.toJSON = function toJSON() { + AnnotateImageRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BoundingPoly; + return AnnotateImageRequest; })(); - v1p1beta1.Position = (function() { + v1p1beta1.AnnotateImageResponse = (function() { /** - * Properties of a Position. + * Properties of an AnnotateImageResponse. * @memberof google.cloud.vision.v1p1beta1 - * @interface IPosition - * @property {number|null} [x] Position x - * @property {number|null} [y] Position y - * @property {number|null} [z] Position z + * @interface IAnnotateImageResponse + * @property {Array.|null} [faceAnnotations] AnnotateImageResponse faceAnnotations + * @property {Array.|null} [landmarkAnnotations] AnnotateImageResponse landmarkAnnotations + * @property {Array.|null} [logoAnnotations] AnnotateImageResponse logoAnnotations + * @property {Array.|null} [labelAnnotations] AnnotateImageResponse labelAnnotations + * @property {Array.|null} [textAnnotations] AnnotateImageResponse textAnnotations + * @property {google.cloud.vision.v1p1beta1.ITextAnnotation|null} [fullTextAnnotation] AnnotateImageResponse fullTextAnnotation + * @property {google.cloud.vision.v1p1beta1.ISafeSearchAnnotation|null} [safeSearchAnnotation] AnnotateImageResponse safeSearchAnnotation + * @property {google.cloud.vision.v1p1beta1.IImageProperties|null} [imagePropertiesAnnotation] AnnotateImageResponse imagePropertiesAnnotation + * @property {google.cloud.vision.v1p1beta1.ICropHintsAnnotation|null} [cropHintsAnnotation] AnnotateImageResponse cropHintsAnnotation + * @property {google.cloud.vision.v1p1beta1.IWebDetection|null} [webDetection] AnnotateImageResponse webDetection + * @property {google.rpc.IStatus|null} [error] AnnotateImageResponse error */ /** - * Constructs a new Position. + * Constructs a new AnnotateImageResponse. * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a Position. - * @implements IPosition + * @classdesc Represents an AnnotateImageResponse. + * @implements IAnnotateImageResponse * @constructor - * @param {google.cloud.vision.v1p1beta1.IPosition=} [properties] Properties to set + * @param {google.cloud.vision.v1p1beta1.IAnnotateImageResponse=} [properties] Properties to set */ - function Position(properties) { + function AnnotateImageResponse(properties) { + this.faceAnnotations = []; + this.landmarkAnnotations = []; + this.logoAnnotations = []; + this.labelAnnotations = []; + this.textAnnotations = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -32056,101 +31318,220 @@ } /** - * Position x. - * @member {number} x - * @memberof google.cloud.vision.v1p1beta1.Position + * AnnotateImageResponse faceAnnotations. + * @member {Array.} faceAnnotations + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse * @instance */ - Position.prototype.x = 0; + AnnotateImageResponse.prototype.faceAnnotations = $util.emptyArray; /** - * Position y. - * @member {number} y - * @memberof google.cloud.vision.v1p1beta1.Position + * AnnotateImageResponse landmarkAnnotations. + * @member {Array.} landmarkAnnotations + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse * @instance */ - Position.prototype.y = 0; + AnnotateImageResponse.prototype.landmarkAnnotations = $util.emptyArray; /** - * Position z. - * @member {number} z - * @memberof google.cloud.vision.v1p1beta1.Position + * AnnotateImageResponse logoAnnotations. + * @member {Array.} logoAnnotations + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse * @instance */ - Position.prototype.z = 0; + AnnotateImageResponse.prototype.logoAnnotations = $util.emptyArray; /** - * Creates a new Position instance using the specified properties. + * AnnotateImageResponse labelAnnotations. + * @member {Array.} labelAnnotations + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse + * @instance + */ + AnnotateImageResponse.prototype.labelAnnotations = $util.emptyArray; + + /** + * AnnotateImageResponse textAnnotations. + * @member {Array.} textAnnotations + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse + * @instance + */ + AnnotateImageResponse.prototype.textAnnotations = $util.emptyArray; + + /** + * AnnotateImageResponse fullTextAnnotation. + * @member {google.cloud.vision.v1p1beta1.ITextAnnotation|null|undefined} fullTextAnnotation + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse + * @instance + */ + AnnotateImageResponse.prototype.fullTextAnnotation = null; + + /** + * AnnotateImageResponse safeSearchAnnotation. + * @member {google.cloud.vision.v1p1beta1.ISafeSearchAnnotation|null|undefined} safeSearchAnnotation + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse + * @instance + */ + AnnotateImageResponse.prototype.safeSearchAnnotation = null; + + /** + * AnnotateImageResponse imagePropertiesAnnotation. + * @member {google.cloud.vision.v1p1beta1.IImageProperties|null|undefined} imagePropertiesAnnotation + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse + * @instance + */ + AnnotateImageResponse.prototype.imagePropertiesAnnotation = null; + + /** + * AnnotateImageResponse cropHintsAnnotation. + * @member {google.cloud.vision.v1p1beta1.ICropHintsAnnotation|null|undefined} cropHintsAnnotation + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse + * @instance + */ + AnnotateImageResponse.prototype.cropHintsAnnotation = null; + + /** + * AnnotateImageResponse webDetection. + * @member {google.cloud.vision.v1p1beta1.IWebDetection|null|undefined} webDetection + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse + * @instance + */ + AnnotateImageResponse.prototype.webDetection = null; + + /** + * AnnotateImageResponse error. + * @member {google.rpc.IStatus|null|undefined} error + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse + * @instance + */ + AnnotateImageResponse.prototype.error = null; + + /** + * Creates a new AnnotateImageResponse instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p1beta1.Position + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse * @static - * @param {google.cloud.vision.v1p1beta1.IPosition=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.Position} Position instance + * @param {google.cloud.vision.v1p1beta1.IAnnotateImageResponse=} [properties] Properties to set + * @returns {google.cloud.vision.v1p1beta1.AnnotateImageResponse} AnnotateImageResponse instance */ - Position.create = function create(properties) { - return new Position(properties); + AnnotateImageResponse.create = function create(properties) { + return new AnnotateImageResponse(properties); }; /** - * Encodes the specified Position message. Does not implicitly {@link google.cloud.vision.v1p1beta1.Position.verify|verify} messages. + * Encodes the specified AnnotateImageResponse message. Does not implicitly {@link google.cloud.vision.v1p1beta1.AnnotateImageResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p1beta1.Position + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse * @static - * @param {google.cloud.vision.v1p1beta1.IPosition} message Position message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IAnnotateImageResponse} message AnnotateImageResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Position.encode = function encode(message, writer) { + AnnotateImageResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.x != null && message.hasOwnProperty("x")) - writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); - if (message.y != null && message.hasOwnProperty("y")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); - if (message.z != null && message.hasOwnProperty("z")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.z); + if (message.faceAnnotations != null && message.faceAnnotations.length) + for (var i = 0; i < message.faceAnnotations.length; ++i) + $root.google.cloud.vision.v1p1beta1.FaceAnnotation.encode(message.faceAnnotations[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.landmarkAnnotations != null && message.landmarkAnnotations.length) + for (var i = 0; i < message.landmarkAnnotations.length; ++i) + $root.google.cloud.vision.v1p1beta1.EntityAnnotation.encode(message.landmarkAnnotations[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.logoAnnotations != null && message.logoAnnotations.length) + for (var i = 0; i < message.logoAnnotations.length; ++i) + $root.google.cloud.vision.v1p1beta1.EntityAnnotation.encode(message.logoAnnotations[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.labelAnnotations != null && message.labelAnnotations.length) + for (var i = 0; i < message.labelAnnotations.length; ++i) + $root.google.cloud.vision.v1p1beta1.EntityAnnotation.encode(message.labelAnnotations[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.textAnnotations != null && message.textAnnotations.length) + for (var i = 0; i < message.textAnnotations.length; ++i) + $root.google.cloud.vision.v1p1beta1.EntityAnnotation.encode(message.textAnnotations[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.safeSearchAnnotation != null && message.hasOwnProperty("safeSearchAnnotation")) + $root.google.cloud.vision.v1p1beta1.SafeSearchAnnotation.encode(message.safeSearchAnnotation, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.imagePropertiesAnnotation != null && message.hasOwnProperty("imagePropertiesAnnotation")) + $root.google.cloud.vision.v1p1beta1.ImageProperties.encode(message.imagePropertiesAnnotation, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.error != null && message.hasOwnProperty("error")) + $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.cropHintsAnnotation != null && message.hasOwnProperty("cropHintsAnnotation")) + $root.google.cloud.vision.v1p1beta1.CropHintsAnnotation.encode(message.cropHintsAnnotation, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.fullTextAnnotation != null && message.hasOwnProperty("fullTextAnnotation")) + $root.google.cloud.vision.v1p1beta1.TextAnnotation.encode(message.fullTextAnnotation, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.webDetection != null && message.hasOwnProperty("webDetection")) + $root.google.cloud.vision.v1p1beta1.WebDetection.encode(message.webDetection, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); return writer; }; /** - * Encodes the specified Position message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.Position.verify|verify} messages. + * Encodes the specified AnnotateImageResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.AnnotateImageResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.Position + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse * @static - * @param {google.cloud.vision.v1p1beta1.IPosition} message Position message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IAnnotateImageResponse} message AnnotateImageResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Position.encodeDelimited = function encodeDelimited(message, writer) { + AnnotateImageResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Position message from the specified reader or buffer. + * Decodes an AnnotateImageResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p1beta1.Position + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p1beta1.Position} Position + * @returns {google.cloud.vision.v1p1beta1.AnnotateImageResponse} AnnotateImageResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Position.decode = function decode(reader, length) { + AnnotateImageResponse.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.vision.v1p1beta1.Position(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p1beta1.AnnotateImageResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.x = reader.float(); + if (!(message.faceAnnotations && message.faceAnnotations.length)) + message.faceAnnotations = []; + message.faceAnnotations.push($root.google.cloud.vision.v1p1beta1.FaceAnnotation.decode(reader, reader.uint32())); break; case 2: - message.y = reader.float(); + if (!(message.landmarkAnnotations && message.landmarkAnnotations.length)) + message.landmarkAnnotations = []; + message.landmarkAnnotations.push($root.google.cloud.vision.v1p1beta1.EntityAnnotation.decode(reader, reader.uint32())); break; case 3: - message.z = reader.float(); + if (!(message.logoAnnotations && message.logoAnnotations.length)) + message.logoAnnotations = []; + message.logoAnnotations.push($root.google.cloud.vision.v1p1beta1.EntityAnnotation.decode(reader, reader.uint32())); + break; + case 4: + if (!(message.labelAnnotations && message.labelAnnotations.length)) + message.labelAnnotations = []; + message.labelAnnotations.push($root.google.cloud.vision.v1p1beta1.EntityAnnotation.decode(reader, reader.uint32())); + break; + case 5: + if (!(message.textAnnotations && message.textAnnotations.length)) + message.textAnnotations = []; + message.textAnnotations.push($root.google.cloud.vision.v1p1beta1.EntityAnnotation.decode(reader, reader.uint32())); + break; + case 12: + message.fullTextAnnotation = $root.google.cloud.vision.v1p1beta1.TextAnnotation.decode(reader, reader.uint32()); + break; + case 6: + message.safeSearchAnnotation = $root.google.cloud.vision.v1p1beta1.SafeSearchAnnotation.decode(reader, reader.uint32()); + break; + case 8: + message.imagePropertiesAnnotation = $root.google.cloud.vision.v1p1beta1.ImageProperties.decode(reader, reader.uint32()); + break; + case 11: + message.cropHintsAnnotation = $root.google.cloud.vision.v1p1beta1.CropHintsAnnotation.decode(reader, reader.uint32()); + break; + case 13: + message.webDetection = $root.google.cloud.vision.v1p1beta1.WebDetection.decode(reader, reader.uint32()); + break; + case 9: + message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -32161,126 +31542,306 @@ }; /** - * Decodes a Position message from the specified reader or buffer, length delimited. + * Decodes an AnnotateImageResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.Position + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.Position} Position + * @returns {google.cloud.vision.v1p1beta1.AnnotateImageResponse} AnnotateImageResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Position.decodeDelimited = function decodeDelimited(reader) { + AnnotateImageResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Position message. + * Verifies an AnnotateImageResponse message. * @function verify - * @memberof google.cloud.vision.v1p1beta1.Position + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Position.verify = function verify(message) { + AnnotateImageResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.x != null && message.hasOwnProperty("x")) - if (typeof message.x !== "number") - return "x: number expected"; - if (message.y != null && message.hasOwnProperty("y")) - if (typeof message.y !== "number") - return "y: number expected"; - if (message.z != null && message.hasOwnProperty("z")) - if (typeof message.z !== "number") - return "z: number expected"; - return null; - }; - - /** - * Creates a Position message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.Position - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.Position} Position + if (message.faceAnnotations != null && message.hasOwnProperty("faceAnnotations")) { + if (!Array.isArray(message.faceAnnotations)) + return "faceAnnotations: array expected"; + for (var i = 0; i < message.faceAnnotations.length; ++i) { + var error = $root.google.cloud.vision.v1p1beta1.FaceAnnotation.verify(message.faceAnnotations[i]); + if (error) + return "faceAnnotations." + error; + } + } + if (message.landmarkAnnotations != null && message.hasOwnProperty("landmarkAnnotations")) { + if (!Array.isArray(message.landmarkAnnotations)) + return "landmarkAnnotations: array expected"; + for (var i = 0; i < message.landmarkAnnotations.length; ++i) { + var error = $root.google.cloud.vision.v1p1beta1.EntityAnnotation.verify(message.landmarkAnnotations[i]); + if (error) + return "landmarkAnnotations." + error; + } + } + if (message.logoAnnotations != null && message.hasOwnProperty("logoAnnotations")) { + if (!Array.isArray(message.logoAnnotations)) + return "logoAnnotations: array expected"; + for (var i = 0; i < message.logoAnnotations.length; ++i) { + var error = $root.google.cloud.vision.v1p1beta1.EntityAnnotation.verify(message.logoAnnotations[i]); + if (error) + return "logoAnnotations." + error; + } + } + if (message.labelAnnotations != null && message.hasOwnProperty("labelAnnotations")) { + if (!Array.isArray(message.labelAnnotations)) + return "labelAnnotations: array expected"; + for (var i = 0; i < message.labelAnnotations.length; ++i) { + var error = $root.google.cloud.vision.v1p1beta1.EntityAnnotation.verify(message.labelAnnotations[i]); + if (error) + return "labelAnnotations." + error; + } + } + if (message.textAnnotations != null && message.hasOwnProperty("textAnnotations")) { + if (!Array.isArray(message.textAnnotations)) + return "textAnnotations: array expected"; + for (var i = 0; i < message.textAnnotations.length; ++i) { + var error = $root.google.cloud.vision.v1p1beta1.EntityAnnotation.verify(message.textAnnotations[i]); + if (error) + return "textAnnotations." + error; + } + } + if (message.fullTextAnnotation != null && message.hasOwnProperty("fullTextAnnotation")) { + var error = $root.google.cloud.vision.v1p1beta1.TextAnnotation.verify(message.fullTextAnnotation); + if (error) + return "fullTextAnnotation." + error; + } + if (message.safeSearchAnnotation != null && message.hasOwnProperty("safeSearchAnnotation")) { + var error = $root.google.cloud.vision.v1p1beta1.SafeSearchAnnotation.verify(message.safeSearchAnnotation); + if (error) + return "safeSearchAnnotation." + error; + } + if (message.imagePropertiesAnnotation != null && message.hasOwnProperty("imagePropertiesAnnotation")) { + var error = $root.google.cloud.vision.v1p1beta1.ImageProperties.verify(message.imagePropertiesAnnotation); + if (error) + return "imagePropertiesAnnotation." + error; + } + if (message.cropHintsAnnotation != null && message.hasOwnProperty("cropHintsAnnotation")) { + var error = $root.google.cloud.vision.v1p1beta1.CropHintsAnnotation.verify(message.cropHintsAnnotation); + if (error) + return "cropHintsAnnotation." + error; + } + if (message.webDetection != null && message.hasOwnProperty("webDetection")) { + var error = $root.google.cloud.vision.v1p1beta1.WebDetection.verify(message.webDetection); + if (error) + return "webDetection." + error; + } + if (message.error != null && message.hasOwnProperty("error")) { + var error = $root.google.rpc.Status.verify(message.error); + if (error) + return "error." + error; + } + return null; + }; + + /** + * Creates an AnnotateImageResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.vision.v1p1beta1.AnnotateImageResponse} AnnotateImageResponse */ - Position.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.Position) + AnnotateImageResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p1beta1.AnnotateImageResponse) return object; - var message = new $root.google.cloud.vision.v1p1beta1.Position(); - if (object.x != null) - message.x = Number(object.x); - if (object.y != null) - message.y = Number(object.y); - if (object.z != null) - message.z = Number(object.z); + var message = new $root.google.cloud.vision.v1p1beta1.AnnotateImageResponse(); + if (object.faceAnnotations) { + if (!Array.isArray(object.faceAnnotations)) + throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.faceAnnotations: array expected"); + message.faceAnnotations = []; + for (var i = 0; i < object.faceAnnotations.length; ++i) { + if (typeof object.faceAnnotations[i] !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.faceAnnotations: object expected"); + message.faceAnnotations[i] = $root.google.cloud.vision.v1p1beta1.FaceAnnotation.fromObject(object.faceAnnotations[i]); + } + } + if (object.landmarkAnnotations) { + if (!Array.isArray(object.landmarkAnnotations)) + throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.landmarkAnnotations: array expected"); + message.landmarkAnnotations = []; + for (var i = 0; i < object.landmarkAnnotations.length; ++i) { + if (typeof object.landmarkAnnotations[i] !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.landmarkAnnotations: object expected"); + message.landmarkAnnotations[i] = $root.google.cloud.vision.v1p1beta1.EntityAnnotation.fromObject(object.landmarkAnnotations[i]); + } + } + if (object.logoAnnotations) { + if (!Array.isArray(object.logoAnnotations)) + throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.logoAnnotations: array expected"); + message.logoAnnotations = []; + for (var i = 0; i < object.logoAnnotations.length; ++i) { + if (typeof object.logoAnnotations[i] !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.logoAnnotations: object expected"); + message.logoAnnotations[i] = $root.google.cloud.vision.v1p1beta1.EntityAnnotation.fromObject(object.logoAnnotations[i]); + } + } + if (object.labelAnnotations) { + if (!Array.isArray(object.labelAnnotations)) + throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.labelAnnotations: array expected"); + message.labelAnnotations = []; + for (var i = 0; i < object.labelAnnotations.length; ++i) { + if (typeof object.labelAnnotations[i] !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.labelAnnotations: object expected"); + message.labelAnnotations[i] = $root.google.cloud.vision.v1p1beta1.EntityAnnotation.fromObject(object.labelAnnotations[i]); + } + } + if (object.textAnnotations) { + if (!Array.isArray(object.textAnnotations)) + throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.textAnnotations: array expected"); + message.textAnnotations = []; + for (var i = 0; i < object.textAnnotations.length; ++i) { + if (typeof object.textAnnotations[i] !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.textAnnotations: object expected"); + message.textAnnotations[i] = $root.google.cloud.vision.v1p1beta1.EntityAnnotation.fromObject(object.textAnnotations[i]); + } + } + if (object.fullTextAnnotation != null) { + if (typeof object.fullTextAnnotation !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.fullTextAnnotation: object expected"); + message.fullTextAnnotation = $root.google.cloud.vision.v1p1beta1.TextAnnotation.fromObject(object.fullTextAnnotation); + } + if (object.safeSearchAnnotation != null) { + if (typeof object.safeSearchAnnotation !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.safeSearchAnnotation: object expected"); + message.safeSearchAnnotation = $root.google.cloud.vision.v1p1beta1.SafeSearchAnnotation.fromObject(object.safeSearchAnnotation); + } + if (object.imagePropertiesAnnotation != null) { + if (typeof object.imagePropertiesAnnotation !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.imagePropertiesAnnotation: object expected"); + message.imagePropertiesAnnotation = $root.google.cloud.vision.v1p1beta1.ImageProperties.fromObject(object.imagePropertiesAnnotation); + } + if (object.cropHintsAnnotation != null) { + if (typeof object.cropHintsAnnotation !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.cropHintsAnnotation: object expected"); + message.cropHintsAnnotation = $root.google.cloud.vision.v1p1beta1.CropHintsAnnotation.fromObject(object.cropHintsAnnotation); + } + if (object.webDetection != null) { + if (typeof object.webDetection !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.webDetection: object expected"); + message.webDetection = $root.google.cloud.vision.v1p1beta1.WebDetection.fromObject(object.webDetection); + } + if (object.error != null) { + if (typeof object.error !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.AnnotateImageResponse.error: object expected"); + message.error = $root.google.rpc.Status.fromObject(object.error); + } return message; }; /** - * Creates a plain object from a Position message. Also converts values to other types if specified. + * Creates a plain object from an AnnotateImageResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p1beta1.Position + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse * @static - * @param {google.cloud.vision.v1p1beta1.Position} message Position + * @param {google.cloud.vision.v1p1beta1.AnnotateImageResponse} message AnnotateImageResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Position.toObject = function toObject(message, options) { + AnnotateImageResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) { + object.faceAnnotations = []; + object.landmarkAnnotations = []; + object.logoAnnotations = []; + object.labelAnnotations = []; + object.textAnnotations = []; + } if (options.defaults) { - object.x = 0; - object.y = 0; - object.z = 0; + object.safeSearchAnnotation = null; + object.imagePropertiesAnnotation = null; + object.error = null; + object.cropHintsAnnotation = null; + object.fullTextAnnotation = null; + object.webDetection = null; } - if (message.x != null && message.hasOwnProperty("x")) - object.x = options.json && !isFinite(message.x) ? String(message.x) : message.x; - if (message.y != null && message.hasOwnProperty("y")) - object.y = options.json && !isFinite(message.y) ? String(message.y) : message.y; - if (message.z != null && message.hasOwnProperty("z")) - object.z = options.json && !isFinite(message.z) ? String(message.z) : message.z; + if (message.faceAnnotations && message.faceAnnotations.length) { + object.faceAnnotations = []; + for (var j = 0; j < message.faceAnnotations.length; ++j) + object.faceAnnotations[j] = $root.google.cloud.vision.v1p1beta1.FaceAnnotation.toObject(message.faceAnnotations[j], options); + } + if (message.landmarkAnnotations && message.landmarkAnnotations.length) { + object.landmarkAnnotations = []; + for (var j = 0; j < message.landmarkAnnotations.length; ++j) + object.landmarkAnnotations[j] = $root.google.cloud.vision.v1p1beta1.EntityAnnotation.toObject(message.landmarkAnnotations[j], options); + } + if (message.logoAnnotations && message.logoAnnotations.length) { + object.logoAnnotations = []; + for (var j = 0; j < message.logoAnnotations.length; ++j) + object.logoAnnotations[j] = $root.google.cloud.vision.v1p1beta1.EntityAnnotation.toObject(message.logoAnnotations[j], options); + } + if (message.labelAnnotations && message.labelAnnotations.length) { + object.labelAnnotations = []; + for (var j = 0; j < message.labelAnnotations.length; ++j) + object.labelAnnotations[j] = $root.google.cloud.vision.v1p1beta1.EntityAnnotation.toObject(message.labelAnnotations[j], options); + } + if (message.textAnnotations && message.textAnnotations.length) { + object.textAnnotations = []; + for (var j = 0; j < message.textAnnotations.length; ++j) + object.textAnnotations[j] = $root.google.cloud.vision.v1p1beta1.EntityAnnotation.toObject(message.textAnnotations[j], options); + } + if (message.safeSearchAnnotation != null && message.hasOwnProperty("safeSearchAnnotation")) + object.safeSearchAnnotation = $root.google.cloud.vision.v1p1beta1.SafeSearchAnnotation.toObject(message.safeSearchAnnotation, options); + if (message.imagePropertiesAnnotation != null && message.hasOwnProperty("imagePropertiesAnnotation")) + object.imagePropertiesAnnotation = $root.google.cloud.vision.v1p1beta1.ImageProperties.toObject(message.imagePropertiesAnnotation, options); + if (message.error != null && message.hasOwnProperty("error")) + object.error = $root.google.rpc.Status.toObject(message.error, options); + if (message.cropHintsAnnotation != null && message.hasOwnProperty("cropHintsAnnotation")) + object.cropHintsAnnotation = $root.google.cloud.vision.v1p1beta1.CropHintsAnnotation.toObject(message.cropHintsAnnotation, options); + if (message.fullTextAnnotation != null && message.hasOwnProperty("fullTextAnnotation")) + object.fullTextAnnotation = $root.google.cloud.vision.v1p1beta1.TextAnnotation.toObject(message.fullTextAnnotation, options); + if (message.webDetection != null && message.hasOwnProperty("webDetection")) + object.webDetection = $root.google.cloud.vision.v1p1beta1.WebDetection.toObject(message.webDetection, options); return object; }; /** - * Converts this Position to JSON. + * Converts this AnnotateImageResponse to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.Position + * @memberof google.cloud.vision.v1p1beta1.AnnotateImageResponse * @instance * @returns {Object.} JSON object */ - Position.prototype.toJSON = function toJSON() { + AnnotateImageResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Position; + return AnnotateImageResponse; })(); - v1p1beta1.TextAnnotation = (function() { + v1p1beta1.BatchAnnotateImagesRequest = (function() { /** - * Properties of a TextAnnotation. + * Properties of a BatchAnnotateImagesRequest. * @memberof google.cloud.vision.v1p1beta1 - * @interface ITextAnnotation - * @property {Array.|null} [pages] TextAnnotation pages - * @property {string|null} [text] TextAnnotation text + * @interface IBatchAnnotateImagesRequest + * @property {Array.|null} [requests] BatchAnnotateImagesRequest requests */ /** - * Constructs a new TextAnnotation. + * Constructs a new BatchAnnotateImagesRequest. * @memberof google.cloud.vision.v1p1beta1 - * @classdesc Represents a TextAnnotation. - * @implements ITextAnnotation + * @classdesc Represents a BatchAnnotateImagesRequest. + * @implements IBatchAnnotateImagesRequest * @constructor - * @param {google.cloud.vision.v1p1beta1.ITextAnnotation=} [properties] Properties to set + * @param {google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest=} [properties] Properties to set */ - function TextAnnotation(properties) { - this.pages = []; + function BatchAnnotateImagesRequest(properties) { + this.requests = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -32288,91 +31849,78 @@ } /** - * TextAnnotation pages. - * @member {Array.} pages - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation - * @instance - */ - TextAnnotation.prototype.pages = $util.emptyArray; - - /** - * TextAnnotation text. - * @member {string} text - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation + * BatchAnnotateImagesRequest requests. + * @member {Array.} requests + * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest * @instance */ - TextAnnotation.prototype.text = ""; + BatchAnnotateImagesRequest.prototype.requests = $util.emptyArray; /** - * Creates a new TextAnnotation instance using the specified properties. + * Creates a new BatchAnnotateImagesRequest instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation + * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest * @static - * @param {google.cloud.vision.v1p1beta1.ITextAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.TextAnnotation} TextAnnotation instance + * @param {google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest=} [properties] Properties to set + * @returns {google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest instance */ - TextAnnotation.create = function create(properties) { - return new TextAnnotation(properties); + BatchAnnotateImagesRequest.create = function create(properties) { + return new BatchAnnotateImagesRequest(properties); }; /** - * Encodes the specified TextAnnotation message. Does not implicitly {@link google.cloud.vision.v1p1beta1.TextAnnotation.verify|verify} messages. + * Encodes the specified BatchAnnotateImagesRequest message. Does not implicitly {@link google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation + * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest * @static - * @param {google.cloud.vision.v1p1beta1.ITextAnnotation} message TextAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest} message BatchAnnotateImagesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - TextAnnotation.encode = function encode(message, writer) { + BatchAnnotateImagesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.pages != null && message.pages.length) - for (var i = 0; i < message.pages.length; ++i) - $root.google.cloud.vision.v1p1beta1.Page.encode(message.pages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.text != null && message.hasOwnProperty("text")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.text); + if (message.requests != null && message.requests.length) + for (var i = 0; i < message.requests.length; ++i) + $root.google.cloud.vision.v1p1beta1.AnnotateImageRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified TextAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.TextAnnotation.verify|verify} messages. + * Encodes the specified BatchAnnotateImagesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation + * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest * @static - * @param {google.cloud.vision.v1p1beta1.ITextAnnotation} message TextAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest} message BatchAnnotateImagesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - TextAnnotation.encodeDelimited = function encodeDelimited(message, writer) { + BatchAnnotateImagesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a TextAnnotation message from the specified reader or buffer. + * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation + * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p1beta1.TextAnnotation} TextAnnotation + * @returns {google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - TextAnnotation.decode = function decode(reader, length) { + BatchAnnotateImagesRequest.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.vision.v1p1beta1.TextAnnotation(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.pages && message.pages.length)) - message.pages = []; - message.pages.push($root.google.cloud.vision.v1p1beta1.Page.decode(reader, reader.uint32())); - break; - case 2: - message.text = reader.string(); + if (!(message.requests && message.requests.length)) + message.requests = []; + message.requests.push($root.google.cloud.vision.v1p1beta1.AnnotateImageRequest.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -32383,167 +31931,619 @@ }; /** - * Decodes a TextAnnotation message from the specified reader or buffer, length delimited. + * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation + * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p1beta1.TextAnnotation} TextAnnotation + * @returns {google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - TextAnnotation.decodeDelimited = function decodeDelimited(reader) { + BatchAnnotateImagesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a TextAnnotation message. + * Verifies a BatchAnnotateImagesRequest message. * @function verify - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation + * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - TextAnnotation.verify = function verify(message) { + BatchAnnotateImagesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.pages != null && message.hasOwnProperty("pages")) { - if (!Array.isArray(message.pages)) - return "pages: array expected"; - for (var i = 0; i < message.pages.length; ++i) { - var error = $root.google.cloud.vision.v1p1beta1.Page.verify(message.pages[i]); + if (message.requests != null && message.hasOwnProperty("requests")) { + if (!Array.isArray(message.requests)) + return "requests: array expected"; + for (var i = 0; i < message.requests.length; ++i) { + var error = $root.google.cloud.vision.v1p1beta1.AnnotateImageRequest.verify(message.requests[i]); if (error) - return "pages." + error; + return "requests." + error; } } - if (message.text != null && message.hasOwnProperty("text")) - if (!$util.isString(message.text)) - return "text: string expected"; return null; }; /** - * Creates a TextAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates a BatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation + * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p1beta1.TextAnnotation} TextAnnotation + * @returns {google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest */ - TextAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p1beta1.TextAnnotation) + BatchAnnotateImagesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest) return object; - var message = new $root.google.cloud.vision.v1p1beta1.TextAnnotation(); - if (object.pages) { - if (!Array.isArray(object.pages)) - throw TypeError(".google.cloud.vision.v1p1beta1.TextAnnotation.pages: array expected"); - message.pages = []; - for (var i = 0; i < object.pages.length; ++i) { - if (typeof object.pages[i] !== "object") - throw TypeError(".google.cloud.vision.v1p1beta1.TextAnnotation.pages: object expected"); - message.pages[i] = $root.google.cloud.vision.v1p1beta1.Page.fromObject(object.pages[i]); + var message = new $root.google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest(); + if (object.requests) { + if (!Array.isArray(object.requests)) + throw TypeError(".google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest.requests: array expected"); + message.requests = []; + for (var i = 0; i < object.requests.length; ++i) { + if (typeof object.requests[i] !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest.requests: object expected"); + message.requests[i] = $root.google.cloud.vision.v1p1beta1.AnnotateImageRequest.fromObject(object.requests[i]); } } - if (object.text != null) - message.text = String(object.text); return message; }; /** - * Creates a plain object from a TextAnnotation message. Also converts values to other types if specified. + * Creates a plain object from a BatchAnnotateImagesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation + * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest * @static - * @param {google.cloud.vision.v1p1beta1.TextAnnotation} message TextAnnotation + * @param {google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest} message BatchAnnotateImagesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - TextAnnotation.toObject = function toObject(message, options) { + BatchAnnotateImagesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.pages = []; - if (options.defaults) - object.text = ""; - if (message.pages && message.pages.length) { - object.pages = []; - for (var j = 0; j < message.pages.length; ++j) - object.pages[j] = $root.google.cloud.vision.v1p1beta1.Page.toObject(message.pages[j], options); + object.requests = []; + if (message.requests && message.requests.length) { + object.requests = []; + for (var j = 0; j < message.requests.length; ++j) + object.requests[j] = $root.google.cloud.vision.v1p1beta1.AnnotateImageRequest.toObject(message.requests[j], options); } - if (message.text != null && message.hasOwnProperty("text")) - object.text = message.text; return object; }; /** - * Converts this TextAnnotation to JSON. + * Converts this BatchAnnotateImagesRequest to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation + * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest * @instance * @returns {Object.} JSON object */ - TextAnnotation.prototype.toJSON = function toJSON() { + BatchAnnotateImagesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - TextAnnotation.DetectedLanguage = (function() { - - /** - * Properties of a DetectedLanguage. - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation - * @interface IDetectedLanguage - * @property {string|null} [languageCode] DetectedLanguage languageCode - * @property {number|null} [confidence] DetectedLanguage confidence - */ + return BatchAnnotateImagesRequest; + })(); - /** - * Constructs a new DetectedLanguage. - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation - * @classdesc Represents a DetectedLanguage. - * @implements IDetectedLanguage - * @constructor - * @param {google.cloud.vision.v1p1beta1.TextAnnotation.IDetectedLanguage=} [properties] Properties to set - */ - function DetectedLanguage(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]]; - } + v1p1beta1.BatchAnnotateImagesResponse = (function() { - /** - * DetectedLanguage languageCode. - * @member {string} languageCode - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage - * @instance - */ - DetectedLanguage.prototype.languageCode = ""; + /** + * Properties of a BatchAnnotateImagesResponse. + * @memberof google.cloud.vision.v1p1beta1 + * @interface IBatchAnnotateImagesResponse + * @property {Array.|null} [responses] BatchAnnotateImagesResponse responses + */ - /** - * DetectedLanguage confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage - * @instance - */ - DetectedLanguage.prototype.confidence = 0; + /** + * Constructs a new BatchAnnotateImagesResponse. + * @memberof google.cloud.vision.v1p1beta1 + * @classdesc Represents a BatchAnnotateImagesResponse. + * @implements IBatchAnnotateImagesResponse + * @constructor + * @param {google.cloud.vision.v1p1beta1.IBatchAnnotateImagesResponse=} [properties] Properties to set + */ + function BatchAnnotateImagesResponse(properties) { + this.responses = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Creates a new DetectedLanguage instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage - * @static - * @param {google.cloud.vision.v1p1beta1.TextAnnotation.IDetectedLanguage=} [properties] Properties to set - * @returns {google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage} DetectedLanguage instance - */ - DetectedLanguage.create = function create(properties) { - return new DetectedLanguage(properties); - }; + /** + * BatchAnnotateImagesResponse responses. + * @member {Array.} responses + * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse + * @instance + */ + BatchAnnotateImagesResponse.prototype.responses = $util.emptyArray; - /** - * Encodes the specified DetectedLanguage message. Does not implicitly {@link google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage.verify|verify} messages. + /** + * Creates a new BatchAnnotateImagesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse + * @static + * @param {google.cloud.vision.v1p1beta1.IBatchAnnotateImagesResponse=} [properties] Properties to set + * @returns {google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse instance + */ + BatchAnnotateImagesResponse.create = function create(properties) { + return new BatchAnnotateImagesResponse(properties); + }; + + /** + * Encodes the specified BatchAnnotateImagesResponse message. Does not implicitly {@link google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse + * @static + * @param {google.cloud.vision.v1p1beta1.IBatchAnnotateImagesResponse} message BatchAnnotateImagesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchAnnotateImagesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.responses != null && message.responses.length) + for (var i = 0; i < message.responses.length; ++i) + $root.google.cloud.vision.v1p1beta1.AnnotateImageResponse.encode(message.responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchAnnotateImagesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse + * @static + * @param {google.cloud.vision.v1p1beta1.IBatchAnnotateImagesResponse} message BatchAnnotateImagesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchAnnotateImagesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchAnnotateImagesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchAnnotateImagesResponse.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.vision.v1p1beta1.BatchAnnotateImagesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.responses && message.responses.length)) + message.responses = []; + message.responses.push($root.google.cloud.vision.v1p1beta1.AnnotateImageResponse.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchAnnotateImagesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchAnnotateImagesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchAnnotateImagesResponse message. + * @function verify + * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchAnnotateImagesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.responses != null && message.hasOwnProperty("responses")) { + if (!Array.isArray(message.responses)) + return "responses: array expected"; + for (var i = 0; i < message.responses.length; ++i) { + var error = $root.google.cloud.vision.v1p1beta1.AnnotateImageResponse.verify(message.responses[i]); + if (error) + return "responses." + error; + } + } + return null; + }; + + /** + * Creates a BatchAnnotateImagesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse + */ + BatchAnnotateImagesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse) + return object; + var message = new $root.google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse(); + if (object.responses) { + if (!Array.isArray(object.responses)) + throw TypeError(".google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse.responses: array expected"); + message.responses = []; + for (var i = 0; i < object.responses.length; ++i) { + if (typeof object.responses[i] !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse.responses: object expected"); + message.responses[i] = $root.google.cloud.vision.v1p1beta1.AnnotateImageResponse.fromObject(object.responses[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a BatchAnnotateImagesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse + * @static + * @param {google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse} message BatchAnnotateImagesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchAnnotateImagesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.responses = []; + if (message.responses && message.responses.length) { + object.responses = []; + for (var j = 0; j < message.responses.length; ++j) + object.responses[j] = $root.google.cloud.vision.v1p1beta1.AnnotateImageResponse.toObject(message.responses[j], options); + } + return object; + }; + + /** + * Converts this BatchAnnotateImagesResponse to JSON. + * @function toJSON + * @memberof google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse + * @instance + * @returns {Object.} JSON object + */ + BatchAnnotateImagesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return BatchAnnotateImagesResponse; + })(); + + /** + * Likelihood enum. + * @name google.cloud.vision.v1p1beta1.Likelihood + * @enum {string} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} VERY_UNLIKELY=1 VERY_UNLIKELY value + * @property {number} UNLIKELY=2 UNLIKELY value + * @property {number} POSSIBLE=3 POSSIBLE value + * @property {number} LIKELY=4 LIKELY value + * @property {number} VERY_LIKELY=5 VERY_LIKELY value + */ + v1p1beta1.Likelihood = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "VERY_UNLIKELY"] = 1; + values[valuesById[2] = "UNLIKELY"] = 2; + values[valuesById[3] = "POSSIBLE"] = 3; + values[valuesById[4] = "LIKELY"] = 4; + values[valuesById[5] = "VERY_LIKELY"] = 5; + return values; + })(); + + v1p1beta1.TextAnnotation = (function() { + + /** + * Properties of a TextAnnotation. + * @memberof google.cloud.vision.v1p1beta1 + * @interface ITextAnnotation + * @property {Array.|null} [pages] TextAnnotation pages + * @property {string|null} [text] TextAnnotation text + */ + + /** + * Constructs a new TextAnnotation. + * @memberof google.cloud.vision.v1p1beta1 + * @classdesc Represents a TextAnnotation. + * @implements ITextAnnotation + * @constructor + * @param {google.cloud.vision.v1p1beta1.ITextAnnotation=} [properties] Properties to set + */ + function TextAnnotation(properties) { + this.pages = []; + 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]]; + } + + /** + * TextAnnotation pages. + * @member {Array.} pages + * @memberof google.cloud.vision.v1p1beta1.TextAnnotation + * @instance + */ + TextAnnotation.prototype.pages = $util.emptyArray; + + /** + * TextAnnotation text. + * @member {string} text + * @memberof google.cloud.vision.v1p1beta1.TextAnnotation + * @instance + */ + TextAnnotation.prototype.text = ""; + + /** + * Creates a new TextAnnotation instance using the specified properties. + * @function create + * @memberof google.cloud.vision.v1p1beta1.TextAnnotation + * @static + * @param {google.cloud.vision.v1p1beta1.ITextAnnotation=} [properties] Properties to set + * @returns {google.cloud.vision.v1p1beta1.TextAnnotation} TextAnnotation instance + */ + TextAnnotation.create = function create(properties) { + return new TextAnnotation(properties); + }; + + /** + * Encodes the specified TextAnnotation message. Does not implicitly {@link google.cloud.vision.v1p1beta1.TextAnnotation.verify|verify} messages. + * @function encode + * @memberof google.cloud.vision.v1p1beta1.TextAnnotation + * @static + * @param {google.cloud.vision.v1p1beta1.ITextAnnotation} message TextAnnotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextAnnotation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pages != null && message.pages.length) + for (var i = 0; i < message.pages.length; ++i) + $root.google.cloud.vision.v1p1beta1.Page.encode(message.pages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.text != null && message.hasOwnProperty("text")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.text); + return writer; + }; + + /** + * Encodes the specified TextAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p1beta1.TextAnnotation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.vision.v1p1beta1.TextAnnotation + * @static + * @param {google.cloud.vision.v1p1beta1.ITextAnnotation} message TextAnnotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextAnnotation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TextAnnotation message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.vision.v1p1beta1.TextAnnotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.vision.v1p1beta1.TextAnnotation} TextAnnotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextAnnotation.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.vision.v1p1beta1.TextAnnotation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.pages && message.pages.length)) + message.pages = []; + message.pages.push($root.google.cloud.vision.v1p1beta1.Page.decode(reader, reader.uint32())); + break; + case 2: + message.text = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TextAnnotation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.vision.v1p1beta1.TextAnnotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.vision.v1p1beta1.TextAnnotation} TextAnnotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextAnnotation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TextAnnotation message. + * @function verify + * @memberof google.cloud.vision.v1p1beta1.TextAnnotation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TextAnnotation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pages != null && message.hasOwnProperty("pages")) { + if (!Array.isArray(message.pages)) + return "pages: array expected"; + for (var i = 0; i < message.pages.length; ++i) { + var error = $root.google.cloud.vision.v1p1beta1.Page.verify(message.pages[i]); + if (error) + return "pages." + error; + } + } + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + return null; + }; + + /** + * Creates a TextAnnotation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.vision.v1p1beta1.TextAnnotation + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.vision.v1p1beta1.TextAnnotation} TextAnnotation + */ + TextAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p1beta1.TextAnnotation) + return object; + var message = new $root.google.cloud.vision.v1p1beta1.TextAnnotation(); + if (object.pages) { + if (!Array.isArray(object.pages)) + throw TypeError(".google.cloud.vision.v1p1beta1.TextAnnotation.pages: array expected"); + message.pages = []; + for (var i = 0; i < object.pages.length; ++i) { + if (typeof object.pages[i] !== "object") + throw TypeError(".google.cloud.vision.v1p1beta1.TextAnnotation.pages: object expected"); + message.pages[i] = $root.google.cloud.vision.v1p1beta1.Page.fromObject(object.pages[i]); + } + } + if (object.text != null) + message.text = String(object.text); + return message; + }; + + /** + * Creates a plain object from a TextAnnotation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.vision.v1p1beta1.TextAnnotation + * @static + * @param {google.cloud.vision.v1p1beta1.TextAnnotation} message TextAnnotation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TextAnnotation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.pages = []; + if (options.defaults) + object.text = ""; + if (message.pages && message.pages.length) { + object.pages = []; + for (var j = 0; j < message.pages.length; ++j) + object.pages[j] = $root.google.cloud.vision.v1p1beta1.Page.toObject(message.pages[j], options); + } + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + return object; + }; + + /** + * Converts this TextAnnotation to JSON. + * @function toJSON + * @memberof google.cloud.vision.v1p1beta1.TextAnnotation + * @instance + * @returns {Object.} JSON object + */ + TextAnnotation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + TextAnnotation.DetectedLanguage = (function() { + + /** + * Properties of a DetectedLanguage. + * @memberof google.cloud.vision.v1p1beta1.TextAnnotation + * @interface IDetectedLanguage + * @property {string|null} [languageCode] DetectedLanguage languageCode + * @property {number|null} [confidence] DetectedLanguage confidence + */ + + /** + * Constructs a new DetectedLanguage. + * @memberof google.cloud.vision.v1p1beta1.TextAnnotation + * @classdesc Represents a DetectedLanguage. + * @implements IDetectedLanguage + * @constructor + * @param {google.cloud.vision.v1p1beta1.TextAnnotation.IDetectedLanguage=} [properties] Properties to set + */ + function DetectedLanguage(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]]; + } + + /** + * DetectedLanguage languageCode. + * @member {string} languageCode + * @memberof google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage + * @instance + */ + DetectedLanguage.prototype.languageCode = ""; + + /** + * DetectedLanguage confidence. + * @member {number} confidence + * @memberof google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage + * @instance + */ + DetectedLanguage.prototype.confidence = 0; + + /** + * Creates a new DetectedLanguage instance using the specified properties. + * @function create + * @memberof google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage + * @static + * @param {google.cloud.vision.v1p1beta1.TextAnnotation.IDetectedLanguage=} [properties] Properties to set + * @returns {google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage} DetectedLanguage instance + */ + DetectedLanguage.create = function create(properties) { + return new DetectedLanguage(properties); + }; + + /** + * Encodes the specified DetectedLanguage message. Does not implicitly {@link google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage.verify|verify} messages. * @function encode * @memberof google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage * @static @@ -36113,127 +36113,25 @@ */ var v1p2beta1 = {}; - v1p2beta1.ImageAnnotator = (function() { - - /** - * Constructs a new ImageAnnotator service. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an ImageAnnotator - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function ImageAnnotator(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (ImageAnnotator.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ImageAnnotator; - - /** - * Creates new ImageAnnotator service using the specified rpc implementation. - * @function create - * @memberof google.cloud.vision.v1p2beta1.ImageAnnotator - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {ImageAnnotator} RPC service. Useful where requests and/or responses are streamed. - */ - ImageAnnotator.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.vision.v1p2beta1.ImageAnnotator#batchAnnotateImages}. - * @memberof google.cloud.vision.v1p2beta1.ImageAnnotator - * @typedef BatchAnnotateImagesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse} [response] BatchAnnotateImagesResponse - */ - - /** - * Calls BatchAnnotateImages. - * @function batchAnnotateImages - * @memberof google.cloud.vision.v1p2beta1.ImageAnnotator - * @instance - * @param {google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest} request BatchAnnotateImagesRequest message or plain object - * @param {google.cloud.vision.v1p2beta1.ImageAnnotator.BatchAnnotateImagesCallback} callback Node-style callback called with the error, if any, and BatchAnnotateImagesResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ImageAnnotator.prototype.batchAnnotateImages = function batchAnnotateImages(request, callback) { - return this.rpcCall(batchAnnotateImages, $root.google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest, $root.google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse, request, callback); - }, "name", { value: "BatchAnnotateImages" }); - - /** - * Calls BatchAnnotateImages. - * @function batchAnnotateImages - * @memberof google.cloud.vision.v1p2beta1.ImageAnnotator - * @instance - * @param {google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest} request BatchAnnotateImagesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.vision.v1p2beta1.ImageAnnotator#asyncBatchAnnotateFiles}. - * @memberof google.cloud.vision.v1p2beta1.ImageAnnotator - * @typedef AsyncBatchAnnotateFilesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation - */ - - /** - * Calls AsyncBatchAnnotateFiles. - * @function asyncBatchAnnotateFiles - * @memberof google.cloud.vision.v1p2beta1.ImageAnnotator - * @instance - * @param {google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesRequest} request AsyncBatchAnnotateFilesRequest message or plain object - * @param {google.cloud.vision.v1p2beta1.ImageAnnotator.AsyncBatchAnnotateFilesCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(ImageAnnotator.prototype.asyncBatchAnnotateFiles = function asyncBatchAnnotateFiles(request, callback) { - return this.rpcCall(asyncBatchAnnotateFiles, $root.google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "AsyncBatchAnnotateFiles" }); - - /** - * Calls AsyncBatchAnnotateFiles. - * @function asyncBatchAnnotateFiles - * @memberof google.cloud.vision.v1p2beta1.ImageAnnotator - * @instance - * @param {google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesRequest} request AsyncBatchAnnotateFilesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return ImageAnnotator; - })(); - - v1p2beta1.Feature = (function() { + v1p2beta1.Vertex = (function() { /** - * Properties of a Feature. + * Properties of a Vertex. * @memberof google.cloud.vision.v1p2beta1 - * @interface IFeature - * @property {google.cloud.vision.v1p2beta1.Feature.Type|null} [type] Feature type - * @property {number|null} [maxResults] Feature maxResults - * @property {string|null} [model] Feature model + * @interface IVertex + * @property {number|null} [x] Vertex x + * @property {number|null} [y] Vertex y */ /** - * Constructs a new Feature. + * Constructs a new Vertex. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a Feature. - * @implements IFeature + * @classdesc Represents a Vertex. + * @implements IVertex * @constructor - * @param {google.cloud.vision.v1p2beta1.IFeature=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.IVertex=} [properties] Properties to set */ - function Feature(properties) { + function Vertex(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -36241,101 +36139,88 @@ } /** - * Feature type. - * @member {google.cloud.vision.v1p2beta1.Feature.Type} type - * @memberof google.cloud.vision.v1p2beta1.Feature - * @instance - */ - Feature.prototype.type = 0; - - /** - * Feature maxResults. - * @member {number} maxResults - * @memberof google.cloud.vision.v1p2beta1.Feature + * Vertex x. + * @member {number} x + * @memberof google.cloud.vision.v1p2beta1.Vertex * @instance */ - Feature.prototype.maxResults = 0; + Vertex.prototype.x = 0; /** - * Feature model. - * @member {string} model - * @memberof google.cloud.vision.v1p2beta1.Feature + * Vertex y. + * @member {number} y + * @memberof google.cloud.vision.v1p2beta1.Vertex * @instance */ - Feature.prototype.model = ""; + Vertex.prototype.y = 0; /** - * Creates a new Feature instance using the specified properties. + * Creates a new Vertex instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.Feature + * @memberof google.cloud.vision.v1p2beta1.Vertex * @static - * @param {google.cloud.vision.v1p2beta1.IFeature=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.Feature} Feature instance + * @param {google.cloud.vision.v1p2beta1.IVertex=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.Vertex} Vertex instance */ - Feature.create = function create(properties) { - return new Feature(properties); + Vertex.create = function create(properties) { + return new Vertex(properties); }; /** - * Encodes the specified Feature message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Feature.verify|verify} messages. + * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Vertex.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.Feature + * @memberof google.cloud.vision.v1p2beta1.Vertex * @static - * @param {google.cloud.vision.v1p2beta1.IFeature} message Feature message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IVertex} message Vertex message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Feature.encode = function encode(message, writer) { + Vertex.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.type != null && message.hasOwnProperty("type")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); - if (message.maxResults != null && message.hasOwnProperty("maxResults")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.maxResults); - if (message.model != null && message.hasOwnProperty("model")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.model); + if (message.x != null && message.hasOwnProperty("x")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.x); + if (message.y != null && message.hasOwnProperty("y")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.y); return writer; }; /** - * Encodes the specified Feature message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.Feature.verify|verify} messages. + * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.Vertex.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.Feature + * @memberof google.cloud.vision.v1p2beta1.Vertex * @static - * @param {google.cloud.vision.v1p2beta1.IFeature} message Feature message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IVertex} message Vertex message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Feature.encodeDelimited = function encodeDelimited(message, writer) { + Vertex.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Feature message from the specified reader or buffer. + * Decodes a Vertex message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.Feature + * @memberof google.cloud.vision.v1p2beta1.Vertex * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.Feature} Feature + * @returns {google.cloud.vision.v1p2beta1.Vertex} Vertex * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Feature.decode = function decode(reader, length) { + Vertex.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.vision.v1p2beta1.Feature(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.Vertex(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.type = reader.int32(); + message.x = reader.int32(); break; case 2: - message.maxResults = reader.int32(); - break; - case 3: - message.model = reader.string(); + message.y = reader.int32(); break; default: reader.skipType(tag & 7); @@ -36346,215 +36231,117 @@ }; /** - * Decodes a Feature message from the specified reader or buffer, length delimited. + * Decodes a Vertex message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.Feature + * @memberof google.cloud.vision.v1p2beta1.Vertex * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.Feature} Feature + * @returns {google.cloud.vision.v1p2beta1.Vertex} Vertex * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Feature.decodeDelimited = function decodeDelimited(reader) { + Vertex.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Feature message. + * Verifies a Vertex message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.Feature + * @memberof google.cloud.vision.v1p2beta1.Vertex * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Feature.verify = function verify(message) { + Vertex.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 11: - case 6: - case 7: - case 9: - case 10: - break; - } - if (message.maxResults != null && message.hasOwnProperty("maxResults")) - if (!$util.isInteger(message.maxResults)) - return "maxResults: integer expected"; - if (message.model != null && message.hasOwnProperty("model")) - if (!$util.isString(message.model)) - return "model: string expected"; + if (message.x != null && message.hasOwnProperty("x")) + if (!$util.isInteger(message.x)) + return "x: integer expected"; + if (message.y != null && message.hasOwnProperty("y")) + if (!$util.isInteger(message.y)) + return "y: integer expected"; return null; }; /** - * Creates a Feature message from a plain object. Also converts values to their respective internal types. + * Creates a Vertex message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.Feature + * @memberof google.cloud.vision.v1p2beta1.Vertex * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.Feature} Feature + * @returns {google.cloud.vision.v1p2beta1.Vertex} Vertex */ - Feature.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.Feature) + Vertex.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.Vertex) return object; - var message = new $root.google.cloud.vision.v1p2beta1.Feature(); - switch (object.type) { - case "TYPE_UNSPECIFIED": - case 0: - message.type = 0; - break; - case "FACE_DETECTION": - case 1: - message.type = 1; - break; - case "LANDMARK_DETECTION": - case 2: - message.type = 2; - break; - case "LOGO_DETECTION": - case 3: - message.type = 3; - break; - case "LABEL_DETECTION": - case 4: - message.type = 4; - break; - case "TEXT_DETECTION": - case 5: - message.type = 5; - break; - case "DOCUMENT_TEXT_DETECTION": - case 11: - message.type = 11; - break; - case "SAFE_SEARCH_DETECTION": - case 6: - message.type = 6; - break; - case "IMAGE_PROPERTIES": - case 7: - message.type = 7; - break; - case "CROP_HINTS": - case 9: - message.type = 9; - break; - case "WEB_DETECTION": - case 10: - message.type = 10; - break; - } - if (object.maxResults != null) - message.maxResults = object.maxResults | 0; - if (object.model != null) - message.model = String(object.model); + var message = new $root.google.cloud.vision.v1p2beta1.Vertex(); + if (object.x != null) + message.x = object.x | 0; + if (object.y != null) + message.y = object.y | 0; return message; }; /** - * Creates a plain object from a Feature message. Also converts values to other types if specified. + * Creates a plain object from a Vertex message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.Feature + * @memberof google.cloud.vision.v1p2beta1.Vertex * @static - * @param {google.cloud.vision.v1p2beta1.Feature} message Feature + * @param {google.cloud.vision.v1p2beta1.Vertex} message Vertex * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Feature.toObject = function toObject(message, options) { + Vertex.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; - object.maxResults = 0; - object.model = ""; + object.x = 0; + object.y = 0; } - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.vision.v1p2beta1.Feature.Type[message.type] : message.type; - if (message.maxResults != null && message.hasOwnProperty("maxResults")) - object.maxResults = message.maxResults; - if (message.model != null && message.hasOwnProperty("model")) - object.model = message.model; + if (message.x != null && message.hasOwnProperty("x")) + object.x = message.x; + if (message.y != null && message.hasOwnProperty("y")) + object.y = message.y; return object; }; /** - * Converts this Feature to JSON. + * Converts this Vertex to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.Feature + * @memberof google.cloud.vision.v1p2beta1.Vertex * @instance * @returns {Object.} JSON object */ - Feature.prototype.toJSON = function toJSON() { + Vertex.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * Type enum. - * @name google.cloud.vision.v1p2beta1.Feature.Type - * @enum {string} - * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value - * @property {number} FACE_DETECTION=1 FACE_DETECTION value - * @property {number} LANDMARK_DETECTION=2 LANDMARK_DETECTION value - * @property {number} LOGO_DETECTION=3 LOGO_DETECTION value - * @property {number} LABEL_DETECTION=4 LABEL_DETECTION value - * @property {number} TEXT_DETECTION=5 TEXT_DETECTION value - * @property {number} DOCUMENT_TEXT_DETECTION=11 DOCUMENT_TEXT_DETECTION value - * @property {number} SAFE_SEARCH_DETECTION=6 SAFE_SEARCH_DETECTION value - * @property {number} IMAGE_PROPERTIES=7 IMAGE_PROPERTIES value - * @property {number} CROP_HINTS=9 CROP_HINTS value - * @property {number} WEB_DETECTION=10 WEB_DETECTION value - */ - Feature.Type = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "FACE_DETECTION"] = 1; - values[valuesById[2] = "LANDMARK_DETECTION"] = 2; - values[valuesById[3] = "LOGO_DETECTION"] = 3; - values[valuesById[4] = "LABEL_DETECTION"] = 4; - values[valuesById[5] = "TEXT_DETECTION"] = 5; - values[valuesById[11] = "DOCUMENT_TEXT_DETECTION"] = 11; - values[valuesById[6] = "SAFE_SEARCH_DETECTION"] = 6; - values[valuesById[7] = "IMAGE_PROPERTIES"] = 7; - values[valuesById[9] = "CROP_HINTS"] = 9; - values[valuesById[10] = "WEB_DETECTION"] = 10; - return values; - })(); - - return Feature; + return Vertex; })(); - v1p2beta1.ImageSource = (function() { + v1p2beta1.NormalizedVertex = (function() { /** - * Properties of an ImageSource. + * Properties of a NormalizedVertex. * @memberof google.cloud.vision.v1p2beta1 - * @interface IImageSource - * @property {string|null} [gcsImageUri] ImageSource gcsImageUri - * @property {string|null} [imageUri] ImageSource imageUri + * @interface INormalizedVertex + * @property {number|null} [x] NormalizedVertex x + * @property {number|null} [y] NormalizedVertex y */ /** - * Constructs a new ImageSource. + * Constructs a new NormalizedVertex. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an ImageSource. - * @implements IImageSource + * @classdesc Represents a NormalizedVertex. + * @implements INormalizedVertex * @constructor - * @param {google.cloud.vision.v1p2beta1.IImageSource=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.INormalizedVertex=} [properties] Properties to set */ - function ImageSource(properties) { + function NormalizedVertex(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -36562,88 +36349,88 @@ } /** - * ImageSource gcsImageUri. - * @member {string} gcsImageUri - * @memberof google.cloud.vision.v1p2beta1.ImageSource + * NormalizedVertex x. + * @member {number} x + * @memberof google.cloud.vision.v1p2beta1.NormalizedVertex * @instance */ - ImageSource.prototype.gcsImageUri = ""; + NormalizedVertex.prototype.x = 0; /** - * ImageSource imageUri. - * @member {string} imageUri - * @memberof google.cloud.vision.v1p2beta1.ImageSource + * NormalizedVertex y. + * @member {number} y + * @memberof google.cloud.vision.v1p2beta1.NormalizedVertex * @instance */ - ImageSource.prototype.imageUri = ""; + NormalizedVertex.prototype.y = 0; /** - * Creates a new ImageSource instance using the specified properties. + * Creates a new NormalizedVertex instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.ImageSource + * @memberof google.cloud.vision.v1p2beta1.NormalizedVertex * @static - * @param {google.cloud.vision.v1p2beta1.IImageSource=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.ImageSource} ImageSource instance + * @param {google.cloud.vision.v1p2beta1.INormalizedVertex=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.NormalizedVertex} NormalizedVertex instance */ - ImageSource.create = function create(properties) { - return new ImageSource(properties); + NormalizedVertex.create = function create(properties) { + return new NormalizedVertex(properties); }; /** - * Encodes the specified ImageSource message. Does not implicitly {@link google.cloud.vision.v1p2beta1.ImageSource.verify|verify} messages. + * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.vision.v1p2beta1.NormalizedVertex.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.ImageSource + * @memberof google.cloud.vision.v1p2beta1.NormalizedVertex * @static - * @param {google.cloud.vision.v1p2beta1.IImageSource} message ImageSource message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.INormalizedVertex} message NormalizedVertex message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageSource.encode = function encode(message, writer) { + NormalizedVertex.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.gcsImageUri != null && message.hasOwnProperty("gcsImageUri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsImageUri); - if (message.imageUri != null && message.hasOwnProperty("imageUri")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.imageUri); + if (message.x != null && message.hasOwnProperty("x")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); + if (message.y != null && message.hasOwnProperty("y")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); return writer; }; /** - * Encodes the specified ImageSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.ImageSource.verify|verify} messages. + * Encodes the specified NormalizedVertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.NormalizedVertex.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.ImageSource + * @memberof google.cloud.vision.v1p2beta1.NormalizedVertex * @static - * @param {google.cloud.vision.v1p2beta1.IImageSource} message ImageSource message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.INormalizedVertex} message NormalizedVertex message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageSource.encodeDelimited = function encodeDelimited(message, writer) { + NormalizedVertex.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImageSource message from the specified reader or buffer. + * Decodes a NormalizedVertex message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.ImageSource + * @memberof google.cloud.vision.v1p2beta1.NormalizedVertex * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.ImageSource} ImageSource + * @returns {google.cloud.vision.v1p2beta1.NormalizedVertex} NormalizedVertex * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageSource.decode = function decode(reader, length) { + NormalizedVertex.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.vision.v1p2beta1.ImageSource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.NormalizedVertex(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.gcsImageUri = reader.string(); + message.x = reader.float(); break; case 2: - message.imageUri = reader.string(); + message.y = reader.float(); break; default: reader.skipType(tag & 7); @@ -36654,117 +36441,119 @@ }; /** - * Decodes an ImageSource message from the specified reader or buffer, length delimited. + * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.ImageSource + * @memberof google.cloud.vision.v1p2beta1.NormalizedVertex * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.ImageSource} ImageSource + * @returns {google.cloud.vision.v1p2beta1.NormalizedVertex} NormalizedVertex * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageSource.decodeDelimited = function decodeDelimited(reader) { + NormalizedVertex.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImageSource message. + * Verifies a NormalizedVertex message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.ImageSource + * @memberof google.cloud.vision.v1p2beta1.NormalizedVertex * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImageSource.verify = function verify(message) { + NormalizedVertex.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.gcsImageUri != null && message.hasOwnProperty("gcsImageUri")) - if (!$util.isString(message.gcsImageUri)) - return "gcsImageUri: string expected"; - if (message.imageUri != null && message.hasOwnProperty("imageUri")) - if (!$util.isString(message.imageUri)) - return "imageUri: string expected"; + if (message.x != null && message.hasOwnProperty("x")) + if (typeof message.x !== "number") + return "x: number expected"; + if (message.y != null && message.hasOwnProperty("y")) + if (typeof message.y !== "number") + return "y: number expected"; return null; }; /** - * Creates an ImageSource message from a plain object. Also converts values to their respective internal types. + * Creates a NormalizedVertex message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.ImageSource + * @memberof google.cloud.vision.v1p2beta1.NormalizedVertex * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.ImageSource} ImageSource + * @returns {google.cloud.vision.v1p2beta1.NormalizedVertex} NormalizedVertex */ - ImageSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.ImageSource) + NormalizedVertex.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.NormalizedVertex) return object; - var message = new $root.google.cloud.vision.v1p2beta1.ImageSource(); - if (object.gcsImageUri != null) - message.gcsImageUri = String(object.gcsImageUri); - if (object.imageUri != null) - message.imageUri = String(object.imageUri); + var message = new $root.google.cloud.vision.v1p2beta1.NormalizedVertex(); + if (object.x != null) + message.x = Number(object.x); + if (object.y != null) + message.y = Number(object.y); return message; }; /** - * Creates a plain object from an ImageSource message. Also converts values to other types if specified. + * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.ImageSource + * @memberof google.cloud.vision.v1p2beta1.NormalizedVertex * @static - * @param {google.cloud.vision.v1p2beta1.ImageSource} message ImageSource + * @param {google.cloud.vision.v1p2beta1.NormalizedVertex} message NormalizedVertex * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImageSource.toObject = function toObject(message, options) { + NormalizedVertex.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.gcsImageUri = ""; - object.imageUri = ""; + object.x = 0; + object.y = 0; } - if (message.gcsImageUri != null && message.hasOwnProperty("gcsImageUri")) - object.gcsImageUri = message.gcsImageUri; - if (message.imageUri != null && message.hasOwnProperty("imageUri")) - object.imageUri = message.imageUri; + if (message.x != null && message.hasOwnProperty("x")) + object.x = options.json && !isFinite(message.x) ? String(message.x) : message.x; + if (message.y != null && message.hasOwnProperty("y")) + object.y = options.json && !isFinite(message.y) ? String(message.y) : message.y; return object; }; /** - * Converts this ImageSource to JSON. + * Converts this NormalizedVertex to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.ImageSource + * @memberof google.cloud.vision.v1p2beta1.NormalizedVertex * @instance * @returns {Object.} JSON object */ - ImageSource.prototype.toJSON = function toJSON() { + NormalizedVertex.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImageSource; + return NormalizedVertex; })(); - v1p2beta1.Image = (function() { + v1p2beta1.BoundingPoly = (function() { /** - * Properties of an Image. + * Properties of a BoundingPoly. * @memberof google.cloud.vision.v1p2beta1 - * @interface IImage - * @property {Uint8Array|null} [content] Image content - * @property {google.cloud.vision.v1p2beta1.IImageSource|null} [source] Image source + * @interface IBoundingPoly + * @property {Array.|null} [vertices] BoundingPoly vertices + * @property {Array.|null} [normalizedVertices] BoundingPoly normalizedVertices */ /** - * Constructs a new Image. + * Constructs a new BoundingPoly. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an Image. - * @implements IImage + * @classdesc Represents a BoundingPoly. + * @implements IBoundingPoly * @constructor - * @param {google.cloud.vision.v1p2beta1.IImage=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.IBoundingPoly=} [properties] Properties to set */ - function Image(properties) { + function BoundingPoly(properties) { + this.vertices = []; + this.normalizedVertices = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -36772,88 +36561,94 @@ } /** - * Image content. - * @member {Uint8Array} content - * @memberof google.cloud.vision.v1p2beta1.Image + * BoundingPoly vertices. + * @member {Array.} vertices + * @memberof google.cloud.vision.v1p2beta1.BoundingPoly * @instance */ - Image.prototype.content = $util.newBuffer([]); + BoundingPoly.prototype.vertices = $util.emptyArray; /** - * Image source. - * @member {google.cloud.vision.v1p2beta1.IImageSource|null|undefined} source - * @memberof google.cloud.vision.v1p2beta1.Image + * BoundingPoly normalizedVertices. + * @member {Array.} normalizedVertices + * @memberof google.cloud.vision.v1p2beta1.BoundingPoly * @instance */ - Image.prototype.source = null; + BoundingPoly.prototype.normalizedVertices = $util.emptyArray; /** - * Creates a new Image instance using the specified properties. + * Creates a new BoundingPoly instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.Image + * @memberof google.cloud.vision.v1p2beta1.BoundingPoly * @static - * @param {google.cloud.vision.v1p2beta1.IImage=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.Image} Image instance + * @param {google.cloud.vision.v1p2beta1.IBoundingPoly=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.BoundingPoly} BoundingPoly instance */ - Image.create = function create(properties) { - return new Image(properties); + BoundingPoly.create = function create(properties) { + return new BoundingPoly(properties); }; /** - * Encodes the specified Image message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Image.verify|verify} messages. + * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.vision.v1p2beta1.BoundingPoly.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.Image + * @memberof google.cloud.vision.v1p2beta1.BoundingPoly * @static - * @param {google.cloud.vision.v1p2beta1.IImage} message Image message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IBoundingPoly} message BoundingPoly message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Image.encode = function encode(message, writer) { + BoundingPoly.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.content != null && message.hasOwnProperty("content")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.content); - if (message.source != null && message.hasOwnProperty("source")) - $root.google.cloud.vision.v1p2beta1.ImageSource.encode(message.source, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.vertices != null && message.vertices.length) + for (var i = 0; i < message.vertices.length; ++i) + $root.google.cloud.vision.v1p2beta1.Vertex.encode(message.vertices[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.normalizedVertices != null && message.normalizedVertices.length) + for (var i = 0; i < message.normalizedVertices.length; ++i) + $root.google.cloud.vision.v1p2beta1.NormalizedVertex.encode(message.normalizedVertices[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.Image.verify|verify} messages. + * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.BoundingPoly.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.Image + * @memberof google.cloud.vision.v1p2beta1.BoundingPoly * @static - * @param {google.cloud.vision.v1p2beta1.IImage} message Image message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IBoundingPoly} message BoundingPoly message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Image.encodeDelimited = function encodeDelimited(message, writer) { + BoundingPoly.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Image message from the specified reader or buffer. + * Decodes a BoundingPoly message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.Image + * @memberof google.cloud.vision.v1p2beta1.BoundingPoly * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.Image} Image + * @returns {google.cloud.vision.v1p2beta1.BoundingPoly} BoundingPoly * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Image.decode = function decode(reader, length) { + BoundingPoly.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.vision.v1p2beta1.Image(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.BoundingPoly(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.content = reader.bytes(); + if (!(message.vertices && message.vertices.length)) + message.vertices = []; + message.vertices.push($root.google.cloud.vision.v1p2beta1.Vertex.decode(reader, reader.uint32())); break; case 2: - message.source = $root.google.cloud.vision.v1p2beta1.ImageSource.decode(reader, reader.uint32()); + if (!(message.normalizedVertices && message.normalizedVertices.length)) + message.normalizedVertices = []; + message.normalizedVertices.push($root.google.cloud.vision.v1p2beta1.NormalizedVertex.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -36864,145 +36659,152 @@ }; /** - * Decodes an Image message from the specified reader or buffer, length delimited. + * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.Image + * @memberof google.cloud.vision.v1p2beta1.BoundingPoly * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.Image} Image + * @returns {google.cloud.vision.v1p2beta1.BoundingPoly} BoundingPoly * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Image.decodeDelimited = function decodeDelimited(reader) { + BoundingPoly.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Image message. + * Verifies a BoundingPoly message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.Image + * @memberof google.cloud.vision.v1p2beta1.BoundingPoly * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Image.verify = function verify(message) { + BoundingPoly.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.content != null && message.hasOwnProperty("content")) - if (!(message.content && typeof message.content.length === "number" || $util.isString(message.content))) - return "content: buffer expected"; - if (message.source != null && message.hasOwnProperty("source")) { - var error = $root.google.cloud.vision.v1p2beta1.ImageSource.verify(message.source); - if (error) - return "source." + error; + if (message.vertices != null && message.hasOwnProperty("vertices")) { + if (!Array.isArray(message.vertices)) + return "vertices: array expected"; + for (var i = 0; i < message.vertices.length; ++i) { + var error = $root.google.cloud.vision.v1p2beta1.Vertex.verify(message.vertices[i]); + if (error) + return "vertices." + error; + } + } + if (message.normalizedVertices != null && message.hasOwnProperty("normalizedVertices")) { + if (!Array.isArray(message.normalizedVertices)) + return "normalizedVertices: array expected"; + for (var i = 0; i < message.normalizedVertices.length; ++i) { + var error = $root.google.cloud.vision.v1p2beta1.NormalizedVertex.verify(message.normalizedVertices[i]); + if (error) + return "normalizedVertices." + error; + } } return null; }; /** - * Creates an Image message from a plain object. Also converts values to their respective internal types. + * Creates a BoundingPoly message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.Image + * @memberof google.cloud.vision.v1p2beta1.BoundingPoly * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.Image} Image + * @returns {google.cloud.vision.v1p2beta1.BoundingPoly} BoundingPoly */ - Image.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.Image) + BoundingPoly.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.BoundingPoly) return object; - var message = new $root.google.cloud.vision.v1p2beta1.Image(); - if (object.content != null) - if (typeof object.content === "string") - $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); - else if (object.content.length) - message.content = object.content; - if (object.source != null) { - if (typeof object.source !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.Image.source: object expected"); - message.source = $root.google.cloud.vision.v1p2beta1.ImageSource.fromObject(object.source); + var message = new $root.google.cloud.vision.v1p2beta1.BoundingPoly(); + if (object.vertices) { + if (!Array.isArray(object.vertices)) + throw TypeError(".google.cloud.vision.v1p2beta1.BoundingPoly.vertices: array expected"); + message.vertices = []; + for (var i = 0; i < object.vertices.length; ++i) { + if (typeof object.vertices[i] !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.BoundingPoly.vertices: object expected"); + message.vertices[i] = $root.google.cloud.vision.v1p2beta1.Vertex.fromObject(object.vertices[i]); + } + } + if (object.normalizedVertices) { + if (!Array.isArray(object.normalizedVertices)) + throw TypeError(".google.cloud.vision.v1p2beta1.BoundingPoly.normalizedVertices: array expected"); + message.normalizedVertices = []; + for (var i = 0; i < object.normalizedVertices.length; ++i) { + if (typeof object.normalizedVertices[i] !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.BoundingPoly.normalizedVertices: object expected"); + message.normalizedVertices[i] = $root.google.cloud.vision.v1p2beta1.NormalizedVertex.fromObject(object.normalizedVertices[i]); + } } return message; }; /** - * Creates a plain object from an Image message. Also converts values to other types if specified. + * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.Image + * @memberof google.cloud.vision.v1p2beta1.BoundingPoly * @static - * @param {google.cloud.vision.v1p2beta1.Image} message Image + * @param {google.cloud.vision.v1p2beta1.BoundingPoly} message BoundingPoly * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Image.toObject = function toObject(message, options) { + BoundingPoly.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - if (options.bytes === String) - object.content = ""; - else { - object.content = []; - if (options.bytes !== Array) - object.content = $util.newBuffer(object.content); - } - object.source = null; + if (options.arrays || options.defaults) { + object.vertices = []; + object.normalizedVertices = []; + } + if (message.vertices && message.vertices.length) { + object.vertices = []; + for (var j = 0; j < message.vertices.length; ++j) + object.vertices[j] = $root.google.cloud.vision.v1p2beta1.Vertex.toObject(message.vertices[j], options); + } + if (message.normalizedVertices && message.normalizedVertices.length) { + object.normalizedVertices = []; + for (var j = 0; j < message.normalizedVertices.length; ++j) + object.normalizedVertices[j] = $root.google.cloud.vision.v1p2beta1.NormalizedVertex.toObject(message.normalizedVertices[j], options); } - if (message.content != null && message.hasOwnProperty("content")) - object.content = options.bytes === String ? $util.base64.encode(message.content, 0, message.content.length) : options.bytes === Array ? Array.prototype.slice.call(message.content) : message.content; - if (message.source != null && message.hasOwnProperty("source")) - object.source = $root.google.cloud.vision.v1p2beta1.ImageSource.toObject(message.source, options); return object; }; /** - * Converts this Image to JSON. + * Converts this BoundingPoly to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.Image + * @memberof google.cloud.vision.v1p2beta1.BoundingPoly * @instance * @returns {Object.} JSON object */ - Image.prototype.toJSON = function toJSON() { + BoundingPoly.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Image; + return BoundingPoly; })(); - v1p2beta1.FaceAnnotation = (function() { + v1p2beta1.Position = (function() { /** - * Properties of a FaceAnnotation. + * Properties of a Position. * @memberof google.cloud.vision.v1p2beta1 - * @interface IFaceAnnotation - * @property {google.cloud.vision.v1p2beta1.IBoundingPoly|null} [boundingPoly] FaceAnnotation boundingPoly - * @property {google.cloud.vision.v1p2beta1.IBoundingPoly|null} [fdBoundingPoly] FaceAnnotation fdBoundingPoly - * @property {Array.|null} [landmarks] FaceAnnotation landmarks - * @property {number|null} [rollAngle] FaceAnnotation rollAngle - * @property {number|null} [panAngle] FaceAnnotation panAngle - * @property {number|null} [tiltAngle] FaceAnnotation tiltAngle - * @property {number|null} [detectionConfidence] FaceAnnotation detectionConfidence - * @property {number|null} [landmarkingConfidence] FaceAnnotation landmarkingConfidence - * @property {google.cloud.vision.v1p2beta1.Likelihood|null} [joyLikelihood] FaceAnnotation joyLikelihood - * @property {google.cloud.vision.v1p2beta1.Likelihood|null} [sorrowLikelihood] FaceAnnotation sorrowLikelihood - * @property {google.cloud.vision.v1p2beta1.Likelihood|null} [angerLikelihood] FaceAnnotation angerLikelihood - * @property {google.cloud.vision.v1p2beta1.Likelihood|null} [surpriseLikelihood] FaceAnnotation surpriseLikelihood - * @property {google.cloud.vision.v1p2beta1.Likelihood|null} [underExposedLikelihood] FaceAnnotation underExposedLikelihood - * @property {google.cloud.vision.v1p2beta1.Likelihood|null} [blurredLikelihood] FaceAnnotation blurredLikelihood - * @property {google.cloud.vision.v1p2beta1.Likelihood|null} [headwearLikelihood] FaceAnnotation headwearLikelihood + * @interface IPosition + * @property {number|null} [x] Position x + * @property {number|null} [y] Position y + * @property {number|null} [z] Position z */ /** - * Constructs a new FaceAnnotation. + * Constructs a new Position. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a FaceAnnotation. - * @implements IFaceAnnotation + * @classdesc Represents a Position. + * @implements IPosition * @constructor - * @param {google.cloud.vision.v1p2beta1.IFaceAnnotation=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.IPosition=} [properties] Properties to set */ - function FaceAnnotation(properties) { - this.landmarks = []; + function Position(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -37010,260 +36812,101 @@ } /** - * FaceAnnotation boundingPoly. - * @member {google.cloud.vision.v1p2beta1.IBoundingPoly|null|undefined} boundingPoly - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.boundingPoly = null; - - /** - * FaceAnnotation fdBoundingPoly. - * @member {google.cloud.vision.v1p2beta1.IBoundingPoly|null|undefined} fdBoundingPoly - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.fdBoundingPoly = null; - - /** - * FaceAnnotation landmarks. - * @member {Array.} landmarks - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.landmarks = $util.emptyArray; - - /** - * FaceAnnotation rollAngle. - * @member {number} rollAngle - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.rollAngle = 0; - - /** - * FaceAnnotation panAngle. - * @member {number} panAngle - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.panAngle = 0; - - /** - * FaceAnnotation tiltAngle. - * @member {number} tiltAngle - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.tiltAngle = 0; - - /** - * FaceAnnotation detectionConfidence. - * @member {number} detectionConfidence - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.detectionConfidence = 0; - - /** - * FaceAnnotation landmarkingConfidence. - * @member {number} landmarkingConfidence - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.landmarkingConfidence = 0; - - /** - * FaceAnnotation joyLikelihood. - * @member {google.cloud.vision.v1p2beta1.Likelihood} joyLikelihood - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.joyLikelihood = 0; - - /** - * FaceAnnotation sorrowLikelihood. - * @member {google.cloud.vision.v1p2beta1.Likelihood} sorrowLikelihood - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.sorrowLikelihood = 0; - - /** - * FaceAnnotation angerLikelihood. - * @member {google.cloud.vision.v1p2beta1.Likelihood} angerLikelihood - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.angerLikelihood = 0; - - /** - * FaceAnnotation surpriseLikelihood. - * @member {google.cloud.vision.v1p2beta1.Likelihood} surpriseLikelihood - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.surpriseLikelihood = 0; - - /** - * FaceAnnotation underExposedLikelihood. - * @member {google.cloud.vision.v1p2beta1.Likelihood} underExposedLikelihood - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation + * Position x. + * @member {number} x + * @memberof google.cloud.vision.v1p2beta1.Position * @instance */ - FaceAnnotation.prototype.underExposedLikelihood = 0; + Position.prototype.x = 0; /** - * FaceAnnotation blurredLikelihood. - * @member {google.cloud.vision.v1p2beta1.Likelihood} blurredLikelihood - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation + * Position y. + * @member {number} y + * @memberof google.cloud.vision.v1p2beta1.Position * @instance */ - FaceAnnotation.prototype.blurredLikelihood = 0; + Position.prototype.y = 0; /** - * FaceAnnotation headwearLikelihood. - * @member {google.cloud.vision.v1p2beta1.Likelihood} headwearLikelihood - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation + * Position z. + * @member {number} z + * @memberof google.cloud.vision.v1p2beta1.Position * @instance */ - FaceAnnotation.prototype.headwearLikelihood = 0; + Position.prototype.z = 0; /** - * Creates a new FaceAnnotation instance using the specified properties. + * Creates a new Position instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p2beta1.Position * @static - * @param {google.cloud.vision.v1p2beta1.IFaceAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.FaceAnnotation} FaceAnnotation instance + * @param {google.cloud.vision.v1p2beta1.IPosition=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.Position} Position instance */ - FaceAnnotation.create = function create(properties) { - return new FaceAnnotation(properties); + Position.create = function create(properties) { + return new Position(properties); }; /** - * Encodes the specified FaceAnnotation message. Does not implicitly {@link google.cloud.vision.v1p2beta1.FaceAnnotation.verify|verify} messages. + * Encodes the specified Position message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Position.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p2beta1.Position * @static - * @param {google.cloud.vision.v1p2beta1.IFaceAnnotation} message FaceAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IPosition} message Position message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FaceAnnotation.encode = function encode(message, writer) { + Position.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - $root.google.cloud.vision.v1p2beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.fdBoundingPoly != null && message.hasOwnProperty("fdBoundingPoly")) - $root.google.cloud.vision.v1p2beta1.BoundingPoly.encode(message.fdBoundingPoly, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.landmarks != null && message.landmarks.length) - for (var i = 0; i < message.landmarks.length; ++i) - $root.google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark.encode(message.landmarks[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.rollAngle != null && message.hasOwnProperty("rollAngle")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.rollAngle); - if (message.panAngle != null && message.hasOwnProperty("panAngle")) - writer.uint32(/* id 5, wireType 5 =*/45).float(message.panAngle); - if (message.tiltAngle != null && message.hasOwnProperty("tiltAngle")) - writer.uint32(/* id 6, wireType 5 =*/53).float(message.tiltAngle); - if (message.detectionConfidence != null && message.hasOwnProperty("detectionConfidence")) - writer.uint32(/* id 7, wireType 5 =*/61).float(message.detectionConfidence); - if (message.landmarkingConfidence != null && message.hasOwnProperty("landmarkingConfidence")) - writer.uint32(/* id 8, wireType 5 =*/69).float(message.landmarkingConfidence); - if (message.joyLikelihood != null && message.hasOwnProperty("joyLikelihood")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.joyLikelihood); - if (message.sorrowLikelihood != null && message.hasOwnProperty("sorrowLikelihood")) - writer.uint32(/* id 10, wireType 0 =*/80).int32(message.sorrowLikelihood); - if (message.angerLikelihood != null && message.hasOwnProperty("angerLikelihood")) - writer.uint32(/* id 11, wireType 0 =*/88).int32(message.angerLikelihood); - if (message.surpriseLikelihood != null && message.hasOwnProperty("surpriseLikelihood")) - writer.uint32(/* id 12, wireType 0 =*/96).int32(message.surpriseLikelihood); - if (message.underExposedLikelihood != null && message.hasOwnProperty("underExposedLikelihood")) - writer.uint32(/* id 13, wireType 0 =*/104).int32(message.underExposedLikelihood); - if (message.blurredLikelihood != null && message.hasOwnProperty("blurredLikelihood")) - writer.uint32(/* id 14, wireType 0 =*/112).int32(message.blurredLikelihood); - if (message.headwearLikelihood != null && message.hasOwnProperty("headwearLikelihood")) - writer.uint32(/* id 15, wireType 0 =*/120).int32(message.headwearLikelihood); + if (message.x != null && message.hasOwnProperty("x")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); + if (message.y != null && message.hasOwnProperty("y")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); + if (message.z != null && message.hasOwnProperty("z")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.z); return writer; }; /** - * Encodes the specified FaceAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.FaceAnnotation.verify|verify} messages. + * Encodes the specified Position message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.Position.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p2beta1.Position * @static - * @param {google.cloud.vision.v1p2beta1.IFaceAnnotation} message FaceAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IPosition} message Position message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FaceAnnotation.encodeDelimited = function encodeDelimited(message, writer) { + Position.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FaceAnnotation message from the specified reader or buffer. + * Decodes a Position message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p2beta1.Position * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.FaceAnnotation} FaceAnnotation + * @returns {google.cloud.vision.v1p2beta1.Position} Position * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FaceAnnotation.decode = function decode(reader, length) { + Position.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.vision.v1p2beta1.FaceAnnotation(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.Position(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.boundingPoly = $root.google.cloud.vision.v1p2beta1.BoundingPoly.decode(reader, reader.uint32()); + message.x = reader.float(); break; case 2: - message.fdBoundingPoly = $root.google.cloud.vision.v1p2beta1.BoundingPoly.decode(reader, reader.uint32()); + message.y = reader.float(); break; case 3: - if (!(message.landmarks && message.landmarks.length)) - message.landmarks = []; - message.landmarks.push($root.google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark.decode(reader, reader.uint32())); - break; - case 4: - message.rollAngle = reader.float(); - break; - case 5: - message.panAngle = reader.float(); - break; - case 6: - message.tiltAngle = reader.float(); - break; - case 7: - message.detectionConfidence = reader.float(); - break; - case 8: - message.landmarkingConfidence = reader.float(); - break; - case 9: - message.joyLikelihood = reader.int32(); - break; - case 10: - message.sorrowLikelihood = reader.int32(); - break; - case 11: - message.angerLikelihood = reader.int32(); - break; - case 12: - message.surpriseLikelihood = reader.int32(); - break; - case 13: - message.underExposedLikelihood = reader.int32(); - break; - case 14: - message.blurredLikelihood = reader.int32(); - break; - case 15: - message.headwearLikelihood = reader.int32(); + message.z = reader.float(); break; default: reader.skipType(tag & 7); @@ -37274,952 +36917,227 @@ }; /** - * Decodes a FaceAnnotation message from the specified reader or buffer, length delimited. + * Decodes a Position message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p2beta1.Position * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.FaceAnnotation} FaceAnnotation + * @returns {google.cloud.vision.v1p2beta1.Position} Position * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FaceAnnotation.decodeDelimited = function decodeDelimited(reader) { + Position.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FaceAnnotation message. + * Verifies a Position message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p2beta1.Position * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FaceAnnotation.verify = function verify(message) { + Position.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { - var error = $root.google.cloud.vision.v1p2beta1.BoundingPoly.verify(message.boundingPoly); - if (error) - return "boundingPoly." + error; - } - if (message.fdBoundingPoly != null && message.hasOwnProperty("fdBoundingPoly")) { - var error = $root.google.cloud.vision.v1p2beta1.BoundingPoly.verify(message.fdBoundingPoly); - if (error) - return "fdBoundingPoly." + error; - } - if (message.landmarks != null && message.hasOwnProperty("landmarks")) { - if (!Array.isArray(message.landmarks)) - return "landmarks: array expected"; - for (var i = 0; i < message.landmarks.length; ++i) { - var error = $root.google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark.verify(message.landmarks[i]); - if (error) - return "landmarks." + error; - } - } - if (message.rollAngle != null && message.hasOwnProperty("rollAngle")) - if (typeof message.rollAngle !== "number") - return "rollAngle: number expected"; - if (message.panAngle != null && message.hasOwnProperty("panAngle")) - if (typeof message.panAngle !== "number") - return "panAngle: number expected"; - if (message.tiltAngle != null && message.hasOwnProperty("tiltAngle")) - if (typeof message.tiltAngle !== "number") - return "tiltAngle: number expected"; - if (message.detectionConfidence != null && message.hasOwnProperty("detectionConfidence")) - if (typeof message.detectionConfidence !== "number") - return "detectionConfidence: number expected"; - if (message.landmarkingConfidence != null && message.hasOwnProperty("landmarkingConfidence")) - if (typeof message.landmarkingConfidence !== "number") - return "landmarkingConfidence: number expected"; - if (message.joyLikelihood != null && message.hasOwnProperty("joyLikelihood")) - switch (message.joyLikelihood) { - default: - return "joyLikelihood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.sorrowLikelihood != null && message.hasOwnProperty("sorrowLikelihood")) - switch (message.sorrowLikelihood) { - default: - return "sorrowLikelihood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.angerLikelihood != null && message.hasOwnProperty("angerLikelihood")) - switch (message.angerLikelihood) { - default: - return "angerLikelihood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.surpriseLikelihood != null && message.hasOwnProperty("surpriseLikelihood")) - switch (message.surpriseLikelihood) { - default: - return "surpriseLikelihood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.underExposedLikelihood != null && message.hasOwnProperty("underExposedLikelihood")) - switch (message.underExposedLikelihood) { - default: - return "underExposedLikelihood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.blurredLikelihood != null && message.hasOwnProperty("blurredLikelihood")) - switch (message.blurredLikelihood) { - default: - return "blurredLikelihood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.headwearLikelihood != null && message.hasOwnProperty("headwearLikelihood")) - switch (message.headwearLikelihood) { - default: - return "headwearLikelihood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } + if (message.x != null && message.hasOwnProperty("x")) + if (typeof message.x !== "number") + return "x: number expected"; + if (message.y != null && message.hasOwnProperty("y")) + if (typeof message.y !== "number") + return "y: number expected"; + if (message.z != null && message.hasOwnProperty("z")) + if (typeof message.z !== "number") + return "z: number expected"; return null; }; /** - * Creates a FaceAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates a Position message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p2beta1.Position * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.FaceAnnotation} FaceAnnotation + * @returns {google.cloud.vision.v1p2beta1.Position} Position */ - FaceAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.FaceAnnotation) + Position.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.Position) return object; - var message = new $root.google.cloud.vision.v1p2beta1.FaceAnnotation(); - if (object.boundingPoly != null) { - if (typeof object.boundingPoly !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.FaceAnnotation.boundingPoly: object expected"); - message.boundingPoly = $root.google.cloud.vision.v1p2beta1.BoundingPoly.fromObject(object.boundingPoly); - } - if (object.fdBoundingPoly != null) { - if (typeof object.fdBoundingPoly !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.FaceAnnotation.fdBoundingPoly: object expected"); - message.fdBoundingPoly = $root.google.cloud.vision.v1p2beta1.BoundingPoly.fromObject(object.fdBoundingPoly); - } - if (object.landmarks) { - if (!Array.isArray(object.landmarks)) - throw TypeError(".google.cloud.vision.v1p2beta1.FaceAnnotation.landmarks: array expected"); - message.landmarks = []; - for (var i = 0; i < object.landmarks.length; ++i) { - if (typeof object.landmarks[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.FaceAnnotation.landmarks: object expected"); - message.landmarks[i] = $root.google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark.fromObject(object.landmarks[i]); - } - } - if (object.rollAngle != null) - message.rollAngle = Number(object.rollAngle); - if (object.panAngle != null) - message.panAngle = Number(object.panAngle); - if (object.tiltAngle != null) - message.tiltAngle = Number(object.tiltAngle); - if (object.detectionConfidence != null) - message.detectionConfidence = Number(object.detectionConfidence); - if (object.landmarkingConfidence != null) - message.landmarkingConfidence = Number(object.landmarkingConfidence); - switch (object.joyLikelihood) { - case "UNKNOWN": - case 0: - message.joyLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.joyLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.joyLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.joyLikelihood = 3; - break; - case "LIKELY": - case 4: - message.joyLikelihood = 4; - break; - case "VERY_LIKELY": - case 5: - message.joyLikelihood = 5; - break; - } - switch (object.sorrowLikelihood) { - case "UNKNOWN": - case 0: - message.sorrowLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.sorrowLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.sorrowLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.sorrowLikelihood = 3; - break; - case "LIKELY": - case 4: - message.sorrowLikelihood = 4; - break; - case "VERY_LIKELY": - case 5: - message.sorrowLikelihood = 5; - break; - } - switch (object.angerLikelihood) { - case "UNKNOWN": - case 0: - message.angerLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.angerLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.angerLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.angerLikelihood = 3; - break; - case "LIKELY": - case 4: - message.angerLikelihood = 4; - break; - case "VERY_LIKELY": - case 5: - message.angerLikelihood = 5; - break; - } - switch (object.surpriseLikelihood) { - case "UNKNOWN": - case 0: - message.surpriseLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.surpriseLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.surpriseLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.surpriseLikelihood = 3; - break; - case "LIKELY": - case 4: - message.surpriseLikelihood = 4; - break; - case "VERY_LIKELY": - case 5: - message.surpriseLikelihood = 5; - break; - } - switch (object.underExposedLikelihood) { - case "UNKNOWN": - case 0: - message.underExposedLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.underExposedLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.underExposedLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.underExposedLikelihood = 3; - break; - case "LIKELY": - case 4: - message.underExposedLikelihood = 4; - break; - case "VERY_LIKELY": - case 5: - message.underExposedLikelihood = 5; - break; - } - switch (object.blurredLikelihood) { - case "UNKNOWN": - case 0: - message.blurredLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.blurredLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.blurredLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.blurredLikelihood = 3; - break; - case "LIKELY": - case 4: - message.blurredLikelihood = 4; - break; - case "VERY_LIKELY": - case 5: - message.blurredLikelihood = 5; - break; - } - switch (object.headwearLikelihood) { - case "UNKNOWN": - case 0: - message.headwearLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.headwearLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.headwearLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.headwearLikelihood = 3; - break; - case "LIKELY": - case 4: - message.headwearLikelihood = 4; - break; - case "VERY_LIKELY": - case 5: - message.headwearLikelihood = 5; - break; - } + var message = new $root.google.cloud.vision.v1p2beta1.Position(); + if (object.x != null) + message.x = Number(object.x); + if (object.y != null) + message.y = Number(object.y); + if (object.z != null) + message.z = Number(object.z); return message; }; /** - * Creates a plain object from a FaceAnnotation message. Also converts values to other types if specified. + * Creates a plain object from a Position message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p2beta1.Position * @static - * @param {google.cloud.vision.v1p2beta1.FaceAnnotation} message FaceAnnotation + * @param {google.cloud.vision.v1p2beta1.Position} message Position * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FaceAnnotation.toObject = function toObject(message, options) { + Position.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.landmarks = []; if (options.defaults) { - object.boundingPoly = null; - object.fdBoundingPoly = null; - object.rollAngle = 0; - object.panAngle = 0; - object.tiltAngle = 0; - object.detectionConfidence = 0; - object.landmarkingConfidence = 0; - object.joyLikelihood = options.enums === String ? "UNKNOWN" : 0; - object.sorrowLikelihood = options.enums === String ? "UNKNOWN" : 0; - object.angerLikelihood = options.enums === String ? "UNKNOWN" : 0; - object.surpriseLikelihood = options.enums === String ? "UNKNOWN" : 0; - object.underExposedLikelihood = options.enums === String ? "UNKNOWN" : 0; - object.blurredLikelihood = options.enums === String ? "UNKNOWN" : 0; - object.headwearLikelihood = options.enums === String ? "UNKNOWN" : 0; - } - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - object.boundingPoly = $root.google.cloud.vision.v1p2beta1.BoundingPoly.toObject(message.boundingPoly, options); - if (message.fdBoundingPoly != null && message.hasOwnProperty("fdBoundingPoly")) - object.fdBoundingPoly = $root.google.cloud.vision.v1p2beta1.BoundingPoly.toObject(message.fdBoundingPoly, options); - if (message.landmarks && message.landmarks.length) { - object.landmarks = []; - for (var j = 0; j < message.landmarks.length; ++j) - object.landmarks[j] = $root.google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark.toObject(message.landmarks[j], options); + object.x = 0; + object.y = 0; + object.z = 0; } - if (message.rollAngle != null && message.hasOwnProperty("rollAngle")) - object.rollAngle = options.json && !isFinite(message.rollAngle) ? String(message.rollAngle) : message.rollAngle; - if (message.panAngle != null && message.hasOwnProperty("panAngle")) - object.panAngle = options.json && !isFinite(message.panAngle) ? String(message.panAngle) : message.panAngle; - if (message.tiltAngle != null && message.hasOwnProperty("tiltAngle")) - object.tiltAngle = options.json && !isFinite(message.tiltAngle) ? String(message.tiltAngle) : message.tiltAngle; - if (message.detectionConfidence != null && message.hasOwnProperty("detectionConfidence")) - object.detectionConfidence = options.json && !isFinite(message.detectionConfidence) ? String(message.detectionConfidence) : message.detectionConfidence; - if (message.landmarkingConfidence != null && message.hasOwnProperty("landmarkingConfidence")) - object.landmarkingConfidence = options.json && !isFinite(message.landmarkingConfidence) ? String(message.landmarkingConfidence) : message.landmarkingConfidence; - if (message.joyLikelihood != null && message.hasOwnProperty("joyLikelihood")) - object.joyLikelihood = options.enums === String ? $root.google.cloud.vision.v1p2beta1.Likelihood[message.joyLikelihood] : message.joyLikelihood; - if (message.sorrowLikelihood != null && message.hasOwnProperty("sorrowLikelihood")) - object.sorrowLikelihood = options.enums === String ? $root.google.cloud.vision.v1p2beta1.Likelihood[message.sorrowLikelihood] : message.sorrowLikelihood; - if (message.angerLikelihood != null && message.hasOwnProperty("angerLikelihood")) - object.angerLikelihood = options.enums === String ? $root.google.cloud.vision.v1p2beta1.Likelihood[message.angerLikelihood] : message.angerLikelihood; - if (message.surpriseLikelihood != null && message.hasOwnProperty("surpriseLikelihood")) - object.surpriseLikelihood = options.enums === String ? $root.google.cloud.vision.v1p2beta1.Likelihood[message.surpriseLikelihood] : message.surpriseLikelihood; - if (message.underExposedLikelihood != null && message.hasOwnProperty("underExposedLikelihood")) - object.underExposedLikelihood = options.enums === String ? $root.google.cloud.vision.v1p2beta1.Likelihood[message.underExposedLikelihood] : message.underExposedLikelihood; - if (message.blurredLikelihood != null && message.hasOwnProperty("blurredLikelihood")) - object.blurredLikelihood = options.enums === String ? $root.google.cloud.vision.v1p2beta1.Likelihood[message.blurredLikelihood] : message.blurredLikelihood; - if (message.headwearLikelihood != null && message.hasOwnProperty("headwearLikelihood")) - object.headwearLikelihood = options.enums === String ? $root.google.cloud.vision.v1p2beta1.Likelihood[message.headwearLikelihood] : message.headwearLikelihood; + if (message.x != null && message.hasOwnProperty("x")) + object.x = options.json && !isFinite(message.x) ? String(message.x) : message.x; + if (message.y != null && message.hasOwnProperty("y")) + object.y = options.json && !isFinite(message.y) ? String(message.y) : message.y; + if (message.z != null && message.hasOwnProperty("z")) + object.z = options.json && !isFinite(message.z) ? String(message.z) : message.z; return object; }; /** - * Converts this FaceAnnotation to JSON. + * Converts this Position to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p2beta1.Position * @instance * @returns {Object.} JSON object */ - FaceAnnotation.prototype.toJSON = function toJSON() { + Position.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - FaceAnnotation.Landmark = (function() { + return Position; + })(); - /** - * Properties of a Landmark. - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation - * @interface ILandmark - * @property {google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark.Type|null} [type] Landmark type - * @property {google.cloud.vision.v1p2beta1.IPosition|null} [position] Landmark position - */ + v1p2beta1.ImageAnnotator = (function() { - /** - * Constructs a new Landmark. - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation - * @classdesc Represents a Landmark. - * @implements ILandmark - * @constructor - * @param {google.cloud.vision.v1p2beta1.FaceAnnotation.ILandmark=} [properties] Properties to set - */ - function Landmark(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]]; - } + /** + * Constructs a new ImageAnnotator service. + * @memberof google.cloud.vision.v1p2beta1 + * @classdesc Represents an ImageAnnotator + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function ImageAnnotator(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } - /** - * Landmark type. - * @member {google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark.Type} type - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark - * @instance - */ - Landmark.prototype.type = 0; + (ImageAnnotator.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ImageAnnotator; - /** - * Landmark position. - * @member {google.cloud.vision.v1p2beta1.IPosition|null|undefined} position - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark - * @instance - */ - Landmark.prototype.position = null; + /** + * Creates new ImageAnnotator service using the specified rpc implementation. + * @function create + * @memberof google.cloud.vision.v1p2beta1.ImageAnnotator + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {ImageAnnotator} RPC service. Useful where requests and/or responses are streamed. + */ + ImageAnnotator.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; - /** - * Creates a new Landmark instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark - * @static - * @param {google.cloud.vision.v1p2beta1.FaceAnnotation.ILandmark=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark} Landmark instance - */ - Landmark.create = function create(properties) { - return new Landmark(properties); - }; - - /** - * Encodes the specified Landmark message. Does not implicitly {@link google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark - * @static - * @param {google.cloud.vision.v1p2beta1.FaceAnnotation.ILandmark} message Landmark message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Landmark.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.type != null && message.hasOwnProperty("type")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); - if (message.position != null && message.hasOwnProperty("position")) - $root.google.cloud.vision.v1p2beta1.Position.encode(message.position, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Landmark message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark - * @static - * @param {google.cloud.vision.v1p2beta1.FaceAnnotation.ILandmark} message Landmark message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Landmark.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Landmark message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark} Landmark - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Landmark.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.vision.v1p2beta1.FaceAnnotation.Landmark(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 3: - message.type = reader.int32(); - break; - case 4: - message.position = $root.google.cloud.vision.v1p2beta1.Position.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Landmark message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark} Landmark - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Landmark.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Landmark message. - * @function verify - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Landmark.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - case 30: - case 31: - case 32: - case 33: - case 34: - break; - } - if (message.position != null && message.hasOwnProperty("position")) { - var error = $root.google.cloud.vision.v1p2beta1.Position.verify(message.position); - if (error) - return "position." + error; - } - return null; - }; + /** + * Callback as used by {@link google.cloud.vision.v1p2beta1.ImageAnnotator#batchAnnotateImages}. + * @memberof google.cloud.vision.v1p2beta1.ImageAnnotator + * @typedef BatchAnnotateImagesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse} [response] BatchAnnotateImagesResponse + */ - /** - * Creates a Landmark message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark} Landmark - */ - Landmark.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark) - return object; - var message = new $root.google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark(); - switch (object.type) { - case "UNKNOWN_LANDMARK": - case 0: - message.type = 0; - break; - case "LEFT_EYE": - case 1: - message.type = 1; - break; - case "RIGHT_EYE": - case 2: - message.type = 2; - break; - case "LEFT_OF_LEFT_EYEBROW": - case 3: - message.type = 3; - break; - case "RIGHT_OF_LEFT_EYEBROW": - case 4: - message.type = 4; - break; - case "LEFT_OF_RIGHT_EYEBROW": - case 5: - message.type = 5; - break; - case "RIGHT_OF_RIGHT_EYEBROW": - case 6: - message.type = 6; - break; - case "MIDPOINT_BETWEEN_EYES": - case 7: - message.type = 7; - break; - case "NOSE_TIP": - case 8: - message.type = 8; - break; - case "UPPER_LIP": - case 9: - message.type = 9; - break; - case "LOWER_LIP": - case 10: - message.type = 10; - break; - case "MOUTH_LEFT": - case 11: - message.type = 11; - break; - case "MOUTH_RIGHT": - case 12: - message.type = 12; - break; - case "MOUTH_CENTER": - case 13: - message.type = 13; - break; - case "NOSE_BOTTOM_RIGHT": - case 14: - message.type = 14; - break; - case "NOSE_BOTTOM_LEFT": - case 15: - message.type = 15; - break; - case "NOSE_BOTTOM_CENTER": - case 16: - message.type = 16; - break; - case "LEFT_EYE_TOP_BOUNDARY": - case 17: - message.type = 17; - break; - case "LEFT_EYE_RIGHT_CORNER": - case 18: - message.type = 18; - break; - case "LEFT_EYE_BOTTOM_BOUNDARY": - case 19: - message.type = 19; - break; - case "LEFT_EYE_LEFT_CORNER": - case 20: - message.type = 20; - break; - case "RIGHT_EYE_TOP_BOUNDARY": - case 21: - message.type = 21; - break; - case "RIGHT_EYE_RIGHT_CORNER": - case 22: - message.type = 22; - break; - case "RIGHT_EYE_BOTTOM_BOUNDARY": - case 23: - message.type = 23; - break; - case "RIGHT_EYE_LEFT_CORNER": - case 24: - message.type = 24; - break; - case "LEFT_EYEBROW_UPPER_MIDPOINT": - case 25: - message.type = 25; - break; - case "RIGHT_EYEBROW_UPPER_MIDPOINT": - case 26: - message.type = 26; - break; - case "LEFT_EAR_TRAGION": - case 27: - message.type = 27; - break; - case "RIGHT_EAR_TRAGION": - case 28: - message.type = 28; - break; - case "LEFT_EYE_PUPIL": - case 29: - message.type = 29; - break; - case "RIGHT_EYE_PUPIL": - case 30: - message.type = 30; - break; - case "FOREHEAD_GLABELLA": - case 31: - message.type = 31; - break; - case "CHIN_GNATHION": - case 32: - message.type = 32; - break; - case "CHIN_LEFT_GONION": - case 33: - message.type = 33; - break; - case "CHIN_RIGHT_GONION": - case 34: - message.type = 34; - break; - } - if (object.position != null) { - if (typeof object.position !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark.position: object expected"); - message.position = $root.google.cloud.vision.v1p2beta1.Position.fromObject(object.position); - } - return message; - }; + /** + * Calls BatchAnnotateImages. + * @function batchAnnotateImages + * @memberof google.cloud.vision.v1p2beta1.ImageAnnotator + * @instance + * @param {google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest} request BatchAnnotateImagesRequest message or plain object + * @param {google.cloud.vision.v1p2beta1.ImageAnnotator.BatchAnnotateImagesCallback} callback Node-style callback called with the error, if any, and BatchAnnotateImagesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ImageAnnotator.prototype.batchAnnotateImages = function batchAnnotateImages(request, callback) { + return this.rpcCall(batchAnnotateImages, $root.google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest, $root.google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse, request, callback); + }, "name", { value: "BatchAnnotateImages" }); - /** - * Creates a plain object from a Landmark message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark - * @static - * @param {google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark} message Landmark - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Landmark.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.type = options.enums === String ? "UNKNOWN_LANDMARK" : 0; - object.position = null; - } - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark.Type[message.type] : message.type; - if (message.position != null && message.hasOwnProperty("position")) - object.position = $root.google.cloud.vision.v1p2beta1.Position.toObject(message.position, options); - return object; - }; + /** + * Calls BatchAnnotateImages. + * @function batchAnnotateImages + * @memberof google.cloud.vision.v1p2beta1.ImageAnnotator + * @instance + * @param {google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest} request BatchAnnotateImagesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - /** - * Converts this Landmark to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark - * @instance - * @returns {Object.} JSON object - */ - Landmark.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Callback as used by {@link google.cloud.vision.v1p2beta1.ImageAnnotator#asyncBatchAnnotateFiles}. + * @memberof google.cloud.vision.v1p2beta1.ImageAnnotator + * @typedef AsyncBatchAnnotateFilesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ - /** - * Type enum. - * @name google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark.Type - * @enum {string} - * @property {number} UNKNOWN_LANDMARK=0 UNKNOWN_LANDMARK value - * @property {number} LEFT_EYE=1 LEFT_EYE value - * @property {number} RIGHT_EYE=2 RIGHT_EYE value - * @property {number} LEFT_OF_LEFT_EYEBROW=3 LEFT_OF_LEFT_EYEBROW value - * @property {number} RIGHT_OF_LEFT_EYEBROW=4 RIGHT_OF_LEFT_EYEBROW value - * @property {number} LEFT_OF_RIGHT_EYEBROW=5 LEFT_OF_RIGHT_EYEBROW value - * @property {number} RIGHT_OF_RIGHT_EYEBROW=6 RIGHT_OF_RIGHT_EYEBROW value - * @property {number} MIDPOINT_BETWEEN_EYES=7 MIDPOINT_BETWEEN_EYES value - * @property {number} NOSE_TIP=8 NOSE_TIP value - * @property {number} UPPER_LIP=9 UPPER_LIP value - * @property {number} LOWER_LIP=10 LOWER_LIP value - * @property {number} MOUTH_LEFT=11 MOUTH_LEFT value - * @property {number} MOUTH_RIGHT=12 MOUTH_RIGHT value - * @property {number} MOUTH_CENTER=13 MOUTH_CENTER value - * @property {number} NOSE_BOTTOM_RIGHT=14 NOSE_BOTTOM_RIGHT value - * @property {number} NOSE_BOTTOM_LEFT=15 NOSE_BOTTOM_LEFT value - * @property {number} NOSE_BOTTOM_CENTER=16 NOSE_BOTTOM_CENTER value - * @property {number} LEFT_EYE_TOP_BOUNDARY=17 LEFT_EYE_TOP_BOUNDARY value - * @property {number} LEFT_EYE_RIGHT_CORNER=18 LEFT_EYE_RIGHT_CORNER value - * @property {number} LEFT_EYE_BOTTOM_BOUNDARY=19 LEFT_EYE_BOTTOM_BOUNDARY value - * @property {number} LEFT_EYE_LEFT_CORNER=20 LEFT_EYE_LEFT_CORNER value - * @property {number} RIGHT_EYE_TOP_BOUNDARY=21 RIGHT_EYE_TOP_BOUNDARY value - * @property {number} RIGHT_EYE_RIGHT_CORNER=22 RIGHT_EYE_RIGHT_CORNER value - * @property {number} RIGHT_EYE_BOTTOM_BOUNDARY=23 RIGHT_EYE_BOTTOM_BOUNDARY value - * @property {number} RIGHT_EYE_LEFT_CORNER=24 RIGHT_EYE_LEFT_CORNER value - * @property {number} LEFT_EYEBROW_UPPER_MIDPOINT=25 LEFT_EYEBROW_UPPER_MIDPOINT value - * @property {number} RIGHT_EYEBROW_UPPER_MIDPOINT=26 RIGHT_EYEBROW_UPPER_MIDPOINT value - * @property {number} LEFT_EAR_TRAGION=27 LEFT_EAR_TRAGION value - * @property {number} RIGHT_EAR_TRAGION=28 RIGHT_EAR_TRAGION value - * @property {number} LEFT_EYE_PUPIL=29 LEFT_EYE_PUPIL value - * @property {number} RIGHT_EYE_PUPIL=30 RIGHT_EYE_PUPIL value - * @property {number} FOREHEAD_GLABELLA=31 FOREHEAD_GLABELLA value - * @property {number} CHIN_GNATHION=32 CHIN_GNATHION value - * @property {number} CHIN_LEFT_GONION=33 CHIN_LEFT_GONION value - * @property {number} CHIN_RIGHT_GONION=34 CHIN_RIGHT_GONION value - */ - Landmark.Type = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "UNKNOWN_LANDMARK"] = 0; - values[valuesById[1] = "LEFT_EYE"] = 1; - values[valuesById[2] = "RIGHT_EYE"] = 2; - values[valuesById[3] = "LEFT_OF_LEFT_EYEBROW"] = 3; - values[valuesById[4] = "RIGHT_OF_LEFT_EYEBROW"] = 4; - values[valuesById[5] = "LEFT_OF_RIGHT_EYEBROW"] = 5; - values[valuesById[6] = "RIGHT_OF_RIGHT_EYEBROW"] = 6; - values[valuesById[7] = "MIDPOINT_BETWEEN_EYES"] = 7; - values[valuesById[8] = "NOSE_TIP"] = 8; - values[valuesById[9] = "UPPER_LIP"] = 9; - values[valuesById[10] = "LOWER_LIP"] = 10; - values[valuesById[11] = "MOUTH_LEFT"] = 11; - values[valuesById[12] = "MOUTH_RIGHT"] = 12; - values[valuesById[13] = "MOUTH_CENTER"] = 13; - values[valuesById[14] = "NOSE_BOTTOM_RIGHT"] = 14; - values[valuesById[15] = "NOSE_BOTTOM_LEFT"] = 15; - values[valuesById[16] = "NOSE_BOTTOM_CENTER"] = 16; - values[valuesById[17] = "LEFT_EYE_TOP_BOUNDARY"] = 17; - values[valuesById[18] = "LEFT_EYE_RIGHT_CORNER"] = 18; - values[valuesById[19] = "LEFT_EYE_BOTTOM_BOUNDARY"] = 19; - values[valuesById[20] = "LEFT_EYE_LEFT_CORNER"] = 20; - values[valuesById[21] = "RIGHT_EYE_TOP_BOUNDARY"] = 21; - values[valuesById[22] = "RIGHT_EYE_RIGHT_CORNER"] = 22; - values[valuesById[23] = "RIGHT_EYE_BOTTOM_BOUNDARY"] = 23; - values[valuesById[24] = "RIGHT_EYE_LEFT_CORNER"] = 24; - values[valuesById[25] = "LEFT_EYEBROW_UPPER_MIDPOINT"] = 25; - values[valuesById[26] = "RIGHT_EYEBROW_UPPER_MIDPOINT"] = 26; - values[valuesById[27] = "LEFT_EAR_TRAGION"] = 27; - values[valuesById[28] = "RIGHT_EAR_TRAGION"] = 28; - values[valuesById[29] = "LEFT_EYE_PUPIL"] = 29; - values[valuesById[30] = "RIGHT_EYE_PUPIL"] = 30; - values[valuesById[31] = "FOREHEAD_GLABELLA"] = 31; - values[valuesById[32] = "CHIN_GNATHION"] = 32; - values[valuesById[33] = "CHIN_LEFT_GONION"] = 33; - values[valuesById[34] = "CHIN_RIGHT_GONION"] = 34; - return values; - })(); + /** + * Calls AsyncBatchAnnotateFiles. + * @function asyncBatchAnnotateFiles + * @memberof google.cloud.vision.v1p2beta1.ImageAnnotator + * @instance + * @param {google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesRequest} request AsyncBatchAnnotateFilesRequest message or plain object + * @param {google.cloud.vision.v1p2beta1.ImageAnnotator.AsyncBatchAnnotateFilesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ImageAnnotator.prototype.asyncBatchAnnotateFiles = function asyncBatchAnnotateFiles(request, callback) { + return this.rpcCall(asyncBatchAnnotateFiles, $root.google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "AsyncBatchAnnotateFiles" }); - return Landmark; - })(); + /** + * Calls AsyncBatchAnnotateFiles. + * @function asyncBatchAnnotateFiles + * @memberof google.cloud.vision.v1p2beta1.ImageAnnotator + * @instance + * @param {google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesRequest} request AsyncBatchAnnotateFilesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ - return FaceAnnotation; + return ImageAnnotator; })(); - v1p2beta1.LocationInfo = (function() { + v1p2beta1.Feature = (function() { /** - * Properties of a LocationInfo. + * Properties of a Feature. * @memberof google.cloud.vision.v1p2beta1 - * @interface ILocationInfo - * @property {google.type.ILatLng|null} [latLng] LocationInfo latLng + * @interface IFeature + * @property {google.cloud.vision.v1p2beta1.Feature.Type|null} [type] Feature type + * @property {number|null} [maxResults] Feature maxResults + * @property {string|null} [model] Feature model */ /** - * Constructs a new LocationInfo. + * Constructs a new Feature. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a LocationInfo. - * @implements ILocationInfo + * @classdesc Represents a Feature. + * @implements IFeature * @constructor - * @param {google.cloud.vision.v1p2beta1.ILocationInfo=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.IFeature=} [properties] Properties to set */ - function LocationInfo(properties) { + function Feature(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -38227,75 +37145,101 @@ } /** - * LocationInfo latLng. - * @member {google.type.ILatLng|null|undefined} latLng - * @memberof google.cloud.vision.v1p2beta1.LocationInfo + * Feature type. + * @member {google.cloud.vision.v1p2beta1.Feature.Type} type + * @memberof google.cloud.vision.v1p2beta1.Feature * @instance */ - LocationInfo.prototype.latLng = null; + Feature.prototype.type = 0; /** - * Creates a new LocationInfo instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.LocationInfo + * Feature maxResults. + * @member {number} maxResults + * @memberof google.cloud.vision.v1p2beta1.Feature + * @instance + */ + Feature.prototype.maxResults = 0; + + /** + * Feature model. + * @member {string} model + * @memberof google.cloud.vision.v1p2beta1.Feature + * @instance + */ + Feature.prototype.model = ""; + + /** + * Creates a new Feature instance using the specified properties. + * @function create + * @memberof google.cloud.vision.v1p2beta1.Feature * @static - * @param {google.cloud.vision.v1p2beta1.ILocationInfo=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.LocationInfo} LocationInfo instance + * @param {google.cloud.vision.v1p2beta1.IFeature=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.Feature} Feature instance */ - LocationInfo.create = function create(properties) { - return new LocationInfo(properties); + Feature.create = function create(properties) { + return new Feature(properties); }; /** - * Encodes the specified LocationInfo message. Does not implicitly {@link google.cloud.vision.v1p2beta1.LocationInfo.verify|verify} messages. + * Encodes the specified Feature message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Feature.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.LocationInfo + * @memberof google.cloud.vision.v1p2beta1.Feature * @static - * @param {google.cloud.vision.v1p2beta1.ILocationInfo} message LocationInfo message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IFeature} message Feature message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - LocationInfo.encode = function encode(message, writer) { + Feature.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.latLng != null && message.hasOwnProperty("latLng")) - $root.google.type.LatLng.encode(message.latLng, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.type != null && message.hasOwnProperty("type")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.maxResults); + if (message.model != null && message.hasOwnProperty("model")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.model); return writer; }; /** - * Encodes the specified LocationInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.LocationInfo.verify|verify} messages. + * Encodes the specified Feature message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.Feature.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.LocationInfo + * @memberof google.cloud.vision.v1p2beta1.Feature * @static - * @param {google.cloud.vision.v1p2beta1.ILocationInfo} message LocationInfo message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IFeature} message Feature message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - LocationInfo.encodeDelimited = function encodeDelimited(message, writer) { + Feature.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a LocationInfo message from the specified reader or buffer. + * Decodes a Feature message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.LocationInfo + * @memberof google.cloud.vision.v1p2beta1.Feature * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.LocationInfo} LocationInfo + * @returns {google.cloud.vision.v1p2beta1.Feature} Feature * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - LocationInfo.decode = function decode(reader, length) { + Feature.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.vision.v1p2beta1.LocationInfo(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.Feature(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.latLng = $root.google.type.LatLng.decode(reader, reader.uint32()); + message.type = reader.int32(); + break; + case 2: + message.maxResults = reader.int32(); + break; + case 3: + message.model = reader.string(); break; default: reader.skipType(tag & 7); @@ -38306,114 +37250,215 @@ }; /** - * Decodes a LocationInfo message from the specified reader or buffer, length delimited. + * Decodes a Feature message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.LocationInfo + * @memberof google.cloud.vision.v1p2beta1.Feature * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.LocationInfo} LocationInfo + * @returns {google.cloud.vision.v1p2beta1.Feature} Feature * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - LocationInfo.decodeDelimited = function decodeDelimited(reader) { + Feature.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a LocationInfo message. + * Verifies a Feature message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.LocationInfo + * @memberof google.cloud.vision.v1p2beta1.Feature * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - LocationInfo.verify = function verify(message) { + Feature.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.latLng != null && message.hasOwnProperty("latLng")) { - var error = $root.google.type.LatLng.verify(message.latLng); - if (error) - return "latLng." + error; - } + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 11: + case 6: + case 7: + case 9: + case 10: + break; + } + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + if (!$util.isInteger(message.maxResults)) + return "maxResults: integer expected"; + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; return null; }; /** - * Creates a LocationInfo message from a plain object. Also converts values to their respective internal types. + * Creates a Feature message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.LocationInfo + * @memberof google.cloud.vision.v1p2beta1.Feature * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.LocationInfo} LocationInfo + * @returns {google.cloud.vision.v1p2beta1.Feature} Feature */ - LocationInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.LocationInfo) + Feature.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.Feature) return object; - var message = new $root.google.cloud.vision.v1p2beta1.LocationInfo(); - if (object.latLng != null) { - if (typeof object.latLng !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.LocationInfo.latLng: object expected"); - message.latLng = $root.google.type.LatLng.fromObject(object.latLng); + var message = new $root.google.cloud.vision.v1p2beta1.Feature(); + switch (object.type) { + case "TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "FACE_DETECTION": + case 1: + message.type = 1; + break; + case "LANDMARK_DETECTION": + case 2: + message.type = 2; + break; + case "LOGO_DETECTION": + case 3: + message.type = 3; + break; + case "LABEL_DETECTION": + case 4: + message.type = 4; + break; + case "TEXT_DETECTION": + case 5: + message.type = 5; + break; + case "DOCUMENT_TEXT_DETECTION": + case 11: + message.type = 11; + break; + case "SAFE_SEARCH_DETECTION": + case 6: + message.type = 6; + break; + case "IMAGE_PROPERTIES": + case 7: + message.type = 7; + break; + case "CROP_HINTS": + case 9: + message.type = 9; + break; + case "WEB_DETECTION": + case 10: + message.type = 10; + break; } + if (object.maxResults != null) + message.maxResults = object.maxResults | 0; + if (object.model != null) + message.model = String(object.model); return message; }; /** - * Creates a plain object from a LocationInfo message. Also converts values to other types if specified. + * Creates a plain object from a Feature message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.LocationInfo + * @memberof google.cloud.vision.v1p2beta1.Feature * @static - * @param {google.cloud.vision.v1p2beta1.LocationInfo} message LocationInfo + * @param {google.cloud.vision.v1p2beta1.Feature} message Feature * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - LocationInfo.toObject = function toObject(message, options) { + Feature.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.latLng = null; - if (message.latLng != null && message.hasOwnProperty("latLng")) - object.latLng = $root.google.type.LatLng.toObject(message.latLng, options); + if (options.defaults) { + object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + object.maxResults = 0; + object.model = ""; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.vision.v1p2beta1.Feature.Type[message.type] : message.type; + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + object.maxResults = message.maxResults; + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; return object; }; /** - * Converts this LocationInfo to JSON. + * Converts this Feature to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.LocationInfo + * @memberof google.cloud.vision.v1p2beta1.Feature * @instance * @returns {Object.} JSON object */ - LocationInfo.prototype.toJSON = function toJSON() { + Feature.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return LocationInfo; + /** + * Type enum. + * @name google.cloud.vision.v1p2beta1.Feature.Type + * @enum {string} + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} FACE_DETECTION=1 FACE_DETECTION value + * @property {number} LANDMARK_DETECTION=2 LANDMARK_DETECTION value + * @property {number} LOGO_DETECTION=3 LOGO_DETECTION value + * @property {number} LABEL_DETECTION=4 LABEL_DETECTION value + * @property {number} TEXT_DETECTION=5 TEXT_DETECTION value + * @property {number} DOCUMENT_TEXT_DETECTION=11 DOCUMENT_TEXT_DETECTION value + * @property {number} SAFE_SEARCH_DETECTION=6 SAFE_SEARCH_DETECTION value + * @property {number} IMAGE_PROPERTIES=7 IMAGE_PROPERTIES value + * @property {number} CROP_HINTS=9 CROP_HINTS value + * @property {number} WEB_DETECTION=10 WEB_DETECTION value + */ + Feature.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "FACE_DETECTION"] = 1; + values[valuesById[2] = "LANDMARK_DETECTION"] = 2; + values[valuesById[3] = "LOGO_DETECTION"] = 3; + values[valuesById[4] = "LABEL_DETECTION"] = 4; + values[valuesById[5] = "TEXT_DETECTION"] = 5; + values[valuesById[11] = "DOCUMENT_TEXT_DETECTION"] = 11; + values[valuesById[6] = "SAFE_SEARCH_DETECTION"] = 6; + values[valuesById[7] = "IMAGE_PROPERTIES"] = 7; + values[valuesById[9] = "CROP_HINTS"] = 9; + values[valuesById[10] = "WEB_DETECTION"] = 10; + return values; + })(); + + return Feature; })(); - v1p2beta1.Property = (function() { + v1p2beta1.ImageSource = (function() { /** - * Properties of a Property. + * Properties of an ImageSource. * @memberof google.cloud.vision.v1p2beta1 - * @interface IProperty - * @property {string|null} [name] Property name - * @property {string|null} [value] Property value - * @property {number|Long|null} [uint64Value] Property uint64Value + * @interface IImageSource + * @property {string|null} [gcsImageUri] ImageSource gcsImageUri + * @property {string|null} [imageUri] ImageSource imageUri */ /** - * Constructs a new Property. + * Constructs a new ImageSource. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a Property. - * @implements IProperty + * @classdesc Represents an ImageSource. + * @implements IImageSource * @constructor - * @param {google.cloud.vision.v1p2beta1.IProperty=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.IImageSource=} [properties] Properties to set */ - function Property(properties) { + function ImageSource(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -38421,101 +37466,88 @@ } /** - * Property name. - * @member {string} name - * @memberof google.cloud.vision.v1p2beta1.Property - * @instance - */ - Property.prototype.name = ""; - - /** - * Property value. - * @member {string} value - * @memberof google.cloud.vision.v1p2beta1.Property + * ImageSource gcsImageUri. + * @member {string} gcsImageUri + * @memberof google.cloud.vision.v1p2beta1.ImageSource * @instance */ - Property.prototype.value = ""; + ImageSource.prototype.gcsImageUri = ""; /** - * Property uint64Value. - * @member {number|Long} uint64Value - * @memberof google.cloud.vision.v1p2beta1.Property + * ImageSource imageUri. + * @member {string} imageUri + * @memberof google.cloud.vision.v1p2beta1.ImageSource * @instance */ - Property.prototype.uint64Value = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + ImageSource.prototype.imageUri = ""; /** - * Creates a new Property instance using the specified properties. + * Creates a new ImageSource instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.Property + * @memberof google.cloud.vision.v1p2beta1.ImageSource * @static - * @param {google.cloud.vision.v1p2beta1.IProperty=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.Property} Property instance + * @param {google.cloud.vision.v1p2beta1.IImageSource=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.ImageSource} ImageSource instance */ - Property.create = function create(properties) { - return new Property(properties); + ImageSource.create = function create(properties) { + return new ImageSource(properties); }; /** - * Encodes the specified Property message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Property.verify|verify} messages. + * Encodes the specified ImageSource message. Does not implicitly {@link google.cloud.vision.v1p2beta1.ImageSource.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.Property + * @memberof google.cloud.vision.v1p2beta1.ImageSource * @static - * @param {google.cloud.vision.v1p2beta1.IProperty} message Property message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IImageSource} message ImageSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Property.encode = function encode(message, writer) { + ImageSource.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.value != null && message.hasOwnProperty("value")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); - if (message.uint64Value != null && message.hasOwnProperty("uint64Value")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.uint64Value); + if (message.gcsImageUri != null && message.hasOwnProperty("gcsImageUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsImageUri); + if (message.imageUri != null && message.hasOwnProperty("imageUri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.imageUri); return writer; }; /** - * Encodes the specified Property message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.Property.verify|verify} messages. + * Encodes the specified ImageSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.ImageSource.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.Property + * @memberof google.cloud.vision.v1p2beta1.ImageSource * @static - * @param {google.cloud.vision.v1p2beta1.IProperty} message Property message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IImageSource} message ImageSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Property.encodeDelimited = function encodeDelimited(message, writer) { + ImageSource.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Property message from the specified reader or buffer. + * Decodes an ImageSource message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.Property + * @memberof google.cloud.vision.v1p2beta1.ImageSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.Property} Property + * @returns {google.cloud.vision.v1p2beta1.ImageSource} ImageSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Property.decode = function decode(reader, length) { + ImageSource.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.vision.v1p2beta1.Property(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.ImageSource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.name = reader.string(); + message.gcsImageUri = reader.string(); break; case 2: - message.value = reader.string(); - break; - case 3: - message.uint64Value = reader.uint64(); + message.imageUri = reader.string(); break; default: reader.skipType(tag & 7); @@ -38526,148 +37558,117 @@ }; /** - * Decodes a Property message from the specified reader or buffer, length delimited. + * Decodes an ImageSource message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.Property + * @memberof google.cloud.vision.v1p2beta1.ImageSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.Property} Property + * @returns {google.cloud.vision.v1p2beta1.ImageSource} ImageSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Property.decodeDelimited = function decodeDelimited(reader) { + ImageSource.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Property message. + * Verifies an ImageSource message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.Property + * @memberof google.cloud.vision.v1p2beta1.ImageSource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Property.verify = function verify(message) { + ImageSource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isString(message.value)) - return "value: string expected"; - if (message.uint64Value != null && message.hasOwnProperty("uint64Value")) - if (!$util.isInteger(message.uint64Value) && !(message.uint64Value && $util.isInteger(message.uint64Value.low) && $util.isInteger(message.uint64Value.high))) - return "uint64Value: integer|Long expected"; + if (message.gcsImageUri != null && message.hasOwnProperty("gcsImageUri")) + if (!$util.isString(message.gcsImageUri)) + return "gcsImageUri: string expected"; + if (message.imageUri != null && message.hasOwnProperty("imageUri")) + if (!$util.isString(message.imageUri)) + return "imageUri: string expected"; return null; }; /** - * Creates a Property message from a plain object. Also converts values to their respective internal types. + * Creates an ImageSource message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.Property + * @memberof google.cloud.vision.v1p2beta1.ImageSource * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.Property} Property + * @returns {google.cloud.vision.v1p2beta1.ImageSource} ImageSource */ - Property.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.Property) + ImageSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.ImageSource) return object; - var message = new $root.google.cloud.vision.v1p2beta1.Property(); - if (object.name != null) - message.name = String(object.name); - if (object.value != null) - message.value = String(object.value); - if (object.uint64Value != null) - if ($util.Long) - (message.uint64Value = $util.Long.fromValue(object.uint64Value)).unsigned = true; - else if (typeof object.uint64Value === "string") - message.uint64Value = parseInt(object.uint64Value, 10); - else if (typeof object.uint64Value === "number") - message.uint64Value = object.uint64Value; - else if (typeof object.uint64Value === "object") - message.uint64Value = new $util.LongBits(object.uint64Value.low >>> 0, object.uint64Value.high >>> 0).toNumber(true); + var message = new $root.google.cloud.vision.v1p2beta1.ImageSource(); + if (object.gcsImageUri != null) + message.gcsImageUri = String(object.gcsImageUri); + if (object.imageUri != null) + message.imageUri = String(object.imageUri); return message; }; /** - * Creates a plain object from a Property message. Also converts values to other types if specified. + * Creates a plain object from an ImageSource message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.Property + * @memberof google.cloud.vision.v1p2beta1.ImageSource * @static - * @param {google.cloud.vision.v1p2beta1.Property} message Property + * @param {google.cloud.vision.v1p2beta1.ImageSource} message ImageSource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Property.toObject = function toObject(message, options) { + ImageSource.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.name = ""; - object.value = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, true); - object.uint64Value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.uint64Value = options.longs === String ? "0" : 0; + object.gcsImageUri = ""; + object.imageUri = ""; } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - if (message.uint64Value != null && message.hasOwnProperty("uint64Value")) - if (typeof message.uint64Value === "number") - object.uint64Value = options.longs === String ? String(message.uint64Value) : message.uint64Value; - else - object.uint64Value = options.longs === String ? $util.Long.prototype.toString.call(message.uint64Value) : options.longs === Number ? new $util.LongBits(message.uint64Value.low >>> 0, message.uint64Value.high >>> 0).toNumber(true) : message.uint64Value; + if (message.gcsImageUri != null && message.hasOwnProperty("gcsImageUri")) + object.gcsImageUri = message.gcsImageUri; + if (message.imageUri != null && message.hasOwnProperty("imageUri")) + object.imageUri = message.imageUri; return object; }; /** - * Converts this Property to JSON. + * Converts this ImageSource to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.Property + * @memberof google.cloud.vision.v1p2beta1.ImageSource * @instance * @returns {Object.} JSON object */ - Property.prototype.toJSON = function toJSON() { + ImageSource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Property; + return ImageSource; })(); - v1p2beta1.EntityAnnotation = (function() { + v1p2beta1.Image = (function() { /** - * Properties of an EntityAnnotation. + * Properties of an Image. * @memberof google.cloud.vision.v1p2beta1 - * @interface IEntityAnnotation - * @property {string|null} [mid] EntityAnnotation mid - * @property {string|null} [locale] EntityAnnotation locale - * @property {string|null} [description] EntityAnnotation description - * @property {number|null} [score] EntityAnnotation score - * @property {number|null} [confidence] EntityAnnotation confidence - * @property {number|null} [topicality] EntityAnnotation topicality - * @property {google.cloud.vision.v1p2beta1.IBoundingPoly|null} [boundingPoly] EntityAnnotation boundingPoly - * @property {Array.|null} [locations] EntityAnnotation locations - * @property {Array.|null} [properties] EntityAnnotation properties + * @interface IImage + * @property {Uint8Array|null} [content] Image content + * @property {google.cloud.vision.v1p2beta1.IImageSource|null} [source] Image source */ /** - * Constructs a new EntityAnnotation. + * Constructs a new Image. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an EntityAnnotation. - * @implements IEntityAnnotation + * @classdesc Represents an Image. + * @implements IImage * @constructor - * @param {google.cloud.vision.v1p2beta1.IEntityAnnotation=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.IImage=} [properties] Properties to set */ - function EntityAnnotation(properties) { - this.locations = []; - this.properties = []; + function Image(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -38675,185 +37676,88 @@ } /** - * EntityAnnotation mid. - * @member {string} mid - * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation + * Image content. + * @member {Uint8Array} content + * @memberof google.cloud.vision.v1p2beta1.Image * @instance */ - EntityAnnotation.prototype.mid = ""; + Image.prototype.content = $util.newBuffer([]); /** - * EntityAnnotation locale. - * @member {string} locale - * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation + * Image source. + * @member {google.cloud.vision.v1p2beta1.IImageSource|null|undefined} source + * @memberof google.cloud.vision.v1p2beta1.Image * @instance */ - EntityAnnotation.prototype.locale = ""; + Image.prototype.source = null; /** - * EntityAnnotation description. - * @member {string} description - * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation - * @instance + * Creates a new Image instance using the specified properties. + * @function create + * @memberof google.cloud.vision.v1p2beta1.Image + * @static + * @param {google.cloud.vision.v1p2beta1.IImage=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.Image} Image instance */ - EntityAnnotation.prototype.description = ""; + Image.create = function create(properties) { + return new Image(properties); + }; /** - * EntityAnnotation score. - * @member {number} score - * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation - * @instance + * Encodes the specified Image message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Image.verify|verify} messages. + * @function encode + * @memberof google.cloud.vision.v1p2beta1.Image + * @static + * @param {google.cloud.vision.v1p2beta1.IImage} message Image message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - EntityAnnotation.prototype.score = 0; - - /** - * EntityAnnotation confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation - * @instance - */ - EntityAnnotation.prototype.confidence = 0; - - /** - * EntityAnnotation topicality. - * @member {number} topicality - * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation - * @instance - */ - EntityAnnotation.prototype.topicality = 0; - - /** - * EntityAnnotation boundingPoly. - * @member {google.cloud.vision.v1p2beta1.IBoundingPoly|null|undefined} boundingPoly - * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation - * @instance - */ - EntityAnnotation.prototype.boundingPoly = null; - - /** - * EntityAnnotation locations. - * @member {Array.} locations - * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation - * @instance - */ - EntityAnnotation.prototype.locations = $util.emptyArray; - - /** - * EntityAnnotation properties. - * @member {Array.} properties - * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation - * @instance - */ - EntityAnnotation.prototype.properties = $util.emptyArray; - - /** - * Creates a new EntityAnnotation instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation - * @static - * @param {google.cloud.vision.v1p2beta1.IEntityAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.EntityAnnotation} EntityAnnotation instance - */ - EntityAnnotation.create = function create(properties) { - return new EntityAnnotation(properties); - }; - - /** - * Encodes the specified EntityAnnotation message. Does not implicitly {@link google.cloud.vision.v1p2beta1.EntityAnnotation.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation - * @static - * @param {google.cloud.vision.v1p2beta1.IEntityAnnotation} message EntityAnnotation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EntityAnnotation.encode = function encode(message, writer) { + Image.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.mid != null && message.hasOwnProperty("mid")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.mid); - if (message.locale != null && message.hasOwnProperty("locale")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.locale); - if (message.description != null && message.hasOwnProperty("description")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); - if (message.score != null && message.hasOwnProperty("score")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.score); - if (message.confidence != null && message.hasOwnProperty("confidence")) - writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); - if (message.topicality != null && message.hasOwnProperty("topicality")) - writer.uint32(/* id 6, wireType 5 =*/53).float(message.topicality); - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - $root.google.cloud.vision.v1p2beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.locations != null && message.locations.length) - for (var i = 0; i < message.locations.length; ++i) - $root.google.cloud.vision.v1p2beta1.LocationInfo.encode(message.locations[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.properties != null && message.properties.length) - for (var i = 0; i < message.properties.length; ++i) - $root.google.cloud.vision.v1p2beta1.Property.encode(message.properties[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.content != null && message.hasOwnProperty("content")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.content); + if (message.source != null && message.hasOwnProperty("source")) + $root.google.cloud.vision.v1p2beta1.ImageSource.encode(message.source, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified EntityAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.EntityAnnotation.verify|verify} messages. + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.Image.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation + * @memberof google.cloud.vision.v1p2beta1.Image * @static - * @param {google.cloud.vision.v1p2beta1.IEntityAnnotation} message EntityAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IImage} message Image message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EntityAnnotation.encodeDelimited = function encodeDelimited(message, writer) { + Image.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an EntityAnnotation message from the specified reader or buffer. + * Decodes an Image message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation + * @memberof google.cloud.vision.v1p2beta1.Image * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.EntityAnnotation} EntityAnnotation + * @returns {google.cloud.vision.v1p2beta1.Image} Image * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EntityAnnotation.decode = function decode(reader, length) { + Image.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.vision.v1p2beta1.EntityAnnotation(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.Image(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.mid = reader.string(); + message.content = reader.bytes(); break; case 2: - message.locale = reader.string(); - break; - case 3: - message.description = reader.string(); - break; - case 4: - message.score = reader.float(); - break; - case 5: - message.confidence = reader.float(); - break; - case 6: - message.topicality = reader.float(); - break; - case 7: - message.boundingPoly = $root.google.cloud.vision.v1p2beta1.BoundingPoly.decode(reader, reader.uint32()); - break; - case 8: - if (!(message.locations && message.locations.length)) - message.locations = []; - message.locations.push($root.google.cloud.vision.v1p2beta1.LocationInfo.decode(reader, reader.uint32())); - break; - case 9: - if (!(message.properties && message.properties.length)) - message.properties = []; - message.properties.push($root.google.cloud.vision.v1p2beta1.Property.decode(reader, reader.uint32())); + message.source = $root.google.cloud.vision.v1p2beta1.ImageSource.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -38864,217 +37768,145 @@ }; /** - * Decodes an EntityAnnotation message from the specified reader or buffer, length delimited. + * Decodes an Image message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation + * @memberof google.cloud.vision.v1p2beta1.Image * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.EntityAnnotation} EntityAnnotation + * @returns {google.cloud.vision.v1p2beta1.Image} Image * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EntityAnnotation.decodeDelimited = function decodeDelimited(reader) { + Image.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an EntityAnnotation message. + * Verifies an Image message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation + * @memberof google.cloud.vision.v1p2beta1.Image * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - EntityAnnotation.verify = function verify(message) { + Image.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.mid != null && message.hasOwnProperty("mid")) - if (!$util.isString(message.mid)) - return "mid: string expected"; - if (message.locale != null && message.hasOwnProperty("locale")) - if (!$util.isString(message.locale)) - return "locale: string expected"; - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; - if (message.confidence != null && message.hasOwnProperty("confidence")) - if (typeof message.confidence !== "number") - return "confidence: number expected"; - if (message.topicality != null && message.hasOwnProperty("topicality")) - if (typeof message.topicality !== "number") - return "topicality: number expected"; - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { - var error = $root.google.cloud.vision.v1p2beta1.BoundingPoly.verify(message.boundingPoly); + if (message.content != null && message.hasOwnProperty("content")) + if (!(message.content && typeof message.content.length === "number" || $util.isString(message.content))) + return "content: buffer expected"; + if (message.source != null && message.hasOwnProperty("source")) { + var error = $root.google.cloud.vision.v1p2beta1.ImageSource.verify(message.source); if (error) - return "boundingPoly." + error; - } - if (message.locations != null && message.hasOwnProperty("locations")) { - if (!Array.isArray(message.locations)) - return "locations: array expected"; - for (var i = 0; i < message.locations.length; ++i) { - var error = $root.google.cloud.vision.v1p2beta1.LocationInfo.verify(message.locations[i]); - if (error) - return "locations." + error; - } - } - if (message.properties != null && message.hasOwnProperty("properties")) { - if (!Array.isArray(message.properties)) - return "properties: array expected"; - for (var i = 0; i < message.properties.length; ++i) { - var error = $root.google.cloud.vision.v1p2beta1.Property.verify(message.properties[i]); - if (error) - return "properties." + error; - } + return "source." + error; } return null; }; /** - * Creates an EntityAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates an Image message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation + * @memberof google.cloud.vision.v1p2beta1.Image * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.EntityAnnotation} EntityAnnotation + * @returns {google.cloud.vision.v1p2beta1.Image} Image */ - EntityAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.EntityAnnotation) + Image.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.Image) return object; - var message = new $root.google.cloud.vision.v1p2beta1.EntityAnnotation(); - if (object.mid != null) - message.mid = String(object.mid); - if (object.locale != null) - message.locale = String(object.locale); - if (object.description != null) - message.description = String(object.description); - if (object.score != null) - message.score = Number(object.score); - if (object.confidence != null) - message.confidence = Number(object.confidence); - if (object.topicality != null) - message.topicality = Number(object.topicality); - if (object.boundingPoly != null) { - if (typeof object.boundingPoly !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.EntityAnnotation.boundingPoly: object expected"); - message.boundingPoly = $root.google.cloud.vision.v1p2beta1.BoundingPoly.fromObject(object.boundingPoly); - } - if (object.locations) { - if (!Array.isArray(object.locations)) - throw TypeError(".google.cloud.vision.v1p2beta1.EntityAnnotation.locations: array expected"); - message.locations = []; - for (var i = 0; i < object.locations.length; ++i) { - if (typeof object.locations[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.EntityAnnotation.locations: object expected"); - message.locations[i] = $root.google.cloud.vision.v1p2beta1.LocationInfo.fromObject(object.locations[i]); - } - } - if (object.properties) { - if (!Array.isArray(object.properties)) - throw TypeError(".google.cloud.vision.v1p2beta1.EntityAnnotation.properties: array expected"); - message.properties = []; - for (var i = 0; i < object.properties.length; ++i) { - if (typeof object.properties[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.EntityAnnotation.properties: object expected"); - message.properties[i] = $root.google.cloud.vision.v1p2beta1.Property.fromObject(object.properties[i]); - } + var message = new $root.google.cloud.vision.v1p2beta1.Image(); + if (object.content != null) + if (typeof object.content === "string") + $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); + else if (object.content.length) + message.content = object.content; + if (object.source != null) { + if (typeof object.source !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.Image.source: object expected"); + message.source = $root.google.cloud.vision.v1p2beta1.ImageSource.fromObject(object.source); } return message; }; /** - * Creates a plain object from an EntityAnnotation message. Also converts values to other types if specified. + * Creates a plain object from an Image message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation + * @memberof google.cloud.vision.v1p2beta1.Image * @static - * @param {google.cloud.vision.v1p2beta1.EntityAnnotation} message EntityAnnotation + * @param {google.cloud.vision.v1p2beta1.Image} message Image * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EntityAnnotation.toObject = function toObject(message, options) { + Image.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.locations = []; - object.properties = []; - } if (options.defaults) { - object.mid = ""; - object.locale = ""; - object.description = ""; - object.score = 0; - object.confidence = 0; - object.topicality = 0; - object.boundingPoly = null; - } - if (message.mid != null && message.hasOwnProperty("mid")) - object.mid = message.mid; - if (message.locale != null && message.hasOwnProperty("locale")) - object.locale = message.locale; - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - if (message.confidence != null && message.hasOwnProperty("confidence")) - object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; - if (message.topicality != null && message.hasOwnProperty("topicality")) - object.topicality = options.json && !isFinite(message.topicality) ? String(message.topicality) : message.topicality; - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - object.boundingPoly = $root.google.cloud.vision.v1p2beta1.BoundingPoly.toObject(message.boundingPoly, options); - if (message.locations && message.locations.length) { - object.locations = []; - for (var j = 0; j < message.locations.length; ++j) - object.locations[j] = $root.google.cloud.vision.v1p2beta1.LocationInfo.toObject(message.locations[j], options); - } - if (message.properties && message.properties.length) { - object.properties = []; - for (var j = 0; j < message.properties.length; ++j) - object.properties[j] = $root.google.cloud.vision.v1p2beta1.Property.toObject(message.properties[j], options); + if (options.bytes === String) + object.content = ""; + else { + object.content = []; + if (options.bytes !== Array) + object.content = $util.newBuffer(object.content); + } + object.source = null; } + if (message.content != null && message.hasOwnProperty("content")) + object.content = options.bytes === String ? $util.base64.encode(message.content, 0, message.content.length) : options.bytes === Array ? Array.prototype.slice.call(message.content) : message.content; + if (message.source != null && message.hasOwnProperty("source")) + object.source = $root.google.cloud.vision.v1p2beta1.ImageSource.toObject(message.source, options); return object; }; /** - * Converts this EntityAnnotation to JSON. + * Converts this Image to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation + * @memberof google.cloud.vision.v1p2beta1.Image * @instance * @returns {Object.} JSON object */ - EntityAnnotation.prototype.toJSON = function toJSON() { + Image.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return EntityAnnotation; + return Image; })(); - v1p2beta1.SafeSearchAnnotation = (function() { + v1p2beta1.FaceAnnotation = (function() { /** - * Properties of a SafeSearchAnnotation. + * Properties of a FaceAnnotation. * @memberof google.cloud.vision.v1p2beta1 - * @interface ISafeSearchAnnotation - * @property {google.cloud.vision.v1p2beta1.Likelihood|null} [adult] SafeSearchAnnotation adult - * @property {google.cloud.vision.v1p2beta1.Likelihood|null} [spoof] SafeSearchAnnotation spoof - * @property {google.cloud.vision.v1p2beta1.Likelihood|null} [medical] SafeSearchAnnotation medical - * @property {google.cloud.vision.v1p2beta1.Likelihood|null} [violence] SafeSearchAnnotation violence - * @property {google.cloud.vision.v1p2beta1.Likelihood|null} [racy] SafeSearchAnnotation racy + * @interface IFaceAnnotation + * @property {google.cloud.vision.v1p2beta1.IBoundingPoly|null} [boundingPoly] FaceAnnotation boundingPoly + * @property {google.cloud.vision.v1p2beta1.IBoundingPoly|null} [fdBoundingPoly] FaceAnnotation fdBoundingPoly + * @property {Array.|null} [landmarks] FaceAnnotation landmarks + * @property {number|null} [rollAngle] FaceAnnotation rollAngle + * @property {number|null} [panAngle] FaceAnnotation panAngle + * @property {number|null} [tiltAngle] FaceAnnotation tiltAngle + * @property {number|null} [detectionConfidence] FaceAnnotation detectionConfidence + * @property {number|null} [landmarkingConfidence] FaceAnnotation landmarkingConfidence + * @property {google.cloud.vision.v1p2beta1.Likelihood|null} [joyLikelihood] FaceAnnotation joyLikelihood + * @property {google.cloud.vision.v1p2beta1.Likelihood|null} [sorrowLikelihood] FaceAnnotation sorrowLikelihood + * @property {google.cloud.vision.v1p2beta1.Likelihood|null} [angerLikelihood] FaceAnnotation angerLikelihood + * @property {google.cloud.vision.v1p2beta1.Likelihood|null} [surpriseLikelihood] FaceAnnotation surpriseLikelihood + * @property {google.cloud.vision.v1p2beta1.Likelihood|null} [underExposedLikelihood] FaceAnnotation underExposedLikelihood + * @property {google.cloud.vision.v1p2beta1.Likelihood|null} [blurredLikelihood] FaceAnnotation blurredLikelihood + * @property {google.cloud.vision.v1p2beta1.Likelihood|null} [headwearLikelihood] FaceAnnotation headwearLikelihood */ /** - * Constructs a new SafeSearchAnnotation. + * Constructs a new FaceAnnotation. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a SafeSearchAnnotation. - * @implements ISafeSearchAnnotation + * @classdesc Represents a FaceAnnotation. + * @implements IFaceAnnotation * @constructor - * @param {google.cloud.vision.v1p2beta1.ISafeSearchAnnotation=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.IFaceAnnotation=} [properties] Properties to set */ - function SafeSearchAnnotation(properties) { + function FaceAnnotation(properties) { + this.landmarks = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -39082,167 +37914,334 @@ } /** - * SafeSearchAnnotation adult. - * @member {google.cloud.vision.v1p2beta1.Likelihood} adult - * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation + * FaceAnnotation boundingPoly. + * @member {google.cloud.vision.v1p2beta1.IBoundingPoly|null|undefined} boundingPoly + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation * @instance */ - SafeSearchAnnotation.prototype.adult = 0; + FaceAnnotation.prototype.boundingPoly = null; /** - * SafeSearchAnnotation spoof. - * @member {google.cloud.vision.v1p2beta1.Likelihood} spoof - * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation + * FaceAnnotation fdBoundingPoly. + * @member {google.cloud.vision.v1p2beta1.IBoundingPoly|null|undefined} fdBoundingPoly + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation * @instance */ - SafeSearchAnnotation.prototype.spoof = 0; + FaceAnnotation.prototype.fdBoundingPoly = null; /** - * SafeSearchAnnotation medical. - * @member {google.cloud.vision.v1p2beta1.Likelihood} medical - * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation + * FaceAnnotation landmarks. + * @member {Array.} landmarks + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation * @instance */ - SafeSearchAnnotation.prototype.medical = 0; + FaceAnnotation.prototype.landmarks = $util.emptyArray; /** - * SafeSearchAnnotation violence. - * @member {google.cloud.vision.v1p2beta1.Likelihood} violence - * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation + * FaceAnnotation rollAngle. + * @member {number} rollAngle + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation * @instance */ - SafeSearchAnnotation.prototype.violence = 0; + FaceAnnotation.prototype.rollAngle = 0; /** - * SafeSearchAnnotation racy. - * @member {google.cloud.vision.v1p2beta1.Likelihood} racy - * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation + * FaceAnnotation panAngle. + * @member {number} panAngle + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation * @instance */ - SafeSearchAnnotation.prototype.racy = 0; + FaceAnnotation.prototype.panAngle = 0; /** - * Creates a new SafeSearchAnnotation instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation - * @static - * @param {google.cloud.vision.v1p2beta1.ISafeSearchAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.SafeSearchAnnotation} SafeSearchAnnotation instance + * FaceAnnotation tiltAngle. + * @member {number} tiltAngle + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation + * @instance */ - SafeSearchAnnotation.create = function create(properties) { - return new SafeSearchAnnotation(properties); - }; + FaceAnnotation.prototype.tiltAngle = 0; /** - * Encodes the specified SafeSearchAnnotation message. Does not implicitly {@link google.cloud.vision.v1p2beta1.SafeSearchAnnotation.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation - * @static - * @param {google.cloud.vision.v1p2beta1.ISafeSearchAnnotation} message SafeSearchAnnotation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * FaceAnnotation detectionConfidence. + * @member {number} detectionConfidence + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation + * @instance */ - SafeSearchAnnotation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.adult != null && message.hasOwnProperty("adult")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.adult); - if (message.spoof != null && message.hasOwnProperty("spoof")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.spoof); - if (message.medical != null && message.hasOwnProperty("medical")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.medical); - if (message.violence != null && message.hasOwnProperty("violence")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.violence); - if (message.racy != null && message.hasOwnProperty("racy")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.racy); - return writer; - }; + FaceAnnotation.prototype.detectionConfidence = 0; /** - * Encodes the specified SafeSearchAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.SafeSearchAnnotation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation - * @static - * @param {google.cloud.vision.v1p2beta1.ISafeSearchAnnotation} message SafeSearchAnnotation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * FaceAnnotation landmarkingConfidence. + * @member {number} landmarkingConfidence + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation + * @instance */ - SafeSearchAnnotation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + FaceAnnotation.prototype.landmarkingConfidence = 0; /** - * Decodes a SafeSearchAnnotation message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.SafeSearchAnnotation} SafeSearchAnnotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * FaceAnnotation joyLikelihood. + * @member {google.cloud.vision.v1p2beta1.Likelihood} joyLikelihood + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation + * @instance */ - SafeSearchAnnotation.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.vision.v1p2beta1.SafeSearchAnnotation(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.adult = reader.int32(); - break; - case 2: - message.spoof = reader.int32(); - break; - case 3: - message.medical = reader.int32(); - break; - case 4: - message.violence = reader.int32(); - break; - case 9: - message.racy = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + FaceAnnotation.prototype.joyLikelihood = 0; /** - * Decodes a SafeSearchAnnotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.SafeSearchAnnotation} SafeSearchAnnotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * FaceAnnotation sorrowLikelihood. + * @member {google.cloud.vision.v1p2beta1.Likelihood} sorrowLikelihood + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation + * @instance */ - SafeSearchAnnotation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + FaceAnnotation.prototype.sorrowLikelihood = 0; /** - * Verifies a SafeSearchAnnotation message. - * @function verify - * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SafeSearchAnnotation.verify = function verify(message) { - if (typeof message !== "object" || message === null) + * FaceAnnotation angerLikelihood. + * @member {google.cloud.vision.v1p2beta1.Likelihood} angerLikelihood + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.angerLikelihood = 0; + + /** + * FaceAnnotation surpriseLikelihood. + * @member {google.cloud.vision.v1p2beta1.Likelihood} surpriseLikelihood + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.surpriseLikelihood = 0; + + /** + * FaceAnnotation underExposedLikelihood. + * @member {google.cloud.vision.v1p2beta1.Likelihood} underExposedLikelihood + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.underExposedLikelihood = 0; + + /** + * FaceAnnotation blurredLikelihood. + * @member {google.cloud.vision.v1p2beta1.Likelihood} blurredLikelihood + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.blurredLikelihood = 0; + + /** + * FaceAnnotation headwearLikelihood. + * @member {google.cloud.vision.v1p2beta1.Likelihood} headwearLikelihood + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.headwearLikelihood = 0; + + /** + * Creates a new FaceAnnotation instance using the specified properties. + * @function create + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation + * @static + * @param {google.cloud.vision.v1p2beta1.IFaceAnnotation=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.FaceAnnotation} FaceAnnotation instance + */ + FaceAnnotation.create = function create(properties) { + return new FaceAnnotation(properties); + }; + + /** + * Encodes the specified FaceAnnotation message. Does not implicitly {@link google.cloud.vision.v1p2beta1.FaceAnnotation.verify|verify} messages. + * @function encode + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation + * @static + * @param {google.cloud.vision.v1p2beta1.IFaceAnnotation} message FaceAnnotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FaceAnnotation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + $root.google.cloud.vision.v1p2beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.fdBoundingPoly != null && message.hasOwnProperty("fdBoundingPoly")) + $root.google.cloud.vision.v1p2beta1.BoundingPoly.encode(message.fdBoundingPoly, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.landmarks != null && message.landmarks.length) + for (var i = 0; i < message.landmarks.length; ++i) + $root.google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark.encode(message.landmarks[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.rollAngle != null && message.hasOwnProperty("rollAngle")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.rollAngle); + if (message.panAngle != null && message.hasOwnProperty("panAngle")) + writer.uint32(/* id 5, wireType 5 =*/45).float(message.panAngle); + if (message.tiltAngle != null && message.hasOwnProperty("tiltAngle")) + writer.uint32(/* id 6, wireType 5 =*/53).float(message.tiltAngle); + if (message.detectionConfidence != null && message.hasOwnProperty("detectionConfidence")) + writer.uint32(/* id 7, wireType 5 =*/61).float(message.detectionConfidence); + if (message.landmarkingConfidence != null && message.hasOwnProperty("landmarkingConfidence")) + writer.uint32(/* id 8, wireType 5 =*/69).float(message.landmarkingConfidence); + if (message.joyLikelihood != null && message.hasOwnProperty("joyLikelihood")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.joyLikelihood); + if (message.sorrowLikelihood != null && message.hasOwnProperty("sorrowLikelihood")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.sorrowLikelihood); + if (message.angerLikelihood != null && message.hasOwnProperty("angerLikelihood")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.angerLikelihood); + if (message.surpriseLikelihood != null && message.hasOwnProperty("surpriseLikelihood")) + writer.uint32(/* id 12, wireType 0 =*/96).int32(message.surpriseLikelihood); + if (message.underExposedLikelihood != null && message.hasOwnProperty("underExposedLikelihood")) + writer.uint32(/* id 13, wireType 0 =*/104).int32(message.underExposedLikelihood); + if (message.blurredLikelihood != null && message.hasOwnProperty("blurredLikelihood")) + writer.uint32(/* id 14, wireType 0 =*/112).int32(message.blurredLikelihood); + if (message.headwearLikelihood != null && message.hasOwnProperty("headwearLikelihood")) + writer.uint32(/* id 15, wireType 0 =*/120).int32(message.headwearLikelihood); + return writer; + }; + + /** + * Encodes the specified FaceAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.FaceAnnotation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation + * @static + * @param {google.cloud.vision.v1p2beta1.IFaceAnnotation} message FaceAnnotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FaceAnnotation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FaceAnnotation message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.vision.v1p2beta1.FaceAnnotation} FaceAnnotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FaceAnnotation.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.vision.v1p2beta1.FaceAnnotation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.boundingPoly = $root.google.cloud.vision.v1p2beta1.BoundingPoly.decode(reader, reader.uint32()); + break; + case 2: + message.fdBoundingPoly = $root.google.cloud.vision.v1p2beta1.BoundingPoly.decode(reader, reader.uint32()); + break; + case 3: + if (!(message.landmarks && message.landmarks.length)) + message.landmarks = []; + message.landmarks.push($root.google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark.decode(reader, reader.uint32())); + break; + case 4: + message.rollAngle = reader.float(); + break; + case 5: + message.panAngle = reader.float(); + break; + case 6: + message.tiltAngle = reader.float(); + break; + case 7: + message.detectionConfidence = reader.float(); + break; + case 8: + message.landmarkingConfidence = reader.float(); + break; + case 9: + message.joyLikelihood = reader.int32(); + break; + case 10: + message.sorrowLikelihood = reader.int32(); + break; + case 11: + message.angerLikelihood = reader.int32(); + break; + case 12: + message.surpriseLikelihood = reader.int32(); + break; + case 13: + message.underExposedLikelihood = reader.int32(); + break; + case 14: + message.blurredLikelihood = reader.int32(); + break; + case 15: + message.headwearLikelihood = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FaceAnnotation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.vision.v1p2beta1.FaceAnnotation} FaceAnnotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FaceAnnotation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FaceAnnotation message. + * @function verify + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FaceAnnotation.verify = function verify(message) { + if (typeof message !== "object" || message === null) return "object expected"; - if (message.adult != null && message.hasOwnProperty("adult")) - switch (message.adult) { + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { + var error = $root.google.cloud.vision.v1p2beta1.BoundingPoly.verify(message.boundingPoly); + if (error) + return "boundingPoly." + error; + } + if (message.fdBoundingPoly != null && message.hasOwnProperty("fdBoundingPoly")) { + var error = $root.google.cloud.vision.v1p2beta1.BoundingPoly.verify(message.fdBoundingPoly); + if (error) + return "fdBoundingPoly." + error; + } + if (message.landmarks != null && message.hasOwnProperty("landmarks")) { + if (!Array.isArray(message.landmarks)) + return "landmarks: array expected"; + for (var i = 0; i < message.landmarks.length; ++i) { + var error = $root.google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark.verify(message.landmarks[i]); + if (error) + return "landmarks." + error; + } + } + if (message.rollAngle != null && message.hasOwnProperty("rollAngle")) + if (typeof message.rollAngle !== "number") + return "rollAngle: number expected"; + if (message.panAngle != null && message.hasOwnProperty("panAngle")) + if (typeof message.panAngle !== "number") + return "panAngle: number expected"; + if (message.tiltAngle != null && message.hasOwnProperty("tiltAngle")) + if (typeof message.tiltAngle !== "number") + return "tiltAngle: number expected"; + if (message.detectionConfidence != null && message.hasOwnProperty("detectionConfidence")) + if (typeof message.detectionConfidence !== "number") + return "detectionConfidence: number expected"; + if (message.landmarkingConfidence != null && message.hasOwnProperty("landmarkingConfidence")) + if (typeof message.landmarkingConfidence !== "number") + return "landmarkingConfidence: number expected"; + if (message.joyLikelihood != null && message.hasOwnProperty("joyLikelihood")) + switch (message.joyLikelihood) { default: - return "adult: enum value expected"; + return "joyLikelihood: enum value expected"; case 0: case 1: case 2: @@ -39251,10 +38250,10 @@ case 5: break; } - if (message.spoof != null && message.hasOwnProperty("spoof")) - switch (message.spoof) { + if (message.sorrowLikelihood != null && message.hasOwnProperty("sorrowLikelihood")) + switch (message.sorrowLikelihood) { default: - return "spoof: enum value expected"; + return "sorrowLikelihood: enum value expected"; case 0: case 1: case 2: @@ -39263,10 +38262,10 @@ case 5: break; } - if (message.medical != null && message.hasOwnProperty("medical")) - switch (message.medical) { + if (message.angerLikelihood != null && message.hasOwnProperty("angerLikelihood")) + switch (message.angerLikelihood) { default: - return "medical: enum value expected"; + return "angerLikelihood: enum value expected"; case 0: case 1: case 2: @@ -39275,10 +38274,10 @@ case 5: break; } - if (message.violence != null && message.hasOwnProperty("violence")) - switch (message.violence) { + if (message.surpriseLikelihood != null && message.hasOwnProperty("surpriseLikelihood")) + switch (message.surpriseLikelihood) { default: - return "violence: enum value expected"; + return "surpriseLikelihood: enum value expected"; case 0: case 1: case 2: @@ -39287,10 +38286,34 @@ case 5: break; } - if (message.racy != null && message.hasOwnProperty("racy")) - switch (message.racy) { + if (message.underExposedLikelihood != null && message.hasOwnProperty("underExposedLikelihood")) + switch (message.underExposedLikelihood) { default: - return "racy: enum value expected"; + return "underExposedLikelihood: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.blurredLikelihood != null && message.hasOwnProperty("blurredLikelihood")) + switch (message.blurredLikelihood) { + default: + return "blurredLikelihood: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.headwearLikelihood != null && message.hasOwnProperty("headwearLikelihood")) + switch (message.headwearLikelihood) { + default: + return "headwearLikelihood: enum value expected"; case 0: case 1: case 2: @@ -39303,673 +38326,804 @@ }; /** - * Creates a SafeSearchAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates a FaceAnnotation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.SafeSearchAnnotation} SafeSearchAnnotation + * @returns {google.cloud.vision.v1p2beta1.FaceAnnotation} FaceAnnotation */ - SafeSearchAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.SafeSearchAnnotation) + FaceAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.FaceAnnotation) return object; - var message = new $root.google.cloud.vision.v1p2beta1.SafeSearchAnnotation(); - switch (object.adult) { + var message = new $root.google.cloud.vision.v1p2beta1.FaceAnnotation(); + if (object.boundingPoly != null) { + if (typeof object.boundingPoly !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.FaceAnnotation.boundingPoly: object expected"); + message.boundingPoly = $root.google.cloud.vision.v1p2beta1.BoundingPoly.fromObject(object.boundingPoly); + } + if (object.fdBoundingPoly != null) { + if (typeof object.fdBoundingPoly !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.FaceAnnotation.fdBoundingPoly: object expected"); + message.fdBoundingPoly = $root.google.cloud.vision.v1p2beta1.BoundingPoly.fromObject(object.fdBoundingPoly); + } + if (object.landmarks) { + if (!Array.isArray(object.landmarks)) + throw TypeError(".google.cloud.vision.v1p2beta1.FaceAnnotation.landmarks: array expected"); + message.landmarks = []; + for (var i = 0; i < object.landmarks.length; ++i) { + if (typeof object.landmarks[i] !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.FaceAnnotation.landmarks: object expected"); + message.landmarks[i] = $root.google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark.fromObject(object.landmarks[i]); + } + } + if (object.rollAngle != null) + message.rollAngle = Number(object.rollAngle); + if (object.panAngle != null) + message.panAngle = Number(object.panAngle); + if (object.tiltAngle != null) + message.tiltAngle = Number(object.tiltAngle); + if (object.detectionConfidence != null) + message.detectionConfidence = Number(object.detectionConfidence); + if (object.landmarkingConfidence != null) + message.landmarkingConfidence = Number(object.landmarkingConfidence); + switch (object.joyLikelihood) { case "UNKNOWN": case 0: - message.adult = 0; + message.joyLikelihood = 0; break; case "VERY_UNLIKELY": case 1: - message.adult = 1; + message.joyLikelihood = 1; break; case "UNLIKELY": case 2: - message.adult = 2; + message.joyLikelihood = 2; break; case "POSSIBLE": case 3: - message.adult = 3; + message.joyLikelihood = 3; break; case "LIKELY": case 4: - message.adult = 4; + message.joyLikelihood = 4; break; case "VERY_LIKELY": case 5: - message.adult = 5; + message.joyLikelihood = 5; break; } - switch (object.spoof) { + switch (object.sorrowLikelihood) { case "UNKNOWN": case 0: - message.spoof = 0; + message.sorrowLikelihood = 0; break; case "VERY_UNLIKELY": case 1: - message.spoof = 1; + message.sorrowLikelihood = 1; break; case "UNLIKELY": case 2: - message.spoof = 2; + message.sorrowLikelihood = 2; break; case "POSSIBLE": case 3: - message.spoof = 3; + message.sorrowLikelihood = 3; break; case "LIKELY": case 4: - message.spoof = 4; + message.sorrowLikelihood = 4; break; case "VERY_LIKELY": case 5: - message.spoof = 5; + message.sorrowLikelihood = 5; break; } - switch (object.medical) { + switch (object.angerLikelihood) { case "UNKNOWN": case 0: - message.medical = 0; + message.angerLikelihood = 0; break; case "VERY_UNLIKELY": case 1: - message.medical = 1; + message.angerLikelihood = 1; break; case "UNLIKELY": case 2: - message.medical = 2; + message.angerLikelihood = 2; break; case "POSSIBLE": case 3: - message.medical = 3; + message.angerLikelihood = 3; break; case "LIKELY": case 4: - message.medical = 4; + message.angerLikelihood = 4; break; case "VERY_LIKELY": case 5: - message.medical = 5; + message.angerLikelihood = 5; break; } - switch (object.violence) { + switch (object.surpriseLikelihood) { case "UNKNOWN": case 0: - message.violence = 0; + message.surpriseLikelihood = 0; break; case "VERY_UNLIKELY": case 1: - message.violence = 1; + message.surpriseLikelihood = 1; break; case "UNLIKELY": case 2: - message.violence = 2; + message.surpriseLikelihood = 2; break; case "POSSIBLE": case 3: - message.violence = 3; + message.surpriseLikelihood = 3; break; case "LIKELY": case 4: - message.violence = 4; + message.surpriseLikelihood = 4; break; case "VERY_LIKELY": case 5: - message.violence = 5; + message.surpriseLikelihood = 5; break; } - switch (object.racy) { + switch (object.underExposedLikelihood) { case "UNKNOWN": case 0: - message.racy = 0; + message.underExposedLikelihood = 0; break; case "VERY_UNLIKELY": case 1: - message.racy = 1; + message.underExposedLikelihood = 1; break; case "UNLIKELY": case 2: - message.racy = 2; + message.underExposedLikelihood = 2; break; case "POSSIBLE": case 3: - message.racy = 3; + message.underExposedLikelihood = 3; break; case "LIKELY": case 4: - message.racy = 4; + message.underExposedLikelihood = 4; break; case "VERY_LIKELY": case 5: - message.racy = 5; + message.underExposedLikelihood = 5; + break; + } + switch (object.blurredLikelihood) { + case "UNKNOWN": + case 0: + message.blurredLikelihood = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.blurredLikelihood = 1; + break; + case "UNLIKELY": + case 2: + message.blurredLikelihood = 2; + break; + case "POSSIBLE": + case 3: + message.blurredLikelihood = 3; + break; + case "LIKELY": + case 4: + message.blurredLikelihood = 4; + break; + case "VERY_LIKELY": + case 5: + message.blurredLikelihood = 5; + break; + } + switch (object.headwearLikelihood) { + case "UNKNOWN": + case 0: + message.headwearLikelihood = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.headwearLikelihood = 1; + break; + case "UNLIKELY": + case 2: + message.headwearLikelihood = 2; + break; + case "POSSIBLE": + case 3: + message.headwearLikelihood = 3; + break; + case "LIKELY": + case 4: + message.headwearLikelihood = 4; + break; + case "VERY_LIKELY": + case 5: + message.headwearLikelihood = 5; break; } return message; }; /** - * Creates a plain object from a SafeSearchAnnotation message. Also converts values to other types if specified. + * Creates a plain object from a FaceAnnotation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation * @static - * @param {google.cloud.vision.v1p2beta1.SafeSearchAnnotation} message SafeSearchAnnotation + * @param {google.cloud.vision.v1p2beta1.FaceAnnotation} message FaceAnnotation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SafeSearchAnnotation.toObject = function toObject(message, options) { + FaceAnnotation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.landmarks = []; if (options.defaults) { - object.adult = options.enums === String ? "UNKNOWN" : 0; - object.spoof = options.enums === String ? "UNKNOWN" : 0; - object.medical = options.enums === String ? "UNKNOWN" : 0; - object.violence = options.enums === String ? "UNKNOWN" : 0; - object.racy = options.enums === String ? "UNKNOWN" : 0; + object.boundingPoly = null; + object.fdBoundingPoly = null; + object.rollAngle = 0; + object.panAngle = 0; + object.tiltAngle = 0; + object.detectionConfidence = 0; + object.landmarkingConfidence = 0; + object.joyLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.sorrowLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.angerLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.surpriseLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.underExposedLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.blurredLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.headwearLikelihood = options.enums === String ? "UNKNOWN" : 0; } - if (message.adult != null && message.hasOwnProperty("adult")) - object.adult = options.enums === String ? $root.google.cloud.vision.v1p2beta1.Likelihood[message.adult] : message.adult; - if (message.spoof != null && message.hasOwnProperty("spoof")) - object.spoof = options.enums === String ? $root.google.cloud.vision.v1p2beta1.Likelihood[message.spoof] : message.spoof; - if (message.medical != null && message.hasOwnProperty("medical")) - object.medical = options.enums === String ? $root.google.cloud.vision.v1p2beta1.Likelihood[message.medical] : message.medical; - if (message.violence != null && message.hasOwnProperty("violence")) - object.violence = options.enums === String ? $root.google.cloud.vision.v1p2beta1.Likelihood[message.violence] : message.violence; - if (message.racy != null && message.hasOwnProperty("racy")) - object.racy = options.enums === String ? $root.google.cloud.vision.v1p2beta1.Likelihood[message.racy] : message.racy; - return object; - }; - - /** - * Converts this SafeSearchAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation - * @instance - * @returns {Object.} JSON object - */ - SafeSearchAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return SafeSearchAnnotation; - })(); - - v1p2beta1.LatLongRect = (function() { - - /** - * Properties of a LatLongRect. - * @memberof google.cloud.vision.v1p2beta1 - * @interface ILatLongRect - * @property {google.type.ILatLng|null} [minLatLng] LatLongRect minLatLng - * @property {google.type.ILatLng|null} [maxLatLng] LatLongRect maxLatLng - */ - - /** - * Constructs a new LatLongRect. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a LatLongRect. - * @implements ILatLongRect - * @constructor - * @param {google.cloud.vision.v1p2beta1.ILatLongRect=} [properties] Properties to set - */ - function LatLongRect(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]]; - } - - /** - * LatLongRect minLatLng. - * @member {google.type.ILatLng|null|undefined} minLatLng - * @memberof google.cloud.vision.v1p2beta1.LatLongRect - * @instance - */ - LatLongRect.prototype.minLatLng = null; - - /** - * LatLongRect maxLatLng. - * @member {google.type.ILatLng|null|undefined} maxLatLng - * @memberof google.cloud.vision.v1p2beta1.LatLongRect - * @instance - */ - LatLongRect.prototype.maxLatLng = null; - - /** - * Creates a new LatLongRect instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.LatLongRect - * @static - * @param {google.cloud.vision.v1p2beta1.ILatLongRect=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.LatLongRect} LatLongRect instance - */ - LatLongRect.create = function create(properties) { - return new LatLongRect(properties); - }; - - /** - * Encodes the specified LatLongRect message. Does not implicitly {@link google.cloud.vision.v1p2beta1.LatLongRect.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.LatLongRect - * @static - * @param {google.cloud.vision.v1p2beta1.ILatLongRect} message LatLongRect message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LatLongRect.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.minLatLng != null && message.hasOwnProperty("minLatLng")) - $root.google.type.LatLng.encode(message.minLatLng, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.maxLatLng != null && message.hasOwnProperty("maxLatLng")) - $root.google.type.LatLng.encode(message.maxLatLng, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified LatLongRect message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.LatLongRect.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.LatLongRect - * @static - * @param {google.cloud.vision.v1p2beta1.ILatLongRect} message LatLongRect message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LatLongRect.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a LatLongRect message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p2beta1.LatLongRect - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.LatLongRect} LatLongRect - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LatLongRect.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.vision.v1p2beta1.LatLongRect(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.minLatLng = $root.google.type.LatLng.decode(reader, reader.uint32()); - break; - case 2: - message.maxLatLng = $root.google.type.LatLng.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a LatLongRect message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.LatLongRect - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.LatLongRect} LatLongRect - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LatLongRect.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a LatLongRect message. - * @function verify - * @memberof google.cloud.vision.v1p2beta1.LatLongRect - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - LatLongRect.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.minLatLng != null && message.hasOwnProperty("minLatLng")) { - var error = $root.google.type.LatLng.verify(message.minLatLng); - if (error) - return "minLatLng." + error; - } - if (message.maxLatLng != null && message.hasOwnProperty("maxLatLng")) { - var error = $root.google.type.LatLng.verify(message.maxLatLng); - if (error) - return "maxLatLng." + error; - } - return null; - }; - - /** - * Creates a LatLongRect message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.LatLongRect - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.LatLongRect} LatLongRect - */ - LatLongRect.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.LatLongRect) - return object; - var message = new $root.google.cloud.vision.v1p2beta1.LatLongRect(); - if (object.minLatLng != null) { - if (typeof object.minLatLng !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.LatLongRect.minLatLng: object expected"); - message.minLatLng = $root.google.type.LatLng.fromObject(object.minLatLng); - } - if (object.maxLatLng != null) { - if (typeof object.maxLatLng !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.LatLongRect.maxLatLng: object expected"); - message.maxLatLng = $root.google.type.LatLng.fromObject(object.maxLatLng); - } - return message; - }; - - /** - * Creates a plain object from a LatLongRect message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.LatLongRect - * @static - * @param {google.cloud.vision.v1p2beta1.LatLongRect} message LatLongRect - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - LatLongRect.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.minLatLng = null; - object.maxLatLng = null; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + object.boundingPoly = $root.google.cloud.vision.v1p2beta1.BoundingPoly.toObject(message.boundingPoly, options); + if (message.fdBoundingPoly != null && message.hasOwnProperty("fdBoundingPoly")) + object.fdBoundingPoly = $root.google.cloud.vision.v1p2beta1.BoundingPoly.toObject(message.fdBoundingPoly, options); + if (message.landmarks && message.landmarks.length) { + object.landmarks = []; + for (var j = 0; j < message.landmarks.length; ++j) + object.landmarks[j] = $root.google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark.toObject(message.landmarks[j], options); } - if (message.minLatLng != null && message.hasOwnProperty("minLatLng")) - object.minLatLng = $root.google.type.LatLng.toObject(message.minLatLng, options); - if (message.maxLatLng != null && message.hasOwnProperty("maxLatLng")) - object.maxLatLng = $root.google.type.LatLng.toObject(message.maxLatLng, options); + if (message.rollAngle != null && message.hasOwnProperty("rollAngle")) + object.rollAngle = options.json && !isFinite(message.rollAngle) ? String(message.rollAngle) : message.rollAngle; + if (message.panAngle != null && message.hasOwnProperty("panAngle")) + object.panAngle = options.json && !isFinite(message.panAngle) ? String(message.panAngle) : message.panAngle; + if (message.tiltAngle != null && message.hasOwnProperty("tiltAngle")) + object.tiltAngle = options.json && !isFinite(message.tiltAngle) ? String(message.tiltAngle) : message.tiltAngle; + if (message.detectionConfidence != null && message.hasOwnProperty("detectionConfidence")) + object.detectionConfidence = options.json && !isFinite(message.detectionConfidence) ? String(message.detectionConfidence) : message.detectionConfidence; + if (message.landmarkingConfidence != null && message.hasOwnProperty("landmarkingConfidence")) + object.landmarkingConfidence = options.json && !isFinite(message.landmarkingConfidence) ? String(message.landmarkingConfidence) : message.landmarkingConfidence; + if (message.joyLikelihood != null && message.hasOwnProperty("joyLikelihood")) + object.joyLikelihood = options.enums === String ? $root.google.cloud.vision.v1p2beta1.Likelihood[message.joyLikelihood] : message.joyLikelihood; + if (message.sorrowLikelihood != null && message.hasOwnProperty("sorrowLikelihood")) + object.sorrowLikelihood = options.enums === String ? $root.google.cloud.vision.v1p2beta1.Likelihood[message.sorrowLikelihood] : message.sorrowLikelihood; + if (message.angerLikelihood != null && message.hasOwnProperty("angerLikelihood")) + object.angerLikelihood = options.enums === String ? $root.google.cloud.vision.v1p2beta1.Likelihood[message.angerLikelihood] : message.angerLikelihood; + if (message.surpriseLikelihood != null && message.hasOwnProperty("surpriseLikelihood")) + object.surpriseLikelihood = options.enums === String ? $root.google.cloud.vision.v1p2beta1.Likelihood[message.surpriseLikelihood] : message.surpriseLikelihood; + if (message.underExposedLikelihood != null && message.hasOwnProperty("underExposedLikelihood")) + object.underExposedLikelihood = options.enums === String ? $root.google.cloud.vision.v1p2beta1.Likelihood[message.underExposedLikelihood] : message.underExposedLikelihood; + if (message.blurredLikelihood != null && message.hasOwnProperty("blurredLikelihood")) + object.blurredLikelihood = options.enums === String ? $root.google.cloud.vision.v1p2beta1.Likelihood[message.blurredLikelihood] : message.blurredLikelihood; + if (message.headwearLikelihood != null && message.hasOwnProperty("headwearLikelihood")) + object.headwearLikelihood = options.enums === String ? $root.google.cloud.vision.v1p2beta1.Likelihood[message.headwearLikelihood] : message.headwearLikelihood; return object; }; /** - * Converts this LatLongRect to JSON. + * Converts this FaceAnnotation to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.LatLongRect + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation * @instance * @returns {Object.} JSON object */ - LatLongRect.prototype.toJSON = function toJSON() { + FaceAnnotation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return LatLongRect; - })(); - - v1p2beta1.ColorInfo = (function() { - - /** - * Properties of a ColorInfo. - * @memberof google.cloud.vision.v1p2beta1 - * @interface IColorInfo - * @property {google.type.IColor|null} [color] ColorInfo color - * @property {number|null} [score] ColorInfo score - * @property {number|null} [pixelFraction] ColorInfo pixelFraction - */ + FaceAnnotation.Landmark = (function() { - /** - * Constructs a new ColorInfo. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a ColorInfo. - * @implements IColorInfo - * @constructor - * @param {google.cloud.vision.v1p2beta1.IColorInfo=} [properties] Properties to set - */ - function ColorInfo(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]]; - } + /** + * Properties of a Landmark. + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation + * @interface ILandmark + * @property {google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark.Type|null} [type] Landmark type + * @property {google.cloud.vision.v1p2beta1.IPosition|null} [position] Landmark position + */ - /** - * ColorInfo color. - * @member {google.type.IColor|null|undefined} color - * @memberof google.cloud.vision.v1p2beta1.ColorInfo - * @instance - */ - ColorInfo.prototype.color = null; + /** + * Constructs a new Landmark. + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation + * @classdesc Represents a Landmark. + * @implements ILandmark + * @constructor + * @param {google.cloud.vision.v1p2beta1.FaceAnnotation.ILandmark=} [properties] Properties to set + */ + function Landmark(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]]; + } - /** - * ColorInfo score. - * @member {number} score - * @memberof google.cloud.vision.v1p2beta1.ColorInfo - * @instance - */ - ColorInfo.prototype.score = 0; + /** + * Landmark type. + * @member {google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark.Type} type + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark + * @instance + */ + Landmark.prototype.type = 0; - /** - * ColorInfo pixelFraction. - * @member {number} pixelFraction - * @memberof google.cloud.vision.v1p2beta1.ColorInfo - * @instance - */ - ColorInfo.prototype.pixelFraction = 0; + /** + * Landmark position. + * @member {google.cloud.vision.v1p2beta1.IPosition|null|undefined} position + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark + * @instance + */ + Landmark.prototype.position = null; - /** - * Creates a new ColorInfo instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.ColorInfo - * @static - * @param {google.cloud.vision.v1p2beta1.IColorInfo=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.ColorInfo} ColorInfo instance - */ - ColorInfo.create = function create(properties) { - return new ColorInfo(properties); - }; + /** + * Creates a new Landmark instance using the specified properties. + * @function create + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark + * @static + * @param {google.cloud.vision.v1p2beta1.FaceAnnotation.ILandmark=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark} Landmark instance + */ + Landmark.create = function create(properties) { + return new Landmark(properties); + }; - /** - * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.vision.v1p2beta1.ColorInfo.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.ColorInfo - * @static - * @param {google.cloud.vision.v1p2beta1.IColorInfo} message ColorInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ColorInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.color != null && message.hasOwnProperty("color")) - $root.google.type.Color.encode(message.color, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.score != null && message.hasOwnProperty("score")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); - if (message.pixelFraction != null && message.hasOwnProperty("pixelFraction")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.pixelFraction); - return writer; - }; + /** + * Encodes the specified Landmark message. Does not implicitly {@link google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark.verify|verify} messages. + * @function encode + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark + * @static + * @param {google.cloud.vision.v1p2beta1.FaceAnnotation.ILandmark} message Landmark message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Landmark.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && message.hasOwnProperty("type")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); + if (message.position != null && message.hasOwnProperty("position")) + $root.google.cloud.vision.v1p2beta1.Position.encode(message.position, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; - /** - * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.ColorInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.ColorInfo - * @static - * @param {google.cloud.vision.v1p2beta1.IColorInfo} message ColorInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ColorInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified Landmark message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark + * @static + * @param {google.cloud.vision.v1p2beta1.FaceAnnotation.ILandmark} message Landmark message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Landmark.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a ColorInfo message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p2beta1.ColorInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.ColorInfo} ColorInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ColorInfo.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.vision.v1p2beta1.ColorInfo(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.color = $root.google.type.Color.decode(reader, reader.uint32()); - break; - case 2: - message.score = reader.float(); - break; - case 3: - message.pixelFraction = reader.float(); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Decodes a Landmark message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark} Landmark + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Landmark.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.vision.v1p2beta1.FaceAnnotation.Landmark(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + message.type = reader.int32(); + break; + case 4: + message.position = $root.google.cloud.vision.v1p2beta1.Position.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } } - } - return message; - }; + return message; + }; - /** - * Decodes a ColorInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.ColorInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.ColorInfo} ColorInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ColorInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a Landmark message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark} Landmark + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Landmark.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Verifies a ColorInfo message. - * @function verify - * @memberof google.cloud.vision.v1p2beta1.ColorInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ColorInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.color != null && message.hasOwnProperty("color")) { - var error = $root.google.type.Color.verify(message.color); - if (error) - return "color." + error; - } - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; - if (message.pixelFraction != null && message.hasOwnProperty("pixelFraction")) - if (typeof message.pixelFraction !== "number") - return "pixelFraction: number expected"; - return null; - }; + /** + * Verifies a Landmark message. + * @function verify + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Landmark.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + case 24: + case 25: + case 26: + case 27: + case 28: + case 29: + case 30: + case 31: + case 32: + case 33: + case 34: + break; + } + if (message.position != null && message.hasOwnProperty("position")) { + var error = $root.google.cloud.vision.v1p2beta1.Position.verify(message.position); + if (error) + return "position." + error; + } + return null; + }; - /** - * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.ColorInfo - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.ColorInfo} ColorInfo - */ - ColorInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.ColorInfo) + /** + * Creates a Landmark message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark} Landmark + */ + Landmark.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark) + return object; + var message = new $root.google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark(); + switch (object.type) { + case "UNKNOWN_LANDMARK": + case 0: + message.type = 0; + break; + case "LEFT_EYE": + case 1: + message.type = 1; + break; + case "RIGHT_EYE": + case 2: + message.type = 2; + break; + case "LEFT_OF_LEFT_EYEBROW": + case 3: + message.type = 3; + break; + case "RIGHT_OF_LEFT_EYEBROW": + case 4: + message.type = 4; + break; + case "LEFT_OF_RIGHT_EYEBROW": + case 5: + message.type = 5; + break; + case "RIGHT_OF_RIGHT_EYEBROW": + case 6: + message.type = 6; + break; + case "MIDPOINT_BETWEEN_EYES": + case 7: + message.type = 7; + break; + case "NOSE_TIP": + case 8: + message.type = 8; + break; + case "UPPER_LIP": + case 9: + message.type = 9; + break; + case "LOWER_LIP": + case 10: + message.type = 10; + break; + case "MOUTH_LEFT": + case 11: + message.type = 11; + break; + case "MOUTH_RIGHT": + case 12: + message.type = 12; + break; + case "MOUTH_CENTER": + case 13: + message.type = 13; + break; + case "NOSE_BOTTOM_RIGHT": + case 14: + message.type = 14; + break; + case "NOSE_BOTTOM_LEFT": + case 15: + message.type = 15; + break; + case "NOSE_BOTTOM_CENTER": + case 16: + message.type = 16; + break; + case "LEFT_EYE_TOP_BOUNDARY": + case 17: + message.type = 17; + break; + case "LEFT_EYE_RIGHT_CORNER": + case 18: + message.type = 18; + break; + case "LEFT_EYE_BOTTOM_BOUNDARY": + case 19: + message.type = 19; + break; + case "LEFT_EYE_LEFT_CORNER": + case 20: + message.type = 20; + break; + case "RIGHT_EYE_TOP_BOUNDARY": + case 21: + message.type = 21; + break; + case "RIGHT_EYE_RIGHT_CORNER": + case 22: + message.type = 22; + break; + case "RIGHT_EYE_BOTTOM_BOUNDARY": + case 23: + message.type = 23; + break; + case "RIGHT_EYE_LEFT_CORNER": + case 24: + message.type = 24; + break; + case "LEFT_EYEBROW_UPPER_MIDPOINT": + case 25: + message.type = 25; + break; + case "RIGHT_EYEBROW_UPPER_MIDPOINT": + case 26: + message.type = 26; + break; + case "LEFT_EAR_TRAGION": + case 27: + message.type = 27; + break; + case "RIGHT_EAR_TRAGION": + case 28: + message.type = 28; + break; + case "LEFT_EYE_PUPIL": + case 29: + message.type = 29; + break; + case "RIGHT_EYE_PUPIL": + case 30: + message.type = 30; + break; + case "FOREHEAD_GLABELLA": + case 31: + message.type = 31; + break; + case "CHIN_GNATHION": + case 32: + message.type = 32; + break; + case "CHIN_LEFT_GONION": + case 33: + message.type = 33; + break; + case "CHIN_RIGHT_GONION": + case 34: + message.type = 34; + break; + } + if (object.position != null) { + if (typeof object.position !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark.position: object expected"); + message.position = $root.google.cloud.vision.v1p2beta1.Position.fromObject(object.position); + } + return message; + }; + + /** + * Creates a plain object from a Landmark message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark + * @static + * @param {google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark} message Landmark + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Landmark.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.type = options.enums === String ? "UNKNOWN_LANDMARK" : 0; + object.position = null; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark.Type[message.type] : message.type; + if (message.position != null && message.hasOwnProperty("position")) + object.position = $root.google.cloud.vision.v1p2beta1.Position.toObject(message.position, options); return object; - var message = new $root.google.cloud.vision.v1p2beta1.ColorInfo(); - if (object.color != null) { - if (typeof object.color !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.ColorInfo.color: object expected"); - message.color = $root.google.type.Color.fromObject(object.color); - } - if (object.score != null) - message.score = Number(object.score); - if (object.pixelFraction != null) - message.pixelFraction = Number(object.pixelFraction); - return message; - }; + }; - /** - * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.ColorInfo - * @static - * @param {google.cloud.vision.v1p2beta1.ColorInfo} message ColorInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ColorInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.color = null; - object.score = 0; - object.pixelFraction = 0; - } - if (message.color != null && message.hasOwnProperty("color")) - object.color = $root.google.type.Color.toObject(message.color, options); - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - if (message.pixelFraction != null && message.hasOwnProperty("pixelFraction")) - object.pixelFraction = options.json && !isFinite(message.pixelFraction) ? String(message.pixelFraction) : message.pixelFraction; - return object; - }; + /** + * Converts this Landmark to JSON. + * @function toJSON + * @memberof google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark + * @instance + * @returns {Object.} JSON object + */ + Landmark.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this ColorInfo to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.ColorInfo - * @instance - * @returns {Object.} JSON object - */ - ColorInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Type enum. + * @name google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark.Type + * @enum {string} + * @property {number} UNKNOWN_LANDMARK=0 UNKNOWN_LANDMARK value + * @property {number} LEFT_EYE=1 LEFT_EYE value + * @property {number} RIGHT_EYE=2 RIGHT_EYE value + * @property {number} LEFT_OF_LEFT_EYEBROW=3 LEFT_OF_LEFT_EYEBROW value + * @property {number} RIGHT_OF_LEFT_EYEBROW=4 RIGHT_OF_LEFT_EYEBROW value + * @property {number} LEFT_OF_RIGHT_EYEBROW=5 LEFT_OF_RIGHT_EYEBROW value + * @property {number} RIGHT_OF_RIGHT_EYEBROW=6 RIGHT_OF_RIGHT_EYEBROW value + * @property {number} MIDPOINT_BETWEEN_EYES=7 MIDPOINT_BETWEEN_EYES value + * @property {number} NOSE_TIP=8 NOSE_TIP value + * @property {number} UPPER_LIP=9 UPPER_LIP value + * @property {number} LOWER_LIP=10 LOWER_LIP value + * @property {number} MOUTH_LEFT=11 MOUTH_LEFT value + * @property {number} MOUTH_RIGHT=12 MOUTH_RIGHT value + * @property {number} MOUTH_CENTER=13 MOUTH_CENTER value + * @property {number} NOSE_BOTTOM_RIGHT=14 NOSE_BOTTOM_RIGHT value + * @property {number} NOSE_BOTTOM_LEFT=15 NOSE_BOTTOM_LEFT value + * @property {number} NOSE_BOTTOM_CENTER=16 NOSE_BOTTOM_CENTER value + * @property {number} LEFT_EYE_TOP_BOUNDARY=17 LEFT_EYE_TOP_BOUNDARY value + * @property {number} LEFT_EYE_RIGHT_CORNER=18 LEFT_EYE_RIGHT_CORNER value + * @property {number} LEFT_EYE_BOTTOM_BOUNDARY=19 LEFT_EYE_BOTTOM_BOUNDARY value + * @property {number} LEFT_EYE_LEFT_CORNER=20 LEFT_EYE_LEFT_CORNER value + * @property {number} RIGHT_EYE_TOP_BOUNDARY=21 RIGHT_EYE_TOP_BOUNDARY value + * @property {number} RIGHT_EYE_RIGHT_CORNER=22 RIGHT_EYE_RIGHT_CORNER value + * @property {number} RIGHT_EYE_BOTTOM_BOUNDARY=23 RIGHT_EYE_BOTTOM_BOUNDARY value + * @property {number} RIGHT_EYE_LEFT_CORNER=24 RIGHT_EYE_LEFT_CORNER value + * @property {number} LEFT_EYEBROW_UPPER_MIDPOINT=25 LEFT_EYEBROW_UPPER_MIDPOINT value + * @property {number} RIGHT_EYEBROW_UPPER_MIDPOINT=26 RIGHT_EYEBROW_UPPER_MIDPOINT value + * @property {number} LEFT_EAR_TRAGION=27 LEFT_EAR_TRAGION value + * @property {number} RIGHT_EAR_TRAGION=28 RIGHT_EAR_TRAGION value + * @property {number} LEFT_EYE_PUPIL=29 LEFT_EYE_PUPIL value + * @property {number} RIGHT_EYE_PUPIL=30 RIGHT_EYE_PUPIL value + * @property {number} FOREHEAD_GLABELLA=31 FOREHEAD_GLABELLA value + * @property {number} CHIN_GNATHION=32 CHIN_GNATHION value + * @property {number} CHIN_LEFT_GONION=33 CHIN_LEFT_GONION value + * @property {number} CHIN_RIGHT_GONION=34 CHIN_RIGHT_GONION value + */ + Landmark.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN_LANDMARK"] = 0; + values[valuesById[1] = "LEFT_EYE"] = 1; + values[valuesById[2] = "RIGHT_EYE"] = 2; + values[valuesById[3] = "LEFT_OF_LEFT_EYEBROW"] = 3; + values[valuesById[4] = "RIGHT_OF_LEFT_EYEBROW"] = 4; + values[valuesById[5] = "LEFT_OF_RIGHT_EYEBROW"] = 5; + values[valuesById[6] = "RIGHT_OF_RIGHT_EYEBROW"] = 6; + values[valuesById[7] = "MIDPOINT_BETWEEN_EYES"] = 7; + values[valuesById[8] = "NOSE_TIP"] = 8; + values[valuesById[9] = "UPPER_LIP"] = 9; + values[valuesById[10] = "LOWER_LIP"] = 10; + values[valuesById[11] = "MOUTH_LEFT"] = 11; + values[valuesById[12] = "MOUTH_RIGHT"] = 12; + values[valuesById[13] = "MOUTH_CENTER"] = 13; + values[valuesById[14] = "NOSE_BOTTOM_RIGHT"] = 14; + values[valuesById[15] = "NOSE_BOTTOM_LEFT"] = 15; + values[valuesById[16] = "NOSE_BOTTOM_CENTER"] = 16; + values[valuesById[17] = "LEFT_EYE_TOP_BOUNDARY"] = 17; + values[valuesById[18] = "LEFT_EYE_RIGHT_CORNER"] = 18; + values[valuesById[19] = "LEFT_EYE_BOTTOM_BOUNDARY"] = 19; + values[valuesById[20] = "LEFT_EYE_LEFT_CORNER"] = 20; + values[valuesById[21] = "RIGHT_EYE_TOP_BOUNDARY"] = 21; + values[valuesById[22] = "RIGHT_EYE_RIGHT_CORNER"] = 22; + values[valuesById[23] = "RIGHT_EYE_BOTTOM_BOUNDARY"] = 23; + values[valuesById[24] = "RIGHT_EYE_LEFT_CORNER"] = 24; + values[valuesById[25] = "LEFT_EYEBROW_UPPER_MIDPOINT"] = 25; + values[valuesById[26] = "RIGHT_EYEBROW_UPPER_MIDPOINT"] = 26; + values[valuesById[27] = "LEFT_EAR_TRAGION"] = 27; + values[valuesById[28] = "RIGHT_EAR_TRAGION"] = 28; + values[valuesById[29] = "LEFT_EYE_PUPIL"] = 29; + values[valuesById[30] = "RIGHT_EYE_PUPIL"] = 30; + values[valuesById[31] = "FOREHEAD_GLABELLA"] = 31; + values[valuesById[32] = "CHIN_GNATHION"] = 32; + values[valuesById[33] = "CHIN_LEFT_GONION"] = 33; + values[valuesById[34] = "CHIN_RIGHT_GONION"] = 34; + return values; + })(); - return ColorInfo; + return Landmark; + })(); + + return FaceAnnotation; })(); - v1p2beta1.DominantColorsAnnotation = (function() { + v1p2beta1.LocationInfo = (function() { /** - * Properties of a DominantColorsAnnotation. + * Properties of a LocationInfo. * @memberof google.cloud.vision.v1p2beta1 - * @interface IDominantColorsAnnotation - * @property {Array.|null} [colors] DominantColorsAnnotation colors + * @interface ILocationInfo + * @property {google.type.ILatLng|null} [latLng] LocationInfo latLng */ /** - * Constructs a new DominantColorsAnnotation. + * Constructs a new LocationInfo. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a DominantColorsAnnotation. - * @implements IDominantColorsAnnotation + * @classdesc Represents a LocationInfo. + * @implements ILocationInfo * @constructor - * @param {google.cloud.vision.v1p2beta1.IDominantColorsAnnotation=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.ILocationInfo=} [properties] Properties to set */ - function DominantColorsAnnotation(properties) { - this.colors = []; + function LocationInfo(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -39977,78 +39131,75 @@ } /** - * DominantColorsAnnotation colors. - * @member {Array.} colors - * @memberof google.cloud.vision.v1p2beta1.DominantColorsAnnotation + * LocationInfo latLng. + * @member {google.type.ILatLng|null|undefined} latLng + * @memberof google.cloud.vision.v1p2beta1.LocationInfo * @instance */ - DominantColorsAnnotation.prototype.colors = $util.emptyArray; + LocationInfo.prototype.latLng = null; /** - * Creates a new DominantColorsAnnotation instance using the specified properties. + * Creates a new LocationInfo instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p2beta1.LocationInfo * @static - * @param {google.cloud.vision.v1p2beta1.IDominantColorsAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.DominantColorsAnnotation} DominantColorsAnnotation instance + * @param {google.cloud.vision.v1p2beta1.ILocationInfo=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.LocationInfo} LocationInfo instance */ - DominantColorsAnnotation.create = function create(properties) { - return new DominantColorsAnnotation(properties); + LocationInfo.create = function create(properties) { + return new LocationInfo(properties); }; /** - * Encodes the specified DominantColorsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p2beta1.DominantColorsAnnotation.verify|verify} messages. + * Encodes the specified LocationInfo message. Does not implicitly {@link google.cloud.vision.v1p2beta1.LocationInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p2beta1.LocationInfo * @static - * @param {google.cloud.vision.v1p2beta1.IDominantColorsAnnotation} message DominantColorsAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.ILocationInfo} message LocationInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DominantColorsAnnotation.encode = function encode(message, writer) { + LocationInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.colors != null && message.colors.length) - for (var i = 0; i < message.colors.length; ++i) - $root.google.cloud.vision.v1p2beta1.ColorInfo.encode(message.colors[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.latLng != null && message.hasOwnProperty("latLng")) + $root.google.type.LatLng.encode(message.latLng, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified DominantColorsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.DominantColorsAnnotation.verify|verify} messages. + * Encodes the specified LocationInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.LocationInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p2beta1.LocationInfo * @static - * @param {google.cloud.vision.v1p2beta1.IDominantColorsAnnotation} message DominantColorsAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.ILocationInfo} message LocationInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DominantColorsAnnotation.encodeDelimited = function encodeDelimited(message, writer) { + LocationInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a DominantColorsAnnotation message from the specified reader or buffer. + * Decodes a LocationInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p2beta1.LocationInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.DominantColorsAnnotation} DominantColorsAnnotation + * @returns {google.cloud.vision.v1p2beta1.LocationInfo} LocationInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DominantColorsAnnotation.decode = function decode(reader, length) { + LocationInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.DominantColorsAnnotation(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.LocationInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.colors && message.colors.length)) - message.colors = []; - message.colors.push($root.google.cloud.vision.v1p2beta1.ColorInfo.decode(reader, reader.uint32())); + message.latLng = $root.google.type.LatLng.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -40059,124 +39210,114 @@ }; /** - * Decodes a DominantColorsAnnotation message from the specified reader or buffer, length delimited. + * Decodes a LocationInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p2beta1.LocationInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.DominantColorsAnnotation} DominantColorsAnnotation + * @returns {google.cloud.vision.v1p2beta1.LocationInfo} LocationInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DominantColorsAnnotation.decodeDelimited = function decodeDelimited(reader) { + LocationInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a DominantColorsAnnotation message. + * Verifies a LocationInfo message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p2beta1.LocationInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DominantColorsAnnotation.verify = function verify(message) { + LocationInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.colors != null && message.hasOwnProperty("colors")) { - if (!Array.isArray(message.colors)) - return "colors: array expected"; - for (var i = 0; i < message.colors.length; ++i) { - var error = $root.google.cloud.vision.v1p2beta1.ColorInfo.verify(message.colors[i]); - if (error) - return "colors." + error; - } - } - return null; - }; + if (message.latLng != null && message.hasOwnProperty("latLng")) { + var error = $root.google.type.LatLng.verify(message.latLng); + if (error) + return "latLng." + error; + } + return null; + }; /** - * Creates a DominantColorsAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates a LocationInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p2beta1.LocationInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.DominantColorsAnnotation} DominantColorsAnnotation + * @returns {google.cloud.vision.v1p2beta1.LocationInfo} LocationInfo */ - DominantColorsAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.DominantColorsAnnotation) + LocationInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.LocationInfo) return object; - var message = new $root.google.cloud.vision.v1p2beta1.DominantColorsAnnotation(); - if (object.colors) { - if (!Array.isArray(object.colors)) - throw TypeError(".google.cloud.vision.v1p2beta1.DominantColorsAnnotation.colors: array expected"); - message.colors = []; - for (var i = 0; i < object.colors.length; ++i) { - if (typeof object.colors[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.DominantColorsAnnotation.colors: object expected"); - message.colors[i] = $root.google.cloud.vision.v1p2beta1.ColorInfo.fromObject(object.colors[i]); - } + var message = new $root.google.cloud.vision.v1p2beta1.LocationInfo(); + if (object.latLng != null) { + if (typeof object.latLng !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.LocationInfo.latLng: object expected"); + message.latLng = $root.google.type.LatLng.fromObject(object.latLng); } return message; }; /** - * Creates a plain object from a DominantColorsAnnotation message. Also converts values to other types if specified. + * Creates a plain object from a LocationInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p2beta1.LocationInfo * @static - * @param {google.cloud.vision.v1p2beta1.DominantColorsAnnotation} message DominantColorsAnnotation + * @param {google.cloud.vision.v1p2beta1.LocationInfo} message LocationInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DominantColorsAnnotation.toObject = function toObject(message, options) { + LocationInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.colors = []; - if (message.colors && message.colors.length) { - object.colors = []; - for (var j = 0; j < message.colors.length; ++j) - object.colors[j] = $root.google.cloud.vision.v1p2beta1.ColorInfo.toObject(message.colors[j], options); - } + if (options.defaults) + object.latLng = null; + if (message.latLng != null && message.hasOwnProperty("latLng")) + object.latLng = $root.google.type.LatLng.toObject(message.latLng, options); return object; }; /** - * Converts this DominantColorsAnnotation to JSON. + * Converts this LocationInfo to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p2beta1.LocationInfo * @instance * @returns {Object.} JSON object */ - DominantColorsAnnotation.prototype.toJSON = function toJSON() { + LocationInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return DominantColorsAnnotation; + return LocationInfo; })(); - v1p2beta1.ImageProperties = (function() { + v1p2beta1.Property = (function() { /** - * Properties of an ImageProperties. + * Properties of a Property. * @memberof google.cloud.vision.v1p2beta1 - * @interface IImageProperties - * @property {google.cloud.vision.v1p2beta1.IDominantColorsAnnotation|null} [dominantColors] ImageProperties dominantColors + * @interface IProperty + * @property {string|null} [name] Property name + * @property {string|null} [value] Property value + * @property {number|Long|null} [uint64Value] Property uint64Value */ /** - * Constructs a new ImageProperties. + * Constructs a new Property. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an ImageProperties. - * @implements IImageProperties + * @classdesc Represents a Property. + * @implements IProperty * @constructor - * @param {google.cloud.vision.v1p2beta1.IImageProperties=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.IProperty=} [properties] Properties to set */ - function ImageProperties(properties) { + function Property(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -40184,75 +39325,101 @@ } /** - * ImageProperties dominantColors. - * @member {google.cloud.vision.v1p2beta1.IDominantColorsAnnotation|null|undefined} dominantColors - * @memberof google.cloud.vision.v1p2beta1.ImageProperties + * Property name. + * @member {string} name + * @memberof google.cloud.vision.v1p2beta1.Property * @instance */ - ImageProperties.prototype.dominantColors = null; + Property.prototype.name = ""; /** - * Creates a new ImageProperties instance using the specified properties. + * Property value. + * @member {string} value + * @memberof google.cloud.vision.v1p2beta1.Property + * @instance + */ + Property.prototype.value = ""; + + /** + * Property uint64Value. + * @member {number|Long} uint64Value + * @memberof google.cloud.vision.v1p2beta1.Property + * @instance + */ + Property.prototype.uint64Value = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Creates a new Property instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.ImageProperties + * @memberof google.cloud.vision.v1p2beta1.Property * @static - * @param {google.cloud.vision.v1p2beta1.IImageProperties=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.ImageProperties} ImageProperties instance + * @param {google.cloud.vision.v1p2beta1.IProperty=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.Property} Property instance */ - ImageProperties.create = function create(properties) { - return new ImageProperties(properties); + Property.create = function create(properties) { + return new Property(properties); }; /** - * Encodes the specified ImageProperties message. Does not implicitly {@link google.cloud.vision.v1p2beta1.ImageProperties.verify|verify} messages. + * Encodes the specified Property message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Property.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.ImageProperties + * @memberof google.cloud.vision.v1p2beta1.Property * @static - * @param {google.cloud.vision.v1p2beta1.IImageProperties} message ImageProperties message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IProperty} message Property message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageProperties.encode = function encode(message, writer) { + Property.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.dominantColors != null && message.hasOwnProperty("dominantColors")) - $root.google.cloud.vision.v1p2beta1.DominantColorsAnnotation.encode(message.dominantColors, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.value != null && message.hasOwnProperty("value")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); + if (message.uint64Value != null && message.hasOwnProperty("uint64Value")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.uint64Value); return writer; }; /** - * Encodes the specified ImageProperties message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.ImageProperties.verify|verify} messages. + * Encodes the specified Property message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.Property.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.ImageProperties + * @memberof google.cloud.vision.v1p2beta1.Property * @static - * @param {google.cloud.vision.v1p2beta1.IImageProperties} message ImageProperties message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IProperty} message Property message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageProperties.encodeDelimited = function encodeDelimited(message, writer) { + Property.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImageProperties message from the specified reader or buffer. + * Decodes a Property message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.ImageProperties + * @memberof google.cloud.vision.v1p2beta1.Property * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.ImageProperties} ImageProperties + * @returns {google.cloud.vision.v1p2beta1.Property} Property * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageProperties.decode = function decode(reader, length) { + Property.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.ImageProperties(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.Property(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.dominantColors = $root.google.cloud.vision.v1p2beta1.DominantColorsAnnotation.decode(reader, reader.uint32()); + message.name = reader.string(); + break; + case 2: + message.value = reader.string(); + break; + case 3: + message.uint64Value = reader.uint64(); break; default: reader.skipType(tag & 7); @@ -40263,114 +39430,148 @@ }; /** - * Decodes an ImageProperties message from the specified reader or buffer, length delimited. + * Decodes a Property message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.ImageProperties + * @memberof google.cloud.vision.v1p2beta1.Property * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.ImageProperties} ImageProperties + * @returns {google.cloud.vision.v1p2beta1.Property} Property * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageProperties.decodeDelimited = function decodeDelimited(reader) { + Property.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImageProperties message. + * Verifies a Property message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.ImageProperties + * @memberof google.cloud.vision.v1p2beta1.Property * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImageProperties.verify = function verify(message) { + Property.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.dominantColors != null && message.hasOwnProperty("dominantColors")) { - var error = $root.google.cloud.vision.v1p2beta1.DominantColorsAnnotation.verify(message.dominantColors); - if (error) - return "dominantColors." + error; - } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + if (message.uint64Value != null && message.hasOwnProperty("uint64Value")) + if (!$util.isInteger(message.uint64Value) && !(message.uint64Value && $util.isInteger(message.uint64Value.low) && $util.isInteger(message.uint64Value.high))) + return "uint64Value: integer|Long expected"; return null; }; /** - * Creates an ImageProperties message from a plain object. Also converts values to their respective internal types. + * Creates a Property message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.ImageProperties + * @memberof google.cloud.vision.v1p2beta1.Property * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.ImageProperties} ImageProperties + * @returns {google.cloud.vision.v1p2beta1.Property} Property */ - ImageProperties.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.ImageProperties) + Property.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.Property) return object; - var message = new $root.google.cloud.vision.v1p2beta1.ImageProperties(); - if (object.dominantColors != null) { - if (typeof object.dominantColors !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.ImageProperties.dominantColors: object expected"); - message.dominantColors = $root.google.cloud.vision.v1p2beta1.DominantColorsAnnotation.fromObject(object.dominantColors); - } + var message = new $root.google.cloud.vision.v1p2beta1.Property(); + if (object.name != null) + message.name = String(object.name); + if (object.value != null) + message.value = String(object.value); + if (object.uint64Value != null) + if ($util.Long) + (message.uint64Value = $util.Long.fromValue(object.uint64Value)).unsigned = true; + else if (typeof object.uint64Value === "string") + message.uint64Value = parseInt(object.uint64Value, 10); + else if (typeof object.uint64Value === "number") + message.uint64Value = object.uint64Value; + else if (typeof object.uint64Value === "object") + message.uint64Value = new $util.LongBits(object.uint64Value.low >>> 0, object.uint64Value.high >>> 0).toNumber(true); return message; }; /** - * Creates a plain object from an ImageProperties message. Also converts values to other types if specified. + * Creates a plain object from a Property message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.ImageProperties + * @memberof google.cloud.vision.v1p2beta1.Property * @static - * @param {google.cloud.vision.v1p2beta1.ImageProperties} message ImageProperties + * @param {google.cloud.vision.v1p2beta1.Property} message Property * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImageProperties.toObject = function toObject(message, options) { + Property.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.dominantColors = null; - if (message.dominantColors != null && message.hasOwnProperty("dominantColors")) - object.dominantColors = $root.google.cloud.vision.v1p2beta1.DominantColorsAnnotation.toObject(message.dominantColors, options); + if (options.defaults) { + object.name = ""; + object.value = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.uint64Value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.uint64Value = options.longs === String ? "0" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.uint64Value != null && message.hasOwnProperty("uint64Value")) + if (typeof message.uint64Value === "number") + object.uint64Value = options.longs === String ? String(message.uint64Value) : message.uint64Value; + else + object.uint64Value = options.longs === String ? $util.Long.prototype.toString.call(message.uint64Value) : options.longs === Number ? new $util.LongBits(message.uint64Value.low >>> 0, message.uint64Value.high >>> 0).toNumber(true) : message.uint64Value; return object; }; /** - * Converts this ImageProperties to JSON. + * Converts this Property to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.ImageProperties + * @memberof google.cloud.vision.v1p2beta1.Property * @instance * @returns {Object.} JSON object */ - ImageProperties.prototype.toJSON = function toJSON() { + Property.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImageProperties; + return Property; })(); - v1p2beta1.CropHint = (function() { + v1p2beta1.EntityAnnotation = (function() { /** - * Properties of a CropHint. + * Properties of an EntityAnnotation. * @memberof google.cloud.vision.v1p2beta1 - * @interface ICropHint - * @property {google.cloud.vision.v1p2beta1.IBoundingPoly|null} [boundingPoly] CropHint boundingPoly - * @property {number|null} [confidence] CropHint confidence - * @property {number|null} [importanceFraction] CropHint importanceFraction + * @interface IEntityAnnotation + * @property {string|null} [mid] EntityAnnotation mid + * @property {string|null} [locale] EntityAnnotation locale + * @property {string|null} [description] EntityAnnotation description + * @property {number|null} [score] EntityAnnotation score + * @property {number|null} [confidence] EntityAnnotation confidence + * @property {number|null} [topicality] EntityAnnotation topicality + * @property {google.cloud.vision.v1p2beta1.IBoundingPoly|null} [boundingPoly] EntityAnnotation boundingPoly + * @property {Array.|null} [locations] EntityAnnotation locations + * @property {Array.|null} [properties] EntityAnnotation properties */ /** - * Constructs a new CropHint. + * Constructs a new EntityAnnotation. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a CropHint. - * @implements ICropHint + * @classdesc Represents an EntityAnnotation. + * @implements IEntityAnnotation * @constructor - * @param {google.cloud.vision.v1p2beta1.ICropHint=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.IEntityAnnotation=} [properties] Properties to set */ - function CropHint(properties) { + function EntityAnnotation(properties) { + this.locations = []; + this.properties = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -40378,101 +39579,185 @@ } /** - * CropHint boundingPoly. - * @member {google.cloud.vision.v1p2beta1.IBoundingPoly|null|undefined} boundingPoly - * @memberof google.cloud.vision.v1p2beta1.CropHint + * EntityAnnotation mid. + * @member {string} mid + * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation * @instance */ - CropHint.prototype.boundingPoly = null; + EntityAnnotation.prototype.mid = ""; /** - * CropHint confidence. + * EntityAnnotation locale. + * @member {string} locale + * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.locale = ""; + + /** + * EntityAnnotation description. + * @member {string} description + * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.description = ""; + + /** + * EntityAnnotation score. + * @member {number} score + * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.score = 0; + + /** + * EntityAnnotation confidence. * @member {number} confidence - * @memberof google.cloud.vision.v1p2beta1.CropHint + * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation * @instance */ - CropHint.prototype.confidence = 0; + EntityAnnotation.prototype.confidence = 0; /** - * CropHint importanceFraction. - * @member {number} importanceFraction - * @memberof google.cloud.vision.v1p2beta1.CropHint + * EntityAnnotation topicality. + * @member {number} topicality + * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation * @instance */ - CropHint.prototype.importanceFraction = 0; + EntityAnnotation.prototype.topicality = 0; /** - * Creates a new CropHint instance using the specified properties. + * EntityAnnotation boundingPoly. + * @member {google.cloud.vision.v1p2beta1.IBoundingPoly|null|undefined} boundingPoly + * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.boundingPoly = null; + + /** + * EntityAnnotation locations. + * @member {Array.} locations + * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.locations = $util.emptyArray; + + /** + * EntityAnnotation properties. + * @member {Array.} properties + * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.properties = $util.emptyArray; + + /** + * Creates a new EntityAnnotation instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.CropHint + * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation * @static - * @param {google.cloud.vision.v1p2beta1.ICropHint=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.CropHint} CropHint instance + * @param {google.cloud.vision.v1p2beta1.IEntityAnnotation=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.EntityAnnotation} EntityAnnotation instance */ - CropHint.create = function create(properties) { - return new CropHint(properties); + EntityAnnotation.create = function create(properties) { + return new EntityAnnotation(properties); }; /** - * Encodes the specified CropHint message. Does not implicitly {@link google.cloud.vision.v1p2beta1.CropHint.verify|verify} messages. + * Encodes the specified EntityAnnotation message. Does not implicitly {@link google.cloud.vision.v1p2beta1.EntityAnnotation.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.CropHint + * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation * @static - * @param {google.cloud.vision.v1p2beta1.ICropHint} message CropHint message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IEntityAnnotation} message EntityAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CropHint.encode = function encode(message, writer) { + EntityAnnotation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - $root.google.cloud.vision.v1p2beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.mid != null && message.hasOwnProperty("mid")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.mid); + if (message.locale != null && message.hasOwnProperty("locale")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.locale); + if (message.description != null && message.hasOwnProperty("description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + if (message.score != null && message.hasOwnProperty("score")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.score); if (message.confidence != null && message.hasOwnProperty("confidence")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); - if (message.importanceFraction != null && message.hasOwnProperty("importanceFraction")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.importanceFraction); + writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); + if (message.topicality != null && message.hasOwnProperty("topicality")) + writer.uint32(/* id 6, wireType 5 =*/53).float(message.topicality); + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + $root.google.cloud.vision.v1p2beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.locations != null && message.locations.length) + for (var i = 0; i < message.locations.length; ++i) + $root.google.cloud.vision.v1p2beta1.LocationInfo.encode(message.locations[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.properties != null && message.properties.length) + for (var i = 0; i < message.properties.length; ++i) + $root.google.cloud.vision.v1p2beta1.Property.encode(message.properties[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); return writer; }; /** - * Encodes the specified CropHint message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.CropHint.verify|verify} messages. + * Encodes the specified EntityAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.EntityAnnotation.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.CropHint + * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation * @static - * @param {google.cloud.vision.v1p2beta1.ICropHint} message CropHint message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IEntityAnnotation} message EntityAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CropHint.encodeDelimited = function encodeDelimited(message, writer) { + EntityAnnotation.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CropHint message from the specified reader or buffer. + * Decodes an EntityAnnotation message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.CropHint + * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.CropHint} CropHint + * @returns {google.cloud.vision.v1p2beta1.EntityAnnotation} EntityAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CropHint.decode = function decode(reader, length) { + EntityAnnotation.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.vision.v1p2beta1.CropHint(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.EntityAnnotation(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.boundingPoly = $root.google.cloud.vision.v1p2beta1.BoundingPoly.decode(reader, reader.uint32()); + message.mid = reader.string(); break; case 2: - message.confidence = reader.float(); + message.locale = reader.string(); break; case 3: - message.importanceFraction = reader.float(); + message.description = reader.string(); + break; + case 4: + message.score = reader.float(); + break; + case 5: + message.confidence = reader.float(); + break; + case 6: + message.topicality = reader.float(); + break; + case 7: + message.boundingPoly = $root.google.cloud.vision.v1p2beta1.BoundingPoly.decode(reader, reader.uint32()); + break; + case 8: + if (!(message.locations && message.locations.length)) + message.locations = []; + message.locations.push($root.google.cloud.vision.v1p2beta1.LocationInfo.decode(reader, reader.uint32())); + break; + case 9: + if (!(message.properties && message.properties.length)) + message.properties = []; + message.properties.push($root.google.cloud.vision.v1p2beta1.Property.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -40483,130 +39768,217 @@ }; /** - * Decodes a CropHint message from the specified reader or buffer, length delimited. + * Decodes an EntityAnnotation message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.CropHint + * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.CropHint} CropHint + * @returns {google.cloud.vision.v1p2beta1.EntityAnnotation} EntityAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CropHint.decodeDelimited = function decodeDelimited(reader) { + EntityAnnotation.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CropHint message. + * Verifies an EntityAnnotation message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.CropHint + * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CropHint.verify = function verify(message) { + EntityAnnotation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.mid != null && message.hasOwnProperty("mid")) + if (!$util.isString(message.mid)) + return "mid: string expected"; + if (message.locale != null && message.hasOwnProperty("locale")) + if (!$util.isString(message.locale)) + return "locale: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.score != null && message.hasOwnProperty("score")) + if (typeof message.score !== "number") + return "score: number expected"; + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + if (message.topicality != null && message.hasOwnProperty("topicality")) + if (typeof message.topicality !== "number") + return "topicality: number expected"; if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { var error = $root.google.cloud.vision.v1p2beta1.BoundingPoly.verify(message.boundingPoly); if (error) return "boundingPoly." + error; } - if (message.confidence != null && message.hasOwnProperty("confidence")) - if (typeof message.confidence !== "number") - return "confidence: number expected"; - if (message.importanceFraction != null && message.hasOwnProperty("importanceFraction")) - if (typeof message.importanceFraction !== "number") - return "importanceFraction: number expected"; + if (message.locations != null && message.hasOwnProperty("locations")) { + if (!Array.isArray(message.locations)) + return "locations: array expected"; + for (var i = 0; i < message.locations.length; ++i) { + var error = $root.google.cloud.vision.v1p2beta1.LocationInfo.verify(message.locations[i]); + if (error) + return "locations." + error; + } + } + if (message.properties != null && message.hasOwnProperty("properties")) { + if (!Array.isArray(message.properties)) + return "properties: array expected"; + for (var i = 0; i < message.properties.length; ++i) { + var error = $root.google.cloud.vision.v1p2beta1.Property.verify(message.properties[i]); + if (error) + return "properties." + error; + } + } return null; }; /** - * Creates a CropHint message from a plain object. Also converts values to their respective internal types. + * Creates an EntityAnnotation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.CropHint + * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.CropHint} CropHint + * @returns {google.cloud.vision.v1p2beta1.EntityAnnotation} EntityAnnotation */ - CropHint.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.CropHint) + EntityAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.EntityAnnotation) return object; - var message = new $root.google.cloud.vision.v1p2beta1.CropHint(); - if (object.boundingPoly != null) { - if (typeof object.boundingPoly !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.CropHint.boundingPoly: object expected"); - message.boundingPoly = $root.google.cloud.vision.v1p2beta1.BoundingPoly.fromObject(object.boundingPoly); - } + var message = new $root.google.cloud.vision.v1p2beta1.EntityAnnotation(); + if (object.mid != null) + message.mid = String(object.mid); + if (object.locale != null) + message.locale = String(object.locale); + if (object.description != null) + message.description = String(object.description); + if (object.score != null) + message.score = Number(object.score); if (object.confidence != null) message.confidence = Number(object.confidence); - if (object.importanceFraction != null) - message.importanceFraction = Number(object.importanceFraction); + if (object.topicality != null) + message.topicality = Number(object.topicality); + if (object.boundingPoly != null) { + if (typeof object.boundingPoly !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.EntityAnnotation.boundingPoly: object expected"); + message.boundingPoly = $root.google.cloud.vision.v1p2beta1.BoundingPoly.fromObject(object.boundingPoly); + } + if (object.locations) { + if (!Array.isArray(object.locations)) + throw TypeError(".google.cloud.vision.v1p2beta1.EntityAnnotation.locations: array expected"); + message.locations = []; + for (var i = 0; i < object.locations.length; ++i) { + if (typeof object.locations[i] !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.EntityAnnotation.locations: object expected"); + message.locations[i] = $root.google.cloud.vision.v1p2beta1.LocationInfo.fromObject(object.locations[i]); + } + } + if (object.properties) { + if (!Array.isArray(object.properties)) + throw TypeError(".google.cloud.vision.v1p2beta1.EntityAnnotation.properties: array expected"); + message.properties = []; + for (var i = 0; i < object.properties.length; ++i) { + if (typeof object.properties[i] !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.EntityAnnotation.properties: object expected"); + message.properties[i] = $root.google.cloud.vision.v1p2beta1.Property.fromObject(object.properties[i]); + } + } return message; }; /** - * Creates a plain object from a CropHint message. Also converts values to other types if specified. + * Creates a plain object from an EntityAnnotation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.CropHint + * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation * @static - * @param {google.cloud.vision.v1p2beta1.CropHint} message CropHint + * @param {google.cloud.vision.v1p2beta1.EntityAnnotation} message EntityAnnotation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CropHint.toObject = function toObject(message, options) { + EntityAnnotation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) { + object.locations = []; + object.properties = []; + } if (options.defaults) { - object.boundingPoly = null; + object.mid = ""; + object.locale = ""; + object.description = ""; + object.score = 0; object.confidence = 0; - object.importanceFraction = 0; + object.topicality = 0; + object.boundingPoly = null; } - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - object.boundingPoly = $root.google.cloud.vision.v1p2beta1.BoundingPoly.toObject(message.boundingPoly, options); + if (message.mid != null && message.hasOwnProperty("mid")) + object.mid = message.mid; + if (message.locale != null && message.hasOwnProperty("locale")) + object.locale = message.locale; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.score != null && message.hasOwnProperty("score")) + object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; if (message.confidence != null && message.hasOwnProperty("confidence")) object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; - if (message.importanceFraction != null && message.hasOwnProperty("importanceFraction")) - object.importanceFraction = options.json && !isFinite(message.importanceFraction) ? String(message.importanceFraction) : message.importanceFraction; + if (message.topicality != null && message.hasOwnProperty("topicality")) + object.topicality = options.json && !isFinite(message.topicality) ? String(message.topicality) : message.topicality; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + object.boundingPoly = $root.google.cloud.vision.v1p2beta1.BoundingPoly.toObject(message.boundingPoly, options); + if (message.locations && message.locations.length) { + object.locations = []; + for (var j = 0; j < message.locations.length; ++j) + object.locations[j] = $root.google.cloud.vision.v1p2beta1.LocationInfo.toObject(message.locations[j], options); + } + if (message.properties && message.properties.length) { + object.properties = []; + for (var j = 0; j < message.properties.length; ++j) + object.properties[j] = $root.google.cloud.vision.v1p2beta1.Property.toObject(message.properties[j], options); + } return object; }; /** - * Converts this CropHint to JSON. + * Converts this EntityAnnotation to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.CropHint + * @memberof google.cloud.vision.v1p2beta1.EntityAnnotation * @instance * @returns {Object.} JSON object */ - CropHint.prototype.toJSON = function toJSON() { + EntityAnnotation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CropHint; + return EntityAnnotation; })(); - v1p2beta1.CropHintsAnnotation = (function() { + v1p2beta1.SafeSearchAnnotation = (function() { /** - * Properties of a CropHintsAnnotation. + * Properties of a SafeSearchAnnotation. * @memberof google.cloud.vision.v1p2beta1 - * @interface ICropHintsAnnotation - * @property {Array.|null} [cropHints] CropHintsAnnotation cropHints + * @interface ISafeSearchAnnotation + * @property {google.cloud.vision.v1p2beta1.Likelihood|null} [adult] SafeSearchAnnotation adult + * @property {google.cloud.vision.v1p2beta1.Likelihood|null} [spoof] SafeSearchAnnotation spoof + * @property {google.cloud.vision.v1p2beta1.Likelihood|null} [medical] SafeSearchAnnotation medical + * @property {google.cloud.vision.v1p2beta1.Likelihood|null} [violence] SafeSearchAnnotation violence + * @property {google.cloud.vision.v1p2beta1.Likelihood|null} [racy] SafeSearchAnnotation racy */ /** - * Constructs a new CropHintsAnnotation. + * Constructs a new SafeSearchAnnotation. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a CropHintsAnnotation. - * @implements ICropHintsAnnotation + * @classdesc Represents a SafeSearchAnnotation. + * @implements ISafeSearchAnnotation * @constructor - * @param {google.cloud.vision.v1p2beta1.ICropHintsAnnotation=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.ISafeSearchAnnotation=} [properties] Properties to set */ - function CropHintsAnnotation(properties) { - this.cropHints = []; + function SafeSearchAnnotation(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -40614,78 +39986,127 @@ } /** - * CropHintsAnnotation cropHints. - * @member {Array.} cropHints - * @memberof google.cloud.vision.v1p2beta1.CropHintsAnnotation + * SafeSearchAnnotation adult. + * @member {google.cloud.vision.v1p2beta1.Likelihood} adult + * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation * @instance */ - CropHintsAnnotation.prototype.cropHints = $util.emptyArray; + SafeSearchAnnotation.prototype.adult = 0; /** - * Creates a new CropHintsAnnotation instance using the specified properties. + * SafeSearchAnnotation spoof. + * @member {google.cloud.vision.v1p2beta1.Likelihood} spoof + * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation + * @instance + */ + SafeSearchAnnotation.prototype.spoof = 0; + + /** + * SafeSearchAnnotation medical. + * @member {google.cloud.vision.v1p2beta1.Likelihood} medical + * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation + * @instance + */ + SafeSearchAnnotation.prototype.medical = 0; + + /** + * SafeSearchAnnotation violence. + * @member {google.cloud.vision.v1p2beta1.Likelihood} violence + * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation + * @instance + */ + SafeSearchAnnotation.prototype.violence = 0; + + /** + * SafeSearchAnnotation racy. + * @member {google.cloud.vision.v1p2beta1.Likelihood} racy + * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation + * @instance + */ + SafeSearchAnnotation.prototype.racy = 0; + + /** + * Creates a new SafeSearchAnnotation instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation * @static - * @param {google.cloud.vision.v1p2beta1.ICropHintsAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.CropHintsAnnotation} CropHintsAnnotation instance + * @param {google.cloud.vision.v1p2beta1.ISafeSearchAnnotation=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.SafeSearchAnnotation} SafeSearchAnnotation instance */ - CropHintsAnnotation.create = function create(properties) { - return new CropHintsAnnotation(properties); + SafeSearchAnnotation.create = function create(properties) { + return new SafeSearchAnnotation(properties); }; /** - * Encodes the specified CropHintsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p2beta1.CropHintsAnnotation.verify|verify} messages. + * Encodes the specified SafeSearchAnnotation message. Does not implicitly {@link google.cloud.vision.v1p2beta1.SafeSearchAnnotation.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation * @static - * @param {google.cloud.vision.v1p2beta1.ICropHintsAnnotation} message CropHintsAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.ISafeSearchAnnotation} message SafeSearchAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CropHintsAnnotation.encode = function encode(message, writer) { + SafeSearchAnnotation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.cropHints != null && message.cropHints.length) - for (var i = 0; i < message.cropHints.length; ++i) - $root.google.cloud.vision.v1p2beta1.CropHint.encode(message.cropHints[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.adult != null && message.hasOwnProperty("adult")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.adult); + if (message.spoof != null && message.hasOwnProperty("spoof")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.spoof); + if (message.medical != null && message.hasOwnProperty("medical")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.medical); + if (message.violence != null && message.hasOwnProperty("violence")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.violence); + if (message.racy != null && message.hasOwnProperty("racy")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.racy); return writer; }; /** - * Encodes the specified CropHintsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.CropHintsAnnotation.verify|verify} messages. + * Encodes the specified SafeSearchAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.SafeSearchAnnotation.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation * @static - * @param {google.cloud.vision.v1p2beta1.ICropHintsAnnotation} message CropHintsAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.ISafeSearchAnnotation} message SafeSearchAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CropHintsAnnotation.encodeDelimited = function encodeDelimited(message, writer) { + SafeSearchAnnotation.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CropHintsAnnotation message from the specified reader or buffer. + * Decodes a SafeSearchAnnotation message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.CropHintsAnnotation} CropHintsAnnotation + * @returns {google.cloud.vision.v1p2beta1.SafeSearchAnnotation} SafeSearchAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CropHintsAnnotation.decode = function decode(reader, length) { + SafeSearchAnnotation.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.vision.v1p2beta1.CropHintsAnnotation(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.SafeSearchAnnotation(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.cropHints && message.cropHints.length)) - message.cropHints = []; - message.cropHints.push($root.google.cloud.vision.v1p2beta1.CropHint.decode(reader, reader.uint32())); + message.adult = reader.int32(); + break; + case 2: + message.spoof = reader.int32(); + break; + case 3: + message.medical = reader.int32(); + break; + case 4: + message.violence = reader.int32(); + break; + case 9: + message.racy = reader.int32(); break; default: reader.skipType(tag & 7); @@ -40696,125 +40117,306 @@ }; /** - * Decodes a CropHintsAnnotation message from the specified reader or buffer, length delimited. + * Decodes a SafeSearchAnnotation message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.CropHintsAnnotation} CropHintsAnnotation + * @returns {google.cloud.vision.v1p2beta1.SafeSearchAnnotation} SafeSearchAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CropHintsAnnotation.decodeDelimited = function decodeDelimited(reader) { + SafeSearchAnnotation.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CropHintsAnnotation message. + * Verifies a SafeSearchAnnotation message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CropHintsAnnotation.verify = function verify(message) { + SafeSearchAnnotation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.cropHints != null && message.hasOwnProperty("cropHints")) { - if (!Array.isArray(message.cropHints)) - return "cropHints: array expected"; - for (var i = 0; i < message.cropHints.length; ++i) { - var error = $root.google.cloud.vision.v1p2beta1.CropHint.verify(message.cropHints[i]); - if (error) - return "cropHints." + error; + if (message.adult != null && message.hasOwnProperty("adult")) + switch (message.adult) { + default: + return "adult: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.spoof != null && message.hasOwnProperty("spoof")) + switch (message.spoof) { + default: + return "spoof: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.medical != null && message.hasOwnProperty("medical")) + switch (message.medical) { + default: + return "medical: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.violence != null && message.hasOwnProperty("violence")) + switch (message.violence) { + default: + return "violence: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.racy != null && message.hasOwnProperty("racy")) + switch (message.racy) { + default: + return "racy: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; } - } return null; }; /** - * Creates a CropHintsAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates a SafeSearchAnnotation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.CropHintsAnnotation} CropHintsAnnotation + * @returns {google.cloud.vision.v1p2beta1.SafeSearchAnnotation} SafeSearchAnnotation */ - CropHintsAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.CropHintsAnnotation) + SafeSearchAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.SafeSearchAnnotation) return object; - var message = new $root.google.cloud.vision.v1p2beta1.CropHintsAnnotation(); - if (object.cropHints) { - if (!Array.isArray(object.cropHints)) - throw TypeError(".google.cloud.vision.v1p2beta1.CropHintsAnnotation.cropHints: array expected"); - message.cropHints = []; - for (var i = 0; i < object.cropHints.length; ++i) { - if (typeof object.cropHints[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.CropHintsAnnotation.cropHints: object expected"); - message.cropHints[i] = $root.google.cloud.vision.v1p2beta1.CropHint.fromObject(object.cropHints[i]); - } + var message = new $root.google.cloud.vision.v1p2beta1.SafeSearchAnnotation(); + switch (object.adult) { + case "UNKNOWN": + case 0: + message.adult = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.adult = 1; + break; + case "UNLIKELY": + case 2: + message.adult = 2; + break; + case "POSSIBLE": + case 3: + message.adult = 3; + break; + case "LIKELY": + case 4: + message.adult = 4; + break; + case "VERY_LIKELY": + case 5: + message.adult = 5; + break; + } + switch (object.spoof) { + case "UNKNOWN": + case 0: + message.spoof = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.spoof = 1; + break; + case "UNLIKELY": + case 2: + message.spoof = 2; + break; + case "POSSIBLE": + case 3: + message.spoof = 3; + break; + case "LIKELY": + case 4: + message.spoof = 4; + break; + case "VERY_LIKELY": + case 5: + message.spoof = 5; + break; + } + switch (object.medical) { + case "UNKNOWN": + case 0: + message.medical = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.medical = 1; + break; + case "UNLIKELY": + case 2: + message.medical = 2; + break; + case "POSSIBLE": + case 3: + message.medical = 3; + break; + case "LIKELY": + case 4: + message.medical = 4; + break; + case "VERY_LIKELY": + case 5: + message.medical = 5; + break; + } + switch (object.violence) { + case "UNKNOWN": + case 0: + message.violence = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.violence = 1; + break; + case "UNLIKELY": + case 2: + message.violence = 2; + break; + case "POSSIBLE": + case 3: + message.violence = 3; + break; + case "LIKELY": + case 4: + message.violence = 4; + break; + case "VERY_LIKELY": + case 5: + message.violence = 5; + break; + } + switch (object.racy) { + case "UNKNOWN": + case 0: + message.racy = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.racy = 1; + break; + case "UNLIKELY": + case 2: + message.racy = 2; + break; + case "POSSIBLE": + case 3: + message.racy = 3; + break; + case "LIKELY": + case 4: + message.racy = 4; + break; + case "VERY_LIKELY": + case 5: + message.racy = 5; + break; } return message; }; /** - * Creates a plain object from a CropHintsAnnotation message. Also converts values to other types if specified. + * Creates a plain object from a SafeSearchAnnotation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation * @static - * @param {google.cloud.vision.v1p2beta1.CropHintsAnnotation} message CropHintsAnnotation + * @param {google.cloud.vision.v1p2beta1.SafeSearchAnnotation} message SafeSearchAnnotation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CropHintsAnnotation.toObject = function toObject(message, options) { + SafeSearchAnnotation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.cropHints = []; - if (message.cropHints && message.cropHints.length) { - object.cropHints = []; - for (var j = 0; j < message.cropHints.length; ++j) - object.cropHints[j] = $root.google.cloud.vision.v1p2beta1.CropHint.toObject(message.cropHints[j], options); + if (options.defaults) { + object.adult = options.enums === String ? "UNKNOWN" : 0; + object.spoof = options.enums === String ? "UNKNOWN" : 0; + object.medical = options.enums === String ? "UNKNOWN" : 0; + object.violence = options.enums === String ? "UNKNOWN" : 0; + object.racy = options.enums === String ? "UNKNOWN" : 0; } + if (message.adult != null && message.hasOwnProperty("adult")) + object.adult = options.enums === String ? $root.google.cloud.vision.v1p2beta1.Likelihood[message.adult] : message.adult; + if (message.spoof != null && message.hasOwnProperty("spoof")) + object.spoof = options.enums === String ? $root.google.cloud.vision.v1p2beta1.Likelihood[message.spoof] : message.spoof; + if (message.medical != null && message.hasOwnProperty("medical")) + object.medical = options.enums === String ? $root.google.cloud.vision.v1p2beta1.Likelihood[message.medical] : message.medical; + if (message.violence != null && message.hasOwnProperty("violence")) + object.violence = options.enums === String ? $root.google.cloud.vision.v1p2beta1.Likelihood[message.violence] : message.violence; + if (message.racy != null && message.hasOwnProperty("racy")) + object.racy = options.enums === String ? $root.google.cloud.vision.v1p2beta1.Likelihood[message.racy] : message.racy; return object; }; /** - * Converts this CropHintsAnnotation to JSON. + * Converts this SafeSearchAnnotation to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p2beta1.SafeSearchAnnotation * @instance * @returns {Object.} JSON object */ - CropHintsAnnotation.prototype.toJSON = function toJSON() { + SafeSearchAnnotation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CropHintsAnnotation; + return SafeSearchAnnotation; })(); - v1p2beta1.CropHintsParams = (function() { + v1p2beta1.LatLongRect = (function() { /** - * Properties of a CropHintsParams. + * Properties of a LatLongRect. * @memberof google.cloud.vision.v1p2beta1 - * @interface ICropHintsParams - * @property {Array.|null} [aspectRatios] CropHintsParams aspectRatios + * @interface ILatLongRect + * @property {google.type.ILatLng|null} [minLatLng] LatLongRect minLatLng + * @property {google.type.ILatLng|null} [maxLatLng] LatLongRect maxLatLng */ /** - * Constructs a new CropHintsParams. + * Constructs a new LatLongRect. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a CropHintsParams. - * @implements ICropHintsParams + * @classdesc Represents a LatLongRect. + * @implements ILatLongRect * @constructor - * @param {google.cloud.vision.v1p2beta1.ICropHintsParams=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.ILatLongRect=} [properties] Properties to set */ - function CropHintsParams(properties) { - this.aspectRatios = []; + function LatLongRect(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -40822,86 +40424,88 @@ } /** - * CropHintsParams aspectRatios. - * @member {Array.} aspectRatios - * @memberof google.cloud.vision.v1p2beta1.CropHintsParams + * LatLongRect minLatLng. + * @member {google.type.ILatLng|null|undefined} minLatLng + * @memberof google.cloud.vision.v1p2beta1.LatLongRect * @instance */ - CropHintsParams.prototype.aspectRatios = $util.emptyArray; + LatLongRect.prototype.minLatLng = null; /** - * Creates a new CropHintsParams instance using the specified properties. + * LatLongRect maxLatLng. + * @member {google.type.ILatLng|null|undefined} maxLatLng + * @memberof google.cloud.vision.v1p2beta1.LatLongRect + * @instance + */ + LatLongRect.prototype.maxLatLng = null; + + /** + * Creates a new LatLongRect instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.CropHintsParams + * @memberof google.cloud.vision.v1p2beta1.LatLongRect * @static - * @param {google.cloud.vision.v1p2beta1.ICropHintsParams=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.CropHintsParams} CropHintsParams instance + * @param {google.cloud.vision.v1p2beta1.ILatLongRect=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.LatLongRect} LatLongRect instance */ - CropHintsParams.create = function create(properties) { - return new CropHintsParams(properties); + LatLongRect.create = function create(properties) { + return new LatLongRect(properties); }; /** - * Encodes the specified CropHintsParams message. Does not implicitly {@link google.cloud.vision.v1p2beta1.CropHintsParams.verify|verify} messages. + * Encodes the specified LatLongRect message. Does not implicitly {@link google.cloud.vision.v1p2beta1.LatLongRect.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.CropHintsParams + * @memberof google.cloud.vision.v1p2beta1.LatLongRect * @static - * @param {google.cloud.vision.v1p2beta1.ICropHintsParams} message CropHintsParams message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.ILatLongRect} message LatLongRect message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CropHintsParams.encode = function encode(message, writer) { + LatLongRect.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.aspectRatios != null && message.aspectRatios.length) { - writer.uint32(/* id 1, wireType 2 =*/10).fork(); - for (var i = 0; i < message.aspectRatios.length; ++i) - writer.float(message.aspectRatios[i]); - writer.ldelim(); - } + if (message.minLatLng != null && message.hasOwnProperty("minLatLng")) + $root.google.type.LatLng.encode(message.minLatLng, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.maxLatLng != null && message.hasOwnProperty("maxLatLng")) + $root.google.type.LatLng.encode(message.maxLatLng, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified CropHintsParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.CropHintsParams.verify|verify} messages. + * Encodes the specified LatLongRect message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.LatLongRect.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.CropHintsParams + * @memberof google.cloud.vision.v1p2beta1.LatLongRect * @static - * @param {google.cloud.vision.v1p2beta1.ICropHintsParams} message CropHintsParams message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.ILatLongRect} message LatLongRect message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CropHintsParams.encodeDelimited = function encodeDelimited(message, writer) { + LatLongRect.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CropHintsParams message from the specified reader or buffer. + * Decodes a LatLongRect message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.CropHintsParams + * @memberof google.cloud.vision.v1p2beta1.LatLongRect * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.CropHintsParams} CropHintsParams + * @returns {google.cloud.vision.v1p2beta1.LatLongRect} LatLongRect * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CropHintsParams.decode = function decode(reader, length) { + LatLongRect.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.vision.v1p2beta1.CropHintsParams(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.LatLongRect(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.aspectRatios && message.aspectRatios.length)) - message.aspectRatios = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.aspectRatios.push(reader.float()); - } else - message.aspectRatios.push(reader.float()); + message.minLatLng = $root.google.type.LatLng.decode(reader, reader.uint32()); + break; + case 2: + message.maxLatLng = $root.google.type.LatLng.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -40912,119 +40516,128 @@ }; /** - * Decodes a CropHintsParams message from the specified reader or buffer, length delimited. + * Decodes a LatLongRect message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.CropHintsParams + * @memberof google.cloud.vision.v1p2beta1.LatLongRect * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.CropHintsParams} CropHintsParams + * @returns {google.cloud.vision.v1p2beta1.LatLongRect} LatLongRect * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CropHintsParams.decodeDelimited = function decodeDelimited(reader) { + LatLongRect.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CropHintsParams message. + * Verifies a LatLongRect message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.CropHintsParams + * @memberof google.cloud.vision.v1p2beta1.LatLongRect * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CropHintsParams.verify = function verify(message) { + LatLongRect.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.aspectRatios != null && message.hasOwnProperty("aspectRatios")) { - if (!Array.isArray(message.aspectRatios)) - return "aspectRatios: array expected"; - for (var i = 0; i < message.aspectRatios.length; ++i) - if (typeof message.aspectRatios[i] !== "number") - return "aspectRatios: number[] expected"; + if (message.minLatLng != null && message.hasOwnProperty("minLatLng")) { + var error = $root.google.type.LatLng.verify(message.minLatLng); + if (error) + return "minLatLng." + error; + } + if (message.maxLatLng != null && message.hasOwnProperty("maxLatLng")) { + var error = $root.google.type.LatLng.verify(message.maxLatLng); + if (error) + return "maxLatLng." + error; } return null; }; /** - * Creates a CropHintsParams message from a plain object. Also converts values to their respective internal types. + * Creates a LatLongRect message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.CropHintsParams + * @memberof google.cloud.vision.v1p2beta1.LatLongRect * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.CropHintsParams} CropHintsParams + * @returns {google.cloud.vision.v1p2beta1.LatLongRect} LatLongRect */ - CropHintsParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.CropHintsParams) + LatLongRect.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.LatLongRect) return object; - var message = new $root.google.cloud.vision.v1p2beta1.CropHintsParams(); - if (object.aspectRatios) { - if (!Array.isArray(object.aspectRatios)) - throw TypeError(".google.cloud.vision.v1p2beta1.CropHintsParams.aspectRatios: array expected"); - message.aspectRatios = []; - for (var i = 0; i < object.aspectRatios.length; ++i) - message.aspectRatios[i] = Number(object.aspectRatios[i]); + var message = new $root.google.cloud.vision.v1p2beta1.LatLongRect(); + if (object.minLatLng != null) { + if (typeof object.minLatLng !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.LatLongRect.minLatLng: object expected"); + message.minLatLng = $root.google.type.LatLng.fromObject(object.minLatLng); + } + if (object.maxLatLng != null) { + if (typeof object.maxLatLng !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.LatLongRect.maxLatLng: object expected"); + message.maxLatLng = $root.google.type.LatLng.fromObject(object.maxLatLng); } return message; }; /** - * Creates a plain object from a CropHintsParams message. Also converts values to other types if specified. + * Creates a plain object from a LatLongRect message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.CropHintsParams + * @memberof google.cloud.vision.v1p2beta1.LatLongRect * @static - * @param {google.cloud.vision.v1p2beta1.CropHintsParams} message CropHintsParams + * @param {google.cloud.vision.v1p2beta1.LatLongRect} message LatLongRect * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CropHintsParams.toObject = function toObject(message, options) { + LatLongRect.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.aspectRatios = []; - if (message.aspectRatios && message.aspectRatios.length) { - object.aspectRatios = []; - for (var j = 0; j < message.aspectRatios.length; ++j) - object.aspectRatios[j] = options.json && !isFinite(message.aspectRatios[j]) ? String(message.aspectRatios[j]) : message.aspectRatios[j]; + if (options.defaults) { + object.minLatLng = null; + object.maxLatLng = null; } + if (message.minLatLng != null && message.hasOwnProperty("minLatLng")) + object.minLatLng = $root.google.type.LatLng.toObject(message.minLatLng, options); + if (message.maxLatLng != null && message.hasOwnProperty("maxLatLng")) + object.maxLatLng = $root.google.type.LatLng.toObject(message.maxLatLng, options); return object; }; /** - * Converts this CropHintsParams to JSON. + * Converts this LatLongRect to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.CropHintsParams + * @memberof google.cloud.vision.v1p2beta1.LatLongRect * @instance * @returns {Object.} JSON object */ - CropHintsParams.prototype.toJSON = function toJSON() { + LatLongRect.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CropHintsParams; + return LatLongRect; })(); - v1p2beta1.WebDetectionParams = (function() { + v1p2beta1.ColorInfo = (function() { /** - * Properties of a WebDetectionParams. + * Properties of a ColorInfo. * @memberof google.cloud.vision.v1p2beta1 - * @interface IWebDetectionParams - * @property {boolean|null} [includeGeoResults] WebDetectionParams includeGeoResults + * @interface IColorInfo + * @property {google.type.IColor|null} [color] ColorInfo color + * @property {number|null} [score] ColorInfo score + * @property {number|null} [pixelFraction] ColorInfo pixelFraction */ /** - * Constructs a new WebDetectionParams. + * Constructs a new ColorInfo. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a WebDetectionParams. - * @implements IWebDetectionParams + * @classdesc Represents a ColorInfo. + * @implements IColorInfo * @constructor - * @param {google.cloud.vision.v1p2beta1.IWebDetectionParams=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.IColorInfo=} [properties] Properties to set */ - function WebDetectionParams(properties) { + function ColorInfo(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -41032,75 +40645,101 @@ } /** - * WebDetectionParams includeGeoResults. - * @member {boolean} includeGeoResults - * @memberof google.cloud.vision.v1p2beta1.WebDetectionParams + * ColorInfo color. + * @member {google.type.IColor|null|undefined} color + * @memberof google.cloud.vision.v1p2beta1.ColorInfo * @instance */ - WebDetectionParams.prototype.includeGeoResults = false; + ColorInfo.prototype.color = null; /** - * Creates a new WebDetectionParams instance using the specified properties. + * ColorInfo score. + * @member {number} score + * @memberof google.cloud.vision.v1p2beta1.ColorInfo + * @instance + */ + ColorInfo.prototype.score = 0; + + /** + * ColorInfo pixelFraction. + * @member {number} pixelFraction + * @memberof google.cloud.vision.v1p2beta1.ColorInfo + * @instance + */ + ColorInfo.prototype.pixelFraction = 0; + + /** + * Creates a new ColorInfo instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p2beta1.ColorInfo * @static - * @param {google.cloud.vision.v1p2beta1.IWebDetectionParams=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.WebDetectionParams} WebDetectionParams instance + * @param {google.cloud.vision.v1p2beta1.IColorInfo=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.ColorInfo} ColorInfo instance */ - WebDetectionParams.create = function create(properties) { - return new WebDetectionParams(properties); + ColorInfo.create = function create(properties) { + return new ColorInfo(properties); }; /** - * Encodes the specified WebDetectionParams message. Does not implicitly {@link google.cloud.vision.v1p2beta1.WebDetectionParams.verify|verify} messages. + * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.vision.v1p2beta1.ColorInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p2beta1.ColorInfo * @static - * @param {google.cloud.vision.v1p2beta1.IWebDetectionParams} message WebDetectionParams message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IColorInfo} message ColorInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WebDetectionParams.encode = function encode(message, writer) { + ColorInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.includeGeoResults != null && message.hasOwnProperty("includeGeoResults")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.includeGeoResults); + if (message.color != null && message.hasOwnProperty("color")) + $root.google.type.Color.encode(message.color, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.score != null && message.hasOwnProperty("score")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); + if (message.pixelFraction != null && message.hasOwnProperty("pixelFraction")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.pixelFraction); return writer; }; /** - * Encodes the specified WebDetectionParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.WebDetectionParams.verify|verify} messages. + * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.ColorInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p2beta1.ColorInfo * @static - * @param {google.cloud.vision.v1p2beta1.IWebDetectionParams} message WebDetectionParams message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IColorInfo} message ColorInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WebDetectionParams.encodeDelimited = function encodeDelimited(message, writer) { + ColorInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a WebDetectionParams message from the specified reader or buffer. + * Decodes a ColorInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p2beta1.ColorInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.WebDetectionParams} WebDetectionParams + * @returns {google.cloud.vision.v1p2beta1.ColorInfo} ColorInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WebDetectionParams.decode = function decode(reader, length) { + ColorInfo.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.vision.v1p2beta1.WebDetectionParams(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.ColorInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.color = $root.google.type.Color.decode(reader, reader.uint32()); + break; case 2: - message.includeGeoResults = reader.bool(); + message.score = reader.float(); + break; + case 3: + message.pixelFraction = reader.float(); break; default: reader.skipType(tag & 7); @@ -41111,111 +40750,130 @@ }; /** - * Decodes a WebDetectionParams message from the specified reader or buffer, length delimited. + * Decodes a ColorInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p2beta1.ColorInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.WebDetectionParams} WebDetectionParams + * @returns {google.cloud.vision.v1p2beta1.ColorInfo} ColorInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WebDetectionParams.decodeDelimited = function decodeDelimited(reader) { + ColorInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a WebDetectionParams message. + * Verifies a ColorInfo message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p2beta1.ColorInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - WebDetectionParams.verify = function verify(message) { + ColorInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.includeGeoResults != null && message.hasOwnProperty("includeGeoResults")) - if (typeof message.includeGeoResults !== "boolean") - return "includeGeoResults: boolean expected"; + if (message.color != null && message.hasOwnProperty("color")) { + var error = $root.google.type.Color.verify(message.color); + if (error) + return "color." + error; + } + if (message.score != null && message.hasOwnProperty("score")) + if (typeof message.score !== "number") + return "score: number expected"; + if (message.pixelFraction != null && message.hasOwnProperty("pixelFraction")) + if (typeof message.pixelFraction !== "number") + return "pixelFraction: number expected"; return null; }; /** - * Creates a WebDetectionParams message from a plain object. Also converts values to their respective internal types. + * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p2beta1.ColorInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.WebDetectionParams} WebDetectionParams + * @returns {google.cloud.vision.v1p2beta1.ColorInfo} ColorInfo */ - WebDetectionParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.WebDetectionParams) + ColorInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.ColorInfo) return object; - var message = new $root.google.cloud.vision.v1p2beta1.WebDetectionParams(); - if (object.includeGeoResults != null) - message.includeGeoResults = Boolean(object.includeGeoResults); + var message = new $root.google.cloud.vision.v1p2beta1.ColorInfo(); + if (object.color != null) { + if (typeof object.color !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.ColorInfo.color: object expected"); + message.color = $root.google.type.Color.fromObject(object.color); + } + if (object.score != null) + message.score = Number(object.score); + if (object.pixelFraction != null) + message.pixelFraction = Number(object.pixelFraction); return message; }; /** - * Creates a plain object from a WebDetectionParams message. Also converts values to other types if specified. + * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p2beta1.ColorInfo * @static - * @param {google.cloud.vision.v1p2beta1.WebDetectionParams} message WebDetectionParams + * @param {google.cloud.vision.v1p2beta1.ColorInfo} message ColorInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - WebDetectionParams.toObject = function toObject(message, options) { + ColorInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.includeGeoResults = false; - if (message.includeGeoResults != null && message.hasOwnProperty("includeGeoResults")) - object.includeGeoResults = message.includeGeoResults; + if (options.defaults) { + object.color = null; + object.score = 0; + object.pixelFraction = 0; + } + if (message.color != null && message.hasOwnProperty("color")) + object.color = $root.google.type.Color.toObject(message.color, options); + if (message.score != null && message.hasOwnProperty("score")) + object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; + if (message.pixelFraction != null && message.hasOwnProperty("pixelFraction")) + object.pixelFraction = options.json && !isFinite(message.pixelFraction) ? String(message.pixelFraction) : message.pixelFraction; return object; }; /** - * Converts this WebDetectionParams to JSON. + * Converts this ColorInfo to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p2beta1.ColorInfo * @instance * @returns {Object.} JSON object */ - WebDetectionParams.prototype.toJSON = function toJSON() { + ColorInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return WebDetectionParams; + return ColorInfo; })(); - v1p2beta1.ImageContext = (function() { + v1p2beta1.DominantColorsAnnotation = (function() { /** - * Properties of an ImageContext. + * Properties of a DominantColorsAnnotation. * @memberof google.cloud.vision.v1p2beta1 - * @interface IImageContext - * @property {google.cloud.vision.v1p2beta1.ILatLongRect|null} [latLongRect] ImageContext latLongRect - * @property {Array.|null} [languageHints] ImageContext languageHints - * @property {google.cloud.vision.v1p2beta1.ICropHintsParams|null} [cropHintsParams] ImageContext cropHintsParams - * @property {google.cloud.vision.v1p2beta1.IWebDetectionParams|null} [webDetectionParams] ImageContext webDetectionParams + * @interface IDominantColorsAnnotation + * @property {Array.|null} [colors] DominantColorsAnnotation colors */ /** - * Constructs a new ImageContext. + * Constructs a new DominantColorsAnnotation. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an ImageContext. - * @implements IImageContext + * @classdesc Represents a DominantColorsAnnotation. + * @implements IDominantColorsAnnotation * @constructor - * @param {google.cloud.vision.v1p2beta1.IImageContext=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.IDominantColorsAnnotation=} [properties] Properties to set */ - function ImageContext(properties) { - this.languageHints = []; + function DominantColorsAnnotation(properties) { + this.colors = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -41223,117 +40881,78 @@ } /** - * ImageContext latLongRect. - * @member {google.cloud.vision.v1p2beta1.ILatLongRect|null|undefined} latLongRect - * @memberof google.cloud.vision.v1p2beta1.ImageContext - * @instance - */ - ImageContext.prototype.latLongRect = null; - - /** - * ImageContext languageHints. - * @member {Array.} languageHints - * @memberof google.cloud.vision.v1p2beta1.ImageContext - * @instance - */ - ImageContext.prototype.languageHints = $util.emptyArray; - - /** - * ImageContext cropHintsParams. - * @member {google.cloud.vision.v1p2beta1.ICropHintsParams|null|undefined} cropHintsParams - * @memberof google.cloud.vision.v1p2beta1.ImageContext - * @instance - */ - ImageContext.prototype.cropHintsParams = null; - - /** - * ImageContext webDetectionParams. - * @member {google.cloud.vision.v1p2beta1.IWebDetectionParams|null|undefined} webDetectionParams - * @memberof google.cloud.vision.v1p2beta1.ImageContext + * DominantColorsAnnotation colors. + * @member {Array.} colors + * @memberof google.cloud.vision.v1p2beta1.DominantColorsAnnotation * @instance */ - ImageContext.prototype.webDetectionParams = null; + DominantColorsAnnotation.prototype.colors = $util.emptyArray; /** - * Creates a new ImageContext instance using the specified properties. + * Creates a new DominantColorsAnnotation instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.ImageContext + * @memberof google.cloud.vision.v1p2beta1.DominantColorsAnnotation * @static - * @param {google.cloud.vision.v1p2beta1.IImageContext=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.ImageContext} ImageContext instance + * @param {google.cloud.vision.v1p2beta1.IDominantColorsAnnotation=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.DominantColorsAnnotation} DominantColorsAnnotation instance */ - ImageContext.create = function create(properties) { - return new ImageContext(properties); + DominantColorsAnnotation.create = function create(properties) { + return new DominantColorsAnnotation(properties); }; /** - * Encodes the specified ImageContext message. Does not implicitly {@link google.cloud.vision.v1p2beta1.ImageContext.verify|verify} messages. + * Encodes the specified DominantColorsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p2beta1.DominantColorsAnnotation.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.ImageContext + * @memberof google.cloud.vision.v1p2beta1.DominantColorsAnnotation * @static - * @param {google.cloud.vision.v1p2beta1.IImageContext} message ImageContext message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IDominantColorsAnnotation} message DominantColorsAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageContext.encode = function encode(message, writer) { + DominantColorsAnnotation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.latLongRect != null && message.hasOwnProperty("latLongRect")) - $root.google.cloud.vision.v1p2beta1.LatLongRect.encode(message.latLongRect, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.languageHints != null && message.languageHints.length) - for (var i = 0; i < message.languageHints.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageHints[i]); - if (message.cropHintsParams != null && message.hasOwnProperty("cropHintsParams")) - $root.google.cloud.vision.v1p2beta1.CropHintsParams.encode(message.cropHintsParams, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.webDetectionParams != null && message.hasOwnProperty("webDetectionParams")) - $root.google.cloud.vision.v1p2beta1.WebDetectionParams.encode(message.webDetectionParams, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.colors != null && message.colors.length) + for (var i = 0; i < message.colors.length; ++i) + $root.google.cloud.vision.v1p2beta1.ColorInfo.encode(message.colors[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified ImageContext message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.ImageContext.verify|verify} messages. + * Encodes the specified DominantColorsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.DominantColorsAnnotation.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.ImageContext + * @memberof google.cloud.vision.v1p2beta1.DominantColorsAnnotation * @static - * @param {google.cloud.vision.v1p2beta1.IImageContext} message ImageContext message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IDominantColorsAnnotation} message DominantColorsAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageContext.encodeDelimited = function encodeDelimited(message, writer) { + DominantColorsAnnotation.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImageContext message from the specified reader or buffer. + * Decodes a DominantColorsAnnotation message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.ImageContext + * @memberof google.cloud.vision.v1p2beta1.DominantColorsAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.ImageContext} ImageContext + * @returns {google.cloud.vision.v1p2beta1.DominantColorsAnnotation} DominantColorsAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageContext.decode = function decode(reader, length) { + DominantColorsAnnotation.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.vision.v1p2beta1.ImageContext(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.DominantColorsAnnotation(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.latLongRect = $root.google.cloud.vision.v1p2beta1.LatLongRect.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.languageHints && message.languageHints.length)) - message.languageHints = []; - message.languageHints.push(reader.string()); - break; - case 4: - message.cropHintsParams = $root.google.cloud.vision.v1p2beta1.CropHintsParams.decode(reader, reader.uint32()); - break; - case 6: - message.webDetectionParams = $root.google.cloud.vision.v1p2beta1.WebDetectionParams.decode(reader, reader.uint32()); + if (!(message.colors && message.colors.length)) + message.colors = []; + message.colors.push($root.google.cloud.vision.v1p2beta1.ColorInfo.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -41344,163 +40963,124 @@ }; /** - * Decodes an ImageContext message from the specified reader or buffer, length delimited. + * Decodes a DominantColorsAnnotation message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.ImageContext + * @memberof google.cloud.vision.v1p2beta1.DominantColorsAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.ImageContext} ImageContext + * @returns {google.cloud.vision.v1p2beta1.DominantColorsAnnotation} DominantColorsAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageContext.decodeDelimited = function decodeDelimited(reader) { + DominantColorsAnnotation.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImageContext message. + * Verifies a DominantColorsAnnotation message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.ImageContext + * @memberof google.cloud.vision.v1p2beta1.DominantColorsAnnotation * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImageContext.verify = function verify(message) { + DominantColorsAnnotation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.latLongRect != null && message.hasOwnProperty("latLongRect")) { - var error = $root.google.cloud.vision.v1p2beta1.LatLongRect.verify(message.latLongRect); - if (error) - return "latLongRect." + error; - } - if (message.languageHints != null && message.hasOwnProperty("languageHints")) { - if (!Array.isArray(message.languageHints)) - return "languageHints: array expected"; - for (var i = 0; i < message.languageHints.length; ++i) - if (!$util.isString(message.languageHints[i])) - return "languageHints: string[] expected"; - } - if (message.cropHintsParams != null && message.hasOwnProperty("cropHintsParams")) { - var error = $root.google.cloud.vision.v1p2beta1.CropHintsParams.verify(message.cropHintsParams); - if (error) - return "cropHintsParams." + error; - } - if (message.webDetectionParams != null && message.hasOwnProperty("webDetectionParams")) { - var error = $root.google.cloud.vision.v1p2beta1.WebDetectionParams.verify(message.webDetectionParams); - if (error) - return "webDetectionParams." + error; + if (message.colors != null && message.hasOwnProperty("colors")) { + if (!Array.isArray(message.colors)) + return "colors: array expected"; + for (var i = 0; i < message.colors.length; ++i) { + var error = $root.google.cloud.vision.v1p2beta1.ColorInfo.verify(message.colors[i]); + if (error) + return "colors." + error; + } } return null; }; /** - * Creates an ImageContext message from a plain object. Also converts values to their respective internal types. + * Creates a DominantColorsAnnotation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.ImageContext + * @memberof google.cloud.vision.v1p2beta1.DominantColorsAnnotation * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.ImageContext} ImageContext + * @returns {google.cloud.vision.v1p2beta1.DominantColorsAnnotation} DominantColorsAnnotation */ - ImageContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.ImageContext) + DominantColorsAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.DominantColorsAnnotation) return object; - var message = new $root.google.cloud.vision.v1p2beta1.ImageContext(); - if (object.latLongRect != null) { - if (typeof object.latLongRect !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.ImageContext.latLongRect: object expected"); - message.latLongRect = $root.google.cloud.vision.v1p2beta1.LatLongRect.fromObject(object.latLongRect); - } - if (object.languageHints) { - if (!Array.isArray(object.languageHints)) - throw TypeError(".google.cloud.vision.v1p2beta1.ImageContext.languageHints: array expected"); - message.languageHints = []; - for (var i = 0; i < object.languageHints.length; ++i) - message.languageHints[i] = String(object.languageHints[i]); - } - if (object.cropHintsParams != null) { - if (typeof object.cropHintsParams !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.ImageContext.cropHintsParams: object expected"); - message.cropHintsParams = $root.google.cloud.vision.v1p2beta1.CropHintsParams.fromObject(object.cropHintsParams); - } - if (object.webDetectionParams != null) { - if (typeof object.webDetectionParams !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.ImageContext.webDetectionParams: object expected"); - message.webDetectionParams = $root.google.cloud.vision.v1p2beta1.WebDetectionParams.fromObject(object.webDetectionParams); + var message = new $root.google.cloud.vision.v1p2beta1.DominantColorsAnnotation(); + if (object.colors) { + if (!Array.isArray(object.colors)) + throw TypeError(".google.cloud.vision.v1p2beta1.DominantColorsAnnotation.colors: array expected"); + message.colors = []; + for (var i = 0; i < object.colors.length; ++i) { + if (typeof object.colors[i] !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.DominantColorsAnnotation.colors: object expected"); + message.colors[i] = $root.google.cloud.vision.v1p2beta1.ColorInfo.fromObject(object.colors[i]); + } } return message; }; /** - * Creates a plain object from an ImageContext message. Also converts values to other types if specified. + * Creates a plain object from a DominantColorsAnnotation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.ImageContext + * @memberof google.cloud.vision.v1p2beta1.DominantColorsAnnotation * @static - * @param {google.cloud.vision.v1p2beta1.ImageContext} message ImageContext + * @param {google.cloud.vision.v1p2beta1.DominantColorsAnnotation} message DominantColorsAnnotation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImageContext.toObject = function toObject(message, options) { + DominantColorsAnnotation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.languageHints = []; - if (options.defaults) { - object.latLongRect = null; - object.cropHintsParams = null; - object.webDetectionParams = null; - } - if (message.latLongRect != null && message.hasOwnProperty("latLongRect")) - object.latLongRect = $root.google.cloud.vision.v1p2beta1.LatLongRect.toObject(message.latLongRect, options); - if (message.languageHints && message.languageHints.length) { - object.languageHints = []; - for (var j = 0; j < message.languageHints.length; ++j) - object.languageHints[j] = message.languageHints[j]; + object.colors = []; + if (message.colors && message.colors.length) { + object.colors = []; + for (var j = 0; j < message.colors.length; ++j) + object.colors[j] = $root.google.cloud.vision.v1p2beta1.ColorInfo.toObject(message.colors[j], options); } - if (message.cropHintsParams != null && message.hasOwnProperty("cropHintsParams")) - object.cropHintsParams = $root.google.cloud.vision.v1p2beta1.CropHintsParams.toObject(message.cropHintsParams, options); - if (message.webDetectionParams != null && message.hasOwnProperty("webDetectionParams")) - object.webDetectionParams = $root.google.cloud.vision.v1p2beta1.WebDetectionParams.toObject(message.webDetectionParams, options); return object; }; /** - * Converts this ImageContext to JSON. + * Converts this DominantColorsAnnotation to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.ImageContext + * @memberof google.cloud.vision.v1p2beta1.DominantColorsAnnotation * @instance * @returns {Object.} JSON object */ - ImageContext.prototype.toJSON = function toJSON() { + DominantColorsAnnotation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImageContext; + return DominantColorsAnnotation; })(); - v1p2beta1.AnnotateImageRequest = (function() { + v1p2beta1.ImageProperties = (function() { /** - * Properties of an AnnotateImageRequest. + * Properties of an ImageProperties. * @memberof google.cloud.vision.v1p2beta1 - * @interface IAnnotateImageRequest - * @property {google.cloud.vision.v1p2beta1.IImage|null} [image] AnnotateImageRequest image - * @property {Array.|null} [features] AnnotateImageRequest features - * @property {google.cloud.vision.v1p2beta1.IImageContext|null} [imageContext] AnnotateImageRequest imageContext + * @interface IImageProperties + * @property {google.cloud.vision.v1p2beta1.IDominantColorsAnnotation|null} [dominantColors] ImageProperties dominantColors */ /** - * Constructs a new AnnotateImageRequest. + * Constructs a new ImageProperties. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an AnnotateImageRequest. - * @implements IAnnotateImageRequest + * @classdesc Represents an ImageProperties. + * @implements IImageProperties * @constructor - * @param {google.cloud.vision.v1p2beta1.IAnnotateImageRequest=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.IImageProperties=} [properties] Properties to set */ - function AnnotateImageRequest(properties) { - this.features = []; + function ImageProperties(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -41508,104 +41088,75 @@ } /** - * AnnotateImageRequest image. - * @member {google.cloud.vision.v1p2beta1.IImage|null|undefined} image - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest - * @instance - */ - AnnotateImageRequest.prototype.image = null; - - /** - * AnnotateImageRequest features. - * @member {Array.} features - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest - * @instance - */ - AnnotateImageRequest.prototype.features = $util.emptyArray; - - /** - * AnnotateImageRequest imageContext. - * @member {google.cloud.vision.v1p2beta1.IImageContext|null|undefined} imageContext - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest + * ImageProperties dominantColors. + * @member {google.cloud.vision.v1p2beta1.IDominantColorsAnnotation|null|undefined} dominantColors + * @memberof google.cloud.vision.v1p2beta1.ImageProperties * @instance */ - AnnotateImageRequest.prototype.imageContext = null; + ImageProperties.prototype.dominantColors = null; /** - * Creates a new AnnotateImageRequest instance using the specified properties. + * Creates a new ImageProperties instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p2beta1.ImageProperties * @static - * @param {google.cloud.vision.v1p2beta1.IAnnotateImageRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.AnnotateImageRequest} AnnotateImageRequest instance + * @param {google.cloud.vision.v1p2beta1.IImageProperties=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.ImageProperties} ImageProperties instance */ - AnnotateImageRequest.create = function create(properties) { - return new AnnotateImageRequest(properties); + ImageProperties.create = function create(properties) { + return new ImageProperties(properties); }; /** - * Encodes the specified AnnotateImageRequest message. Does not implicitly {@link google.cloud.vision.v1p2beta1.AnnotateImageRequest.verify|verify} messages. + * Encodes the specified ImageProperties message. Does not implicitly {@link google.cloud.vision.v1p2beta1.ImageProperties.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p2beta1.ImageProperties * @static - * @param {google.cloud.vision.v1p2beta1.IAnnotateImageRequest} message AnnotateImageRequest message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IImageProperties} message ImageProperties message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateImageRequest.encode = function encode(message, writer) { + ImageProperties.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.image != null && message.hasOwnProperty("image")) - $root.google.cloud.vision.v1p2beta1.Image.encode(message.image, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.features != null && message.features.length) - for (var i = 0; i < message.features.length; ++i) - $root.google.cloud.vision.v1p2beta1.Feature.encode(message.features[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.imageContext != null && message.hasOwnProperty("imageContext")) - $root.google.cloud.vision.v1p2beta1.ImageContext.encode(message.imageContext, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.dominantColors != null && message.hasOwnProperty("dominantColors")) + $root.google.cloud.vision.v1p2beta1.DominantColorsAnnotation.encode(message.dominantColors, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified AnnotateImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.AnnotateImageRequest.verify|verify} messages. + * Encodes the specified ImageProperties message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.ImageProperties.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p2beta1.ImageProperties * @static - * @param {google.cloud.vision.v1p2beta1.IAnnotateImageRequest} message AnnotateImageRequest message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IImageProperties} message ImageProperties message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateImageRequest.encodeDelimited = function encodeDelimited(message, writer) { + ImageProperties.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AnnotateImageRequest message from the specified reader or buffer. + * Decodes an ImageProperties message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p2beta1.ImageProperties * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.AnnotateImageRequest} AnnotateImageRequest + * @returns {google.cloud.vision.v1p2beta1.ImageProperties} ImageProperties * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateImageRequest.decode = function decode(reader, length) { + ImageProperties.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.vision.v1p2beta1.AnnotateImageRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.ImageProperties(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.image = $root.google.cloud.vision.v1p2beta1.Image.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.features && message.features.length)) - message.features = []; - message.features.push($root.google.cloud.vision.v1p2beta1.Feature.decode(reader, reader.uint32())); - break; - case 3: - message.imageContext = $root.google.cloud.vision.v1p2beta1.ImageContext.decode(reader, reader.uint32()); + message.dominantColors = $root.google.cloud.vision.v1p2beta1.DominantColorsAnnotation.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -41616,153 +41167,114 @@ }; /** - * Decodes an AnnotateImageRequest message from the specified reader or buffer, length delimited. + * Decodes an ImageProperties message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p2beta1.ImageProperties * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.AnnotateImageRequest} AnnotateImageRequest + * @returns {google.cloud.vision.v1p2beta1.ImageProperties} ImageProperties * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateImageRequest.decodeDelimited = function decodeDelimited(reader) { + ImageProperties.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AnnotateImageRequest message. + * Verifies an ImageProperties message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p2beta1.ImageProperties * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AnnotateImageRequest.verify = function verify(message) { + ImageProperties.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.image != null && message.hasOwnProperty("image")) { - var error = $root.google.cloud.vision.v1p2beta1.Image.verify(message.image); - if (error) - return "image." + error; - } - if (message.features != null && message.hasOwnProperty("features")) { - if (!Array.isArray(message.features)) - return "features: array expected"; - for (var i = 0; i < message.features.length; ++i) { - var error = $root.google.cloud.vision.v1p2beta1.Feature.verify(message.features[i]); - if (error) - return "features." + error; - } - } - if (message.imageContext != null && message.hasOwnProperty("imageContext")) { - var error = $root.google.cloud.vision.v1p2beta1.ImageContext.verify(message.imageContext); + if (message.dominantColors != null && message.hasOwnProperty("dominantColors")) { + var error = $root.google.cloud.vision.v1p2beta1.DominantColorsAnnotation.verify(message.dominantColors); if (error) - return "imageContext." + error; + return "dominantColors." + error; } return null; }; /** - * Creates an AnnotateImageRequest message from a plain object. Also converts values to their respective internal types. + * Creates an ImageProperties message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p2beta1.ImageProperties * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.AnnotateImageRequest} AnnotateImageRequest + * @returns {google.cloud.vision.v1p2beta1.ImageProperties} ImageProperties */ - AnnotateImageRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.AnnotateImageRequest) + ImageProperties.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.ImageProperties) return object; - var message = new $root.google.cloud.vision.v1p2beta1.AnnotateImageRequest(); - if (object.image != null) { - if (typeof object.image !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageRequest.image: object expected"); - message.image = $root.google.cloud.vision.v1p2beta1.Image.fromObject(object.image); - } - if (object.features) { - if (!Array.isArray(object.features)) - throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageRequest.features: array expected"); - message.features = []; - for (var i = 0; i < object.features.length; ++i) { - if (typeof object.features[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageRequest.features: object expected"); - message.features[i] = $root.google.cloud.vision.v1p2beta1.Feature.fromObject(object.features[i]); - } - } - if (object.imageContext != null) { - if (typeof object.imageContext !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageRequest.imageContext: object expected"); - message.imageContext = $root.google.cloud.vision.v1p2beta1.ImageContext.fromObject(object.imageContext); + var message = new $root.google.cloud.vision.v1p2beta1.ImageProperties(); + if (object.dominantColors != null) { + if (typeof object.dominantColors !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.ImageProperties.dominantColors: object expected"); + message.dominantColors = $root.google.cloud.vision.v1p2beta1.DominantColorsAnnotation.fromObject(object.dominantColors); } return message; }; /** - * Creates a plain object from an AnnotateImageRequest message. Also converts values to other types if specified. + * Creates a plain object from an ImageProperties message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p2beta1.ImageProperties * @static - * @param {google.cloud.vision.v1p2beta1.AnnotateImageRequest} message AnnotateImageRequest + * @param {google.cloud.vision.v1p2beta1.ImageProperties} message ImageProperties * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AnnotateImageRequest.toObject = function toObject(message, options) { + ImageProperties.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.features = []; - if (options.defaults) { - object.image = null; - object.imageContext = null; - } - if (message.image != null && message.hasOwnProperty("image")) - object.image = $root.google.cloud.vision.v1p2beta1.Image.toObject(message.image, options); - if (message.features && message.features.length) { - object.features = []; - for (var j = 0; j < message.features.length; ++j) - object.features[j] = $root.google.cloud.vision.v1p2beta1.Feature.toObject(message.features[j], options); - } - if (message.imageContext != null && message.hasOwnProperty("imageContext")) - object.imageContext = $root.google.cloud.vision.v1p2beta1.ImageContext.toObject(message.imageContext, options); + if (options.defaults) + object.dominantColors = null; + if (message.dominantColors != null && message.hasOwnProperty("dominantColors")) + object.dominantColors = $root.google.cloud.vision.v1p2beta1.DominantColorsAnnotation.toObject(message.dominantColors, options); return object; }; /** - * Converts this AnnotateImageRequest to JSON. + * Converts this ImageProperties to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p2beta1.ImageProperties * @instance * @returns {Object.} JSON object */ - AnnotateImageRequest.prototype.toJSON = function toJSON() { + ImageProperties.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AnnotateImageRequest; + return ImageProperties; })(); - v1p2beta1.ImageAnnotationContext = (function() { + v1p2beta1.CropHint = (function() { /** - * Properties of an ImageAnnotationContext. + * Properties of a CropHint. * @memberof google.cloud.vision.v1p2beta1 - * @interface IImageAnnotationContext - * @property {string|null} [uri] ImageAnnotationContext uri - * @property {number|null} [pageNumber] ImageAnnotationContext pageNumber + * @interface ICropHint + * @property {google.cloud.vision.v1p2beta1.IBoundingPoly|null} [boundingPoly] CropHint boundingPoly + * @property {number|null} [confidence] CropHint confidence + * @property {number|null} [importanceFraction] CropHint importanceFraction */ /** - * Constructs a new ImageAnnotationContext. + * Constructs a new CropHint. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an ImageAnnotationContext. - * @implements IImageAnnotationContext + * @classdesc Represents a CropHint. + * @implements ICropHint * @constructor - * @param {google.cloud.vision.v1p2beta1.IImageAnnotationContext=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.ICropHint=} [properties] Properties to set */ - function ImageAnnotationContext(properties) { + function CropHint(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -41770,88 +41282,101 @@ } /** - * ImageAnnotationContext uri. - * @member {string} uri - * @memberof google.cloud.vision.v1p2beta1.ImageAnnotationContext + * CropHint boundingPoly. + * @member {google.cloud.vision.v1p2beta1.IBoundingPoly|null|undefined} boundingPoly + * @memberof google.cloud.vision.v1p2beta1.CropHint * @instance */ - ImageAnnotationContext.prototype.uri = ""; + CropHint.prototype.boundingPoly = null; /** - * ImageAnnotationContext pageNumber. - * @member {number} pageNumber - * @memberof google.cloud.vision.v1p2beta1.ImageAnnotationContext + * CropHint confidence. + * @member {number} confidence + * @memberof google.cloud.vision.v1p2beta1.CropHint * @instance */ - ImageAnnotationContext.prototype.pageNumber = 0; + CropHint.prototype.confidence = 0; /** - * Creates a new ImageAnnotationContext instance using the specified properties. + * CropHint importanceFraction. + * @member {number} importanceFraction + * @memberof google.cloud.vision.v1p2beta1.CropHint + * @instance + */ + CropHint.prototype.importanceFraction = 0; + + /** + * Creates a new CropHint instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.ImageAnnotationContext + * @memberof google.cloud.vision.v1p2beta1.CropHint * @static - * @param {google.cloud.vision.v1p2beta1.IImageAnnotationContext=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.ImageAnnotationContext} ImageAnnotationContext instance + * @param {google.cloud.vision.v1p2beta1.ICropHint=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.CropHint} CropHint instance */ - ImageAnnotationContext.create = function create(properties) { - return new ImageAnnotationContext(properties); + CropHint.create = function create(properties) { + return new CropHint(properties); }; /** - * Encodes the specified ImageAnnotationContext message. Does not implicitly {@link google.cloud.vision.v1p2beta1.ImageAnnotationContext.verify|verify} messages. + * Encodes the specified CropHint message. Does not implicitly {@link google.cloud.vision.v1p2beta1.CropHint.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.ImageAnnotationContext + * @memberof google.cloud.vision.v1p2beta1.CropHint * @static - * @param {google.cloud.vision.v1p2beta1.IImageAnnotationContext} message ImageAnnotationContext message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.ICropHint} message CropHint message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageAnnotationContext.encode = function encode(message, writer) { + CropHint.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.uri != null && message.hasOwnProperty("uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); - if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageNumber); + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + $root.google.cloud.vision.v1p2beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.confidence != null && message.hasOwnProperty("confidence")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); + if (message.importanceFraction != null && message.hasOwnProperty("importanceFraction")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.importanceFraction); return writer; }; /** - * Encodes the specified ImageAnnotationContext message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.ImageAnnotationContext.verify|verify} messages. + * Encodes the specified CropHint message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.CropHint.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.ImageAnnotationContext + * @memberof google.cloud.vision.v1p2beta1.CropHint * @static - * @param {google.cloud.vision.v1p2beta1.IImageAnnotationContext} message ImageAnnotationContext message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.ICropHint} message CropHint message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageAnnotationContext.encodeDelimited = function encodeDelimited(message, writer) { + CropHint.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImageAnnotationContext message from the specified reader or buffer. + * Decodes a CropHint message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.ImageAnnotationContext + * @memberof google.cloud.vision.v1p2beta1.CropHint * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.ImageAnnotationContext} ImageAnnotationContext + * @returns {google.cloud.vision.v1p2beta1.CropHint} CropHint * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageAnnotationContext.decode = function decode(reader, length) { + CropHint.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.vision.v1p2beta1.ImageAnnotationContext(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.CropHint(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.uri = reader.string(); + message.boundingPoly = $root.google.cloud.vision.v1p2beta1.BoundingPoly.decode(reader, reader.uint32()); break; case 2: - message.pageNumber = reader.int32(); + message.confidence = reader.float(); + break; + case 3: + message.importanceFraction = reader.float(); break; default: reader.skipType(tag & 7); @@ -41862,132 +41387,130 @@ }; /** - * Decodes an ImageAnnotationContext message from the specified reader or buffer, length delimited. + * Decodes a CropHint message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.ImageAnnotationContext + * @memberof google.cloud.vision.v1p2beta1.CropHint * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.ImageAnnotationContext} ImageAnnotationContext + * @returns {google.cloud.vision.v1p2beta1.CropHint} CropHint * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageAnnotationContext.decodeDelimited = function decodeDelimited(reader) { + CropHint.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImageAnnotationContext message. + * Verifies a CropHint message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.ImageAnnotationContext + * @memberof google.cloud.vision.v1p2beta1.CropHint * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImageAnnotationContext.verify = function verify(message) { + CropHint.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) - if (!$util.isInteger(message.pageNumber)) - return "pageNumber: integer expected"; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { + var error = $root.google.cloud.vision.v1p2beta1.BoundingPoly.verify(message.boundingPoly); + if (error) + return "boundingPoly." + error; + } + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + if (message.importanceFraction != null && message.hasOwnProperty("importanceFraction")) + if (typeof message.importanceFraction !== "number") + return "importanceFraction: number expected"; return null; }; /** - * Creates an ImageAnnotationContext message from a plain object. Also converts values to their respective internal types. + * Creates a CropHint message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.ImageAnnotationContext + * @memberof google.cloud.vision.v1p2beta1.CropHint * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.ImageAnnotationContext} ImageAnnotationContext + * @returns {google.cloud.vision.v1p2beta1.CropHint} CropHint */ - ImageAnnotationContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.ImageAnnotationContext) + CropHint.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.CropHint) return object; - var message = new $root.google.cloud.vision.v1p2beta1.ImageAnnotationContext(); - if (object.uri != null) - message.uri = String(object.uri); - if (object.pageNumber != null) - message.pageNumber = object.pageNumber | 0; + var message = new $root.google.cloud.vision.v1p2beta1.CropHint(); + if (object.boundingPoly != null) { + if (typeof object.boundingPoly !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.CropHint.boundingPoly: object expected"); + message.boundingPoly = $root.google.cloud.vision.v1p2beta1.BoundingPoly.fromObject(object.boundingPoly); + } + if (object.confidence != null) + message.confidence = Number(object.confidence); + if (object.importanceFraction != null) + message.importanceFraction = Number(object.importanceFraction); return message; }; /** - * Creates a plain object from an ImageAnnotationContext message. Also converts values to other types if specified. + * Creates a plain object from a CropHint message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.ImageAnnotationContext + * @memberof google.cloud.vision.v1p2beta1.CropHint * @static - * @param {google.cloud.vision.v1p2beta1.ImageAnnotationContext} message ImageAnnotationContext + * @param {google.cloud.vision.v1p2beta1.CropHint} message CropHint * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImageAnnotationContext.toObject = function toObject(message, options) { + CropHint.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.uri = ""; - object.pageNumber = 0; + object.boundingPoly = null; + object.confidence = 0; + object.importanceFraction = 0; } - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) - object.pageNumber = message.pageNumber; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + object.boundingPoly = $root.google.cloud.vision.v1p2beta1.BoundingPoly.toObject(message.boundingPoly, options); + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + if (message.importanceFraction != null && message.hasOwnProperty("importanceFraction")) + object.importanceFraction = options.json && !isFinite(message.importanceFraction) ? String(message.importanceFraction) : message.importanceFraction; return object; }; /** - * Converts this ImageAnnotationContext to JSON. + * Converts this CropHint to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.ImageAnnotationContext + * @memberof google.cloud.vision.v1p2beta1.CropHint * @instance * @returns {Object.} JSON object */ - ImageAnnotationContext.prototype.toJSON = function toJSON() { + CropHint.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImageAnnotationContext; + return CropHint; })(); - v1p2beta1.AnnotateImageResponse = (function() { + v1p2beta1.CropHintsAnnotation = (function() { /** - * Properties of an AnnotateImageResponse. + * Properties of a CropHintsAnnotation. * @memberof google.cloud.vision.v1p2beta1 - * @interface IAnnotateImageResponse - * @property {Array.|null} [faceAnnotations] AnnotateImageResponse faceAnnotations - * @property {Array.|null} [landmarkAnnotations] AnnotateImageResponse landmarkAnnotations - * @property {Array.|null} [logoAnnotations] AnnotateImageResponse logoAnnotations - * @property {Array.|null} [labelAnnotations] AnnotateImageResponse labelAnnotations - * @property {Array.|null} [textAnnotations] AnnotateImageResponse textAnnotations - * @property {google.cloud.vision.v1p2beta1.ITextAnnotation|null} [fullTextAnnotation] AnnotateImageResponse fullTextAnnotation - * @property {google.cloud.vision.v1p2beta1.ISafeSearchAnnotation|null} [safeSearchAnnotation] AnnotateImageResponse safeSearchAnnotation - * @property {google.cloud.vision.v1p2beta1.IImageProperties|null} [imagePropertiesAnnotation] AnnotateImageResponse imagePropertiesAnnotation - * @property {google.cloud.vision.v1p2beta1.ICropHintsAnnotation|null} [cropHintsAnnotation] AnnotateImageResponse cropHintsAnnotation - * @property {google.cloud.vision.v1p2beta1.IWebDetection|null} [webDetection] AnnotateImageResponse webDetection - * @property {google.rpc.IStatus|null} [error] AnnotateImageResponse error - * @property {google.cloud.vision.v1p2beta1.IImageAnnotationContext|null} [context] AnnotateImageResponse context + * @interface ICropHintsAnnotation + * @property {Array.|null} [cropHints] CropHintsAnnotation cropHints */ /** - * Constructs a new AnnotateImageResponse. + * Constructs a new CropHintsAnnotation. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an AnnotateImageResponse. - * @implements IAnnotateImageResponse + * @classdesc Represents a CropHintsAnnotation. + * @implements ICropHintsAnnotation * @constructor - * @param {google.cloud.vision.v1p2beta1.IAnnotateImageResponse=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.ICropHintsAnnotation=} [properties] Properties to set */ - function AnnotateImageResponse(properties) { - this.faceAnnotations = []; - this.landmarkAnnotations = []; - this.logoAnnotations = []; - this.labelAnnotations = []; - this.textAnnotations = []; + function CropHintsAnnotation(properties) { + this.cropHints = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -41995,233 +41518,78 @@ } /** - * AnnotateImageResponse faceAnnotations. - * @member {Array.} faceAnnotations - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse + * CropHintsAnnotation cropHints. + * @member {Array.} cropHints + * @memberof google.cloud.vision.v1p2beta1.CropHintsAnnotation * @instance */ - AnnotateImageResponse.prototype.faceAnnotations = $util.emptyArray; + CropHintsAnnotation.prototype.cropHints = $util.emptyArray; /** - * AnnotateImageResponse landmarkAnnotations. - * @member {Array.} landmarkAnnotations - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.landmarkAnnotations = $util.emptyArray; - - /** - * AnnotateImageResponse logoAnnotations. - * @member {Array.} logoAnnotations - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.logoAnnotations = $util.emptyArray; - - /** - * AnnotateImageResponse labelAnnotations. - * @member {Array.} labelAnnotations - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.labelAnnotations = $util.emptyArray; - - /** - * AnnotateImageResponse textAnnotations. - * @member {Array.} textAnnotations - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.textAnnotations = $util.emptyArray; - - /** - * AnnotateImageResponse fullTextAnnotation. - * @member {google.cloud.vision.v1p2beta1.ITextAnnotation|null|undefined} fullTextAnnotation - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.fullTextAnnotation = null; - - /** - * AnnotateImageResponse safeSearchAnnotation. - * @member {google.cloud.vision.v1p2beta1.ISafeSearchAnnotation|null|undefined} safeSearchAnnotation - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.safeSearchAnnotation = null; - - /** - * AnnotateImageResponse imagePropertiesAnnotation. - * @member {google.cloud.vision.v1p2beta1.IImageProperties|null|undefined} imagePropertiesAnnotation - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.imagePropertiesAnnotation = null; - - /** - * AnnotateImageResponse cropHintsAnnotation. - * @member {google.cloud.vision.v1p2beta1.ICropHintsAnnotation|null|undefined} cropHintsAnnotation - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.cropHintsAnnotation = null; - - /** - * AnnotateImageResponse webDetection. - * @member {google.cloud.vision.v1p2beta1.IWebDetection|null|undefined} webDetection - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.webDetection = null; - - /** - * AnnotateImageResponse error. - * @member {google.rpc.IStatus|null|undefined} error - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.error = null; - - /** - * AnnotateImageResponse context. - * @member {google.cloud.vision.v1p2beta1.IImageAnnotationContext|null|undefined} context - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.context = null; - - /** - * Creates a new AnnotateImageResponse instance using the specified properties. + * Creates a new CropHintsAnnotation instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p2beta1.CropHintsAnnotation * @static - * @param {google.cloud.vision.v1p2beta1.IAnnotateImageResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.AnnotateImageResponse} AnnotateImageResponse instance + * @param {google.cloud.vision.v1p2beta1.ICropHintsAnnotation=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.CropHintsAnnotation} CropHintsAnnotation instance */ - AnnotateImageResponse.create = function create(properties) { - return new AnnotateImageResponse(properties); + CropHintsAnnotation.create = function create(properties) { + return new CropHintsAnnotation(properties); }; /** - * Encodes the specified AnnotateImageResponse message. Does not implicitly {@link google.cloud.vision.v1p2beta1.AnnotateImageResponse.verify|verify} messages. + * Encodes the specified CropHintsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p2beta1.CropHintsAnnotation.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p2beta1.CropHintsAnnotation * @static - * @param {google.cloud.vision.v1p2beta1.IAnnotateImageResponse} message AnnotateImageResponse message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.ICropHintsAnnotation} message CropHintsAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateImageResponse.encode = function encode(message, writer) { + CropHintsAnnotation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.faceAnnotations != null && message.faceAnnotations.length) - for (var i = 0; i < message.faceAnnotations.length; ++i) - $root.google.cloud.vision.v1p2beta1.FaceAnnotation.encode(message.faceAnnotations[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.landmarkAnnotations != null && message.landmarkAnnotations.length) - for (var i = 0; i < message.landmarkAnnotations.length; ++i) - $root.google.cloud.vision.v1p2beta1.EntityAnnotation.encode(message.landmarkAnnotations[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.logoAnnotations != null && message.logoAnnotations.length) - for (var i = 0; i < message.logoAnnotations.length; ++i) - $root.google.cloud.vision.v1p2beta1.EntityAnnotation.encode(message.logoAnnotations[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.labelAnnotations != null && message.labelAnnotations.length) - for (var i = 0; i < message.labelAnnotations.length; ++i) - $root.google.cloud.vision.v1p2beta1.EntityAnnotation.encode(message.labelAnnotations[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.textAnnotations != null && message.textAnnotations.length) - for (var i = 0; i < message.textAnnotations.length; ++i) - $root.google.cloud.vision.v1p2beta1.EntityAnnotation.encode(message.textAnnotations[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.safeSearchAnnotation != null && message.hasOwnProperty("safeSearchAnnotation")) - $root.google.cloud.vision.v1p2beta1.SafeSearchAnnotation.encode(message.safeSearchAnnotation, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.imagePropertiesAnnotation != null && message.hasOwnProperty("imagePropertiesAnnotation")) - $root.google.cloud.vision.v1p2beta1.ImageProperties.encode(message.imagePropertiesAnnotation, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.error != null && message.hasOwnProperty("error")) - $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.cropHintsAnnotation != null && message.hasOwnProperty("cropHintsAnnotation")) - $root.google.cloud.vision.v1p2beta1.CropHintsAnnotation.encode(message.cropHintsAnnotation, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.fullTextAnnotation != null && message.hasOwnProperty("fullTextAnnotation")) - $root.google.cloud.vision.v1p2beta1.TextAnnotation.encode(message.fullTextAnnotation, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.webDetection != null && message.hasOwnProperty("webDetection")) - $root.google.cloud.vision.v1p2beta1.WebDetection.encode(message.webDetection, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); - if (message.context != null && message.hasOwnProperty("context")) - $root.google.cloud.vision.v1p2beta1.ImageAnnotationContext.encode(message.context, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.cropHints != null && message.cropHints.length) + for (var i = 0; i < message.cropHints.length; ++i) + $root.google.cloud.vision.v1p2beta1.CropHint.encode(message.cropHints[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified AnnotateImageResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.AnnotateImageResponse.verify|verify} messages. + * Encodes the specified CropHintsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.CropHintsAnnotation.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p2beta1.CropHintsAnnotation * @static - * @param {google.cloud.vision.v1p2beta1.IAnnotateImageResponse} message AnnotateImageResponse message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.ICropHintsAnnotation} message CropHintsAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateImageResponse.encodeDelimited = function encodeDelimited(message, writer) { + CropHintsAnnotation.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AnnotateImageResponse message from the specified reader or buffer. + * Decodes a CropHintsAnnotation message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p2beta1.CropHintsAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.AnnotateImageResponse} AnnotateImageResponse + * @returns {google.cloud.vision.v1p2beta1.CropHintsAnnotation} CropHintsAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateImageResponse.decode = function decode(reader, length) { + CropHintsAnnotation.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.vision.v1p2beta1.AnnotateImageResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.CropHintsAnnotation(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.faceAnnotations && message.faceAnnotations.length)) - message.faceAnnotations = []; - message.faceAnnotations.push($root.google.cloud.vision.v1p2beta1.FaceAnnotation.decode(reader, reader.uint32())); - break; - case 2: - if (!(message.landmarkAnnotations && message.landmarkAnnotations.length)) - message.landmarkAnnotations = []; - message.landmarkAnnotations.push($root.google.cloud.vision.v1p2beta1.EntityAnnotation.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.logoAnnotations && message.logoAnnotations.length)) - message.logoAnnotations = []; - message.logoAnnotations.push($root.google.cloud.vision.v1p2beta1.EntityAnnotation.decode(reader, reader.uint32())); - break; - case 4: - if (!(message.labelAnnotations && message.labelAnnotations.length)) - message.labelAnnotations = []; - message.labelAnnotations.push($root.google.cloud.vision.v1p2beta1.EntityAnnotation.decode(reader, reader.uint32())); - break; - case 5: - if (!(message.textAnnotations && message.textAnnotations.length)) - message.textAnnotations = []; - message.textAnnotations.push($root.google.cloud.vision.v1p2beta1.EntityAnnotation.decode(reader, reader.uint32())); - break; - case 12: - message.fullTextAnnotation = $root.google.cloud.vision.v1p2beta1.TextAnnotation.decode(reader, reader.uint32()); - break; - case 6: - message.safeSearchAnnotation = $root.google.cloud.vision.v1p2beta1.SafeSearchAnnotation.decode(reader, reader.uint32()); - break; - case 8: - message.imagePropertiesAnnotation = $root.google.cloud.vision.v1p2beta1.ImageProperties.decode(reader, reader.uint32()); - break; - case 11: - message.cropHintsAnnotation = $root.google.cloud.vision.v1p2beta1.CropHintsAnnotation.decode(reader, reader.uint32()); - break; - case 13: - message.webDetection = $root.google.cloud.vision.v1p2beta1.WebDetection.decode(reader, reader.uint32()); - break; - case 9: - message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); - break; - case 21: - message.context = $root.google.cloud.vision.v1p2beta1.ImageAnnotationContext.decode(reader, reader.uint32()); + if (!(message.cropHints && message.cropHints.length)) + message.cropHints = []; + message.cropHints.push($root.google.cloud.vision.v1p2beta1.CropHint.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -42232,320 +41600,125 @@ }; /** - * Decodes an AnnotateImageResponse message from the specified reader or buffer, length delimited. + * Decodes a CropHintsAnnotation message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p2beta1.CropHintsAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.AnnotateImageResponse} AnnotateImageResponse + * @returns {google.cloud.vision.v1p2beta1.CropHintsAnnotation} CropHintsAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateImageResponse.decodeDelimited = function decodeDelimited(reader) { + CropHintsAnnotation.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AnnotateImageResponse message. + * Verifies a CropHintsAnnotation message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p2beta1.CropHintsAnnotation * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AnnotateImageResponse.verify = function verify(message) { + CropHintsAnnotation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.faceAnnotations != null && message.hasOwnProperty("faceAnnotations")) { - if (!Array.isArray(message.faceAnnotations)) - return "faceAnnotations: array expected"; - for (var i = 0; i < message.faceAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1p2beta1.FaceAnnotation.verify(message.faceAnnotations[i]); - if (error) - return "faceAnnotations." + error; - } - } - if (message.landmarkAnnotations != null && message.hasOwnProperty("landmarkAnnotations")) { - if (!Array.isArray(message.landmarkAnnotations)) - return "landmarkAnnotations: array expected"; - for (var i = 0; i < message.landmarkAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1p2beta1.EntityAnnotation.verify(message.landmarkAnnotations[i]); - if (error) - return "landmarkAnnotations." + error; - } - } - if (message.logoAnnotations != null && message.hasOwnProperty("logoAnnotations")) { - if (!Array.isArray(message.logoAnnotations)) - return "logoAnnotations: array expected"; - for (var i = 0; i < message.logoAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1p2beta1.EntityAnnotation.verify(message.logoAnnotations[i]); - if (error) - return "logoAnnotations." + error; - } - } - if (message.labelAnnotations != null && message.hasOwnProperty("labelAnnotations")) { - if (!Array.isArray(message.labelAnnotations)) - return "labelAnnotations: array expected"; - for (var i = 0; i < message.labelAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1p2beta1.EntityAnnotation.verify(message.labelAnnotations[i]); - if (error) - return "labelAnnotations." + error; - } - } - if (message.textAnnotations != null && message.hasOwnProperty("textAnnotations")) { - if (!Array.isArray(message.textAnnotations)) - return "textAnnotations: array expected"; - for (var i = 0; i < message.textAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1p2beta1.EntityAnnotation.verify(message.textAnnotations[i]); + if (message.cropHints != null && message.hasOwnProperty("cropHints")) { + if (!Array.isArray(message.cropHints)) + return "cropHints: array expected"; + for (var i = 0; i < message.cropHints.length; ++i) { + var error = $root.google.cloud.vision.v1p2beta1.CropHint.verify(message.cropHints[i]); if (error) - return "textAnnotations." + error; + return "cropHints." + error; } } - if (message.fullTextAnnotation != null && message.hasOwnProperty("fullTextAnnotation")) { - var error = $root.google.cloud.vision.v1p2beta1.TextAnnotation.verify(message.fullTextAnnotation); - if (error) - return "fullTextAnnotation." + error; - } - if (message.safeSearchAnnotation != null && message.hasOwnProperty("safeSearchAnnotation")) { - var error = $root.google.cloud.vision.v1p2beta1.SafeSearchAnnotation.verify(message.safeSearchAnnotation); - if (error) - return "safeSearchAnnotation." + error; - } - if (message.imagePropertiesAnnotation != null && message.hasOwnProperty("imagePropertiesAnnotation")) { - var error = $root.google.cloud.vision.v1p2beta1.ImageProperties.verify(message.imagePropertiesAnnotation); - if (error) - return "imagePropertiesAnnotation." + error; - } - if (message.cropHintsAnnotation != null && message.hasOwnProperty("cropHintsAnnotation")) { - var error = $root.google.cloud.vision.v1p2beta1.CropHintsAnnotation.verify(message.cropHintsAnnotation); - if (error) - return "cropHintsAnnotation." + error; - } - if (message.webDetection != null && message.hasOwnProperty("webDetection")) { - var error = $root.google.cloud.vision.v1p2beta1.WebDetection.verify(message.webDetection); - if (error) - return "webDetection." + error; - } - if (message.error != null && message.hasOwnProperty("error")) { - var error = $root.google.rpc.Status.verify(message.error); - if (error) - return "error." + error; - } - if (message.context != null && message.hasOwnProperty("context")) { - var error = $root.google.cloud.vision.v1p2beta1.ImageAnnotationContext.verify(message.context); - if (error) - return "context." + error; - } return null; }; /** - * Creates an AnnotateImageResponse message from a plain object. Also converts values to their respective internal types. + * Creates a CropHintsAnnotation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p2beta1.CropHintsAnnotation * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.AnnotateImageResponse} AnnotateImageResponse + * @returns {google.cloud.vision.v1p2beta1.CropHintsAnnotation} CropHintsAnnotation */ - AnnotateImageResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.AnnotateImageResponse) + CropHintsAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.CropHintsAnnotation) return object; - var message = new $root.google.cloud.vision.v1p2beta1.AnnotateImageResponse(); - if (object.faceAnnotations) { - if (!Array.isArray(object.faceAnnotations)) - throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.faceAnnotations: array expected"); - message.faceAnnotations = []; - for (var i = 0; i < object.faceAnnotations.length; ++i) { - if (typeof object.faceAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.faceAnnotations: object expected"); - message.faceAnnotations[i] = $root.google.cloud.vision.v1p2beta1.FaceAnnotation.fromObject(object.faceAnnotations[i]); - } - } - if (object.landmarkAnnotations) { - if (!Array.isArray(object.landmarkAnnotations)) - throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.landmarkAnnotations: array expected"); - message.landmarkAnnotations = []; - for (var i = 0; i < object.landmarkAnnotations.length; ++i) { - if (typeof object.landmarkAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.landmarkAnnotations: object expected"); - message.landmarkAnnotations[i] = $root.google.cloud.vision.v1p2beta1.EntityAnnotation.fromObject(object.landmarkAnnotations[i]); - } - } - if (object.logoAnnotations) { - if (!Array.isArray(object.logoAnnotations)) - throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.logoAnnotations: array expected"); - message.logoAnnotations = []; - for (var i = 0; i < object.logoAnnotations.length; ++i) { - if (typeof object.logoAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.logoAnnotations: object expected"); - message.logoAnnotations[i] = $root.google.cloud.vision.v1p2beta1.EntityAnnotation.fromObject(object.logoAnnotations[i]); - } - } - if (object.labelAnnotations) { - if (!Array.isArray(object.labelAnnotations)) - throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.labelAnnotations: array expected"); - message.labelAnnotations = []; - for (var i = 0; i < object.labelAnnotations.length; ++i) { - if (typeof object.labelAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.labelAnnotations: object expected"); - message.labelAnnotations[i] = $root.google.cloud.vision.v1p2beta1.EntityAnnotation.fromObject(object.labelAnnotations[i]); - } - } - if (object.textAnnotations) { - if (!Array.isArray(object.textAnnotations)) - throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.textAnnotations: array expected"); - message.textAnnotations = []; - for (var i = 0; i < object.textAnnotations.length; ++i) { - if (typeof object.textAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.textAnnotations: object expected"); - message.textAnnotations[i] = $root.google.cloud.vision.v1p2beta1.EntityAnnotation.fromObject(object.textAnnotations[i]); + var message = new $root.google.cloud.vision.v1p2beta1.CropHintsAnnotation(); + if (object.cropHints) { + if (!Array.isArray(object.cropHints)) + throw TypeError(".google.cloud.vision.v1p2beta1.CropHintsAnnotation.cropHints: array expected"); + message.cropHints = []; + for (var i = 0; i < object.cropHints.length; ++i) { + if (typeof object.cropHints[i] !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.CropHintsAnnotation.cropHints: object expected"); + message.cropHints[i] = $root.google.cloud.vision.v1p2beta1.CropHint.fromObject(object.cropHints[i]); } } - if (object.fullTextAnnotation != null) { - if (typeof object.fullTextAnnotation !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.fullTextAnnotation: object expected"); - message.fullTextAnnotation = $root.google.cloud.vision.v1p2beta1.TextAnnotation.fromObject(object.fullTextAnnotation); - } - if (object.safeSearchAnnotation != null) { - if (typeof object.safeSearchAnnotation !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.safeSearchAnnotation: object expected"); - message.safeSearchAnnotation = $root.google.cloud.vision.v1p2beta1.SafeSearchAnnotation.fromObject(object.safeSearchAnnotation); - } - if (object.imagePropertiesAnnotation != null) { - if (typeof object.imagePropertiesAnnotation !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.imagePropertiesAnnotation: object expected"); - message.imagePropertiesAnnotation = $root.google.cloud.vision.v1p2beta1.ImageProperties.fromObject(object.imagePropertiesAnnotation); - } - if (object.cropHintsAnnotation != null) { - if (typeof object.cropHintsAnnotation !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.cropHintsAnnotation: object expected"); - message.cropHintsAnnotation = $root.google.cloud.vision.v1p2beta1.CropHintsAnnotation.fromObject(object.cropHintsAnnotation); - } - if (object.webDetection != null) { - if (typeof object.webDetection !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.webDetection: object expected"); - message.webDetection = $root.google.cloud.vision.v1p2beta1.WebDetection.fromObject(object.webDetection); - } - if (object.error != null) { - if (typeof object.error !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.error: object expected"); - message.error = $root.google.rpc.Status.fromObject(object.error); - } - if (object.context != null) { - if (typeof object.context !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.context: object expected"); - message.context = $root.google.cloud.vision.v1p2beta1.ImageAnnotationContext.fromObject(object.context); - } return message; }; /** - * Creates a plain object from an AnnotateImageResponse message. Also converts values to other types if specified. + * Creates a plain object from a CropHintsAnnotation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p2beta1.CropHintsAnnotation * @static - * @param {google.cloud.vision.v1p2beta1.AnnotateImageResponse} message AnnotateImageResponse + * @param {google.cloud.vision.v1p2beta1.CropHintsAnnotation} message CropHintsAnnotation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AnnotateImageResponse.toObject = function toObject(message, options) { + CropHintsAnnotation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.faceAnnotations = []; - object.landmarkAnnotations = []; - object.logoAnnotations = []; - object.labelAnnotations = []; - object.textAnnotations = []; - } - if (options.defaults) { - object.safeSearchAnnotation = null; - object.imagePropertiesAnnotation = null; - object.error = null; - object.cropHintsAnnotation = null; - object.fullTextAnnotation = null; - object.webDetection = null; - object.context = null; - } - if (message.faceAnnotations && message.faceAnnotations.length) { - object.faceAnnotations = []; - for (var j = 0; j < message.faceAnnotations.length; ++j) - object.faceAnnotations[j] = $root.google.cloud.vision.v1p2beta1.FaceAnnotation.toObject(message.faceAnnotations[j], options); - } - if (message.landmarkAnnotations && message.landmarkAnnotations.length) { - object.landmarkAnnotations = []; - for (var j = 0; j < message.landmarkAnnotations.length; ++j) - object.landmarkAnnotations[j] = $root.google.cloud.vision.v1p2beta1.EntityAnnotation.toObject(message.landmarkAnnotations[j], options); - } - if (message.logoAnnotations && message.logoAnnotations.length) { - object.logoAnnotations = []; - for (var j = 0; j < message.logoAnnotations.length; ++j) - object.logoAnnotations[j] = $root.google.cloud.vision.v1p2beta1.EntityAnnotation.toObject(message.logoAnnotations[j], options); - } - if (message.labelAnnotations && message.labelAnnotations.length) { - object.labelAnnotations = []; - for (var j = 0; j < message.labelAnnotations.length; ++j) - object.labelAnnotations[j] = $root.google.cloud.vision.v1p2beta1.EntityAnnotation.toObject(message.labelAnnotations[j], options); - } - if (message.textAnnotations && message.textAnnotations.length) { - object.textAnnotations = []; - for (var j = 0; j < message.textAnnotations.length; ++j) - object.textAnnotations[j] = $root.google.cloud.vision.v1p2beta1.EntityAnnotation.toObject(message.textAnnotations[j], options); + if (options.arrays || options.defaults) + object.cropHints = []; + if (message.cropHints && message.cropHints.length) { + object.cropHints = []; + for (var j = 0; j < message.cropHints.length; ++j) + object.cropHints[j] = $root.google.cloud.vision.v1p2beta1.CropHint.toObject(message.cropHints[j], options); } - if (message.safeSearchAnnotation != null && message.hasOwnProperty("safeSearchAnnotation")) - object.safeSearchAnnotation = $root.google.cloud.vision.v1p2beta1.SafeSearchAnnotation.toObject(message.safeSearchAnnotation, options); - if (message.imagePropertiesAnnotation != null && message.hasOwnProperty("imagePropertiesAnnotation")) - object.imagePropertiesAnnotation = $root.google.cloud.vision.v1p2beta1.ImageProperties.toObject(message.imagePropertiesAnnotation, options); - if (message.error != null && message.hasOwnProperty("error")) - object.error = $root.google.rpc.Status.toObject(message.error, options); - if (message.cropHintsAnnotation != null && message.hasOwnProperty("cropHintsAnnotation")) - object.cropHintsAnnotation = $root.google.cloud.vision.v1p2beta1.CropHintsAnnotation.toObject(message.cropHintsAnnotation, options); - if (message.fullTextAnnotation != null && message.hasOwnProperty("fullTextAnnotation")) - object.fullTextAnnotation = $root.google.cloud.vision.v1p2beta1.TextAnnotation.toObject(message.fullTextAnnotation, options); - if (message.webDetection != null && message.hasOwnProperty("webDetection")) - object.webDetection = $root.google.cloud.vision.v1p2beta1.WebDetection.toObject(message.webDetection, options); - if (message.context != null && message.hasOwnProperty("context")) - object.context = $root.google.cloud.vision.v1p2beta1.ImageAnnotationContext.toObject(message.context, options); return object; }; /** - * Converts this AnnotateImageResponse to JSON. + * Converts this CropHintsAnnotation to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p2beta1.CropHintsAnnotation * @instance * @returns {Object.} JSON object */ - AnnotateImageResponse.prototype.toJSON = function toJSON() { + CropHintsAnnotation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AnnotateImageResponse; + return CropHintsAnnotation; })(); - v1p2beta1.AnnotateFileResponse = (function() { + v1p2beta1.CropHintsParams = (function() { /** - * Properties of an AnnotateFileResponse. + * Properties of a CropHintsParams. * @memberof google.cloud.vision.v1p2beta1 - * @interface IAnnotateFileResponse - * @property {google.cloud.vision.v1p2beta1.IInputConfig|null} [inputConfig] AnnotateFileResponse inputConfig - * @property {Array.|null} [responses] AnnotateFileResponse responses + * @interface ICropHintsParams + * @property {Array.|null} [aspectRatios] CropHintsParams aspectRatios */ /** - * Constructs a new AnnotateFileResponse. + * Constructs a new CropHintsParams. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an AnnotateFileResponse. - * @implements IAnnotateFileResponse + * @classdesc Represents a CropHintsParams. + * @implements ICropHintsParams * @constructor - * @param {google.cloud.vision.v1p2beta1.IAnnotateFileResponse=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.ICropHintsParams=} [properties] Properties to set */ - function AnnotateFileResponse(properties) { - this.responses = []; + function CropHintsParams(properties) { + this.aspectRatios = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -42553,91 +41726,86 @@ } /** - * AnnotateFileResponse inputConfig. - * @member {google.cloud.vision.v1p2beta1.IInputConfig|null|undefined} inputConfig - * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse + * CropHintsParams aspectRatios. + * @member {Array.} aspectRatios + * @memberof google.cloud.vision.v1p2beta1.CropHintsParams * @instance */ - AnnotateFileResponse.prototype.inputConfig = null; + CropHintsParams.prototype.aspectRatios = $util.emptyArray; /** - * AnnotateFileResponse responses. - * @member {Array.} responses - * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse - * @instance - */ - AnnotateFileResponse.prototype.responses = $util.emptyArray; - - /** - * Creates a new AnnotateFileResponse instance using the specified properties. + * Creates a new CropHintsParams instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse + * @memberof google.cloud.vision.v1p2beta1.CropHintsParams * @static - * @param {google.cloud.vision.v1p2beta1.IAnnotateFileResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.AnnotateFileResponse} AnnotateFileResponse instance + * @param {google.cloud.vision.v1p2beta1.ICropHintsParams=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.CropHintsParams} CropHintsParams instance */ - AnnotateFileResponse.create = function create(properties) { - return new AnnotateFileResponse(properties); + CropHintsParams.create = function create(properties) { + return new CropHintsParams(properties); }; /** - * Encodes the specified AnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1p2beta1.AnnotateFileResponse.verify|verify} messages. + * Encodes the specified CropHintsParams message. Does not implicitly {@link google.cloud.vision.v1p2beta1.CropHintsParams.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse + * @memberof google.cloud.vision.v1p2beta1.CropHintsParams * @static - * @param {google.cloud.vision.v1p2beta1.IAnnotateFileResponse} message AnnotateFileResponse message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.ICropHintsParams} message CropHintsParams message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateFileResponse.encode = function encode(message, writer) { + CropHintsParams.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - $root.google.cloud.vision.v1p2beta1.InputConfig.encode(message.inputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.responses != null && message.responses.length) - for (var i = 0; i < message.responses.length; ++i) - $root.google.cloud.vision.v1p2beta1.AnnotateImageResponse.encode(message.responses[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.aspectRatios != null && message.aspectRatios.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.aspectRatios.length; ++i) + writer.float(message.aspectRatios[i]); + writer.ldelim(); + } return writer; }; /** - * Encodes the specified AnnotateFileResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.AnnotateFileResponse.verify|verify} messages. + * Encodes the specified CropHintsParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.CropHintsParams.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse + * @memberof google.cloud.vision.v1p2beta1.CropHintsParams * @static - * @param {google.cloud.vision.v1p2beta1.IAnnotateFileResponse} message AnnotateFileResponse message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.ICropHintsParams} message CropHintsParams message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateFileResponse.encodeDelimited = function encodeDelimited(message, writer) { + CropHintsParams.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AnnotateFileResponse message from the specified reader or buffer. + * Decodes a CropHintsParams message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse + * @memberof google.cloud.vision.v1p2beta1.CropHintsParams * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.AnnotateFileResponse} AnnotateFileResponse + * @returns {google.cloud.vision.v1p2beta1.CropHintsParams} CropHintsParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateFileResponse.decode = function decode(reader, length) { + CropHintsParams.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.vision.v1p2beta1.AnnotateFileResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.CropHintsParams(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.inputConfig = $root.google.cloud.vision.v1p2beta1.InputConfig.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.responses && message.responses.length)) - message.responses = []; - message.responses.push($root.google.cloud.vision.v1p2beta1.AnnotateImageResponse.decode(reader, reader.uint32())); + if (!(message.aspectRatios && message.aspectRatios.length)) + message.aspectRatios = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.aspectRatios.push(reader.float()); + } else + message.aspectRatios.push(reader.float()); break; default: reader.skipType(tag & 7); @@ -42648,139 +41816,119 @@ }; /** - * Decodes an AnnotateFileResponse message from the specified reader or buffer, length delimited. + * Decodes a CropHintsParams message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse + * @memberof google.cloud.vision.v1p2beta1.CropHintsParams * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.AnnotateFileResponse} AnnotateFileResponse + * @returns {google.cloud.vision.v1p2beta1.CropHintsParams} CropHintsParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateFileResponse.decodeDelimited = function decodeDelimited(reader) { + CropHintsParams.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AnnotateFileResponse message. + * Verifies a CropHintsParams message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse + * @memberof google.cloud.vision.v1p2beta1.CropHintsParams * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AnnotateFileResponse.verify = function verify(message) { + CropHintsParams.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.vision.v1p2beta1.InputConfig.verify(message.inputConfig); - if (error) - return "inputConfig." + error; - } - if (message.responses != null && message.hasOwnProperty("responses")) { - if (!Array.isArray(message.responses)) - return "responses: array expected"; - for (var i = 0; i < message.responses.length; ++i) { - var error = $root.google.cloud.vision.v1p2beta1.AnnotateImageResponse.verify(message.responses[i]); - if (error) - return "responses." + error; - } + if (message.aspectRatios != null && message.hasOwnProperty("aspectRatios")) { + if (!Array.isArray(message.aspectRatios)) + return "aspectRatios: array expected"; + for (var i = 0; i < message.aspectRatios.length; ++i) + if (typeof message.aspectRatios[i] !== "number") + return "aspectRatios: number[] expected"; } return null; }; /** - * Creates an AnnotateFileResponse message from a plain object. Also converts values to their respective internal types. + * Creates a CropHintsParams message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse + * @memberof google.cloud.vision.v1p2beta1.CropHintsParams * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.AnnotateFileResponse} AnnotateFileResponse + * @returns {google.cloud.vision.v1p2beta1.CropHintsParams} CropHintsParams */ - AnnotateFileResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.AnnotateFileResponse) + CropHintsParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.CropHintsParams) return object; - var message = new $root.google.cloud.vision.v1p2beta1.AnnotateFileResponse(); - if (object.inputConfig != null) { - if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateFileResponse.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.vision.v1p2beta1.InputConfig.fromObject(object.inputConfig); - } - if (object.responses) { - if (!Array.isArray(object.responses)) - throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateFileResponse.responses: array expected"); - message.responses = []; - for (var i = 0; i < object.responses.length; ++i) { - if (typeof object.responses[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateFileResponse.responses: object expected"); - message.responses[i] = $root.google.cloud.vision.v1p2beta1.AnnotateImageResponse.fromObject(object.responses[i]); - } + var message = new $root.google.cloud.vision.v1p2beta1.CropHintsParams(); + if (object.aspectRatios) { + if (!Array.isArray(object.aspectRatios)) + throw TypeError(".google.cloud.vision.v1p2beta1.CropHintsParams.aspectRatios: array expected"); + message.aspectRatios = []; + for (var i = 0; i < object.aspectRatios.length; ++i) + message.aspectRatios[i] = Number(object.aspectRatios[i]); } return message; }; /** - * Creates a plain object from an AnnotateFileResponse message. Also converts values to other types if specified. + * Creates a plain object from a CropHintsParams message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse + * @memberof google.cloud.vision.v1p2beta1.CropHintsParams * @static - * @param {google.cloud.vision.v1p2beta1.AnnotateFileResponse} message AnnotateFileResponse + * @param {google.cloud.vision.v1p2beta1.CropHintsParams} message CropHintsParams * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AnnotateFileResponse.toObject = function toObject(message, options) { + CropHintsParams.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.responses = []; - if (options.defaults) - object.inputConfig = null; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - object.inputConfig = $root.google.cloud.vision.v1p2beta1.InputConfig.toObject(message.inputConfig, options); - if (message.responses && message.responses.length) { - object.responses = []; - for (var j = 0; j < message.responses.length; ++j) - object.responses[j] = $root.google.cloud.vision.v1p2beta1.AnnotateImageResponse.toObject(message.responses[j], options); + object.aspectRatios = []; + if (message.aspectRatios && message.aspectRatios.length) { + object.aspectRatios = []; + for (var j = 0; j < message.aspectRatios.length; ++j) + object.aspectRatios[j] = options.json && !isFinite(message.aspectRatios[j]) ? String(message.aspectRatios[j]) : message.aspectRatios[j]; } return object; }; /** - * Converts this AnnotateFileResponse to JSON. + * Converts this CropHintsParams to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse + * @memberof google.cloud.vision.v1p2beta1.CropHintsParams * @instance * @returns {Object.} JSON object */ - AnnotateFileResponse.prototype.toJSON = function toJSON() { + CropHintsParams.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AnnotateFileResponse; + return CropHintsParams; })(); - v1p2beta1.BatchAnnotateImagesRequest = (function() { + v1p2beta1.WebDetectionParams = (function() { /** - * Properties of a BatchAnnotateImagesRequest. + * Properties of a WebDetectionParams. * @memberof google.cloud.vision.v1p2beta1 - * @interface IBatchAnnotateImagesRequest - * @property {Array.|null} [requests] BatchAnnotateImagesRequest requests + * @interface IWebDetectionParams + * @property {boolean|null} [includeGeoResults] WebDetectionParams includeGeoResults */ /** - * Constructs a new BatchAnnotateImagesRequest. + * Constructs a new WebDetectionParams. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a BatchAnnotateImagesRequest. - * @implements IBatchAnnotateImagesRequest + * @classdesc Represents a WebDetectionParams. + * @implements IWebDetectionParams * @constructor - * @param {google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.IWebDetectionParams=} [properties] Properties to set */ - function BatchAnnotateImagesRequest(properties) { - this.requests = []; + function WebDetectionParams(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -42788,78 +41936,75 @@ } /** - * BatchAnnotateImagesRequest requests. - * @member {Array.} requests - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest + * WebDetectionParams includeGeoResults. + * @member {boolean} includeGeoResults + * @memberof google.cloud.vision.v1p2beta1.WebDetectionParams * @instance */ - BatchAnnotateImagesRequest.prototype.requests = $util.emptyArray; + WebDetectionParams.prototype.includeGeoResults = false; /** - * Creates a new BatchAnnotateImagesRequest instance using the specified properties. + * Creates a new WebDetectionParams instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p2beta1.WebDetectionParams * @static - * @param {google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest instance + * @param {google.cloud.vision.v1p2beta1.IWebDetectionParams=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.WebDetectionParams} WebDetectionParams instance */ - BatchAnnotateImagesRequest.create = function create(properties) { - return new BatchAnnotateImagesRequest(properties); + WebDetectionParams.create = function create(properties) { + return new WebDetectionParams(properties); }; /** - * Encodes the specified BatchAnnotateImagesRequest message. Does not implicitly {@link google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest.verify|verify} messages. + * Encodes the specified WebDetectionParams message. Does not implicitly {@link google.cloud.vision.v1p2beta1.WebDetectionParams.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p2beta1.WebDetectionParams * @static - * @param {google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest} message BatchAnnotateImagesRequest message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IWebDetectionParams} message WebDetectionParams message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchAnnotateImagesRequest.encode = function encode(message, writer) { + WebDetectionParams.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.requests != null && message.requests.length) - for (var i = 0; i < message.requests.length; ++i) - $root.google.cloud.vision.v1p2beta1.AnnotateImageRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.includeGeoResults != null && message.hasOwnProperty("includeGeoResults")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.includeGeoResults); return writer; }; /** - * Encodes the specified BatchAnnotateImagesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest.verify|verify} messages. + * Encodes the specified WebDetectionParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.WebDetectionParams.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p2beta1.WebDetectionParams * @static - * @param {google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest} message BatchAnnotateImagesRequest message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IWebDetectionParams} message WebDetectionParams message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchAnnotateImagesRequest.encodeDelimited = function encodeDelimited(message, writer) { + WebDetectionParams.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer. + * Decodes a WebDetectionParams message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p2beta1.WebDetectionParams * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest + * @returns {google.cloud.vision.v1p2beta1.WebDetectionParams} WebDetectionParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchAnnotateImagesRequest.decode = function decode(reader, length) { + WebDetectionParams.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.vision.v1p2beta1.BatchAnnotateImagesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.WebDetectionParams(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.requests && message.requests.length)) - message.requests = []; - message.requests.push($root.google.cloud.vision.v1p2beta1.AnnotateImageRequest.decode(reader, reader.uint32())); + case 2: + message.includeGeoResults = reader.bool(); break; default: reader.skipType(tag & 7); @@ -42870,125 +42015,111 @@ }; /** - * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. + * Decodes a WebDetectionParams message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p2beta1.WebDetectionParams * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest + * @returns {google.cloud.vision.v1p2beta1.WebDetectionParams} WebDetectionParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchAnnotateImagesRequest.decodeDelimited = function decodeDelimited(reader) { + WebDetectionParams.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BatchAnnotateImagesRequest message. + * Verifies a WebDetectionParams message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p2beta1.WebDetectionParams * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BatchAnnotateImagesRequest.verify = function verify(message) { + WebDetectionParams.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.requests != null && message.hasOwnProperty("requests")) { - if (!Array.isArray(message.requests)) - return "requests: array expected"; - for (var i = 0; i < message.requests.length; ++i) { - var error = $root.google.cloud.vision.v1p2beta1.AnnotateImageRequest.verify(message.requests[i]); - if (error) - return "requests." + error; - } - } + if (message.includeGeoResults != null && message.hasOwnProperty("includeGeoResults")) + if (typeof message.includeGeoResults !== "boolean") + return "includeGeoResults: boolean expected"; return null; }; /** - * Creates a BatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. + * Creates a WebDetectionParams message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p2beta1.WebDetectionParams * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest + * @returns {google.cloud.vision.v1p2beta1.WebDetectionParams} WebDetectionParams */ - BatchAnnotateImagesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest) + WebDetectionParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.WebDetectionParams) return object; - var message = new $root.google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest(); - if (object.requests) { - if (!Array.isArray(object.requests)) - throw TypeError(".google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest.requests: array expected"); - message.requests = []; - for (var i = 0; i < object.requests.length; ++i) { - if (typeof object.requests[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest.requests: object expected"); - message.requests[i] = $root.google.cloud.vision.v1p2beta1.AnnotateImageRequest.fromObject(object.requests[i]); - } - } + var message = new $root.google.cloud.vision.v1p2beta1.WebDetectionParams(); + if (object.includeGeoResults != null) + message.includeGeoResults = Boolean(object.includeGeoResults); return message; }; /** - * Creates a plain object from a BatchAnnotateImagesRequest message. Also converts values to other types if specified. + * Creates a plain object from a WebDetectionParams message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p2beta1.WebDetectionParams * @static - * @param {google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest} message BatchAnnotateImagesRequest + * @param {google.cloud.vision.v1p2beta1.WebDetectionParams} message WebDetectionParams * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BatchAnnotateImagesRequest.toObject = function toObject(message, options) { + WebDetectionParams.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.requests = []; - if (message.requests && message.requests.length) { - object.requests = []; - for (var j = 0; j < message.requests.length; ++j) - object.requests[j] = $root.google.cloud.vision.v1p2beta1.AnnotateImageRequest.toObject(message.requests[j], options); - } + if (options.defaults) + object.includeGeoResults = false; + if (message.includeGeoResults != null && message.hasOwnProperty("includeGeoResults")) + object.includeGeoResults = message.includeGeoResults; return object; }; /** - * Converts this BatchAnnotateImagesRequest to JSON. + * Converts this WebDetectionParams to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p2beta1.WebDetectionParams * @instance * @returns {Object.} JSON object */ - BatchAnnotateImagesRequest.prototype.toJSON = function toJSON() { + WebDetectionParams.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BatchAnnotateImagesRequest; + return WebDetectionParams; })(); - v1p2beta1.BatchAnnotateImagesResponse = (function() { + v1p2beta1.ImageContext = (function() { /** - * Properties of a BatchAnnotateImagesResponse. + * Properties of an ImageContext. * @memberof google.cloud.vision.v1p2beta1 - * @interface IBatchAnnotateImagesResponse - * @property {Array.|null} [responses] BatchAnnotateImagesResponse responses + * @interface IImageContext + * @property {google.cloud.vision.v1p2beta1.ILatLongRect|null} [latLongRect] ImageContext latLongRect + * @property {Array.|null} [languageHints] ImageContext languageHints + * @property {google.cloud.vision.v1p2beta1.ICropHintsParams|null} [cropHintsParams] ImageContext cropHintsParams + * @property {google.cloud.vision.v1p2beta1.IWebDetectionParams|null} [webDetectionParams] ImageContext webDetectionParams */ /** - * Constructs a new BatchAnnotateImagesResponse. + * Constructs a new ImageContext. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a BatchAnnotateImagesResponse. - * @implements IBatchAnnotateImagesResponse + * @classdesc Represents an ImageContext. + * @implements IImageContext * @constructor - * @param {google.cloud.vision.v1p2beta1.IBatchAnnotateImagesResponse=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.IImageContext=} [properties] Properties to set */ - function BatchAnnotateImagesResponse(properties) { - this.responses = []; + function ImageContext(properties) { + this.languageHints = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -42996,78 +42127,117 @@ } /** - * BatchAnnotateImagesResponse responses. - * @member {Array.} responses - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse + * ImageContext latLongRect. + * @member {google.cloud.vision.v1p2beta1.ILatLongRect|null|undefined} latLongRect + * @memberof google.cloud.vision.v1p2beta1.ImageContext * @instance */ - BatchAnnotateImagesResponse.prototype.responses = $util.emptyArray; + ImageContext.prototype.latLongRect = null; /** - * Creates a new BatchAnnotateImagesResponse instance using the specified properties. + * ImageContext languageHints. + * @member {Array.} languageHints + * @memberof google.cloud.vision.v1p2beta1.ImageContext + * @instance + */ + ImageContext.prototype.languageHints = $util.emptyArray; + + /** + * ImageContext cropHintsParams. + * @member {google.cloud.vision.v1p2beta1.ICropHintsParams|null|undefined} cropHintsParams + * @memberof google.cloud.vision.v1p2beta1.ImageContext + * @instance + */ + ImageContext.prototype.cropHintsParams = null; + + /** + * ImageContext webDetectionParams. + * @member {google.cloud.vision.v1p2beta1.IWebDetectionParams|null|undefined} webDetectionParams + * @memberof google.cloud.vision.v1p2beta1.ImageContext + * @instance + */ + ImageContext.prototype.webDetectionParams = null; + + /** + * Creates a new ImageContext instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p2beta1.ImageContext * @static - * @param {google.cloud.vision.v1p2beta1.IBatchAnnotateImagesResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse instance + * @param {google.cloud.vision.v1p2beta1.IImageContext=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.ImageContext} ImageContext instance */ - BatchAnnotateImagesResponse.create = function create(properties) { - return new BatchAnnotateImagesResponse(properties); + ImageContext.create = function create(properties) { + return new ImageContext(properties); }; /** - * Encodes the specified BatchAnnotateImagesResponse message. Does not implicitly {@link google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse.verify|verify} messages. + * Encodes the specified ImageContext message. Does not implicitly {@link google.cloud.vision.v1p2beta1.ImageContext.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p2beta1.ImageContext * @static - * @param {google.cloud.vision.v1p2beta1.IBatchAnnotateImagesResponse} message BatchAnnotateImagesResponse message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IImageContext} message ImageContext message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchAnnotateImagesResponse.encode = function encode(message, writer) { + ImageContext.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.responses != null && message.responses.length) - for (var i = 0; i < message.responses.length; ++i) - $root.google.cloud.vision.v1p2beta1.AnnotateImageResponse.encode(message.responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.latLongRect != null && message.hasOwnProperty("latLongRect")) + $root.google.cloud.vision.v1p2beta1.LatLongRect.encode(message.latLongRect, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.languageHints != null && message.languageHints.length) + for (var i = 0; i < message.languageHints.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageHints[i]); + if (message.cropHintsParams != null && message.hasOwnProperty("cropHintsParams")) + $root.google.cloud.vision.v1p2beta1.CropHintsParams.encode(message.cropHintsParams, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.webDetectionParams != null && message.hasOwnProperty("webDetectionParams")) + $root.google.cloud.vision.v1p2beta1.WebDetectionParams.encode(message.webDetectionParams, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); return writer; }; /** - * Encodes the specified BatchAnnotateImagesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse.verify|verify} messages. + * Encodes the specified ImageContext message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.ImageContext.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p2beta1.ImageContext * @static - * @param {google.cloud.vision.v1p2beta1.IBatchAnnotateImagesResponse} message BatchAnnotateImagesResponse message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IImageContext} message ImageContext message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchAnnotateImagesResponse.encodeDelimited = function encodeDelimited(message, writer) { + ImageContext.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BatchAnnotateImagesResponse message from the specified reader or buffer. + * Decodes an ImageContext message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p2beta1.ImageContext * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse + * @returns {google.cloud.vision.v1p2beta1.ImageContext} ImageContext * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchAnnotateImagesResponse.decode = function decode(reader, length) { + ImageContext.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.vision.v1p2beta1.BatchAnnotateImagesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.ImageContext(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.responses && message.responses.length)) - message.responses = []; - message.responses.push($root.google.cloud.vision.v1p2beta1.AnnotateImageResponse.decode(reader, reader.uint32())); + message.latLongRect = $root.google.cloud.vision.v1p2beta1.LatLongRect.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.languageHints && message.languageHints.length)) + message.languageHints = []; + message.languageHints.push(reader.string()); + break; + case 4: + message.cropHintsParams = $root.google.cloud.vision.v1p2beta1.CropHintsParams.decode(reader, reader.uint32()); + break; + case 6: + message.webDetectionParams = $root.google.cloud.vision.v1p2beta1.WebDetectionParams.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -43078,127 +42248,162 @@ }; /** - * Decodes a BatchAnnotateImagesResponse message from the specified reader or buffer, length delimited. + * Decodes an ImageContext message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p2beta1.ImageContext * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse + * @returns {google.cloud.vision.v1p2beta1.ImageContext} ImageContext * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchAnnotateImagesResponse.decodeDelimited = function decodeDelimited(reader) { + ImageContext.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BatchAnnotateImagesResponse message. + * Verifies an ImageContext message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p2beta1.ImageContext * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BatchAnnotateImagesResponse.verify = function verify(message) { + ImageContext.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.responses != null && message.hasOwnProperty("responses")) { - if (!Array.isArray(message.responses)) - return "responses: array expected"; - for (var i = 0; i < message.responses.length; ++i) { - var error = $root.google.cloud.vision.v1p2beta1.AnnotateImageResponse.verify(message.responses[i]); - if (error) - return "responses." + error; - } + if (message.latLongRect != null && message.hasOwnProperty("latLongRect")) { + var error = $root.google.cloud.vision.v1p2beta1.LatLongRect.verify(message.latLongRect); + if (error) + return "latLongRect." + error; + } + if (message.languageHints != null && message.hasOwnProperty("languageHints")) { + if (!Array.isArray(message.languageHints)) + return "languageHints: array expected"; + for (var i = 0; i < message.languageHints.length; ++i) + if (!$util.isString(message.languageHints[i])) + return "languageHints: string[] expected"; + } + if (message.cropHintsParams != null && message.hasOwnProperty("cropHintsParams")) { + var error = $root.google.cloud.vision.v1p2beta1.CropHintsParams.verify(message.cropHintsParams); + if (error) + return "cropHintsParams." + error; + } + if (message.webDetectionParams != null && message.hasOwnProperty("webDetectionParams")) { + var error = $root.google.cloud.vision.v1p2beta1.WebDetectionParams.verify(message.webDetectionParams); + if (error) + return "webDetectionParams." + error; } return null; }; /** - * Creates a BatchAnnotateImagesResponse message from a plain object. Also converts values to their respective internal types. + * Creates an ImageContext message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p2beta1.ImageContext * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse + * @returns {google.cloud.vision.v1p2beta1.ImageContext} ImageContext */ - BatchAnnotateImagesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse) + ImageContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.ImageContext) return object; - var message = new $root.google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse(); - if (object.responses) { - if (!Array.isArray(object.responses)) - throw TypeError(".google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse.responses: array expected"); - message.responses = []; - for (var i = 0; i < object.responses.length; ++i) { - if (typeof object.responses[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse.responses: object expected"); - message.responses[i] = $root.google.cloud.vision.v1p2beta1.AnnotateImageResponse.fromObject(object.responses[i]); - } + var message = new $root.google.cloud.vision.v1p2beta1.ImageContext(); + if (object.latLongRect != null) { + if (typeof object.latLongRect !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.ImageContext.latLongRect: object expected"); + message.latLongRect = $root.google.cloud.vision.v1p2beta1.LatLongRect.fromObject(object.latLongRect); } - return message; - }; - - /** - * Creates a plain object from a BatchAnnotateImagesResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse - * @static - * @param {google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse} message BatchAnnotateImagesResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options + if (object.languageHints) { + if (!Array.isArray(object.languageHints)) + throw TypeError(".google.cloud.vision.v1p2beta1.ImageContext.languageHints: array expected"); + message.languageHints = []; + for (var i = 0; i < object.languageHints.length; ++i) + message.languageHints[i] = String(object.languageHints[i]); + } + if (object.cropHintsParams != null) { + if (typeof object.cropHintsParams !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.ImageContext.cropHintsParams: object expected"); + message.cropHintsParams = $root.google.cloud.vision.v1p2beta1.CropHintsParams.fromObject(object.cropHintsParams); + } + if (object.webDetectionParams != null) { + if (typeof object.webDetectionParams !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.ImageContext.webDetectionParams: object expected"); + message.webDetectionParams = $root.google.cloud.vision.v1p2beta1.WebDetectionParams.fromObject(object.webDetectionParams); + } + return message; + }; + + /** + * Creates a plain object from an ImageContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.vision.v1p2beta1.ImageContext + * @static + * @param {google.cloud.vision.v1p2beta1.ImageContext} message ImageContext + * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BatchAnnotateImagesResponse.toObject = function toObject(message, options) { + ImageContext.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.responses = []; - if (message.responses && message.responses.length) { - object.responses = []; - for (var j = 0; j < message.responses.length; ++j) - object.responses[j] = $root.google.cloud.vision.v1p2beta1.AnnotateImageResponse.toObject(message.responses[j], options); + object.languageHints = []; + if (options.defaults) { + object.latLongRect = null; + object.cropHintsParams = null; + object.webDetectionParams = null; + } + if (message.latLongRect != null && message.hasOwnProperty("latLongRect")) + object.latLongRect = $root.google.cloud.vision.v1p2beta1.LatLongRect.toObject(message.latLongRect, options); + if (message.languageHints && message.languageHints.length) { + object.languageHints = []; + for (var j = 0; j < message.languageHints.length; ++j) + object.languageHints[j] = message.languageHints[j]; } + if (message.cropHintsParams != null && message.hasOwnProperty("cropHintsParams")) + object.cropHintsParams = $root.google.cloud.vision.v1p2beta1.CropHintsParams.toObject(message.cropHintsParams, options); + if (message.webDetectionParams != null && message.hasOwnProperty("webDetectionParams")) + object.webDetectionParams = $root.google.cloud.vision.v1p2beta1.WebDetectionParams.toObject(message.webDetectionParams, options); return object; }; /** - * Converts this BatchAnnotateImagesResponse to JSON. + * Converts this ImageContext to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p2beta1.ImageContext * @instance * @returns {Object.} JSON object */ - BatchAnnotateImagesResponse.prototype.toJSON = function toJSON() { + ImageContext.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BatchAnnotateImagesResponse; + return ImageContext; })(); - v1p2beta1.AsyncAnnotateFileRequest = (function() { + v1p2beta1.AnnotateImageRequest = (function() { /** - * Properties of an AsyncAnnotateFileRequest. + * Properties of an AnnotateImageRequest. * @memberof google.cloud.vision.v1p2beta1 - * @interface IAsyncAnnotateFileRequest - * @property {google.cloud.vision.v1p2beta1.IInputConfig|null} [inputConfig] AsyncAnnotateFileRequest inputConfig - * @property {Array.|null} [features] AsyncAnnotateFileRequest features - * @property {google.cloud.vision.v1p2beta1.IImageContext|null} [imageContext] AsyncAnnotateFileRequest imageContext - * @property {google.cloud.vision.v1p2beta1.IOutputConfig|null} [outputConfig] AsyncAnnotateFileRequest outputConfig + * @interface IAnnotateImageRequest + * @property {google.cloud.vision.v1p2beta1.IImage|null} [image] AnnotateImageRequest image + * @property {Array.|null} [features] AnnotateImageRequest features + * @property {google.cloud.vision.v1p2beta1.IImageContext|null} [imageContext] AnnotateImageRequest imageContext */ /** - * Constructs a new AsyncAnnotateFileRequest. + * Constructs a new AnnotateImageRequest. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an AsyncAnnotateFileRequest. - * @implements IAsyncAnnotateFileRequest + * @classdesc Represents an AnnotateImageRequest. + * @implements IAnnotateImageRequest * @constructor - * @param {google.cloud.vision.v1p2beta1.IAsyncAnnotateFileRequest=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.IAnnotateImageRequest=} [properties] Properties to set */ - function AsyncAnnotateFileRequest(properties) { + function AnnotateImageRequest(properties) { this.features = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) @@ -43207,106 +42412,96 @@ } /** - * AsyncAnnotateFileRequest inputConfig. - * @member {google.cloud.vision.v1p2beta1.IInputConfig|null|undefined} inputConfig - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest + * AnnotateImageRequest image. + * @member {google.cloud.vision.v1p2beta1.IImage|null|undefined} image + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest * @instance */ - AsyncAnnotateFileRequest.prototype.inputConfig = null; + AnnotateImageRequest.prototype.image = null; /** - * AsyncAnnotateFileRequest features. + * AnnotateImageRequest features. * @member {Array.} features - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest * @instance */ - AsyncAnnotateFileRequest.prototype.features = $util.emptyArray; + AnnotateImageRequest.prototype.features = $util.emptyArray; /** - * AsyncAnnotateFileRequest imageContext. + * AnnotateImageRequest imageContext. * @member {google.cloud.vision.v1p2beta1.IImageContext|null|undefined} imageContext - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest - * @instance - */ - AsyncAnnotateFileRequest.prototype.imageContext = null; - - /** - * AsyncAnnotateFileRequest outputConfig. - * @member {google.cloud.vision.v1p2beta1.IOutputConfig|null|undefined} outputConfig - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest * @instance */ - AsyncAnnotateFileRequest.prototype.outputConfig = null; + AnnotateImageRequest.prototype.imageContext = null; /** - * Creates a new AsyncAnnotateFileRequest instance using the specified properties. + * Creates a new AnnotateImageRequest instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest * @static - * @param {google.cloud.vision.v1p2beta1.IAsyncAnnotateFileRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest instance + * @param {google.cloud.vision.v1p2beta1.IAnnotateImageRequest=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.AnnotateImageRequest} AnnotateImageRequest instance */ - AsyncAnnotateFileRequest.create = function create(properties) { - return new AsyncAnnotateFileRequest(properties); + AnnotateImageRequest.create = function create(properties) { + return new AnnotateImageRequest(properties); }; /** - * Encodes the specified AsyncAnnotateFileRequest message. Does not implicitly {@link google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest.verify|verify} messages. + * Encodes the specified AnnotateImageRequest message. Does not implicitly {@link google.cloud.vision.v1p2beta1.AnnotateImageRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest * @static - * @param {google.cloud.vision.v1p2beta1.IAsyncAnnotateFileRequest} message AsyncAnnotateFileRequest message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IAnnotateImageRequest} message AnnotateImageRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncAnnotateFileRequest.encode = function encode(message, writer) { + AnnotateImageRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - $root.google.cloud.vision.v1p2beta1.InputConfig.encode(message.inputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.image != null && message.hasOwnProperty("image")) + $root.google.cloud.vision.v1p2beta1.Image.encode(message.image, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.features != null && message.features.length) for (var i = 0; i < message.features.length; ++i) $root.google.cloud.vision.v1p2beta1.Feature.encode(message.features[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.imageContext != null && message.hasOwnProperty("imageContext")) $root.google.cloud.vision.v1p2beta1.ImageContext.encode(message.imageContext, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) - $root.google.cloud.vision.v1p2beta1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); return writer; }; /** - * Encodes the specified AsyncAnnotateFileRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest.verify|verify} messages. + * Encodes the specified AnnotateImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.AnnotateImageRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest * @static - * @param {google.cloud.vision.v1p2beta1.IAsyncAnnotateFileRequest} message AsyncAnnotateFileRequest message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IAnnotateImageRequest} message AnnotateImageRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncAnnotateFileRequest.encodeDelimited = function encodeDelimited(message, writer) { + AnnotateImageRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer. + * Decodes an AnnotateImageRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest + * @returns {google.cloud.vision.v1p2beta1.AnnotateImageRequest} AnnotateImageRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncAnnotateFileRequest.decode = function decode(reader, length) { + AnnotateImageRequest.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.vision.v1p2beta1.AsyncAnnotateFileRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.AnnotateImageRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.inputConfig = $root.google.cloud.vision.v1p2beta1.InputConfig.decode(reader, reader.uint32()); + message.image = $root.google.cloud.vision.v1p2beta1.Image.decode(reader, reader.uint32()); break; case 2: if (!(message.features && message.features.length)) @@ -43316,9 +42511,6 @@ case 3: message.imageContext = $root.google.cloud.vision.v1p2beta1.ImageContext.decode(reader, reader.uint32()); break; - case 4: - message.outputConfig = $root.google.cloud.vision.v1p2beta1.OutputConfig.decode(reader, reader.uint32()); - break; default: reader.skipType(tag & 7); break; @@ -43328,36 +42520,36 @@ }; /** - * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer, length delimited. + * Decodes an AnnotateImageRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest + * @returns {google.cloud.vision.v1p2beta1.AnnotateImageRequest} AnnotateImageRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncAnnotateFileRequest.decodeDelimited = function decodeDelimited(reader) { + AnnotateImageRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AsyncAnnotateFileRequest message. + * Verifies an AnnotateImageRequest message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AsyncAnnotateFileRequest.verify = function verify(message) { + AnnotateImageRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.vision.v1p2beta1.InputConfig.verify(message.inputConfig); + if (message.image != null && message.hasOwnProperty("image")) { + var error = $root.google.cloud.vision.v1p2beta1.Image.verify(message.image); if (error) - return "inputConfig." + error; + return "image." + error; } if (message.features != null && message.hasOwnProperty("features")) { if (!Array.isArray(message.features)) @@ -43373,76 +42565,65 @@ if (error) return "imageContext." + error; } - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { - var error = $root.google.cloud.vision.v1p2beta1.OutputConfig.verify(message.outputConfig); - if (error) - return "outputConfig." + error; - } return null; }; /** - * Creates an AsyncAnnotateFileRequest message from a plain object. Also converts values to their respective internal types. + * Creates an AnnotateImageRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest + * @returns {google.cloud.vision.v1p2beta1.AnnotateImageRequest} AnnotateImageRequest */ - AsyncAnnotateFileRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest) + AnnotateImageRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.AnnotateImageRequest) return object; - var message = new $root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest(); - if (object.inputConfig != null) { - if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.vision.v1p2beta1.InputConfig.fromObject(object.inputConfig); + var message = new $root.google.cloud.vision.v1p2beta1.AnnotateImageRequest(); + if (object.image != null) { + if (typeof object.image !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageRequest.image: object expected"); + message.image = $root.google.cloud.vision.v1p2beta1.Image.fromObject(object.image); } if (object.features) { if (!Array.isArray(object.features)) - throw TypeError(".google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest.features: array expected"); + throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageRequest.features: array expected"); message.features = []; for (var i = 0; i < object.features.length; ++i) { if (typeof object.features[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest.features: object expected"); + throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageRequest.features: object expected"); message.features[i] = $root.google.cloud.vision.v1p2beta1.Feature.fromObject(object.features[i]); } } if (object.imageContext != null) { if (typeof object.imageContext !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest.imageContext: object expected"); + throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageRequest.imageContext: object expected"); message.imageContext = $root.google.cloud.vision.v1p2beta1.ImageContext.fromObject(object.imageContext); } - if (object.outputConfig != null) { - if (typeof object.outputConfig !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest.outputConfig: object expected"); - message.outputConfig = $root.google.cloud.vision.v1p2beta1.OutputConfig.fromObject(object.outputConfig); - } return message; }; /** - * Creates a plain object from an AsyncAnnotateFileRequest message. Also converts values to other types if specified. + * Creates a plain object from an AnnotateImageRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest * @static - * @param {google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest} message AsyncAnnotateFileRequest + * @param {google.cloud.vision.v1p2beta1.AnnotateImageRequest} message AnnotateImageRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AsyncAnnotateFileRequest.toObject = function toObject(message, options) { + AnnotateImageRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) object.features = []; if (options.defaults) { - object.inputConfig = null; + object.image = null; object.imageContext = null; - object.outputConfig = null; } - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - object.inputConfig = $root.google.cloud.vision.v1p2beta1.InputConfig.toObject(message.inputConfig, options); + if (message.image != null && message.hasOwnProperty("image")) + object.image = $root.google.cloud.vision.v1p2beta1.Image.toObject(message.image, options); if (message.features && message.features.length) { object.features = []; for (var j = 0; j < message.features.length; ++j) @@ -43450,43 +42631,42 @@ } if (message.imageContext != null && message.hasOwnProperty("imageContext")) object.imageContext = $root.google.cloud.vision.v1p2beta1.ImageContext.toObject(message.imageContext, options); - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) - object.outputConfig = $root.google.cloud.vision.v1p2beta1.OutputConfig.toObject(message.outputConfig, options); return object; }; /** - * Converts this AsyncAnnotateFileRequest to JSON. + * Converts this AnnotateImageRequest to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageRequest * @instance * @returns {Object.} JSON object */ - AsyncAnnotateFileRequest.prototype.toJSON = function toJSON() { + AnnotateImageRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AsyncAnnotateFileRequest; + return AnnotateImageRequest; })(); - v1p2beta1.AsyncAnnotateFileResponse = (function() { + v1p2beta1.ImageAnnotationContext = (function() { /** - * Properties of an AsyncAnnotateFileResponse. + * Properties of an ImageAnnotationContext. * @memberof google.cloud.vision.v1p2beta1 - * @interface IAsyncAnnotateFileResponse - * @property {google.cloud.vision.v1p2beta1.IOutputConfig|null} [outputConfig] AsyncAnnotateFileResponse outputConfig + * @interface IImageAnnotationContext + * @property {string|null} [uri] ImageAnnotationContext uri + * @property {number|null} [pageNumber] ImageAnnotationContext pageNumber */ /** - * Constructs a new AsyncAnnotateFileResponse. + * Constructs a new ImageAnnotationContext. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an AsyncAnnotateFileResponse. - * @implements IAsyncAnnotateFileResponse + * @classdesc Represents an ImageAnnotationContext. + * @implements IImageAnnotationContext * @constructor - * @param {google.cloud.vision.v1p2beta1.IAsyncAnnotateFileResponse=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.IImageAnnotationContext=} [properties] Properties to set */ - function AsyncAnnotateFileResponse(properties) { + function ImageAnnotationContext(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -43494,75 +42674,88 @@ } /** - * AsyncAnnotateFileResponse outputConfig. - * @member {google.cloud.vision.v1p2beta1.IOutputConfig|null|undefined} outputConfig - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse + * ImageAnnotationContext uri. + * @member {string} uri + * @memberof google.cloud.vision.v1p2beta1.ImageAnnotationContext * @instance */ - AsyncAnnotateFileResponse.prototype.outputConfig = null; + ImageAnnotationContext.prototype.uri = ""; /** - * Creates a new AsyncAnnotateFileResponse instance using the specified properties. + * ImageAnnotationContext pageNumber. + * @member {number} pageNumber + * @memberof google.cloud.vision.v1p2beta1.ImageAnnotationContext + * @instance + */ + ImageAnnotationContext.prototype.pageNumber = 0; + + /** + * Creates a new ImageAnnotationContext instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1p2beta1.ImageAnnotationContext * @static - * @param {google.cloud.vision.v1p2beta1.IAsyncAnnotateFileResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse instance + * @param {google.cloud.vision.v1p2beta1.IImageAnnotationContext=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.ImageAnnotationContext} ImageAnnotationContext instance */ - AsyncAnnotateFileResponse.create = function create(properties) { - return new AsyncAnnotateFileResponse(properties); + ImageAnnotationContext.create = function create(properties) { + return new ImageAnnotationContext(properties); }; /** - * Encodes the specified AsyncAnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse.verify|verify} messages. + * Encodes the specified ImageAnnotationContext message. Does not implicitly {@link google.cloud.vision.v1p2beta1.ImageAnnotationContext.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1p2beta1.ImageAnnotationContext * @static - * @param {google.cloud.vision.v1p2beta1.IAsyncAnnotateFileResponse} message AsyncAnnotateFileResponse message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IImageAnnotationContext} message ImageAnnotationContext message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncAnnotateFileResponse.encode = function encode(message, writer) { + ImageAnnotationContext.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) - $root.google.cloud.vision.v1p2beta1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.uri != null && message.hasOwnProperty("uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageNumber); return writer; }; /** - * Encodes the specified AsyncAnnotateFileResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse.verify|verify} messages. + * Encodes the specified ImageAnnotationContext message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.ImageAnnotationContext.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1p2beta1.ImageAnnotationContext * @static - * @param {google.cloud.vision.v1p2beta1.IAsyncAnnotateFileResponse} message AsyncAnnotateFileResponse message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IImageAnnotationContext} message ImageAnnotationContext message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncAnnotateFileResponse.encodeDelimited = function encodeDelimited(message, writer) { + ImageAnnotationContext.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer. + * Decodes an ImageAnnotationContext message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1p2beta1.ImageAnnotationContext * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse + * @returns {google.cloud.vision.v1p2beta1.ImageAnnotationContext} ImageAnnotationContext * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncAnnotateFileResponse.decode = function decode(reader, length) { + ImageAnnotationContext.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.vision.v1p2beta1.AsyncAnnotateFileResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.ImageAnnotationContext(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.outputConfig = $root.google.cloud.vision.v1p2beta1.OutputConfig.decode(reader, reader.uint32()); + message.uri = reader.string(); + break; + case 2: + message.pageNumber = reader.int32(); break; default: reader.skipType(tag & 7); @@ -43573,113 +42766,132 @@ }; /** - * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer, length delimited. + * Decodes an ImageAnnotationContext message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1p2beta1.ImageAnnotationContext * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse + * @returns {google.cloud.vision.v1p2beta1.ImageAnnotationContext} ImageAnnotationContext * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncAnnotateFileResponse.decodeDelimited = function decodeDelimited(reader) { + ImageAnnotationContext.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AsyncAnnotateFileResponse message. + * Verifies an ImageAnnotationContext message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1p2beta1.ImageAnnotationContext * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AsyncAnnotateFileResponse.verify = function verify(message) { + ImageAnnotationContext.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { - var error = $root.google.cloud.vision.v1p2beta1.OutputConfig.verify(message.outputConfig); - if (error) - return "outputConfig." + error; - } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + if (!$util.isInteger(message.pageNumber)) + return "pageNumber: integer expected"; return null; }; /** - * Creates an AsyncAnnotateFileResponse message from a plain object. Also converts values to their respective internal types. + * Creates an ImageAnnotationContext message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1p2beta1.ImageAnnotationContext * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse + * @returns {google.cloud.vision.v1p2beta1.ImageAnnotationContext} ImageAnnotationContext */ - AsyncAnnotateFileResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse) + ImageAnnotationContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.ImageAnnotationContext) return object; - var message = new $root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse(); - if (object.outputConfig != null) { - if (typeof object.outputConfig !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse.outputConfig: object expected"); - message.outputConfig = $root.google.cloud.vision.v1p2beta1.OutputConfig.fromObject(object.outputConfig); - } + var message = new $root.google.cloud.vision.v1p2beta1.ImageAnnotationContext(); + if (object.uri != null) + message.uri = String(object.uri); + if (object.pageNumber != null) + message.pageNumber = object.pageNumber | 0; return message; }; /** - * Creates a plain object from an AsyncAnnotateFileResponse message. Also converts values to other types if specified. + * Creates a plain object from an ImageAnnotationContext message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1p2beta1.ImageAnnotationContext * @static - * @param {google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse} message AsyncAnnotateFileResponse + * @param {google.cloud.vision.v1p2beta1.ImageAnnotationContext} message ImageAnnotationContext * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AsyncAnnotateFileResponse.toObject = function toObject(message, options) { + ImageAnnotationContext.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.outputConfig = null; - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) - object.outputConfig = $root.google.cloud.vision.v1p2beta1.OutputConfig.toObject(message.outputConfig, options); + if (options.defaults) { + object.uri = ""; + object.pageNumber = 0; + } + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + object.pageNumber = message.pageNumber; return object; }; /** - * Converts this AsyncAnnotateFileResponse to JSON. + * Converts this ImageAnnotationContext to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1p2beta1.ImageAnnotationContext * @instance * @returns {Object.} JSON object */ - AsyncAnnotateFileResponse.prototype.toJSON = function toJSON() { + ImageAnnotationContext.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AsyncAnnotateFileResponse; + return ImageAnnotationContext; })(); - v1p2beta1.AsyncBatchAnnotateFilesRequest = (function() { + v1p2beta1.AnnotateImageResponse = (function() { /** - * Properties of an AsyncBatchAnnotateFilesRequest. + * Properties of an AnnotateImageResponse. * @memberof google.cloud.vision.v1p2beta1 - * @interface IAsyncBatchAnnotateFilesRequest - * @property {Array.|null} [requests] AsyncBatchAnnotateFilesRequest requests + * @interface IAnnotateImageResponse + * @property {Array.|null} [faceAnnotations] AnnotateImageResponse faceAnnotations + * @property {Array.|null} [landmarkAnnotations] AnnotateImageResponse landmarkAnnotations + * @property {Array.|null} [logoAnnotations] AnnotateImageResponse logoAnnotations + * @property {Array.|null} [labelAnnotations] AnnotateImageResponse labelAnnotations + * @property {Array.|null} [textAnnotations] AnnotateImageResponse textAnnotations + * @property {google.cloud.vision.v1p2beta1.ITextAnnotation|null} [fullTextAnnotation] AnnotateImageResponse fullTextAnnotation + * @property {google.cloud.vision.v1p2beta1.ISafeSearchAnnotation|null} [safeSearchAnnotation] AnnotateImageResponse safeSearchAnnotation + * @property {google.cloud.vision.v1p2beta1.IImageProperties|null} [imagePropertiesAnnotation] AnnotateImageResponse imagePropertiesAnnotation + * @property {google.cloud.vision.v1p2beta1.ICropHintsAnnotation|null} [cropHintsAnnotation] AnnotateImageResponse cropHintsAnnotation + * @property {google.cloud.vision.v1p2beta1.IWebDetection|null} [webDetection] AnnotateImageResponse webDetection + * @property {google.rpc.IStatus|null} [error] AnnotateImageResponse error + * @property {google.cloud.vision.v1p2beta1.IImageAnnotationContext|null} [context] AnnotateImageResponse context */ /** - * Constructs a new AsyncBatchAnnotateFilesRequest. + * Constructs a new AnnotateImageResponse. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an AsyncBatchAnnotateFilesRequest. - * @implements IAsyncBatchAnnotateFilesRequest + * @classdesc Represents an AnnotateImageResponse. + * @implements IAnnotateImageResponse * @constructor - * @param {google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesRequest=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.IAnnotateImageResponse=} [properties] Properties to set */ - function AsyncBatchAnnotateFilesRequest(properties) { - this.requests = []; + function AnnotateImageResponse(properties) { + this.faceAnnotations = []; + this.landmarkAnnotations = []; + this.logoAnnotations = []; + this.labelAnnotations = []; + this.textAnnotations = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -43687,286 +42899,233 @@ } /** - * AsyncBatchAnnotateFilesRequest requests. - * @member {Array.} requests - * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest + * AnnotateImageResponse faceAnnotations. + * @member {Array.} faceAnnotations + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse * @instance */ - AsyncBatchAnnotateFilesRequest.prototype.requests = $util.emptyArray; + AnnotateImageResponse.prototype.faceAnnotations = $util.emptyArray; /** - * Creates a new AsyncBatchAnnotateFilesRequest instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest - * @static - * @param {google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest instance + * AnnotateImageResponse landmarkAnnotations. + * @member {Array.} landmarkAnnotations + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse + * @instance */ - AsyncBatchAnnotateFilesRequest.create = function create(properties) { - return new AsyncBatchAnnotateFilesRequest(properties); - }; + AnnotateImageResponse.prototype.landmarkAnnotations = $util.emptyArray; /** - * Encodes the specified AsyncBatchAnnotateFilesRequest message. Does not implicitly {@link google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest - * @static - * @param {google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesRequest} message AsyncBatchAnnotateFilesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * AnnotateImageResponse logoAnnotations. + * @member {Array.} logoAnnotations + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse + * @instance */ - AsyncBatchAnnotateFilesRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.requests != null && message.requests.length) - for (var i = 0; i < message.requests.length; ++i) - $root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; + AnnotateImageResponse.prototype.logoAnnotations = $util.emptyArray; /** - * Encodes the specified AsyncBatchAnnotateFilesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest - * @static - * @param {google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesRequest} message AsyncBatchAnnotateFilesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * AnnotateImageResponse labelAnnotations. + * @member {Array.} labelAnnotations + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse + * @instance */ - AsyncBatchAnnotateFilesRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + AnnotateImageResponse.prototype.labelAnnotations = $util.emptyArray; /** - * Decodes an AsyncBatchAnnotateFilesRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * AnnotateImageResponse textAnnotations. + * @member {Array.} textAnnotations + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse + * @instance */ - AsyncBatchAnnotateFilesRequest.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.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.requests && message.requests.length)) - message.requests = []; - message.requests.push($root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AsyncBatchAnnotateFilesRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AsyncBatchAnnotateFilesRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + AnnotateImageResponse.prototype.textAnnotations = $util.emptyArray; /** - * Verifies an AsyncBatchAnnotateFilesRequest message. - * @function verify - * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not + * AnnotateImageResponse fullTextAnnotation. + * @member {google.cloud.vision.v1p2beta1.ITextAnnotation|null|undefined} fullTextAnnotation + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse + * @instance */ - AsyncBatchAnnotateFilesRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.requests != null && message.hasOwnProperty("requests")) { - if (!Array.isArray(message.requests)) - return "requests: array expected"; - for (var i = 0; i < message.requests.length; ++i) { - var error = $root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest.verify(message.requests[i]); - if (error) - return "requests." + error; - } - } - return null; - }; + AnnotateImageResponse.prototype.fullTextAnnotation = null; /** - * Creates an AsyncBatchAnnotateFilesRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest + * AnnotateImageResponse safeSearchAnnotation. + * @member {google.cloud.vision.v1p2beta1.ISafeSearchAnnotation|null|undefined} safeSearchAnnotation + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse + * @instance */ - AsyncBatchAnnotateFilesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest) - return object; - var message = new $root.google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest(); - if (object.requests) { - if (!Array.isArray(object.requests)) - throw TypeError(".google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest.requests: array expected"); - message.requests = []; - for (var i = 0; i < object.requests.length; ++i) { - if (typeof object.requests[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest.requests: object expected"); - message.requests[i] = $root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest.fromObject(object.requests[i]); - } - } - return message; - }; + AnnotateImageResponse.prototype.safeSearchAnnotation = null; /** - * Creates a plain object from an AsyncBatchAnnotateFilesRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest - * @static - * @param {google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest} message AsyncBatchAnnotateFilesRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object + * AnnotateImageResponse imagePropertiesAnnotation. + * @member {google.cloud.vision.v1p2beta1.IImageProperties|null|undefined} imagePropertiesAnnotation + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse + * @instance */ - AsyncBatchAnnotateFilesRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.requests = []; - if (message.requests && message.requests.length) { - object.requests = []; - for (var j = 0; j < message.requests.length; ++j) - object.requests[j] = $root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest.toObject(message.requests[j], options); - } - return object; - }; + AnnotateImageResponse.prototype.imagePropertiesAnnotation = null; /** - * Converts this AsyncBatchAnnotateFilesRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest + * AnnotateImageResponse cropHintsAnnotation. + * @member {google.cloud.vision.v1p2beta1.ICropHintsAnnotation|null|undefined} cropHintsAnnotation + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse * @instance - * @returns {Object.} JSON object */ - AsyncBatchAnnotateFilesRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return AsyncBatchAnnotateFilesRequest; - })(); - - v1p2beta1.AsyncBatchAnnotateFilesResponse = (function() { + AnnotateImageResponse.prototype.cropHintsAnnotation = null; /** - * Properties of an AsyncBatchAnnotateFilesResponse. - * @memberof google.cloud.vision.v1p2beta1 - * @interface IAsyncBatchAnnotateFilesResponse - * @property {Array.|null} [responses] AsyncBatchAnnotateFilesResponse responses + * AnnotateImageResponse webDetection. + * @member {google.cloud.vision.v1p2beta1.IWebDetection|null|undefined} webDetection + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse + * @instance */ + AnnotateImageResponse.prototype.webDetection = null; /** - * Constructs a new AsyncBatchAnnotateFilesResponse. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an AsyncBatchAnnotateFilesResponse. - * @implements IAsyncBatchAnnotateFilesResponse - * @constructor - * @param {google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesResponse=} [properties] Properties to set + * AnnotateImageResponse error. + * @member {google.rpc.IStatus|null|undefined} error + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse + * @instance */ - function AsyncBatchAnnotateFilesResponse(properties) { - this.responses = []; - 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]]; - } + AnnotateImageResponse.prototype.error = null; /** - * AsyncBatchAnnotateFilesResponse responses. - * @member {Array.} responses - * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse + * AnnotateImageResponse context. + * @member {google.cloud.vision.v1p2beta1.IImageAnnotationContext|null|undefined} context + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse * @instance */ - AsyncBatchAnnotateFilesResponse.prototype.responses = $util.emptyArray; + AnnotateImageResponse.prototype.context = null; /** - * Creates a new AsyncBatchAnnotateFilesResponse instance using the specified properties. + * Creates a new AnnotateImageResponse instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse * @static - * @param {google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse instance + * @param {google.cloud.vision.v1p2beta1.IAnnotateImageResponse=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.AnnotateImageResponse} AnnotateImageResponse instance */ - AsyncBatchAnnotateFilesResponse.create = function create(properties) { - return new AsyncBatchAnnotateFilesResponse(properties); + AnnotateImageResponse.create = function create(properties) { + return new AnnotateImageResponse(properties); }; /** - * Encodes the specified AsyncBatchAnnotateFilesResponse message. Does not implicitly {@link google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse.verify|verify} messages. + * Encodes the specified AnnotateImageResponse message. Does not implicitly {@link google.cloud.vision.v1p2beta1.AnnotateImageResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse * @static - * @param {google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesResponse} message AsyncBatchAnnotateFilesResponse message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IAnnotateImageResponse} message AnnotateImageResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncBatchAnnotateFilesResponse.encode = function encode(message, writer) { + AnnotateImageResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.responses != null && message.responses.length) - for (var i = 0; i < message.responses.length; ++i) - $root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse.encode(message.responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.faceAnnotations != null && message.faceAnnotations.length) + for (var i = 0; i < message.faceAnnotations.length; ++i) + $root.google.cloud.vision.v1p2beta1.FaceAnnotation.encode(message.faceAnnotations[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.landmarkAnnotations != null && message.landmarkAnnotations.length) + for (var i = 0; i < message.landmarkAnnotations.length; ++i) + $root.google.cloud.vision.v1p2beta1.EntityAnnotation.encode(message.landmarkAnnotations[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.logoAnnotations != null && message.logoAnnotations.length) + for (var i = 0; i < message.logoAnnotations.length; ++i) + $root.google.cloud.vision.v1p2beta1.EntityAnnotation.encode(message.logoAnnotations[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.labelAnnotations != null && message.labelAnnotations.length) + for (var i = 0; i < message.labelAnnotations.length; ++i) + $root.google.cloud.vision.v1p2beta1.EntityAnnotation.encode(message.labelAnnotations[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.textAnnotations != null && message.textAnnotations.length) + for (var i = 0; i < message.textAnnotations.length; ++i) + $root.google.cloud.vision.v1p2beta1.EntityAnnotation.encode(message.textAnnotations[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.safeSearchAnnotation != null && message.hasOwnProperty("safeSearchAnnotation")) + $root.google.cloud.vision.v1p2beta1.SafeSearchAnnotation.encode(message.safeSearchAnnotation, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.imagePropertiesAnnotation != null && message.hasOwnProperty("imagePropertiesAnnotation")) + $root.google.cloud.vision.v1p2beta1.ImageProperties.encode(message.imagePropertiesAnnotation, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.error != null && message.hasOwnProperty("error")) + $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.cropHintsAnnotation != null && message.hasOwnProperty("cropHintsAnnotation")) + $root.google.cloud.vision.v1p2beta1.CropHintsAnnotation.encode(message.cropHintsAnnotation, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.fullTextAnnotation != null && message.hasOwnProperty("fullTextAnnotation")) + $root.google.cloud.vision.v1p2beta1.TextAnnotation.encode(message.fullTextAnnotation, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.webDetection != null && message.hasOwnProperty("webDetection")) + $root.google.cloud.vision.v1p2beta1.WebDetection.encode(message.webDetection, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.context != null && message.hasOwnProperty("context")) + $root.google.cloud.vision.v1p2beta1.ImageAnnotationContext.encode(message.context, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); return writer; }; /** - * Encodes the specified AsyncBatchAnnotateFilesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse.verify|verify} messages. + * Encodes the specified AnnotateImageResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.AnnotateImageResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse * @static - * @param {google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesResponse} message AsyncBatchAnnotateFilesResponse message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IAnnotateImageResponse} message AnnotateImageResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncBatchAnnotateFilesResponse.encodeDelimited = function encodeDelimited(message, writer) { + AnnotateImageResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AsyncBatchAnnotateFilesResponse message from the specified reader or buffer. + * Decodes an AnnotateImageResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse + * @returns {google.cloud.vision.v1p2beta1.AnnotateImageResponse} AnnotateImageResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncBatchAnnotateFilesResponse.decode = function decode(reader, length) { + AnnotateImageResponse.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.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.AnnotateImageResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.responses && message.responses.length)) - message.responses = []; - message.responses.push($root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse.decode(reader, reader.uint32())); + if (!(message.faceAnnotations && message.faceAnnotations.length)) + message.faceAnnotations = []; + message.faceAnnotations.push($root.google.cloud.vision.v1p2beta1.FaceAnnotation.decode(reader, reader.uint32())); + break; + case 2: + if (!(message.landmarkAnnotations && message.landmarkAnnotations.length)) + message.landmarkAnnotations = []; + message.landmarkAnnotations.push($root.google.cloud.vision.v1p2beta1.EntityAnnotation.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.logoAnnotations && message.logoAnnotations.length)) + message.logoAnnotations = []; + message.logoAnnotations.push($root.google.cloud.vision.v1p2beta1.EntityAnnotation.decode(reader, reader.uint32())); + break; + case 4: + if (!(message.labelAnnotations && message.labelAnnotations.length)) + message.labelAnnotations = []; + message.labelAnnotations.push($root.google.cloud.vision.v1p2beta1.EntityAnnotation.decode(reader, reader.uint32())); + break; + case 5: + if (!(message.textAnnotations && message.textAnnotations.length)) + message.textAnnotations = []; + message.textAnnotations.push($root.google.cloud.vision.v1p2beta1.EntityAnnotation.decode(reader, reader.uint32())); + break; + case 12: + message.fullTextAnnotation = $root.google.cloud.vision.v1p2beta1.TextAnnotation.decode(reader, reader.uint32()); + break; + case 6: + message.safeSearchAnnotation = $root.google.cloud.vision.v1p2beta1.SafeSearchAnnotation.decode(reader, reader.uint32()); + break; + case 8: + message.imagePropertiesAnnotation = $root.google.cloud.vision.v1p2beta1.ImageProperties.decode(reader, reader.uint32()); + break; + case 11: + message.cropHintsAnnotation = $root.google.cloud.vision.v1p2beta1.CropHintsAnnotation.decode(reader, reader.uint32()); + break; + case 13: + message.webDetection = $root.google.cloud.vision.v1p2beta1.WebDetection.decode(reader, reader.uint32()); + break; + case 9: + message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + case 21: + message.context = $root.google.cloud.vision.v1p2beta1.ImageAnnotationContext.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -43977,125 +43136,320 @@ }; /** - * Decodes an AsyncBatchAnnotateFilesResponse message from the specified reader or buffer, length delimited. + * Decodes an AnnotateImageResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse + * @returns {google.cloud.vision.v1p2beta1.AnnotateImageResponse} AnnotateImageResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncBatchAnnotateFilesResponse.decodeDelimited = function decodeDelimited(reader) { + AnnotateImageResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AsyncBatchAnnotateFilesResponse message. + * Verifies an AnnotateImageResponse message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AsyncBatchAnnotateFilesResponse.verify = function verify(message) { + AnnotateImageResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.responses != null && message.hasOwnProperty("responses")) { - if (!Array.isArray(message.responses)) - return "responses: array expected"; - for (var i = 0; i < message.responses.length; ++i) { - var error = $root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse.verify(message.responses[i]); + if (message.faceAnnotations != null && message.hasOwnProperty("faceAnnotations")) { + if (!Array.isArray(message.faceAnnotations)) + return "faceAnnotations: array expected"; + for (var i = 0; i < message.faceAnnotations.length; ++i) { + var error = $root.google.cloud.vision.v1p2beta1.FaceAnnotation.verify(message.faceAnnotations[i]); if (error) - return "responses." + error; + return "faceAnnotations." + error; + } + } + if (message.landmarkAnnotations != null && message.hasOwnProperty("landmarkAnnotations")) { + if (!Array.isArray(message.landmarkAnnotations)) + return "landmarkAnnotations: array expected"; + for (var i = 0; i < message.landmarkAnnotations.length; ++i) { + var error = $root.google.cloud.vision.v1p2beta1.EntityAnnotation.verify(message.landmarkAnnotations[i]); + if (error) + return "landmarkAnnotations." + error; + } + } + if (message.logoAnnotations != null && message.hasOwnProperty("logoAnnotations")) { + if (!Array.isArray(message.logoAnnotations)) + return "logoAnnotations: array expected"; + for (var i = 0; i < message.logoAnnotations.length; ++i) { + var error = $root.google.cloud.vision.v1p2beta1.EntityAnnotation.verify(message.logoAnnotations[i]); + if (error) + return "logoAnnotations." + error; + } + } + if (message.labelAnnotations != null && message.hasOwnProperty("labelAnnotations")) { + if (!Array.isArray(message.labelAnnotations)) + return "labelAnnotations: array expected"; + for (var i = 0; i < message.labelAnnotations.length; ++i) { + var error = $root.google.cloud.vision.v1p2beta1.EntityAnnotation.verify(message.labelAnnotations[i]); + if (error) + return "labelAnnotations." + error; + } + } + if (message.textAnnotations != null && message.hasOwnProperty("textAnnotations")) { + if (!Array.isArray(message.textAnnotations)) + return "textAnnotations: array expected"; + for (var i = 0; i < message.textAnnotations.length; ++i) { + var error = $root.google.cloud.vision.v1p2beta1.EntityAnnotation.verify(message.textAnnotations[i]); + if (error) + return "textAnnotations." + error; } } + if (message.fullTextAnnotation != null && message.hasOwnProperty("fullTextAnnotation")) { + var error = $root.google.cloud.vision.v1p2beta1.TextAnnotation.verify(message.fullTextAnnotation); + if (error) + return "fullTextAnnotation." + error; + } + if (message.safeSearchAnnotation != null && message.hasOwnProperty("safeSearchAnnotation")) { + var error = $root.google.cloud.vision.v1p2beta1.SafeSearchAnnotation.verify(message.safeSearchAnnotation); + if (error) + return "safeSearchAnnotation." + error; + } + if (message.imagePropertiesAnnotation != null && message.hasOwnProperty("imagePropertiesAnnotation")) { + var error = $root.google.cloud.vision.v1p2beta1.ImageProperties.verify(message.imagePropertiesAnnotation); + if (error) + return "imagePropertiesAnnotation." + error; + } + if (message.cropHintsAnnotation != null && message.hasOwnProperty("cropHintsAnnotation")) { + var error = $root.google.cloud.vision.v1p2beta1.CropHintsAnnotation.verify(message.cropHintsAnnotation); + if (error) + return "cropHintsAnnotation." + error; + } + if (message.webDetection != null && message.hasOwnProperty("webDetection")) { + var error = $root.google.cloud.vision.v1p2beta1.WebDetection.verify(message.webDetection); + if (error) + return "webDetection." + error; + } + if (message.error != null && message.hasOwnProperty("error")) { + var error = $root.google.rpc.Status.verify(message.error); + if (error) + return "error." + error; + } + if (message.context != null && message.hasOwnProperty("context")) { + var error = $root.google.cloud.vision.v1p2beta1.ImageAnnotationContext.verify(message.context); + if (error) + return "context." + error; + } return null; }; /** - * Creates an AsyncBatchAnnotateFilesResponse message from a plain object. Also converts values to their respective internal types. + * Creates an AnnotateImageResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse + * @returns {google.cloud.vision.v1p2beta1.AnnotateImageResponse} AnnotateImageResponse */ - AsyncBatchAnnotateFilesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse) + AnnotateImageResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.AnnotateImageResponse) return object; - var message = new $root.google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse(); - if (object.responses) { - if (!Array.isArray(object.responses)) - throw TypeError(".google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse.responses: array expected"); - message.responses = []; - for (var i = 0; i < object.responses.length; ++i) { - if (typeof object.responses[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse.responses: object expected"); - message.responses[i] = $root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse.fromObject(object.responses[i]); + var message = new $root.google.cloud.vision.v1p2beta1.AnnotateImageResponse(); + if (object.faceAnnotations) { + if (!Array.isArray(object.faceAnnotations)) + throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.faceAnnotations: array expected"); + message.faceAnnotations = []; + for (var i = 0; i < object.faceAnnotations.length; ++i) { + if (typeof object.faceAnnotations[i] !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.faceAnnotations: object expected"); + message.faceAnnotations[i] = $root.google.cloud.vision.v1p2beta1.FaceAnnotation.fromObject(object.faceAnnotations[i]); + } + } + if (object.landmarkAnnotations) { + if (!Array.isArray(object.landmarkAnnotations)) + throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.landmarkAnnotations: array expected"); + message.landmarkAnnotations = []; + for (var i = 0; i < object.landmarkAnnotations.length; ++i) { + if (typeof object.landmarkAnnotations[i] !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.landmarkAnnotations: object expected"); + message.landmarkAnnotations[i] = $root.google.cloud.vision.v1p2beta1.EntityAnnotation.fromObject(object.landmarkAnnotations[i]); + } + } + if (object.logoAnnotations) { + if (!Array.isArray(object.logoAnnotations)) + throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.logoAnnotations: array expected"); + message.logoAnnotations = []; + for (var i = 0; i < object.logoAnnotations.length; ++i) { + if (typeof object.logoAnnotations[i] !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.logoAnnotations: object expected"); + message.logoAnnotations[i] = $root.google.cloud.vision.v1p2beta1.EntityAnnotation.fromObject(object.logoAnnotations[i]); } } + if (object.labelAnnotations) { + if (!Array.isArray(object.labelAnnotations)) + throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.labelAnnotations: array expected"); + message.labelAnnotations = []; + for (var i = 0; i < object.labelAnnotations.length; ++i) { + if (typeof object.labelAnnotations[i] !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.labelAnnotations: object expected"); + message.labelAnnotations[i] = $root.google.cloud.vision.v1p2beta1.EntityAnnotation.fromObject(object.labelAnnotations[i]); + } + } + if (object.textAnnotations) { + if (!Array.isArray(object.textAnnotations)) + throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.textAnnotations: array expected"); + message.textAnnotations = []; + for (var i = 0; i < object.textAnnotations.length; ++i) { + if (typeof object.textAnnotations[i] !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.textAnnotations: object expected"); + message.textAnnotations[i] = $root.google.cloud.vision.v1p2beta1.EntityAnnotation.fromObject(object.textAnnotations[i]); + } + } + if (object.fullTextAnnotation != null) { + if (typeof object.fullTextAnnotation !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.fullTextAnnotation: object expected"); + message.fullTextAnnotation = $root.google.cloud.vision.v1p2beta1.TextAnnotation.fromObject(object.fullTextAnnotation); + } + if (object.safeSearchAnnotation != null) { + if (typeof object.safeSearchAnnotation !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.safeSearchAnnotation: object expected"); + message.safeSearchAnnotation = $root.google.cloud.vision.v1p2beta1.SafeSearchAnnotation.fromObject(object.safeSearchAnnotation); + } + if (object.imagePropertiesAnnotation != null) { + if (typeof object.imagePropertiesAnnotation !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.imagePropertiesAnnotation: object expected"); + message.imagePropertiesAnnotation = $root.google.cloud.vision.v1p2beta1.ImageProperties.fromObject(object.imagePropertiesAnnotation); + } + if (object.cropHintsAnnotation != null) { + if (typeof object.cropHintsAnnotation !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.cropHintsAnnotation: object expected"); + message.cropHintsAnnotation = $root.google.cloud.vision.v1p2beta1.CropHintsAnnotation.fromObject(object.cropHintsAnnotation); + } + if (object.webDetection != null) { + if (typeof object.webDetection !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.webDetection: object expected"); + message.webDetection = $root.google.cloud.vision.v1p2beta1.WebDetection.fromObject(object.webDetection); + } + if (object.error != null) { + if (typeof object.error !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.error: object expected"); + message.error = $root.google.rpc.Status.fromObject(object.error); + } + if (object.context != null) { + if (typeof object.context !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateImageResponse.context: object expected"); + message.context = $root.google.cloud.vision.v1p2beta1.ImageAnnotationContext.fromObject(object.context); + } return message; }; /** - * Creates a plain object from an AsyncBatchAnnotateFilesResponse message. Also converts values to other types if specified. + * Creates a plain object from an AnnotateImageResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse * @static - * @param {google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse} message AsyncBatchAnnotateFilesResponse + * @param {google.cloud.vision.v1p2beta1.AnnotateImageResponse} message AnnotateImageResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AsyncBatchAnnotateFilesResponse.toObject = function toObject(message, options) { + AnnotateImageResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.responses = []; - if (message.responses && message.responses.length) { - object.responses = []; - for (var j = 0; j < message.responses.length; ++j) - object.responses[j] = $root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse.toObject(message.responses[j], options); + if (options.arrays || options.defaults) { + object.faceAnnotations = []; + object.landmarkAnnotations = []; + object.logoAnnotations = []; + object.labelAnnotations = []; + object.textAnnotations = []; } - return object; - }; - - /** - * Converts this AsyncBatchAnnotateFilesResponse to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse - * @instance - * @returns {Object.} JSON object - */ - AsyncBatchAnnotateFilesResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return AsyncBatchAnnotateFilesResponse; - })(); - - v1p2beta1.InputConfig = (function() { - - /** - * Properties of an InputConfig. + if (options.defaults) { + object.safeSearchAnnotation = null; + object.imagePropertiesAnnotation = null; + object.error = null; + object.cropHintsAnnotation = null; + object.fullTextAnnotation = null; + object.webDetection = null; + object.context = null; + } + if (message.faceAnnotations && message.faceAnnotations.length) { + object.faceAnnotations = []; + for (var j = 0; j < message.faceAnnotations.length; ++j) + object.faceAnnotations[j] = $root.google.cloud.vision.v1p2beta1.FaceAnnotation.toObject(message.faceAnnotations[j], options); + } + if (message.landmarkAnnotations && message.landmarkAnnotations.length) { + object.landmarkAnnotations = []; + for (var j = 0; j < message.landmarkAnnotations.length; ++j) + object.landmarkAnnotations[j] = $root.google.cloud.vision.v1p2beta1.EntityAnnotation.toObject(message.landmarkAnnotations[j], options); + } + if (message.logoAnnotations && message.logoAnnotations.length) { + object.logoAnnotations = []; + for (var j = 0; j < message.logoAnnotations.length; ++j) + object.logoAnnotations[j] = $root.google.cloud.vision.v1p2beta1.EntityAnnotation.toObject(message.logoAnnotations[j], options); + } + if (message.labelAnnotations && message.labelAnnotations.length) { + object.labelAnnotations = []; + for (var j = 0; j < message.labelAnnotations.length; ++j) + object.labelAnnotations[j] = $root.google.cloud.vision.v1p2beta1.EntityAnnotation.toObject(message.labelAnnotations[j], options); + } + if (message.textAnnotations && message.textAnnotations.length) { + object.textAnnotations = []; + for (var j = 0; j < message.textAnnotations.length; ++j) + object.textAnnotations[j] = $root.google.cloud.vision.v1p2beta1.EntityAnnotation.toObject(message.textAnnotations[j], options); + } + if (message.safeSearchAnnotation != null && message.hasOwnProperty("safeSearchAnnotation")) + object.safeSearchAnnotation = $root.google.cloud.vision.v1p2beta1.SafeSearchAnnotation.toObject(message.safeSearchAnnotation, options); + if (message.imagePropertiesAnnotation != null && message.hasOwnProperty("imagePropertiesAnnotation")) + object.imagePropertiesAnnotation = $root.google.cloud.vision.v1p2beta1.ImageProperties.toObject(message.imagePropertiesAnnotation, options); + if (message.error != null && message.hasOwnProperty("error")) + object.error = $root.google.rpc.Status.toObject(message.error, options); + if (message.cropHintsAnnotation != null && message.hasOwnProperty("cropHintsAnnotation")) + object.cropHintsAnnotation = $root.google.cloud.vision.v1p2beta1.CropHintsAnnotation.toObject(message.cropHintsAnnotation, options); + if (message.fullTextAnnotation != null && message.hasOwnProperty("fullTextAnnotation")) + object.fullTextAnnotation = $root.google.cloud.vision.v1p2beta1.TextAnnotation.toObject(message.fullTextAnnotation, options); + if (message.webDetection != null && message.hasOwnProperty("webDetection")) + object.webDetection = $root.google.cloud.vision.v1p2beta1.WebDetection.toObject(message.webDetection, options); + if (message.context != null && message.hasOwnProperty("context")) + object.context = $root.google.cloud.vision.v1p2beta1.ImageAnnotationContext.toObject(message.context, options); + return object; + }; + + /** + * Converts this AnnotateImageResponse to JSON. + * @function toJSON + * @memberof google.cloud.vision.v1p2beta1.AnnotateImageResponse + * @instance + * @returns {Object.} JSON object + */ + AnnotateImageResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return AnnotateImageResponse; + })(); + + v1p2beta1.AnnotateFileResponse = (function() { + + /** + * Properties of an AnnotateFileResponse. * @memberof google.cloud.vision.v1p2beta1 - * @interface IInputConfig - * @property {google.cloud.vision.v1p2beta1.IGcsSource|null} [gcsSource] InputConfig gcsSource - * @property {string|null} [mimeType] InputConfig mimeType + * @interface IAnnotateFileResponse + * @property {google.cloud.vision.v1p2beta1.IInputConfig|null} [inputConfig] AnnotateFileResponse inputConfig + * @property {Array.|null} [responses] AnnotateFileResponse responses */ /** - * Constructs a new InputConfig. + * Constructs a new AnnotateFileResponse. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an InputConfig. - * @implements IInputConfig + * @classdesc Represents an AnnotateFileResponse. + * @implements IAnnotateFileResponse * @constructor - * @param {google.cloud.vision.v1p2beta1.IInputConfig=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.IAnnotateFileResponse=} [properties] Properties to set */ - function InputConfig(properties) { + function AnnotateFileResponse(properties) { + this.responses = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -44103,88 +43457,91 @@ } /** - * InputConfig gcsSource. - * @member {google.cloud.vision.v1p2beta1.IGcsSource|null|undefined} gcsSource - * @memberof google.cloud.vision.v1p2beta1.InputConfig + * AnnotateFileResponse inputConfig. + * @member {google.cloud.vision.v1p2beta1.IInputConfig|null|undefined} inputConfig + * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse * @instance */ - InputConfig.prototype.gcsSource = null; + AnnotateFileResponse.prototype.inputConfig = null; /** - * InputConfig mimeType. - * @member {string} mimeType - * @memberof google.cloud.vision.v1p2beta1.InputConfig + * AnnotateFileResponse responses. + * @member {Array.} responses + * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse * @instance */ - InputConfig.prototype.mimeType = ""; + AnnotateFileResponse.prototype.responses = $util.emptyArray; /** - * Creates a new InputConfig instance using the specified properties. + * Creates a new AnnotateFileResponse instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.InputConfig + * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse * @static - * @param {google.cloud.vision.v1p2beta1.IInputConfig=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.InputConfig} InputConfig instance + * @param {google.cloud.vision.v1p2beta1.IAnnotateFileResponse=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.AnnotateFileResponse} AnnotateFileResponse instance */ - InputConfig.create = function create(properties) { - return new InputConfig(properties); + AnnotateFileResponse.create = function create(properties) { + return new AnnotateFileResponse(properties); }; /** - * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.vision.v1p2beta1.InputConfig.verify|verify} messages. + * Encodes the specified AnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1p2beta1.AnnotateFileResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.InputConfig + * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse * @static - * @param {google.cloud.vision.v1p2beta1.IInputConfig} message InputConfig message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IAnnotateFileResponse} message AnnotateFileResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - InputConfig.encode = function encode(message, writer) { + AnnotateFileResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) - $root.google.cloud.vision.v1p2beta1.GcsSource.encode(message.gcsSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.mimeType != null && message.hasOwnProperty("mimeType")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimeType); + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + $root.google.cloud.vision.v1p2beta1.InputConfig.encode(message.inputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.responses != null && message.responses.length) + for (var i = 0; i < message.responses.length; ++i) + $root.google.cloud.vision.v1p2beta1.AnnotateImageResponse.encode(message.responses[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified InputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.InputConfig.verify|verify} messages. + * Encodes the specified AnnotateFileResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.AnnotateFileResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.InputConfig + * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse * @static - * @param {google.cloud.vision.v1p2beta1.IInputConfig} message InputConfig message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IAnnotateFileResponse} message AnnotateFileResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - InputConfig.encodeDelimited = function encodeDelimited(message, writer) { + AnnotateFileResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an InputConfig message from the specified reader or buffer. + * Decodes an AnnotateFileResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.InputConfig + * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.InputConfig} InputConfig + * @returns {google.cloud.vision.v1p2beta1.AnnotateFileResponse} AnnotateFileResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - InputConfig.decode = function decode(reader, length) { + AnnotateFileResponse.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.vision.v1p2beta1.InputConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.AnnotateFileResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.gcsSource = $root.google.cloud.vision.v1p2beta1.GcsSource.decode(reader, reader.uint32()); + message.inputConfig = $root.google.cloud.vision.v1p2beta1.InputConfig.decode(reader, reader.uint32()); break; case 2: - message.mimeType = reader.string(); + if (!(message.responses && message.responses.length)) + message.responses = []; + message.responses.push($root.google.cloud.vision.v1p2beta1.AnnotateImageResponse.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -44195,122 +43552,139 @@ }; /** - * Decodes an InputConfig message from the specified reader or buffer, length delimited. + * Decodes an AnnotateFileResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.InputConfig + * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.InputConfig} InputConfig + * @returns {google.cloud.vision.v1p2beta1.AnnotateFileResponse} AnnotateFileResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - InputConfig.decodeDelimited = function decodeDelimited(reader) { + AnnotateFileResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an InputConfig message. + * Verifies an AnnotateFileResponse message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.InputConfig + * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - InputConfig.verify = function verify(message) { + AnnotateFileResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - var error = $root.google.cloud.vision.v1p2beta1.GcsSource.verify(message.gcsSource); + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.vision.v1p2beta1.InputConfig.verify(message.inputConfig); if (error) - return "gcsSource." + error; + return "inputConfig." + error; + } + if (message.responses != null && message.hasOwnProperty("responses")) { + if (!Array.isArray(message.responses)) + return "responses: array expected"; + for (var i = 0; i < message.responses.length; ++i) { + var error = $root.google.cloud.vision.v1p2beta1.AnnotateImageResponse.verify(message.responses[i]); + if (error) + return "responses." + error; + } } - if (message.mimeType != null && message.hasOwnProperty("mimeType")) - if (!$util.isString(message.mimeType)) - return "mimeType: string expected"; return null; }; /** - * Creates an InputConfig message from a plain object. Also converts values to their respective internal types. + * Creates an AnnotateFileResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.InputConfig + * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.InputConfig} InputConfig + * @returns {google.cloud.vision.v1p2beta1.AnnotateFileResponse} AnnotateFileResponse */ - InputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.InputConfig) + AnnotateFileResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.AnnotateFileResponse) return object; - var message = new $root.google.cloud.vision.v1p2beta1.InputConfig(); - if (object.gcsSource != null) { - if (typeof object.gcsSource !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.InputConfig.gcsSource: object expected"); - message.gcsSource = $root.google.cloud.vision.v1p2beta1.GcsSource.fromObject(object.gcsSource); + var message = new $root.google.cloud.vision.v1p2beta1.AnnotateFileResponse(); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateFileResponse.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.vision.v1p2beta1.InputConfig.fromObject(object.inputConfig); + } + if (object.responses) { + if (!Array.isArray(object.responses)) + throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateFileResponse.responses: array expected"); + message.responses = []; + for (var i = 0; i < object.responses.length; ++i) { + if (typeof object.responses[i] !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.AnnotateFileResponse.responses: object expected"); + message.responses[i] = $root.google.cloud.vision.v1p2beta1.AnnotateImageResponse.fromObject(object.responses[i]); + } } - if (object.mimeType != null) - message.mimeType = String(object.mimeType); return message; }; /** - * Creates a plain object from an InputConfig message. Also converts values to other types if specified. + * Creates a plain object from an AnnotateFileResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.InputConfig + * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse * @static - * @param {google.cloud.vision.v1p2beta1.InputConfig} message InputConfig + * @param {google.cloud.vision.v1p2beta1.AnnotateFileResponse} message AnnotateFileResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - InputConfig.toObject = function toObject(message, options) { + AnnotateFileResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.gcsSource = null; - object.mimeType = ""; + if (options.arrays || options.defaults) + object.responses = []; + if (options.defaults) + object.inputConfig = null; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.vision.v1p2beta1.InputConfig.toObject(message.inputConfig, options); + if (message.responses && message.responses.length) { + object.responses = []; + for (var j = 0; j < message.responses.length; ++j) + object.responses[j] = $root.google.cloud.vision.v1p2beta1.AnnotateImageResponse.toObject(message.responses[j], options); } - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) - object.gcsSource = $root.google.cloud.vision.v1p2beta1.GcsSource.toObject(message.gcsSource, options); - if (message.mimeType != null && message.hasOwnProperty("mimeType")) - object.mimeType = message.mimeType; return object; }; /** - * Converts this InputConfig to JSON. + * Converts this AnnotateFileResponse to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.InputConfig + * @memberof google.cloud.vision.v1p2beta1.AnnotateFileResponse * @instance * @returns {Object.} JSON object */ - InputConfig.prototype.toJSON = function toJSON() { + AnnotateFileResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return InputConfig; + return AnnotateFileResponse; })(); - v1p2beta1.OutputConfig = (function() { + v1p2beta1.BatchAnnotateImagesRequest = (function() { /** - * Properties of an OutputConfig. + * Properties of a BatchAnnotateImagesRequest. * @memberof google.cloud.vision.v1p2beta1 - * @interface IOutputConfig - * @property {google.cloud.vision.v1p2beta1.IGcsDestination|null} [gcsDestination] OutputConfig gcsDestination - * @property {number|null} [batchSize] OutputConfig batchSize + * @interface IBatchAnnotateImagesRequest + * @property {Array.|null} [requests] BatchAnnotateImagesRequest requests */ /** - * Constructs a new OutputConfig. + * Constructs a new BatchAnnotateImagesRequest. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an OutputConfig. - * @implements IOutputConfig + * @classdesc Represents a BatchAnnotateImagesRequest. + * @implements IBatchAnnotateImagesRequest * @constructor - * @param {google.cloud.vision.v1p2beta1.IOutputConfig=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest=} [properties] Properties to set */ - function OutputConfig(properties) { + function BatchAnnotateImagesRequest(properties) { + this.requests = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -44318,88 +43692,78 @@ } /** - * OutputConfig gcsDestination. - * @member {google.cloud.vision.v1p2beta1.IGcsDestination|null|undefined} gcsDestination - * @memberof google.cloud.vision.v1p2beta1.OutputConfig - * @instance - */ - OutputConfig.prototype.gcsDestination = null; - - /** - * OutputConfig batchSize. - * @member {number} batchSize - * @memberof google.cloud.vision.v1p2beta1.OutputConfig + * BatchAnnotateImagesRequest requests. + * @member {Array.} requests + * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest * @instance */ - OutputConfig.prototype.batchSize = 0; + BatchAnnotateImagesRequest.prototype.requests = $util.emptyArray; /** - * Creates a new OutputConfig instance using the specified properties. + * Creates a new BatchAnnotateImagesRequest instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.OutputConfig + * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest * @static - * @param {google.cloud.vision.v1p2beta1.IOutputConfig=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.OutputConfig} OutputConfig instance + * @param {google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest instance */ - OutputConfig.create = function create(properties) { - return new OutputConfig(properties); + BatchAnnotateImagesRequest.create = function create(properties) { + return new BatchAnnotateImagesRequest(properties); }; /** - * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.vision.v1p2beta1.OutputConfig.verify|verify} messages. + * Encodes the specified BatchAnnotateImagesRequest message. Does not implicitly {@link google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.OutputConfig + * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest * @static - * @param {google.cloud.vision.v1p2beta1.IOutputConfig} message OutputConfig message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest} message BatchAnnotateImagesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OutputConfig.encode = function encode(message, writer) { + BatchAnnotateImagesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) - $root.google.cloud.vision.v1p2beta1.GcsDestination.encode(message.gcsDestination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.batchSize != null && message.hasOwnProperty("batchSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.batchSize); + if (message.requests != null && message.requests.length) + for (var i = 0; i < message.requests.length; ++i) + $root.google.cloud.vision.v1p2beta1.AnnotateImageRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified OutputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.OutputConfig.verify|verify} messages. + * Encodes the specified BatchAnnotateImagesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.OutputConfig + * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest * @static - * @param {google.cloud.vision.v1p2beta1.IOutputConfig} message OutputConfig message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest} message BatchAnnotateImagesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OutputConfig.encodeDelimited = function encodeDelimited(message, writer) { + BatchAnnotateImagesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an OutputConfig message from the specified reader or buffer. + * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.OutputConfig + * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.OutputConfig} OutputConfig + * @returns {google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OutputConfig.decode = function decode(reader, length) { + BatchAnnotateImagesRequest.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.vision.v1p2beta1.OutputConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.gcsDestination = $root.google.cloud.vision.v1p2beta1.GcsDestination.decode(reader, reader.uint32()); - break; - case 2: - message.batchSize = reader.int32(); + if (!(message.requests && message.requests.length)) + message.requests = []; + message.requests.push($root.google.cloud.vision.v1p2beta1.AnnotateImageRequest.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -44410,121 +43774,125 @@ }; /** - * Decodes an OutputConfig message from the specified reader or buffer, length delimited. + * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.OutputConfig + * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.OutputConfig} OutputConfig + * @returns {google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OutputConfig.decodeDelimited = function decodeDelimited(reader) { + BatchAnnotateImagesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an OutputConfig message. + * Verifies a BatchAnnotateImagesRequest message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.OutputConfig + * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - OutputConfig.verify = function verify(message) { + BatchAnnotateImagesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { - var error = $root.google.cloud.vision.v1p2beta1.GcsDestination.verify(message.gcsDestination); - if (error) - return "gcsDestination." + error; + if (message.requests != null && message.hasOwnProperty("requests")) { + if (!Array.isArray(message.requests)) + return "requests: array expected"; + for (var i = 0; i < message.requests.length; ++i) { + var error = $root.google.cloud.vision.v1p2beta1.AnnotateImageRequest.verify(message.requests[i]); + if (error) + return "requests." + error; + } } - if (message.batchSize != null && message.hasOwnProperty("batchSize")) - if (!$util.isInteger(message.batchSize)) - return "batchSize: integer expected"; return null; }; /** - * Creates an OutputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a BatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.OutputConfig + * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.OutputConfig} OutputConfig + * @returns {google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest */ - OutputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.OutputConfig) + BatchAnnotateImagesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest) return object; - var message = new $root.google.cloud.vision.v1p2beta1.OutputConfig(); - if (object.gcsDestination != null) { - if (typeof object.gcsDestination !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.OutputConfig.gcsDestination: object expected"); - message.gcsDestination = $root.google.cloud.vision.v1p2beta1.GcsDestination.fromObject(object.gcsDestination); + var message = new $root.google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest(); + if (object.requests) { + if (!Array.isArray(object.requests)) + throw TypeError(".google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest.requests: array expected"); + message.requests = []; + for (var i = 0; i < object.requests.length; ++i) { + if (typeof object.requests[i] !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest.requests: object expected"); + message.requests[i] = $root.google.cloud.vision.v1p2beta1.AnnotateImageRequest.fromObject(object.requests[i]); + } } - if (object.batchSize != null) - message.batchSize = object.batchSize | 0; return message; }; /** - * Creates a plain object from an OutputConfig message. Also converts values to other types if specified. + * Creates a plain object from a BatchAnnotateImagesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.OutputConfig + * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest * @static - * @param {google.cloud.vision.v1p2beta1.OutputConfig} message OutputConfig + * @param {google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest} message BatchAnnotateImagesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - OutputConfig.toObject = function toObject(message, options) { + BatchAnnotateImagesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.gcsDestination = null; - object.batchSize = 0; + if (options.arrays || options.defaults) + object.requests = []; + if (message.requests && message.requests.length) { + object.requests = []; + for (var j = 0; j < message.requests.length; ++j) + object.requests[j] = $root.google.cloud.vision.v1p2beta1.AnnotateImageRequest.toObject(message.requests[j], options); } - if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) - object.gcsDestination = $root.google.cloud.vision.v1p2beta1.GcsDestination.toObject(message.gcsDestination, options); - if (message.batchSize != null && message.hasOwnProperty("batchSize")) - object.batchSize = message.batchSize; return object; }; /** - * Converts this OutputConfig to JSON. + * Converts this BatchAnnotateImagesRequest to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.OutputConfig + * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest * @instance * @returns {Object.} JSON object */ - OutputConfig.prototype.toJSON = function toJSON() { + BatchAnnotateImagesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return OutputConfig; + return BatchAnnotateImagesRequest; })(); - v1p2beta1.GcsSource = (function() { + v1p2beta1.BatchAnnotateImagesResponse = (function() { /** - * Properties of a GcsSource. + * Properties of a BatchAnnotateImagesResponse. * @memberof google.cloud.vision.v1p2beta1 - * @interface IGcsSource - * @property {string|null} [uri] GcsSource uri + * @interface IBatchAnnotateImagesResponse + * @property {Array.|null} [responses] BatchAnnotateImagesResponse responses */ /** - * Constructs a new GcsSource. + * Constructs a new BatchAnnotateImagesResponse. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a GcsSource. - * @implements IGcsSource + * @classdesc Represents a BatchAnnotateImagesResponse. + * @implements IBatchAnnotateImagesResponse * @constructor - * @param {google.cloud.vision.v1p2beta1.IGcsSource=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.IBatchAnnotateImagesResponse=} [properties] Properties to set */ - function GcsSource(properties) { + function BatchAnnotateImagesResponse(properties) { + this.responses = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -44532,75 +43900,78 @@ } /** - * GcsSource uri. - * @member {string} uri - * @memberof google.cloud.vision.v1p2beta1.GcsSource + * BatchAnnotateImagesResponse responses. + * @member {Array.} responses + * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse * @instance */ - GcsSource.prototype.uri = ""; + BatchAnnotateImagesResponse.prototype.responses = $util.emptyArray; /** - * Creates a new GcsSource instance using the specified properties. + * Creates a new BatchAnnotateImagesResponse instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.GcsSource + * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse * @static - * @param {google.cloud.vision.v1p2beta1.IGcsSource=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.GcsSource} GcsSource instance + * @param {google.cloud.vision.v1p2beta1.IBatchAnnotateImagesResponse=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse instance */ - GcsSource.create = function create(properties) { - return new GcsSource(properties); + BatchAnnotateImagesResponse.create = function create(properties) { + return new BatchAnnotateImagesResponse(properties); }; /** - * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.vision.v1p2beta1.GcsSource.verify|verify} messages. + * Encodes the specified BatchAnnotateImagesResponse message. Does not implicitly {@link google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.GcsSource + * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse * @static - * @param {google.cloud.vision.v1p2beta1.IGcsSource} message GcsSource message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IBatchAnnotateImagesResponse} message BatchAnnotateImagesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsSource.encode = function encode(message, writer) { + BatchAnnotateImagesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.uri != null && message.hasOwnProperty("uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.responses != null && message.responses.length) + for (var i = 0; i < message.responses.length; ++i) + $root.google.cloud.vision.v1p2beta1.AnnotateImageResponse.encode(message.responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.GcsSource.verify|verify} messages. + * Encodes the specified BatchAnnotateImagesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.GcsSource + * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse * @static - * @param {google.cloud.vision.v1p2beta1.IGcsSource} message GcsSource message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IBatchAnnotateImagesResponse} message BatchAnnotateImagesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsSource.encodeDelimited = function encodeDelimited(message, writer) { + BatchAnnotateImagesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GcsSource message from the specified reader or buffer. + * Decodes a BatchAnnotateImagesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.GcsSource + * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.GcsSource} GcsSource + * @returns {google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsSource.decode = function decode(reader, length) { + BatchAnnotateImagesResponse.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.vision.v1p2beta1.GcsSource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.uri = reader.string(); + if (!(message.responses && message.responses.length)) + message.responses = []; + message.responses.push($root.google.cloud.vision.v1p2beta1.AnnotateImageResponse.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -44611,107 +43982,128 @@ }; /** - * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * Decodes a BatchAnnotateImagesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.GcsSource + * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.GcsSource} GcsSource + * @returns {google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsSource.decodeDelimited = function decodeDelimited(reader) { + BatchAnnotateImagesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GcsSource message. + * Verifies a BatchAnnotateImagesResponse message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.GcsSource + * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GcsSource.verify = function verify(message) { + BatchAnnotateImagesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; + if (message.responses != null && message.hasOwnProperty("responses")) { + if (!Array.isArray(message.responses)) + return "responses: array expected"; + for (var i = 0; i < message.responses.length; ++i) { + var error = $root.google.cloud.vision.v1p2beta1.AnnotateImageResponse.verify(message.responses[i]); + if (error) + return "responses." + error; + } + } return null; }; /** - * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * Creates a BatchAnnotateImagesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.GcsSource + * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.GcsSource} GcsSource + * @returns {google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse */ - GcsSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.GcsSource) + BatchAnnotateImagesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse) return object; - var message = new $root.google.cloud.vision.v1p2beta1.GcsSource(); - if (object.uri != null) - message.uri = String(object.uri); + var message = new $root.google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse(); + if (object.responses) { + if (!Array.isArray(object.responses)) + throw TypeError(".google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse.responses: array expected"); + message.responses = []; + for (var i = 0; i < object.responses.length; ++i) { + if (typeof object.responses[i] !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse.responses: object expected"); + message.responses[i] = $root.google.cloud.vision.v1p2beta1.AnnotateImageResponse.fromObject(object.responses[i]); + } + } return message; }; /** - * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * Creates a plain object from a BatchAnnotateImagesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.GcsSource + * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse * @static - * @param {google.cloud.vision.v1p2beta1.GcsSource} message GcsSource + * @param {google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse} message BatchAnnotateImagesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GcsSource.toObject = function toObject(message, options) { + BatchAnnotateImagesResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.uri = ""; - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; + if (options.arrays || options.defaults) + object.responses = []; + if (message.responses && message.responses.length) { + object.responses = []; + for (var j = 0; j < message.responses.length; ++j) + object.responses[j] = $root.google.cloud.vision.v1p2beta1.AnnotateImageResponse.toObject(message.responses[j], options); + } return object; }; /** - * Converts this GcsSource to JSON. + * Converts this BatchAnnotateImagesResponse to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.GcsSource + * @memberof google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse * @instance * @returns {Object.} JSON object */ - GcsSource.prototype.toJSON = function toJSON() { + BatchAnnotateImagesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GcsSource; + return BatchAnnotateImagesResponse; })(); - v1p2beta1.GcsDestination = (function() { + v1p2beta1.AsyncAnnotateFileRequest = (function() { /** - * Properties of a GcsDestination. + * Properties of an AsyncAnnotateFileRequest. * @memberof google.cloud.vision.v1p2beta1 - * @interface IGcsDestination - * @property {string|null} [uri] GcsDestination uri + * @interface IAsyncAnnotateFileRequest + * @property {google.cloud.vision.v1p2beta1.IInputConfig|null} [inputConfig] AsyncAnnotateFileRequest inputConfig + * @property {Array.|null} [features] AsyncAnnotateFileRequest features + * @property {google.cloud.vision.v1p2beta1.IImageContext|null} [imageContext] AsyncAnnotateFileRequest imageContext + * @property {google.cloud.vision.v1p2beta1.IOutputConfig|null} [outputConfig] AsyncAnnotateFileRequest outputConfig */ /** - * Constructs a new GcsDestination. + * Constructs a new AsyncAnnotateFileRequest. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a GcsDestination. - * @implements IGcsDestination + * @classdesc Represents an AsyncAnnotateFileRequest. + * @implements IAsyncAnnotateFileRequest * @constructor - * @param {google.cloud.vision.v1p2beta1.IGcsDestination=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.IAsyncAnnotateFileRequest=} [properties] Properties to set */ - function GcsDestination(properties) { + function AsyncAnnotateFileRequest(properties) { + this.features = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -44719,75 +44111,117 @@ } /** - * GcsDestination uri. - * @member {string} uri - * @memberof google.cloud.vision.v1p2beta1.GcsDestination + * AsyncAnnotateFileRequest inputConfig. + * @member {google.cloud.vision.v1p2beta1.IInputConfig|null|undefined} inputConfig + * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest * @instance */ - GcsDestination.prototype.uri = ""; + AsyncAnnotateFileRequest.prototype.inputConfig = null; /** - * Creates a new GcsDestination instance using the specified properties. + * AsyncAnnotateFileRequest features. + * @member {Array.} features + * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest + * @instance + */ + AsyncAnnotateFileRequest.prototype.features = $util.emptyArray; + + /** + * AsyncAnnotateFileRequest imageContext. + * @member {google.cloud.vision.v1p2beta1.IImageContext|null|undefined} imageContext + * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest + * @instance + */ + AsyncAnnotateFileRequest.prototype.imageContext = null; + + /** + * AsyncAnnotateFileRequest outputConfig. + * @member {google.cloud.vision.v1p2beta1.IOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest + * @instance + */ + AsyncAnnotateFileRequest.prototype.outputConfig = null; + + /** + * Creates a new AsyncAnnotateFileRequest instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.GcsDestination + * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest * @static - * @param {google.cloud.vision.v1p2beta1.IGcsDestination=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.GcsDestination} GcsDestination instance + * @param {google.cloud.vision.v1p2beta1.IAsyncAnnotateFileRequest=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest instance */ - GcsDestination.create = function create(properties) { - return new GcsDestination(properties); + AsyncAnnotateFileRequest.create = function create(properties) { + return new AsyncAnnotateFileRequest(properties); }; /** - * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.vision.v1p2beta1.GcsDestination.verify|verify} messages. + * Encodes the specified AsyncAnnotateFileRequest message. Does not implicitly {@link google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.GcsDestination + * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest * @static - * @param {google.cloud.vision.v1p2beta1.IGcsDestination} message GcsDestination message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IAsyncAnnotateFileRequest} message AsyncAnnotateFileRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsDestination.encode = function encode(message, writer) { + AsyncAnnotateFileRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.uri != null && message.hasOwnProperty("uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + $root.google.cloud.vision.v1p2beta1.InputConfig.encode(message.inputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.features != null && message.features.length) + for (var i = 0; i < message.features.length; ++i) + $root.google.cloud.vision.v1p2beta1.Feature.encode(message.features[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.imageContext != null && message.hasOwnProperty("imageContext")) + $root.google.cloud.vision.v1p2beta1.ImageContext.encode(message.imageContext, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + $root.google.cloud.vision.v1p2beta1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); return writer; }; /** - * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.GcsDestination.verify|verify} messages. + * Encodes the specified AsyncAnnotateFileRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.GcsDestination + * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest * @static - * @param {google.cloud.vision.v1p2beta1.IGcsDestination} message GcsDestination message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IAsyncAnnotateFileRequest} message AsyncAnnotateFileRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsDestination.encodeDelimited = function encodeDelimited(message, writer) { + AsyncAnnotateFileRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GcsDestination message from the specified reader or buffer. + * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.GcsDestination + * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.GcsDestination} GcsDestination + * @returns {google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsDestination.decode = function decode(reader, length) { + AsyncAnnotateFileRequest.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.vision.v1p2beta1.GcsDestination(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.uri = reader.string(); + message.inputConfig = $root.google.cloud.vision.v1p2beta1.InputConfig.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.features && message.features.length)) + message.features = []; + message.features.push($root.google.cloud.vision.v1p2beta1.Feature.decode(reader, reader.uint32())); + break; + case 3: + message.imageContext = $root.google.cloud.vision.v1p2beta1.ImageContext.decode(reader, reader.uint32()); + break; + case 4: + message.outputConfig = $root.google.cloud.vision.v1p2beta1.OutputConfig.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -44798,109 +44232,165 @@ }; /** - * Decodes a GcsDestination message from the specified reader or buffer, length delimited. + * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.GcsDestination + * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.GcsDestination} GcsDestination + * @returns {google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsDestination.decodeDelimited = function decodeDelimited(reader) { + AsyncAnnotateFileRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GcsDestination message. + * Verifies an AsyncAnnotateFileRequest message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.GcsDestination + * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GcsDestination.verify = function verify(message) { + AsyncAnnotateFileRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.vision.v1p2beta1.InputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; + } + if (message.features != null && message.hasOwnProperty("features")) { + if (!Array.isArray(message.features)) + return "features: array expected"; + for (var i = 0; i < message.features.length; ++i) { + var error = $root.google.cloud.vision.v1p2beta1.Feature.verify(message.features[i]); + if (error) + return "features." + error; + } + } + if (message.imageContext != null && message.hasOwnProperty("imageContext")) { + var error = $root.google.cloud.vision.v1p2beta1.ImageContext.verify(message.imageContext); + if (error) + return "imageContext." + error; + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + var error = $root.google.cloud.vision.v1p2beta1.OutputConfig.verify(message.outputConfig); + if (error) + return "outputConfig." + error; + } return null; }; /** - * Creates a GcsDestination message from a plain object. Also converts values to their respective internal types. + * Creates an AsyncAnnotateFileRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.GcsDestination + * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.GcsDestination} GcsDestination + * @returns {google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest */ - GcsDestination.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.GcsDestination) + AsyncAnnotateFileRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest) return object; - var message = new $root.google.cloud.vision.v1p2beta1.GcsDestination(); - if (object.uri != null) - message.uri = String(object.uri); + var message = new $root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest(); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.vision.v1p2beta1.InputConfig.fromObject(object.inputConfig); + } + if (object.features) { + if (!Array.isArray(object.features)) + throw TypeError(".google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest.features: array expected"); + message.features = []; + for (var i = 0; i < object.features.length; ++i) { + if (typeof object.features[i] !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest.features: object expected"); + message.features[i] = $root.google.cloud.vision.v1p2beta1.Feature.fromObject(object.features[i]); + } + } + if (object.imageContext != null) { + if (typeof object.imageContext !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest.imageContext: object expected"); + message.imageContext = $root.google.cloud.vision.v1p2beta1.ImageContext.fromObject(object.imageContext); + } + if (object.outputConfig != null) { + if (typeof object.outputConfig !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest.outputConfig: object expected"); + message.outputConfig = $root.google.cloud.vision.v1p2beta1.OutputConfig.fromObject(object.outputConfig); + } return message; }; /** - * Creates a plain object from a GcsDestination message. Also converts values to other types if specified. + * Creates a plain object from an AsyncAnnotateFileRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.GcsDestination + * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest * @static - * @param {google.cloud.vision.v1p2beta1.GcsDestination} message GcsDestination + * @param {google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest} message AsyncAnnotateFileRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GcsDestination.toObject = function toObject(message, options) { + AsyncAnnotateFileRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.uri = ""; - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; + if (options.arrays || options.defaults) + object.features = []; + if (options.defaults) { + object.inputConfig = null; + object.imageContext = null; + object.outputConfig = null; + } + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.vision.v1p2beta1.InputConfig.toObject(message.inputConfig, options); + if (message.features && message.features.length) { + object.features = []; + for (var j = 0; j < message.features.length; ++j) + object.features[j] = $root.google.cloud.vision.v1p2beta1.Feature.toObject(message.features[j], options); + } + if (message.imageContext != null && message.hasOwnProperty("imageContext")) + object.imageContext = $root.google.cloud.vision.v1p2beta1.ImageContext.toObject(message.imageContext, options); + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + object.outputConfig = $root.google.cloud.vision.v1p2beta1.OutputConfig.toObject(message.outputConfig, options); return object; }; /** - * Converts this GcsDestination to JSON. + * Converts this AsyncAnnotateFileRequest to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.GcsDestination + * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest * @instance * @returns {Object.} JSON object */ - GcsDestination.prototype.toJSON = function toJSON() { + AsyncAnnotateFileRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GcsDestination; + return AsyncAnnotateFileRequest; })(); - v1p2beta1.OperationMetadata = (function() { + v1p2beta1.AsyncAnnotateFileResponse = (function() { /** - * Properties of an OperationMetadata. + * Properties of an AsyncAnnotateFileResponse. * @memberof google.cloud.vision.v1p2beta1 - * @interface IOperationMetadata - * @property {google.cloud.vision.v1p2beta1.OperationMetadata.State|null} [state] OperationMetadata state - * @property {google.protobuf.ITimestamp|null} [createTime] OperationMetadata createTime - * @property {google.protobuf.ITimestamp|null} [updateTime] OperationMetadata updateTime + * @interface IAsyncAnnotateFileResponse + * @property {google.cloud.vision.v1p2beta1.IOutputConfig|null} [outputConfig] AsyncAnnotateFileResponse outputConfig */ /** - * Constructs a new OperationMetadata. + * Constructs a new AsyncAnnotateFileResponse. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents an OperationMetadata. - * @implements IOperationMetadata + * @classdesc Represents an AsyncAnnotateFileResponse. + * @implements IAsyncAnnotateFileResponse * @constructor - * @param {google.cloud.vision.v1p2beta1.IOperationMetadata=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.IAsyncAnnotateFileResponse=} [properties] Properties to set */ - function OperationMetadata(properties) { + function AsyncAnnotateFileResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -44908,101 +44398,75 @@ } /** - * OperationMetadata state. - * @member {google.cloud.vision.v1p2beta1.OperationMetadata.State} state - * @memberof google.cloud.vision.v1p2beta1.OperationMetadata - * @instance - */ - OperationMetadata.prototype.state = 0; - - /** - * OperationMetadata createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.vision.v1p2beta1.OperationMetadata - * @instance - */ - OperationMetadata.prototype.createTime = null; - - /** - * OperationMetadata updateTime. - * @member {google.protobuf.ITimestamp|null|undefined} updateTime - * @memberof google.cloud.vision.v1p2beta1.OperationMetadata + * AsyncAnnotateFileResponse outputConfig. + * @member {google.cloud.vision.v1p2beta1.IOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse * @instance */ - OperationMetadata.prototype.updateTime = null; + AsyncAnnotateFileResponse.prototype.outputConfig = null; /** - * Creates a new OperationMetadata instance using the specified properties. + * Creates a new AsyncAnnotateFileResponse instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.OperationMetadata + * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse * @static - * @param {google.cloud.vision.v1p2beta1.IOperationMetadata=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.OperationMetadata} OperationMetadata instance + * @param {google.cloud.vision.v1p2beta1.IAsyncAnnotateFileResponse=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse instance */ - OperationMetadata.create = function create(properties) { - return new OperationMetadata(properties); + AsyncAnnotateFileResponse.create = function create(properties) { + return new AsyncAnnotateFileResponse(properties); }; /** - * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.vision.v1p2beta1.OperationMetadata.verify|verify} messages. + * Encodes the specified AsyncAnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.OperationMetadata + * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse * @static - * @param {google.cloud.vision.v1p2beta1.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IAsyncAnnotateFileResponse} message AsyncAnnotateFileResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OperationMetadata.encode = function encode(message, writer) { + AsyncAnnotateFileResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.state != null && message.hasOwnProperty("state")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); - if (message.createTime != null && message.hasOwnProperty("createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.updateTime != null && message.hasOwnProperty("updateTime")) - $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + $root.google.cloud.vision.v1p2beta1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.OperationMetadata.verify|verify} messages. + * Encodes the specified AsyncAnnotateFileResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.OperationMetadata + * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse * @static - * @param {google.cloud.vision.v1p2beta1.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IAsyncAnnotateFileResponse} message AsyncAnnotateFileResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + AsyncAnnotateFileResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an OperationMetadata message from the specified reader or buffer. + * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.OperationMetadata + * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.OperationMetadata} OperationMetadata + * @returns {google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OperationMetadata.decode = function decode(reader, length) { + AsyncAnnotateFileResponse.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.vision.v1p2beta1.OperationMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.state = reader.int32(); - break; - case 5: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 6: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.outputConfig = $root.google.cloud.vision.v1p2beta1.OutputConfig.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -45013,205 +44477,113 @@ }; /** - * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. + * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.OperationMetadata + * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.OperationMetadata} OperationMetadata + * @returns {google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OperationMetadata.decodeDelimited = function decodeDelimited(reader) { + AsyncAnnotateFileResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an OperationMetadata message. + * Verifies an AsyncAnnotateFileResponse message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.OperationMetadata + * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - OperationMetadata.verify = function verify(message) { + AsyncAnnotateFileResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.state != null && message.hasOwnProperty("state")) - switch (message.state) { - default: - return "state: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; - } - if (message.createTime != null && message.hasOwnProperty("createTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.createTime); - if (error) - return "createTime." + error; - } - if (message.updateTime != null && message.hasOwnProperty("updateTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + var error = $root.google.cloud.vision.v1p2beta1.OutputConfig.verify(message.outputConfig); if (error) - return "updateTime." + error; + return "outputConfig." + error; } return null; }; /** - * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. + * Creates an AsyncAnnotateFileResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.OperationMetadata + * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.OperationMetadata} OperationMetadata + * @returns {google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse */ - OperationMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.OperationMetadata) + AsyncAnnotateFileResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse) return object; - var message = new $root.google.cloud.vision.v1p2beta1.OperationMetadata(); - switch (object.state) { - case "STATE_UNSPECIFIED": - case 0: - message.state = 0; - break; - case "CREATED": - case 1: - message.state = 1; - break; - case "RUNNING": - case 2: - message.state = 2; - break; - case "DONE": - case 3: - message.state = 3; - break; - case "CANCELLED": - case 4: - message.state = 4; - break; - } - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.OperationMetadata.createTime: object expected"); - message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); - } - if (object.updateTime != null) { - if (typeof object.updateTime !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.OperationMetadata.updateTime: object expected"); - message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + var message = new $root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse(); + if (object.outputConfig != null) { + if (typeof object.outputConfig !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse.outputConfig: object expected"); + message.outputConfig = $root.google.cloud.vision.v1p2beta1.OutputConfig.fromObject(object.outputConfig); } return message; }; /** - * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. + * Creates a plain object from an AsyncAnnotateFileResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.OperationMetadata + * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse * @static - * @param {google.cloud.vision.v1p2beta1.OperationMetadata} message OperationMetadata + * @param {google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse} message AsyncAnnotateFileResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - OperationMetadata.toObject = function toObject(message, options) { + AsyncAnnotateFileResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; - object.createTime = null; - object.updateTime = null; - } - if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.vision.v1p2beta1.OperationMetadata.State[message.state] : message.state; - if (message.createTime != null && message.hasOwnProperty("createTime")) - object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); - if (message.updateTime != null && message.hasOwnProperty("updateTime")) - object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (options.defaults) + object.outputConfig = null; + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + object.outputConfig = $root.google.cloud.vision.v1p2beta1.OutputConfig.toObject(message.outputConfig, options); return object; }; /** - * Converts this OperationMetadata to JSON. + * Converts this AsyncAnnotateFileResponse to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.OperationMetadata + * @memberof google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse * @instance * @returns {Object.} JSON object */ - OperationMetadata.prototype.toJSON = function toJSON() { + AsyncAnnotateFileResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * State enum. - * @name google.cloud.vision.v1p2beta1.OperationMetadata.State - * @enum {string} - * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value - * @property {number} CREATED=1 CREATED value - * @property {number} RUNNING=2 RUNNING value - * @property {number} DONE=3 DONE value - * @property {number} CANCELLED=4 CANCELLED value - */ - OperationMetadata.State = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; - values[valuesById[1] = "CREATED"] = 1; - values[valuesById[2] = "RUNNING"] = 2; - values[valuesById[3] = "DONE"] = 3; - values[valuesById[4] = "CANCELLED"] = 4; - return values; - })(); - - return OperationMetadata; - })(); - - /** - * Likelihood enum. - * @name google.cloud.vision.v1p2beta1.Likelihood - * @enum {string} - * @property {number} UNKNOWN=0 UNKNOWN value - * @property {number} VERY_UNLIKELY=1 VERY_UNLIKELY value - * @property {number} UNLIKELY=2 UNLIKELY value - * @property {number} POSSIBLE=3 POSSIBLE value - * @property {number} LIKELY=4 LIKELY value - * @property {number} VERY_LIKELY=5 VERY_LIKELY value - */ - v1p2beta1.Likelihood = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "UNKNOWN"] = 0; - values[valuesById[1] = "VERY_UNLIKELY"] = 1; - values[valuesById[2] = "UNLIKELY"] = 2; - values[valuesById[3] = "POSSIBLE"] = 3; - values[valuesById[4] = "LIKELY"] = 4; - values[valuesById[5] = "VERY_LIKELY"] = 5; - return values; + return AsyncAnnotateFileResponse; })(); - v1p2beta1.Vertex = (function() { + v1p2beta1.AsyncBatchAnnotateFilesRequest = (function() { /** - * Properties of a Vertex. + * Properties of an AsyncBatchAnnotateFilesRequest. * @memberof google.cloud.vision.v1p2beta1 - * @interface IVertex - * @property {number|null} [x] Vertex x - * @property {number|null} [y] Vertex y + * @interface IAsyncBatchAnnotateFilesRequest + * @property {Array.|null} [requests] AsyncBatchAnnotateFilesRequest requests */ /** - * Constructs a new Vertex. + * Constructs a new AsyncBatchAnnotateFilesRequest. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a Vertex. - * @implements IVertex + * @classdesc Represents an AsyncBatchAnnotateFilesRequest. + * @implements IAsyncBatchAnnotateFilesRequest * @constructor - * @param {google.cloud.vision.v1p2beta1.IVertex=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesRequest=} [properties] Properties to set */ - function Vertex(properties) { + function AsyncBatchAnnotateFilesRequest(properties) { + this.requests = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -45219,88 +44591,78 @@ } /** - * Vertex x. - * @member {number} x - * @memberof google.cloud.vision.v1p2beta1.Vertex - * @instance - */ - Vertex.prototype.x = 0; - - /** - * Vertex y. - * @member {number} y - * @memberof google.cloud.vision.v1p2beta1.Vertex + * AsyncBatchAnnotateFilesRequest requests. + * @member {Array.} requests + * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest * @instance */ - Vertex.prototype.y = 0; + AsyncBatchAnnotateFilesRequest.prototype.requests = $util.emptyArray; /** - * Creates a new Vertex instance using the specified properties. + * Creates a new AsyncBatchAnnotateFilesRequest instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.Vertex + * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest * @static - * @param {google.cloud.vision.v1p2beta1.IVertex=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.Vertex} Vertex instance + * @param {google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesRequest=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest instance */ - Vertex.create = function create(properties) { - return new Vertex(properties); + AsyncBatchAnnotateFilesRequest.create = function create(properties) { + return new AsyncBatchAnnotateFilesRequest(properties); }; /** - * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Vertex.verify|verify} messages. + * Encodes the specified AsyncBatchAnnotateFilesRequest message. Does not implicitly {@link google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.Vertex + * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest * @static - * @param {google.cloud.vision.v1p2beta1.IVertex} message Vertex message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesRequest} message AsyncBatchAnnotateFilesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Vertex.encode = function encode(message, writer) { + AsyncBatchAnnotateFilesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.x != null && message.hasOwnProperty("x")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.x); - if (message.y != null && message.hasOwnProperty("y")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.y); + if (message.requests != null && message.requests.length) + for (var i = 0; i < message.requests.length; ++i) + $root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.Vertex.verify|verify} messages. + * Encodes the specified AsyncBatchAnnotateFilesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.Vertex + * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest * @static - * @param {google.cloud.vision.v1p2beta1.IVertex} message Vertex message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesRequest} message AsyncBatchAnnotateFilesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Vertex.encodeDelimited = function encodeDelimited(message, writer) { + AsyncBatchAnnotateFilesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Vertex message from the specified reader or buffer. + * Decodes an AsyncBatchAnnotateFilesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.Vertex + * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.Vertex} Vertex + * @returns {google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Vertex.decode = function decode(reader, length) { + AsyncBatchAnnotateFilesRequest.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.vision.v1p2beta1.Vertex(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.x = reader.int32(); - break; - case 2: - message.y = reader.int32(); + if (!(message.requests && message.requests.length)) + message.requests = []; + message.requests.push($root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -45311,117 +44673,125 @@ }; /** - * Decodes a Vertex message from the specified reader or buffer, length delimited. + * Decodes an AsyncBatchAnnotateFilesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.Vertex + * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.Vertex} Vertex + * @returns {google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Vertex.decodeDelimited = function decodeDelimited(reader) { + AsyncBatchAnnotateFilesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Vertex message. + * Verifies an AsyncBatchAnnotateFilesRequest message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.Vertex + * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Vertex.verify = function verify(message) { + AsyncBatchAnnotateFilesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.x != null && message.hasOwnProperty("x")) - if (!$util.isInteger(message.x)) - return "x: integer expected"; - if (message.y != null && message.hasOwnProperty("y")) - if (!$util.isInteger(message.y)) - return "y: integer expected"; + if (message.requests != null && message.hasOwnProperty("requests")) { + if (!Array.isArray(message.requests)) + return "requests: array expected"; + for (var i = 0; i < message.requests.length; ++i) { + var error = $root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest.verify(message.requests[i]); + if (error) + return "requests." + error; + } + } return null; }; /** - * Creates a Vertex message from a plain object. Also converts values to their respective internal types. + * Creates an AsyncBatchAnnotateFilesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.Vertex + * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.Vertex} Vertex + * @returns {google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest */ - Vertex.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.Vertex) + AsyncBatchAnnotateFilesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest) return object; - var message = new $root.google.cloud.vision.v1p2beta1.Vertex(); - if (object.x != null) - message.x = object.x | 0; - if (object.y != null) - message.y = object.y | 0; + var message = new $root.google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest(); + if (object.requests) { + if (!Array.isArray(object.requests)) + throw TypeError(".google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest.requests: array expected"); + message.requests = []; + for (var i = 0; i < object.requests.length; ++i) { + if (typeof object.requests[i] !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest.requests: object expected"); + message.requests[i] = $root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest.fromObject(object.requests[i]); + } + } return message; }; /** - * Creates a plain object from a Vertex message. Also converts values to other types if specified. + * Creates a plain object from an AsyncBatchAnnotateFilesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.Vertex + * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest * @static - * @param {google.cloud.vision.v1p2beta1.Vertex} message Vertex + * @param {google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest} message AsyncBatchAnnotateFilesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Vertex.toObject = function toObject(message, options) { + AsyncBatchAnnotateFilesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.x = 0; - object.y = 0; + if (options.arrays || options.defaults) + object.requests = []; + if (message.requests && message.requests.length) { + object.requests = []; + for (var j = 0; j < message.requests.length; ++j) + object.requests[j] = $root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest.toObject(message.requests[j], options); } - if (message.x != null && message.hasOwnProperty("x")) - object.x = message.x; - if (message.y != null && message.hasOwnProperty("y")) - object.y = message.y; return object; }; /** - * Converts this Vertex to JSON. + * Converts this AsyncBatchAnnotateFilesRequest to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.Vertex + * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest * @instance * @returns {Object.} JSON object */ - Vertex.prototype.toJSON = function toJSON() { + AsyncBatchAnnotateFilesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Vertex; + return AsyncBatchAnnotateFilesRequest; })(); - v1p2beta1.NormalizedVertex = (function() { + v1p2beta1.AsyncBatchAnnotateFilesResponse = (function() { /** - * Properties of a NormalizedVertex. + * Properties of an AsyncBatchAnnotateFilesResponse. * @memberof google.cloud.vision.v1p2beta1 - * @interface INormalizedVertex - * @property {number|null} [x] NormalizedVertex x - * @property {number|null} [y] NormalizedVertex y + * @interface IAsyncBatchAnnotateFilesResponse + * @property {Array.|null} [responses] AsyncBatchAnnotateFilesResponse responses */ /** - * Constructs a new NormalizedVertex. + * Constructs a new AsyncBatchAnnotateFilesResponse. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a NormalizedVertex. - * @implements INormalizedVertex + * @classdesc Represents an AsyncBatchAnnotateFilesResponse. + * @implements IAsyncBatchAnnotateFilesResponse * @constructor - * @param {google.cloud.vision.v1p2beta1.INormalizedVertex=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesResponse=} [properties] Properties to set */ - function NormalizedVertex(properties) { + function AsyncBatchAnnotateFilesResponse(properties) { + this.responses = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -45429,88 +44799,78 @@ } /** - * NormalizedVertex x. - * @member {number} x - * @memberof google.cloud.vision.v1p2beta1.NormalizedVertex - * @instance - */ - NormalizedVertex.prototype.x = 0; - - /** - * NormalizedVertex y. - * @member {number} y - * @memberof google.cloud.vision.v1p2beta1.NormalizedVertex + * AsyncBatchAnnotateFilesResponse responses. + * @member {Array.} responses + * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse * @instance */ - NormalizedVertex.prototype.y = 0; + AsyncBatchAnnotateFilesResponse.prototype.responses = $util.emptyArray; /** - * Creates a new NormalizedVertex instance using the specified properties. + * Creates a new AsyncBatchAnnotateFilesResponse instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.NormalizedVertex + * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse * @static - * @param {google.cloud.vision.v1p2beta1.INormalizedVertex=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.NormalizedVertex} NormalizedVertex instance + * @param {google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesResponse=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse instance */ - NormalizedVertex.create = function create(properties) { - return new NormalizedVertex(properties); + AsyncBatchAnnotateFilesResponse.create = function create(properties) { + return new AsyncBatchAnnotateFilesResponse(properties); }; /** - * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.vision.v1p2beta1.NormalizedVertex.verify|verify} messages. + * Encodes the specified AsyncBatchAnnotateFilesResponse message. Does not implicitly {@link google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.NormalizedVertex + * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse * @static - * @param {google.cloud.vision.v1p2beta1.INormalizedVertex} message NormalizedVertex message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesResponse} message AsyncBatchAnnotateFilesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - NormalizedVertex.encode = function encode(message, writer) { + AsyncBatchAnnotateFilesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.x != null && message.hasOwnProperty("x")) - writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); - if (message.y != null && message.hasOwnProperty("y")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); + if (message.responses != null && message.responses.length) + for (var i = 0; i < message.responses.length; ++i) + $root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse.encode(message.responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified NormalizedVertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.NormalizedVertex.verify|verify} messages. + * Encodes the specified AsyncBatchAnnotateFilesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.NormalizedVertex + * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse * @static - * @param {google.cloud.vision.v1p2beta1.INormalizedVertex} message NormalizedVertex message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesResponse} message AsyncBatchAnnotateFilesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - NormalizedVertex.encodeDelimited = function encodeDelimited(message, writer) { + AsyncBatchAnnotateFilesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a NormalizedVertex message from the specified reader or buffer. + * Decodes an AsyncBatchAnnotateFilesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.NormalizedVertex + * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.NormalizedVertex} NormalizedVertex + * @returns {google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - NormalizedVertex.decode = function decode(reader, length) { + AsyncBatchAnnotateFilesResponse.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.vision.v1p2beta1.NormalizedVertex(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.x = reader.float(); - break; - case 2: - message.y = reader.float(); + if (!(message.responses && message.responses.length)) + message.responses = []; + message.responses.push($root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -45521,119 +44881,125 @@ }; /** - * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. + * Decodes an AsyncBatchAnnotateFilesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.NormalizedVertex + * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.NormalizedVertex} NormalizedVertex + * @returns {google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - NormalizedVertex.decodeDelimited = function decodeDelimited(reader) { + AsyncBatchAnnotateFilesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a NormalizedVertex message. + * Verifies an AsyncBatchAnnotateFilesResponse message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.NormalizedVertex + * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - NormalizedVertex.verify = function verify(message) { + AsyncBatchAnnotateFilesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.x != null && message.hasOwnProperty("x")) - if (typeof message.x !== "number") - return "x: number expected"; - if (message.y != null && message.hasOwnProperty("y")) - if (typeof message.y !== "number") - return "y: number expected"; + if (message.responses != null && message.hasOwnProperty("responses")) { + if (!Array.isArray(message.responses)) + return "responses: array expected"; + for (var i = 0; i < message.responses.length; ++i) { + var error = $root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse.verify(message.responses[i]); + if (error) + return "responses." + error; + } + } return null; }; /** - * Creates a NormalizedVertex message from a plain object. Also converts values to their respective internal types. + * Creates an AsyncBatchAnnotateFilesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.NormalizedVertex + * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.NormalizedVertex} NormalizedVertex + * @returns {google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse */ - NormalizedVertex.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.NormalizedVertex) + AsyncBatchAnnotateFilesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse) return object; - var message = new $root.google.cloud.vision.v1p2beta1.NormalizedVertex(); - if (object.x != null) - message.x = Number(object.x); - if (object.y != null) - message.y = Number(object.y); + var message = new $root.google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse(); + if (object.responses) { + if (!Array.isArray(object.responses)) + throw TypeError(".google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse.responses: array expected"); + message.responses = []; + for (var i = 0; i < object.responses.length; ++i) { + if (typeof object.responses[i] !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse.responses: object expected"); + message.responses[i] = $root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse.fromObject(object.responses[i]); + } + } return message; }; /** - * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. + * Creates a plain object from an AsyncBatchAnnotateFilesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.NormalizedVertex + * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse * @static - * @param {google.cloud.vision.v1p2beta1.NormalizedVertex} message NormalizedVertex + * @param {google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse} message AsyncBatchAnnotateFilesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - NormalizedVertex.toObject = function toObject(message, options) { + AsyncBatchAnnotateFilesResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.x = 0; - object.y = 0; + if (options.arrays || options.defaults) + object.responses = []; + if (message.responses && message.responses.length) { + object.responses = []; + for (var j = 0; j < message.responses.length; ++j) + object.responses[j] = $root.google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse.toObject(message.responses[j], options); } - if (message.x != null && message.hasOwnProperty("x")) - object.x = options.json && !isFinite(message.x) ? String(message.x) : message.x; - if (message.y != null && message.hasOwnProperty("y")) - object.y = options.json && !isFinite(message.y) ? String(message.y) : message.y; return object; }; /** - * Converts this NormalizedVertex to JSON. + * Converts this AsyncBatchAnnotateFilesResponse to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.NormalizedVertex + * @memberof google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse * @instance * @returns {Object.} JSON object */ - NormalizedVertex.prototype.toJSON = function toJSON() { + AsyncBatchAnnotateFilesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return NormalizedVertex; + return AsyncBatchAnnotateFilesResponse; })(); - v1p2beta1.BoundingPoly = (function() { + v1p2beta1.InputConfig = (function() { /** - * Properties of a BoundingPoly. + * Properties of an InputConfig. * @memberof google.cloud.vision.v1p2beta1 - * @interface IBoundingPoly - * @property {Array.|null} [vertices] BoundingPoly vertices - * @property {Array.|null} [normalizedVertices] BoundingPoly normalizedVertices + * @interface IInputConfig + * @property {google.cloud.vision.v1p2beta1.IGcsSource|null} [gcsSource] InputConfig gcsSource + * @property {string|null} [mimeType] InputConfig mimeType */ /** - * Constructs a new BoundingPoly. + * Constructs a new InputConfig. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a BoundingPoly. - * @implements IBoundingPoly + * @classdesc Represents an InputConfig. + * @implements IInputConfig * @constructor - * @param {google.cloud.vision.v1p2beta1.IBoundingPoly=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.IInputConfig=} [properties] Properties to set */ - function BoundingPoly(properties) { - this.vertices = []; - this.normalizedVertices = []; + function InputConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -45641,94 +45007,88 @@ } /** - * BoundingPoly vertices. - * @member {Array.} vertices - * @memberof google.cloud.vision.v1p2beta1.BoundingPoly + * InputConfig gcsSource. + * @member {google.cloud.vision.v1p2beta1.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.vision.v1p2beta1.InputConfig * @instance */ - BoundingPoly.prototype.vertices = $util.emptyArray; + InputConfig.prototype.gcsSource = null; /** - * BoundingPoly normalizedVertices. - * @member {Array.} normalizedVertices - * @memberof google.cloud.vision.v1p2beta1.BoundingPoly + * InputConfig mimeType. + * @member {string} mimeType + * @memberof google.cloud.vision.v1p2beta1.InputConfig * @instance */ - BoundingPoly.prototype.normalizedVertices = $util.emptyArray; + InputConfig.prototype.mimeType = ""; /** - * Creates a new BoundingPoly instance using the specified properties. + * Creates a new InputConfig instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.BoundingPoly + * @memberof google.cloud.vision.v1p2beta1.InputConfig * @static - * @param {google.cloud.vision.v1p2beta1.IBoundingPoly=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.BoundingPoly} BoundingPoly instance + * @param {google.cloud.vision.v1p2beta1.IInputConfig=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.InputConfig} InputConfig instance */ - BoundingPoly.create = function create(properties) { - return new BoundingPoly(properties); + InputConfig.create = function create(properties) { + return new InputConfig(properties); }; /** - * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.vision.v1p2beta1.BoundingPoly.verify|verify} messages. + * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.vision.v1p2beta1.InputConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.BoundingPoly + * @memberof google.cloud.vision.v1p2beta1.InputConfig * @static - * @param {google.cloud.vision.v1p2beta1.IBoundingPoly} message BoundingPoly message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IInputConfig} message InputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BoundingPoly.encode = function encode(message, writer) { + InputConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.vertices != null && message.vertices.length) - for (var i = 0; i < message.vertices.length; ++i) - $root.google.cloud.vision.v1p2beta1.Vertex.encode(message.vertices[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.normalizedVertices != null && message.normalizedVertices.length) - for (var i = 0; i < message.normalizedVertices.length; ++i) - $root.google.cloud.vision.v1p2beta1.NormalizedVertex.encode(message.normalizedVertices[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) + $root.google.cloud.vision.v1p2beta1.GcsSource.encode(message.gcsSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimeType); return writer; }; /** - * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.BoundingPoly.verify|verify} messages. + * Encodes the specified InputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.InputConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.BoundingPoly + * @memberof google.cloud.vision.v1p2beta1.InputConfig * @static - * @param {google.cloud.vision.v1p2beta1.IBoundingPoly} message BoundingPoly message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IInputConfig} message InputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BoundingPoly.encodeDelimited = function encodeDelimited(message, writer) { + InputConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BoundingPoly message from the specified reader or buffer. + * Decodes an InputConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.BoundingPoly + * @memberof google.cloud.vision.v1p2beta1.InputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.BoundingPoly} BoundingPoly + * @returns {google.cloud.vision.v1p2beta1.InputConfig} InputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BoundingPoly.decode = function decode(reader, length) { + InputConfig.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.vision.v1p2beta1.BoundingPoly(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.InputConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.vertices && message.vertices.length)) - message.vertices = []; - message.vertices.push($root.google.cloud.vision.v1p2beta1.Vertex.decode(reader, reader.uint32())); + message.gcsSource = $root.google.cloud.vision.v1p2beta1.GcsSource.decode(reader, reader.uint32()); break; case 2: - if (!(message.normalizedVertices && message.normalizedVertices.length)) - message.normalizedVertices = []; - message.normalizedVertices.push($root.google.cloud.vision.v1p2beta1.NormalizedVertex.decode(reader, reader.uint32())); + message.mimeType = reader.string(); break; default: reader.skipType(tag & 7); @@ -45739,152 +45099,122 @@ }; /** - * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. + * Decodes an InputConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.BoundingPoly + * @memberof google.cloud.vision.v1p2beta1.InputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.BoundingPoly} BoundingPoly + * @returns {google.cloud.vision.v1p2beta1.InputConfig} InputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BoundingPoly.decodeDelimited = function decodeDelimited(reader) { + InputConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BoundingPoly message. + * Verifies an InputConfig message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.BoundingPoly + * @memberof google.cloud.vision.v1p2beta1.InputConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BoundingPoly.verify = function verify(message) { + InputConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.vertices != null && message.hasOwnProperty("vertices")) { - if (!Array.isArray(message.vertices)) - return "vertices: array expected"; - for (var i = 0; i < message.vertices.length; ++i) { - var error = $root.google.cloud.vision.v1p2beta1.Vertex.verify(message.vertices[i]); - if (error) - return "vertices." + error; - } - } - if (message.normalizedVertices != null && message.hasOwnProperty("normalizedVertices")) { - if (!Array.isArray(message.normalizedVertices)) - return "normalizedVertices: array expected"; - for (var i = 0; i < message.normalizedVertices.length; ++i) { - var error = $root.google.cloud.vision.v1p2beta1.NormalizedVertex.verify(message.normalizedVertices[i]); - if (error) - return "normalizedVertices." + error; - } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + var error = $root.google.cloud.vision.v1p2beta1.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; return null; }; /** - * Creates a BoundingPoly message from a plain object. Also converts values to their respective internal types. + * Creates an InputConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.BoundingPoly + * @memberof google.cloud.vision.v1p2beta1.InputConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.BoundingPoly} BoundingPoly + * @returns {google.cloud.vision.v1p2beta1.InputConfig} InputConfig */ - BoundingPoly.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.BoundingPoly) + InputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.InputConfig) return object; - var message = new $root.google.cloud.vision.v1p2beta1.BoundingPoly(); - if (object.vertices) { - if (!Array.isArray(object.vertices)) - throw TypeError(".google.cloud.vision.v1p2beta1.BoundingPoly.vertices: array expected"); - message.vertices = []; - for (var i = 0; i < object.vertices.length; ++i) { - if (typeof object.vertices[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.BoundingPoly.vertices: object expected"); - message.vertices[i] = $root.google.cloud.vision.v1p2beta1.Vertex.fromObject(object.vertices[i]); - } - } - if (object.normalizedVertices) { - if (!Array.isArray(object.normalizedVertices)) - throw TypeError(".google.cloud.vision.v1p2beta1.BoundingPoly.normalizedVertices: array expected"); - message.normalizedVertices = []; - for (var i = 0; i < object.normalizedVertices.length; ++i) { - if (typeof object.normalizedVertices[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.BoundingPoly.normalizedVertices: object expected"); - message.normalizedVertices[i] = $root.google.cloud.vision.v1p2beta1.NormalizedVertex.fromObject(object.normalizedVertices[i]); - } + var message = new $root.google.cloud.vision.v1p2beta1.InputConfig(); + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.InputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.vision.v1p2beta1.GcsSource.fromObject(object.gcsSource); } + if (object.mimeType != null) + message.mimeType = String(object.mimeType); return message; }; /** - * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. + * Creates a plain object from an InputConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.BoundingPoly + * @memberof google.cloud.vision.v1p2beta1.InputConfig * @static - * @param {google.cloud.vision.v1p2beta1.BoundingPoly} message BoundingPoly + * @param {google.cloud.vision.v1p2beta1.InputConfig} message InputConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BoundingPoly.toObject = function toObject(message, options) { + InputConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.vertices = []; - object.normalizedVertices = []; - } - if (message.vertices && message.vertices.length) { - object.vertices = []; - for (var j = 0; j < message.vertices.length; ++j) - object.vertices[j] = $root.google.cloud.vision.v1p2beta1.Vertex.toObject(message.vertices[j], options); - } - if (message.normalizedVertices && message.normalizedVertices.length) { - object.normalizedVertices = []; - for (var j = 0; j < message.normalizedVertices.length; ++j) - object.normalizedVertices[j] = $root.google.cloud.vision.v1p2beta1.NormalizedVertex.toObject(message.normalizedVertices[j], options); + if (options.defaults) { + object.gcsSource = null; + object.mimeType = ""; } + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) + object.gcsSource = $root.google.cloud.vision.v1p2beta1.GcsSource.toObject(message.gcsSource, options); + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; return object; }; /** - * Converts this BoundingPoly to JSON. + * Converts this InputConfig to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.BoundingPoly + * @memberof google.cloud.vision.v1p2beta1.InputConfig * @instance * @returns {Object.} JSON object */ - BoundingPoly.prototype.toJSON = function toJSON() { + InputConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BoundingPoly; + return InputConfig; })(); - v1p2beta1.Position = (function() { + v1p2beta1.OutputConfig = (function() { /** - * Properties of a Position. + * Properties of an OutputConfig. * @memberof google.cloud.vision.v1p2beta1 - * @interface IPosition - * @property {number|null} [x] Position x - * @property {number|null} [y] Position y - * @property {number|null} [z] Position z + * @interface IOutputConfig + * @property {google.cloud.vision.v1p2beta1.IGcsDestination|null} [gcsDestination] OutputConfig gcsDestination + * @property {number|null} [batchSize] OutputConfig batchSize */ /** - * Constructs a new Position. + * Constructs a new OutputConfig. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a Position. - * @implements IPosition + * @classdesc Represents an OutputConfig. + * @implements IOutputConfig * @constructor - * @param {google.cloud.vision.v1p2beta1.IPosition=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.IOutputConfig=} [properties] Properties to set */ - function Position(properties) { + function OutputConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -45892,101 +45222,88 @@ } /** - * Position x. - * @member {number} x - * @memberof google.cloud.vision.v1p2beta1.Position - * @instance - */ - Position.prototype.x = 0; - - /** - * Position y. - * @member {number} y - * @memberof google.cloud.vision.v1p2beta1.Position + * OutputConfig gcsDestination. + * @member {google.cloud.vision.v1p2beta1.IGcsDestination|null|undefined} gcsDestination + * @memberof google.cloud.vision.v1p2beta1.OutputConfig * @instance */ - Position.prototype.y = 0; + OutputConfig.prototype.gcsDestination = null; /** - * Position z. - * @member {number} z - * @memberof google.cloud.vision.v1p2beta1.Position + * OutputConfig batchSize. + * @member {number} batchSize + * @memberof google.cloud.vision.v1p2beta1.OutputConfig * @instance */ - Position.prototype.z = 0; + OutputConfig.prototype.batchSize = 0; /** - * Creates a new Position instance using the specified properties. + * Creates a new OutputConfig instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.Position + * @memberof google.cloud.vision.v1p2beta1.OutputConfig * @static - * @param {google.cloud.vision.v1p2beta1.IPosition=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.Position} Position instance + * @param {google.cloud.vision.v1p2beta1.IOutputConfig=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.OutputConfig} OutputConfig instance */ - Position.create = function create(properties) { - return new Position(properties); + OutputConfig.create = function create(properties) { + return new OutputConfig(properties); }; /** - * Encodes the specified Position message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Position.verify|verify} messages. + * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.vision.v1p2beta1.OutputConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.Position + * @memberof google.cloud.vision.v1p2beta1.OutputConfig * @static - * @param {google.cloud.vision.v1p2beta1.IPosition} message Position message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IOutputConfig} message OutputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Position.encode = function encode(message, writer) { + OutputConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.x != null && message.hasOwnProperty("x")) - writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); - if (message.y != null && message.hasOwnProperty("y")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); - if (message.z != null && message.hasOwnProperty("z")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.z); + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) + $root.google.cloud.vision.v1p2beta1.GcsDestination.encode(message.gcsDestination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.batchSize != null && message.hasOwnProperty("batchSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.batchSize); return writer; }; /** - * Encodes the specified Position message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.Position.verify|verify} messages. + * Encodes the specified OutputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.OutputConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.Position + * @memberof google.cloud.vision.v1p2beta1.OutputConfig * @static - * @param {google.cloud.vision.v1p2beta1.IPosition} message Position message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IOutputConfig} message OutputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Position.encodeDelimited = function encodeDelimited(message, writer) { + OutputConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Position message from the specified reader or buffer. + * Decodes an OutputConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.Position + * @memberof google.cloud.vision.v1p2beta1.OutputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.Position} Position + * @returns {google.cloud.vision.v1p2beta1.OutputConfig} OutputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Position.decode = function decode(reader, length) { + OutputConfig.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.vision.v1p2beta1.Position(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.OutputConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.x = reader.float(); + message.gcsDestination = $root.google.cloud.vision.v1p2beta1.GcsDestination.decode(reader, reader.uint32()); break; case 2: - message.y = reader.float(); - break; - case 3: - message.z = reader.float(); + message.batchSize = reader.int32(); break; default: reader.skipType(tag & 7); @@ -45997,126 +45314,121 @@ }; /** - * Decodes a Position message from the specified reader or buffer, length delimited. + * Decodes an OutputConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.Position + * @memberof google.cloud.vision.v1p2beta1.OutputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.Position} Position + * @returns {google.cloud.vision.v1p2beta1.OutputConfig} OutputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Position.decodeDelimited = function decodeDelimited(reader) { + OutputConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Position message. + * Verifies an OutputConfig message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.Position + * @memberof google.cloud.vision.v1p2beta1.OutputConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Position.verify = function verify(message) { + OutputConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.x != null && message.hasOwnProperty("x")) - if (typeof message.x !== "number") - return "x: number expected"; - if (message.y != null && message.hasOwnProperty("y")) - if (typeof message.y !== "number") - return "y: number expected"; - if (message.z != null && message.hasOwnProperty("z")) - if (typeof message.z !== "number") - return "z: number expected"; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { + var error = $root.google.cloud.vision.v1p2beta1.GcsDestination.verify(message.gcsDestination); + if (error) + return "gcsDestination." + error; + } + if (message.batchSize != null && message.hasOwnProperty("batchSize")) + if (!$util.isInteger(message.batchSize)) + return "batchSize: integer expected"; return null; }; /** - * Creates a Position message from a plain object. Also converts values to their respective internal types. + * Creates an OutputConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.Position + * @memberof google.cloud.vision.v1p2beta1.OutputConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.Position} Position + * @returns {google.cloud.vision.v1p2beta1.OutputConfig} OutputConfig */ - Position.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.Position) + OutputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.OutputConfig) return object; - var message = new $root.google.cloud.vision.v1p2beta1.Position(); - if (object.x != null) - message.x = Number(object.x); - if (object.y != null) - message.y = Number(object.y); - if (object.z != null) - message.z = Number(object.z); + var message = new $root.google.cloud.vision.v1p2beta1.OutputConfig(); + if (object.gcsDestination != null) { + if (typeof object.gcsDestination !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.OutputConfig.gcsDestination: object expected"); + message.gcsDestination = $root.google.cloud.vision.v1p2beta1.GcsDestination.fromObject(object.gcsDestination); + } + if (object.batchSize != null) + message.batchSize = object.batchSize | 0; return message; }; /** - * Creates a plain object from a Position message. Also converts values to other types if specified. + * Creates a plain object from an OutputConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.Position + * @memberof google.cloud.vision.v1p2beta1.OutputConfig * @static - * @param {google.cloud.vision.v1p2beta1.Position} message Position + * @param {google.cloud.vision.v1p2beta1.OutputConfig} message OutputConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Position.toObject = function toObject(message, options) { + OutputConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.x = 0; - object.y = 0; - object.z = 0; + object.gcsDestination = null; + object.batchSize = 0; } - if (message.x != null && message.hasOwnProperty("x")) - object.x = options.json && !isFinite(message.x) ? String(message.x) : message.x; - if (message.y != null && message.hasOwnProperty("y")) - object.y = options.json && !isFinite(message.y) ? String(message.y) : message.y; - if (message.z != null && message.hasOwnProperty("z")) - object.z = options.json && !isFinite(message.z) ? String(message.z) : message.z; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) + object.gcsDestination = $root.google.cloud.vision.v1p2beta1.GcsDestination.toObject(message.gcsDestination, options); + if (message.batchSize != null && message.hasOwnProperty("batchSize")) + object.batchSize = message.batchSize; return object; }; /** - * Converts this Position to JSON. + * Converts this OutputConfig to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.Position + * @memberof google.cloud.vision.v1p2beta1.OutputConfig * @instance * @returns {Object.} JSON object */ - Position.prototype.toJSON = function toJSON() { + OutputConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Position; + return OutputConfig; })(); - v1p2beta1.TextAnnotation = (function() { + v1p2beta1.GcsSource = (function() { /** - * Properties of a TextAnnotation. + * Properties of a GcsSource. * @memberof google.cloud.vision.v1p2beta1 - * @interface ITextAnnotation - * @property {Array.|null} [pages] TextAnnotation pages - * @property {string|null} [text] TextAnnotation text + * @interface IGcsSource + * @property {string|null} [uri] GcsSource uri */ /** - * Constructs a new TextAnnotation. + * Constructs a new GcsSource. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a TextAnnotation. - * @implements ITextAnnotation + * @classdesc Represents a GcsSource. + * @implements IGcsSource * @constructor - * @param {google.cloud.vision.v1p2beta1.ITextAnnotation=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.IGcsSource=} [properties] Properties to set */ - function TextAnnotation(properties) { - this.pages = []; + function GcsSource(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -46124,91 +45436,75 @@ } /** - * TextAnnotation pages. - * @member {Array.} pages - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation - * @instance - */ - TextAnnotation.prototype.pages = $util.emptyArray; - - /** - * TextAnnotation text. - * @member {string} text - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation + * GcsSource uri. + * @member {string} uri + * @memberof google.cloud.vision.v1p2beta1.GcsSource * @instance */ - TextAnnotation.prototype.text = ""; + GcsSource.prototype.uri = ""; /** - * Creates a new TextAnnotation instance using the specified properties. + * Creates a new GcsSource instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation + * @memberof google.cloud.vision.v1p2beta1.GcsSource * @static - * @param {google.cloud.vision.v1p2beta1.ITextAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.TextAnnotation} TextAnnotation instance + * @param {google.cloud.vision.v1p2beta1.IGcsSource=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.GcsSource} GcsSource instance */ - TextAnnotation.create = function create(properties) { - return new TextAnnotation(properties); + GcsSource.create = function create(properties) { + return new GcsSource(properties); }; /** - * Encodes the specified TextAnnotation message. Does not implicitly {@link google.cloud.vision.v1p2beta1.TextAnnotation.verify|verify} messages. + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.vision.v1p2beta1.GcsSource.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation + * @memberof google.cloud.vision.v1p2beta1.GcsSource * @static - * @param {google.cloud.vision.v1p2beta1.ITextAnnotation} message TextAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IGcsSource} message GcsSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - TextAnnotation.encode = function encode(message, writer) { + GcsSource.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.pages != null && message.pages.length) - for (var i = 0; i < message.pages.length; ++i) - $root.google.cloud.vision.v1p2beta1.Page.encode(message.pages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.text != null && message.hasOwnProperty("text")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.text); + if (message.uri != null && message.hasOwnProperty("uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); return writer; }; /** - * Encodes the specified TextAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.TextAnnotation.verify|verify} messages. + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.GcsSource.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation + * @memberof google.cloud.vision.v1p2beta1.GcsSource * @static - * @param {google.cloud.vision.v1p2beta1.ITextAnnotation} message TextAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IGcsSource} message GcsSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - TextAnnotation.encodeDelimited = function encodeDelimited(message, writer) { + GcsSource.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a TextAnnotation message from the specified reader or buffer. + * Decodes a GcsSource message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation + * @memberof google.cloud.vision.v1p2beta1.GcsSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.TextAnnotation} TextAnnotation + * @returns {google.cloud.vision.v1p2beta1.GcsSource} GcsSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - TextAnnotation.decode = function decode(reader, length) { + GcsSource.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.vision.v1p2beta1.TextAnnotation(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.GcsSource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.pages && message.pages.length)) - message.pages = []; - message.pages.push($root.google.cloud.vision.v1p2beta1.Page.decode(reader, reader.uint32())); - break; - case 2: - message.text = reader.string(); + message.uri = reader.string(); break; default: reader.skipType(tag & 7); @@ -46219,980 +45515,398 @@ }; /** - * Decodes a TextAnnotation message from the specified reader or buffer, length delimited. + * Decodes a GcsSource message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation + * @memberof google.cloud.vision.v1p2beta1.GcsSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.TextAnnotation} TextAnnotation + * @returns {google.cloud.vision.v1p2beta1.GcsSource} GcsSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - TextAnnotation.decodeDelimited = function decodeDelimited(reader) { + GcsSource.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a TextAnnotation message. + * Verifies a GcsSource message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation + * @memberof google.cloud.vision.v1p2beta1.GcsSource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - TextAnnotation.verify = function verify(message) { + GcsSource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.pages != null && message.hasOwnProperty("pages")) { - if (!Array.isArray(message.pages)) - return "pages: array expected"; - for (var i = 0; i < message.pages.length; ++i) { - var error = $root.google.cloud.vision.v1p2beta1.Page.verify(message.pages[i]); - if (error) - return "pages." + error; - } - } - if (message.text != null && message.hasOwnProperty("text")) - if (!$util.isString(message.text)) - return "text: string expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; return null; }; /** - * Creates a TextAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation + * @memberof google.cloud.vision.v1p2beta1.GcsSource * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.TextAnnotation} TextAnnotation + * @returns {google.cloud.vision.v1p2beta1.GcsSource} GcsSource */ - TextAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.TextAnnotation) + GcsSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.GcsSource) return object; - var message = new $root.google.cloud.vision.v1p2beta1.TextAnnotation(); - if (object.pages) { - if (!Array.isArray(object.pages)) - throw TypeError(".google.cloud.vision.v1p2beta1.TextAnnotation.pages: array expected"); - message.pages = []; - for (var i = 0; i < object.pages.length; ++i) { - if (typeof object.pages[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.TextAnnotation.pages: object expected"); - message.pages[i] = $root.google.cloud.vision.v1p2beta1.Page.fromObject(object.pages[i]); - } - } - if (object.text != null) - message.text = String(object.text); + var message = new $root.google.cloud.vision.v1p2beta1.GcsSource(); + if (object.uri != null) + message.uri = String(object.uri); return message; }; /** - * Creates a plain object from a TextAnnotation message. Also converts values to other types if specified. + * Creates a plain object from a GcsSource message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation + * @memberof google.cloud.vision.v1p2beta1.GcsSource * @static - * @param {google.cloud.vision.v1p2beta1.TextAnnotation} message TextAnnotation + * @param {google.cloud.vision.v1p2beta1.GcsSource} message GcsSource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - TextAnnotation.toObject = function toObject(message, options) { + GcsSource.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.pages = []; if (options.defaults) - object.text = ""; - if (message.pages && message.pages.length) { - object.pages = []; - for (var j = 0; j < message.pages.length; ++j) - object.pages[j] = $root.google.cloud.vision.v1p2beta1.Page.toObject(message.pages[j], options); - } - if (message.text != null && message.hasOwnProperty("text")) - object.text = message.text; + object.uri = ""; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; return object; }; /** - * Converts this TextAnnotation to JSON. + * Converts this GcsSource to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation + * @memberof google.cloud.vision.v1p2beta1.GcsSource * @instance * @returns {Object.} JSON object */ - TextAnnotation.prototype.toJSON = function toJSON() { + GcsSource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - TextAnnotation.DetectedLanguage = (function() { - - /** - * Properties of a DetectedLanguage. - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation - * @interface IDetectedLanguage - * @property {string|null} [languageCode] DetectedLanguage languageCode - * @property {number|null} [confidence] DetectedLanguage confidence - */ + return GcsSource; + })(); - /** - * Constructs a new DetectedLanguage. - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation - * @classdesc Represents a DetectedLanguage. - * @implements IDetectedLanguage - * @constructor - * @param {google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedLanguage=} [properties] Properties to set - */ - function DetectedLanguage(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]]; - } + v1p2beta1.GcsDestination = (function() { - /** - * DetectedLanguage languageCode. - * @member {string} languageCode - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage - * @instance - */ - DetectedLanguage.prototype.languageCode = ""; + /** + * Properties of a GcsDestination. + * @memberof google.cloud.vision.v1p2beta1 + * @interface IGcsDestination + * @property {string|null} [uri] GcsDestination uri + */ - /** - * DetectedLanguage confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage - * @instance - */ - DetectedLanguage.prototype.confidence = 0; + /** + * Constructs a new GcsDestination. + * @memberof google.cloud.vision.v1p2beta1 + * @classdesc Represents a GcsDestination. + * @implements IGcsDestination + * @constructor + * @param {google.cloud.vision.v1p2beta1.IGcsDestination=} [properties] Properties to set + */ + function GcsDestination(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Creates a new DetectedLanguage instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage - * @static - * @param {google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedLanguage=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage} DetectedLanguage instance - */ - DetectedLanguage.create = function create(properties) { - return new DetectedLanguage(properties); - }; + /** + * GcsDestination uri. + * @member {string} uri + * @memberof google.cloud.vision.v1p2beta1.GcsDestination + * @instance + */ + GcsDestination.prototype.uri = ""; - /** - * Encodes the specified DetectedLanguage message. Does not implicitly {@link google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage - * @static - * @param {google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedLanguage} message DetectedLanguage message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DetectedLanguage.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.languageCode != null && message.hasOwnProperty("languageCode")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.languageCode); - if (message.confidence != null && message.hasOwnProperty("confidence")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); - return writer; - }; + /** + * Creates a new GcsDestination instance using the specified properties. + * @function create + * @memberof google.cloud.vision.v1p2beta1.GcsDestination + * @static + * @param {google.cloud.vision.v1p2beta1.IGcsDestination=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.GcsDestination} GcsDestination instance + */ + GcsDestination.create = function create(properties) { + return new GcsDestination(properties); + }; - /** - * Encodes the specified DetectedLanguage message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage - * @static - * @param {google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedLanguage} message DetectedLanguage message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DetectedLanguage.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.vision.v1p2beta1.GcsDestination.verify|verify} messages. + * @function encode + * @memberof google.cloud.vision.v1p2beta1.GcsDestination + * @static + * @param {google.cloud.vision.v1p2beta1.IGcsDestination} message GcsDestination message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsDestination.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uri != null && message.hasOwnProperty("uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + return writer; + }; - /** - * Decodes a DetectedLanguage message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage} DetectedLanguage - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DetectedLanguage.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.vision.v1p2beta1.TextAnnotation.DetectedLanguage(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.languageCode = reader.string(); - break; - case 2: - message.confidence = reader.float(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.GcsDestination.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.vision.v1p2beta1.GcsDestination + * @static + * @param {google.cloud.vision.v1p2beta1.IGcsDestination} message GcsDestination message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsDestination.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Decodes a DetectedLanguage message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage} DetectedLanguage - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DetectedLanguage.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Decodes a GcsDestination message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.vision.v1p2beta1.GcsDestination + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.vision.v1p2beta1.GcsDestination} GcsDestination + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsDestination.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.vision.v1p2beta1.GcsDestination(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.uri = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Verifies a DetectedLanguage message. - * @function verify - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DetectedLanguage.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.languageCode != null && message.hasOwnProperty("languageCode")) - if (!$util.isString(message.languageCode)) - return "languageCode: string expected"; - if (message.confidence != null && message.hasOwnProperty("confidence")) - if (typeof message.confidence !== "number") - return "confidence: number expected"; - return null; - }; + /** + * Decodes a GcsDestination message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.vision.v1p2beta1.GcsDestination + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.vision.v1p2beta1.GcsDestination} GcsDestination + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsDestination.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Creates a DetectedLanguage message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage} DetectedLanguage - */ - DetectedLanguage.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage) - return object; - var message = new $root.google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage(); - if (object.languageCode != null) - message.languageCode = String(object.languageCode); - if (object.confidence != null) - message.confidence = Number(object.confidence); - return message; - }; + /** + * Verifies a GcsDestination message. + * @function verify + * @memberof google.cloud.vision.v1p2beta1.GcsDestination + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GcsDestination.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + return null; + }; - /** - * Creates a plain object from a DetectedLanguage message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage - * @static - * @param {google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage} message DetectedLanguage - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DetectedLanguage.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.languageCode = ""; - object.confidence = 0; - } - if (message.languageCode != null && message.hasOwnProperty("languageCode")) - object.languageCode = message.languageCode; - if (message.confidence != null && message.hasOwnProperty("confidence")) - object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + /** + * Creates a GcsDestination message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.vision.v1p2beta1.GcsDestination + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.vision.v1p2beta1.GcsDestination} GcsDestination + */ + GcsDestination.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.GcsDestination) return object; - }; + var message = new $root.google.cloud.vision.v1p2beta1.GcsDestination(); + if (object.uri != null) + message.uri = String(object.uri); + return message; + }; - /** - * Converts this DetectedLanguage to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage - * @instance - * @returns {Object.} JSON object - */ - DetectedLanguage.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a GcsDestination message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.vision.v1p2beta1.GcsDestination + * @static + * @param {google.cloud.vision.v1p2beta1.GcsDestination} message GcsDestination + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GcsDestination.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.uri = ""; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + return object; + }; - return DetectedLanguage; - })(); + /** + * Converts this GcsDestination to JSON. + * @function toJSON + * @memberof google.cloud.vision.v1p2beta1.GcsDestination + * @instance + * @returns {Object.} JSON object + */ + GcsDestination.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - TextAnnotation.DetectedBreak = (function() { + return GcsDestination; + })(); - /** - * Properties of a DetectedBreak. - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation - * @interface IDetectedBreak - * @property {google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak.BreakType|null} [type] DetectedBreak type - * @property {boolean|null} [isPrefix] DetectedBreak isPrefix - */ + v1p2beta1.OperationMetadata = (function() { - /** - * Constructs a new DetectedBreak. - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation - * @classdesc Represents a DetectedBreak. - * @implements IDetectedBreak - * @constructor - * @param {google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedBreak=} [properties] Properties to set - */ - function DetectedBreak(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]]; - } + /** + * Properties of an OperationMetadata. + * @memberof google.cloud.vision.v1p2beta1 + * @interface IOperationMetadata + * @property {google.cloud.vision.v1p2beta1.OperationMetadata.State|null} [state] OperationMetadata state + * @property {google.protobuf.ITimestamp|null} [createTime] OperationMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] OperationMetadata updateTime + */ - /** - * DetectedBreak type. - * @member {google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak.BreakType} type - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak - * @instance - */ - DetectedBreak.prototype.type = 0; + /** + * Constructs a new OperationMetadata. + * @memberof google.cloud.vision.v1p2beta1 + * @classdesc Represents an OperationMetadata. + * @implements IOperationMetadata + * @constructor + * @param {google.cloud.vision.v1p2beta1.IOperationMetadata=} [properties] Properties to set + */ + function OperationMetadata(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]]; + } - /** - * DetectedBreak isPrefix. - * @member {boolean} isPrefix - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak - * @instance - */ - DetectedBreak.prototype.isPrefix = false; + /** + * OperationMetadata state. + * @member {google.cloud.vision.v1p2beta1.OperationMetadata.State} state + * @memberof google.cloud.vision.v1p2beta1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.state = 0; - /** - * Creates a new DetectedBreak instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak - * @static - * @param {google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedBreak=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak} DetectedBreak instance - */ - DetectedBreak.create = function create(properties) { - return new DetectedBreak(properties); - }; + /** + * OperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.vision.v1p2beta1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.createTime = null; - /** - * Encodes the specified DetectedBreak message. Does not implicitly {@link google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak - * @static - * @param {google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedBreak} message DetectedBreak message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DetectedBreak.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.type != null && message.hasOwnProperty("type")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); - if (message.isPrefix != null && message.hasOwnProperty("isPrefix")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.isPrefix); - return writer; - }; + /** + * OperationMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.vision.v1p2beta1.OperationMetadata + * @instance + */ + OperationMetadata.prototype.updateTime = null; - /** - * Encodes the specified DetectedBreak message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak - * @static - * @param {google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedBreak} message DetectedBreak message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DetectedBreak.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Creates a new OperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.vision.v1p2beta1.OperationMetadata + * @static + * @param {google.cloud.vision.v1p2beta1.IOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.OperationMetadata} OperationMetadata instance + */ + OperationMetadata.create = function create(properties) { + return new OperationMetadata(properties); + }; - /** - * Decodes a DetectedBreak message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak} DetectedBreak - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DetectedBreak.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.vision.v1p2beta1.TextAnnotation.DetectedBreak(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.type = reader.int32(); - break; - case 2: - message.isPrefix = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.vision.v1p2beta1.OperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.vision.v1p2beta1.OperationMetadata + * @static + * @param {google.cloud.vision.v1p2beta1.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.state != null && message.hasOwnProperty("state")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); + if (message.createTime != null && message.hasOwnProperty("createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; - /** - * Decodes a DetectedBreak message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak} DetectedBreak - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DetectedBreak.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DetectedBreak message. - * @function verify - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DetectedBreak.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.isPrefix != null && message.hasOwnProperty("isPrefix")) - if (typeof message.isPrefix !== "boolean") - return "isPrefix: boolean expected"; - return null; - }; - - /** - * Creates a DetectedBreak message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak} DetectedBreak - */ - DetectedBreak.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak) - return object; - var message = new $root.google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak(); - switch (object.type) { - case "UNKNOWN": - case 0: - message.type = 0; - break; - case "SPACE": - case 1: - message.type = 1; - break; - case "SURE_SPACE": - case 2: - message.type = 2; - break; - case "EOL_SURE_SPACE": - case 3: - message.type = 3; - break; - case "HYPHEN": - case 4: - message.type = 4; - break; - case "LINE_BREAK": - case 5: - message.type = 5; - break; - } - if (object.isPrefix != null) - message.isPrefix = Boolean(object.isPrefix); - return message; - }; - - /** - * Creates a plain object from a DetectedBreak message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak - * @static - * @param {google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak} message DetectedBreak - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DetectedBreak.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.type = options.enums === String ? "UNKNOWN" : 0; - object.isPrefix = false; - } - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak.BreakType[message.type] : message.type; - if (message.isPrefix != null && message.hasOwnProperty("isPrefix")) - object.isPrefix = message.isPrefix; - return object; - }; - - /** - * Converts this DetectedBreak to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak - * @instance - * @returns {Object.} JSON object - */ - DetectedBreak.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * BreakType enum. - * @name google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak.BreakType - * @enum {string} - * @property {number} UNKNOWN=0 UNKNOWN value - * @property {number} SPACE=1 SPACE value - * @property {number} SURE_SPACE=2 SURE_SPACE value - * @property {number} EOL_SURE_SPACE=3 EOL_SURE_SPACE value - * @property {number} HYPHEN=4 HYPHEN value - * @property {number} LINE_BREAK=5 LINE_BREAK value - */ - DetectedBreak.BreakType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "UNKNOWN"] = 0; - values[valuesById[1] = "SPACE"] = 1; - values[valuesById[2] = "SURE_SPACE"] = 2; - values[valuesById[3] = "EOL_SURE_SPACE"] = 3; - values[valuesById[4] = "HYPHEN"] = 4; - values[valuesById[5] = "LINE_BREAK"] = 5; - return values; - })(); - - return DetectedBreak; - })(); - - TextAnnotation.TextProperty = (function() { - - /** - * Properties of a TextProperty. - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation - * @interface ITextProperty - * @property {Array.|null} [detectedLanguages] TextProperty detectedLanguages - * @property {google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedBreak|null} [detectedBreak] TextProperty detectedBreak - */ - - /** - * Constructs a new TextProperty. - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation - * @classdesc Represents a TextProperty. - * @implements ITextProperty - * @constructor - * @param {google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty=} [properties] Properties to set - */ - function TextProperty(properties) { - this.detectedLanguages = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * TextProperty detectedLanguages. - * @member {Array.} detectedLanguages - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty - * @instance - */ - TextProperty.prototype.detectedLanguages = $util.emptyArray; - - /** - * TextProperty detectedBreak. - * @member {google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedBreak|null|undefined} detectedBreak - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty - * @instance - */ - TextProperty.prototype.detectedBreak = null; - - /** - * Creates a new TextProperty instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty - * @static - * @param {google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty} TextProperty instance - */ - TextProperty.create = function create(properties) { - return new TextProperty(properties); - }; - - /** - * Encodes the specified TextProperty message. Does not implicitly {@link google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty - * @static - * @param {google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty} message TextProperty message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TextProperty.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.detectedLanguages != null && message.detectedLanguages.length) - for (var i = 0; i < message.detectedLanguages.length; ++i) - $root.google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.detectedBreak != null && message.hasOwnProperty("detectedBreak")) - $root.google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak.encode(message.detectedBreak, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified TextProperty message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty - * @static - * @param {google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty} message TextProperty message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TextProperty.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TextProperty message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty} TextProperty - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TextProperty.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.vision.v1p2beta1.TextAnnotation.TextProperty(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.detectedLanguages && message.detectedLanguages.length)) - message.detectedLanguages = []; - message.detectedLanguages.push($root.google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage.decode(reader, reader.uint32())); - break; - case 2: - message.detectedBreak = $root.google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a TextProperty message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty} TextProperty - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TextProperty.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TextProperty message. - * @function verify - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TextProperty.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { - if (!Array.isArray(message.detectedLanguages)) - return "detectedLanguages: array expected"; - for (var i = 0; i < message.detectedLanguages.length; ++i) { - var error = $root.google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage.verify(message.detectedLanguages[i]); - if (error) - return "detectedLanguages." + error; - } - } - if (message.detectedBreak != null && message.hasOwnProperty("detectedBreak")) { - var error = $root.google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak.verify(message.detectedBreak); - if (error) - return "detectedBreak." + error; - } - return null; - }; - - /** - * Creates a TextProperty message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty} TextProperty - */ - TextProperty.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty) - return object; - var message = new $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty(); - if (object.detectedLanguages) { - if (!Array.isArray(object.detectedLanguages)) - throw TypeError(".google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.detectedLanguages: array expected"); - message.detectedLanguages = []; - for (var i = 0; i < object.detectedLanguages.length; ++i) { - if (typeof object.detectedLanguages[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.detectedLanguages: object expected"); - message.detectedLanguages[i] = $root.google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage.fromObject(object.detectedLanguages[i]); - } - } - if (object.detectedBreak != null) { - if (typeof object.detectedBreak !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.detectedBreak: object expected"); - message.detectedBreak = $root.google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak.fromObject(object.detectedBreak); - } - return message; - }; - - /** - * Creates a plain object from a TextProperty message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty - * @static - * @param {google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty} message TextProperty - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TextProperty.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.detectedLanguages = []; - if (options.defaults) - object.detectedBreak = null; - if (message.detectedLanguages && message.detectedLanguages.length) { - object.detectedLanguages = []; - for (var j = 0; j < message.detectedLanguages.length; ++j) - object.detectedLanguages[j] = $root.google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage.toObject(message.detectedLanguages[j], options); - } - if (message.detectedBreak != null && message.hasOwnProperty("detectedBreak")) - object.detectedBreak = $root.google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak.toObject(message.detectedBreak, options); - return object; - }; - - /** - * Converts this TextProperty to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty - * @instance - * @returns {Object.} JSON object - */ - TextProperty.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return TextProperty; - })(); - - return TextAnnotation; - })(); - - v1p2beta1.Page = (function() { - - /** - * Properties of a Page. - * @memberof google.cloud.vision.v1p2beta1 - * @interface IPage - * @property {google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null} [property] Page property - * @property {number|null} [width] Page width - * @property {number|null} [height] Page height - * @property {Array.|null} [blocks] Page blocks - * @property {number|null} [confidence] Page confidence - */ - - /** - * Constructs a new Page. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a Page. - * @implements IPage - * @constructor - * @param {google.cloud.vision.v1p2beta1.IPage=} [properties] Properties to set - */ - function Page(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]]; - } - - /** - * Page property. - * @member {google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null|undefined} property - * @memberof google.cloud.vision.v1p2beta1.Page - * @instance - */ - Page.prototype.property = null; - - /** - * Page width. - * @member {number} width - * @memberof google.cloud.vision.v1p2beta1.Page - * @instance - */ - Page.prototype.width = 0; - - /** - * Page height. - * @member {number} height - * @memberof google.cloud.vision.v1p2beta1.Page - * @instance - */ - Page.prototype.height = 0; - - /** - * Page blocks. - * @member {Array.} blocks - * @memberof google.cloud.vision.v1p2beta1.Page - * @instance - */ - Page.prototype.blocks = $util.emptyArray; - - /** - * Page confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p2beta1.Page - * @instance - */ - Page.prototype.confidence = 0; - - /** - * Creates a new Page instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.Page - * @static - * @param {google.cloud.vision.v1p2beta1.IPage=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.Page} Page instance - */ - Page.create = function create(properties) { - return new Page(properties); - }; - - /** - * Encodes the specified Page message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Page.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.Page - * @static - * @param {google.cloud.vision.v1p2beta1.IPage} message Page message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Page.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.property != null && message.hasOwnProperty("property")) - $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.width != null && message.hasOwnProperty("width")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.width); - if (message.height != null && message.hasOwnProperty("height")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.height); - if (message.blocks != null && message.blocks.length) - for (var i = 0; i < message.blocks.length; ++i) - $root.google.cloud.vision.v1p2beta1.Block.encode(message.blocks[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.confidence != null && message.hasOwnProperty("confidence")) - writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); - return writer; - }; - - /** - * Encodes the specified Page message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.Page.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.Page - * @static - * @param {google.cloud.vision.v1p2beta1.IPage} message Page message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Page.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.OperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.vision.v1p2beta1.OperationMetadata + * @static + * @param {google.cloud.vision.v1p2beta1.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * Decodes a Page message from the specified reader or buffer. + * Decodes an OperationMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.Page + * @memberof google.cloud.vision.v1p2beta1.OperationMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.Page} Page + * @returns {google.cloud.vision.v1p2beta1.OperationMetadata} OperationMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Page.decode = function decode(reader, length) { + OperationMetadata.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.vision.v1p2beta1.Page(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.OperationMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.property = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.decode(reader, reader.uint32()); - break; - case 2: - message.width = reader.int32(); - break; - case 3: - message.height = reader.int32(); - break; - case 4: - if (!(message.blocks && message.blocks.length)) - message.blocks = []; - message.blocks.push($root.google.cloud.vision.v1p2beta1.Block.decode(reader, reader.uint32())); + message.state = reader.int32(); break; case 5: - message.confidence = reader.float(); + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + case 6: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -47203,168 +45917,206 @@ }; /** - * Decodes a Page message from the specified reader or buffer, length delimited. + * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.Page + * @memberof google.cloud.vision.v1p2beta1.OperationMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.Page} Page + * @returns {google.cloud.vision.v1p2beta1.OperationMetadata} OperationMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Page.decodeDelimited = function decodeDelimited(reader) { + OperationMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Page message. + * Verifies an OperationMetadata message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.Page + * @memberof google.cloud.vision.v1p2beta1.OperationMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Page.verify = function verify(message) { + OperationMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.property != null && message.hasOwnProperty("property")) { - var error = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.verify(message.property); + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); if (error) - return "property." + error; + return "createTime." + error; } - if (message.width != null && message.hasOwnProperty("width")) - if (!$util.isInteger(message.width)) - return "width: integer expected"; - if (message.height != null && message.hasOwnProperty("height")) - if (!$util.isInteger(message.height)) - return "height: integer 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.vision.v1p2beta1.Block.verify(message.blocks[i]); - if (error) - return "blocks." + error; - } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; } - if (message.confidence != null && message.hasOwnProperty("confidence")) - if (typeof message.confidence !== "number") - return "confidence: number expected"; return null; }; /** - * Creates a Page message from a plain object. Also converts values to their respective internal types. + * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.Page + * @memberof google.cloud.vision.v1p2beta1.OperationMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.Page} Page + * @returns {google.cloud.vision.v1p2beta1.OperationMetadata} OperationMetadata */ - Page.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.Page) + OperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.OperationMetadata) return object; - var message = new $root.google.cloud.vision.v1p2beta1.Page(); - if (object.property != null) { - if (typeof object.property !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.Page.property: object expected"); - message.property = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.fromObject(object.property); + var message = new $root.google.cloud.vision.v1p2beta1.OperationMetadata(); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "CREATED": + case 1: + message.state = 1; + break; + case "RUNNING": + case 2: + message.state = 2; + break; + case "DONE": + case 3: + message.state = 3; + break; + case "CANCELLED": + case 4: + message.state = 4; + break; } - if (object.width != null) - message.width = object.width | 0; - if (object.height != null) - message.height = object.height | 0; - if (object.blocks) { - if (!Array.isArray(object.blocks)) - throw TypeError(".google.cloud.vision.v1p2beta1.Page.blocks: array expected"); - message.blocks = []; - for (var i = 0; i < object.blocks.length; ++i) { - if (typeof object.blocks[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.Page.blocks: object expected"); - message.blocks[i] = $root.google.cloud.vision.v1p2beta1.Block.fromObject(object.blocks[i]); - } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.OperationMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.OperationMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); } - if (object.confidence != null) - message.confidence = Number(object.confidence); return message; }; /** - * Creates a plain object from a Page message. Also converts values to other types if specified. + * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.Page + * @memberof google.cloud.vision.v1p2beta1.OperationMetadata * @static - * @param {google.cloud.vision.v1p2beta1.Page} message Page + * @param {google.cloud.vision.v1p2beta1.OperationMetadata} message OperationMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Page.toObject = function toObject(message, options) { + OperationMetadata.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.blocks = []; if (options.defaults) { - object.property = null; - object.width = 0; - object.height = 0; - object.confidence = 0; - } - if (message.property != null && message.hasOwnProperty("property")) - object.property = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.toObject(message.property, options); - if (message.width != null && message.hasOwnProperty("width")) - object.width = message.width; - if (message.height != null && message.hasOwnProperty("height")) - object.height = message.height; - if (message.blocks && message.blocks.length) { - object.blocks = []; - for (var j = 0; j < message.blocks.length; ++j) - object.blocks[j] = $root.google.cloud.vision.v1p2beta1.Block.toObject(message.blocks[j], options); + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.createTime = null; + object.updateTime = null; } - if (message.confidence != null && message.hasOwnProperty("confidence")) - object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.vision.v1p2beta1.OperationMetadata.State[message.state] : message.state; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); return object; }; /** - * Converts this Page to JSON. + * Converts this OperationMetadata to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.Page + * @memberof google.cloud.vision.v1p2beta1.OperationMetadata * @instance * @returns {Object.} JSON object */ - Page.prototype.toJSON = function toJSON() { + OperationMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Page; + /** + * State enum. + * @name google.cloud.vision.v1p2beta1.OperationMetadata.State + * @enum {string} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} CREATED=1 CREATED value + * @property {number} RUNNING=2 RUNNING value + * @property {number} DONE=3 DONE value + * @property {number} CANCELLED=4 CANCELLED value + */ + OperationMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "CREATED"] = 1; + values[valuesById[2] = "RUNNING"] = 2; + values[valuesById[3] = "DONE"] = 3; + values[valuesById[4] = "CANCELLED"] = 4; + return values; + })(); + + return OperationMetadata; })(); - v1p2beta1.Block = (function() { + /** + * Likelihood enum. + * @name google.cloud.vision.v1p2beta1.Likelihood + * @enum {string} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} VERY_UNLIKELY=1 VERY_UNLIKELY value + * @property {number} UNLIKELY=2 UNLIKELY value + * @property {number} POSSIBLE=3 POSSIBLE value + * @property {number} LIKELY=4 LIKELY value + * @property {number} VERY_LIKELY=5 VERY_LIKELY value + */ + v1p2beta1.Likelihood = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "VERY_UNLIKELY"] = 1; + values[valuesById[2] = "UNLIKELY"] = 2; + values[valuesById[3] = "POSSIBLE"] = 3; + values[valuesById[4] = "LIKELY"] = 4; + values[valuesById[5] = "VERY_LIKELY"] = 5; + return values; + })(); + + v1p2beta1.TextAnnotation = (function() { /** - * Properties of a Block. + * Properties of a TextAnnotation. * @memberof google.cloud.vision.v1p2beta1 - * @interface IBlock - * @property {google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null} [property] Block property - * @property {google.cloud.vision.v1p2beta1.IBoundingPoly|null} [boundingBox] Block boundingBox - * @property {Array.|null} [paragraphs] Block paragraphs - * @property {google.cloud.vision.v1p2beta1.Block.BlockType|null} [blockType] Block blockType - * @property {number|null} [confidence] Block confidence + * @interface ITextAnnotation + * @property {Array.|null} [pages] TextAnnotation pages + * @property {string|null} [text] TextAnnotation text */ /** - * Constructs a new Block. + * Constructs a new TextAnnotation. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a Block. - * @implements IBlock + * @classdesc Represents a TextAnnotation. + * @implements ITextAnnotation * @constructor - * @param {google.cloud.vision.v1p2beta1.IBlock=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.ITextAnnotation=} [properties] Properties to set */ - function Block(properties) { - this.paragraphs = []; + function TextAnnotation(properties) { + this.pages = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -47372,130 +46124,91 @@ } /** - * Block property. - * @member {google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null|undefined} property - * @memberof google.cloud.vision.v1p2beta1.Block - * @instance - */ - Block.prototype.property = null; - - /** - * Block boundingBox. - * @member {google.cloud.vision.v1p2beta1.IBoundingPoly|null|undefined} boundingBox - * @memberof google.cloud.vision.v1p2beta1.Block - * @instance - */ - Block.prototype.boundingBox = null; - - /** - * Block paragraphs. - * @member {Array.} paragraphs - * @memberof google.cloud.vision.v1p2beta1.Block - * @instance - */ - Block.prototype.paragraphs = $util.emptyArray; - - /** - * Block blockType. - * @member {google.cloud.vision.v1p2beta1.Block.BlockType} blockType - * @memberof google.cloud.vision.v1p2beta1.Block + * TextAnnotation pages. + * @member {Array.} pages + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation * @instance */ - Block.prototype.blockType = 0; + TextAnnotation.prototype.pages = $util.emptyArray; /** - * Block confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p2beta1.Block + * TextAnnotation text. + * @member {string} text + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation * @instance */ - Block.prototype.confidence = 0; + TextAnnotation.prototype.text = ""; /** - * Creates a new Block instance using the specified properties. + * Creates a new TextAnnotation instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.Block + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation * @static - * @param {google.cloud.vision.v1p2beta1.IBlock=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.Block} Block instance + * @param {google.cloud.vision.v1p2beta1.ITextAnnotation=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.TextAnnotation} TextAnnotation instance */ - Block.create = function create(properties) { - return new Block(properties); + TextAnnotation.create = function create(properties) { + return new TextAnnotation(properties); }; /** - * Encodes the specified Block message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Block.verify|verify} messages. + * Encodes the specified TextAnnotation message. Does not implicitly {@link google.cloud.vision.v1p2beta1.TextAnnotation.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.Block + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation * @static - * @param {google.cloud.vision.v1p2beta1.IBlock} message Block message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.ITextAnnotation} message TextAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Block.encode = function encode(message, writer) { + TextAnnotation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.property != null && message.hasOwnProperty("property")) - $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) - $root.google.cloud.vision.v1p2beta1.BoundingPoly.encode(message.boundingBox, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.paragraphs != null && message.paragraphs.length) - for (var i = 0; i < message.paragraphs.length; ++i) - $root.google.cloud.vision.v1p2beta1.Paragraph.encode(message.paragraphs[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.blockType != null && message.hasOwnProperty("blockType")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.blockType); - if (message.confidence != null && message.hasOwnProperty("confidence")) - writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); + if (message.pages != null && message.pages.length) + for (var i = 0; i < message.pages.length; ++i) + $root.google.cloud.vision.v1p2beta1.Page.encode(message.pages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.text != null && message.hasOwnProperty("text")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.text); return writer; }; /** - * Encodes the specified Block message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.Block.verify|verify} messages. + * Encodes the specified TextAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.TextAnnotation.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.Block + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation * @static - * @param {google.cloud.vision.v1p2beta1.IBlock} message Block message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.ITextAnnotation} message TextAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Block.encodeDelimited = function encodeDelimited(message, writer) { + TextAnnotation.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Block message from the specified reader or buffer. + * Decodes a TextAnnotation message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.Block + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.Block} Block + * @returns {google.cloud.vision.v1p2beta1.TextAnnotation} TextAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Block.decode = function decode(reader, length) { + TextAnnotation.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.vision.v1p2beta1.Block(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.TextAnnotation(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.property = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.decode(reader, reader.uint32()); + if (!(message.pages && message.pages.length)) + message.pages = []; + message.pages.push($root.google.cloud.vision.v1p2beta1.Page.decode(reader, reader.uint32())); break; case 2: - message.boundingBox = $root.google.cloud.vision.v1p2beta1.BoundingPoly.decode(reader, reader.uint32()); - break; - case 3: - if (!(message.paragraphs && message.paragraphs.length)) - message.paragraphs = []; - message.paragraphs.push($root.google.cloud.vision.v1p2beta1.Paragraph.decode(reader, reader.uint32())); - break; - case 4: - message.blockType = reader.int32(); - break; - case 5: - message.confidence = reader.float(); + message.text = reader.string(); break; default: reader.skipType(tag & 7); @@ -47506,899 +46219,961 @@ }; /** - * Decodes a Block message from the specified reader or buffer, length delimited. + * Decodes a TextAnnotation message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.Block + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.Block} Block + * @returns {google.cloud.vision.v1p2beta1.TextAnnotation} TextAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Block.decodeDelimited = function decodeDelimited(reader) { + TextAnnotation.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Block message. + * Verifies a TextAnnotation message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.Block + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Block.verify = function verify(message) { + TextAnnotation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.property != null && message.hasOwnProperty("property")) { - var error = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.verify(message.property); - if (error) - return "property." + error; - } - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) { - var error = $root.google.cloud.vision.v1p2beta1.BoundingPoly.verify(message.boundingBox); - if (error) - return "boundingBox." + error; - } - if (message.paragraphs != null && message.hasOwnProperty("paragraphs")) { - if (!Array.isArray(message.paragraphs)) - return "paragraphs: array expected"; - for (var i = 0; i < message.paragraphs.length; ++i) { - var error = $root.google.cloud.vision.v1p2beta1.Paragraph.verify(message.paragraphs[i]); + if (message.pages != null && message.hasOwnProperty("pages")) { + if (!Array.isArray(message.pages)) + return "pages: array expected"; + for (var i = 0; i < message.pages.length; ++i) { + var error = $root.google.cloud.vision.v1p2beta1.Page.verify(message.pages[i]); if (error) - return "paragraphs." + error; + return "pages." + error; } } - if (message.blockType != null && message.hasOwnProperty("blockType")) - switch (message.blockType) { - default: - return "blockType: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.confidence != null && message.hasOwnProperty("confidence")) - if (typeof message.confidence !== "number") - return "confidence: number expected"; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; return null; }; /** - * Creates a Block message from a plain object. Also converts values to their respective internal types. + * Creates a TextAnnotation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.Block + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.Block} Block + * @returns {google.cloud.vision.v1p2beta1.TextAnnotation} TextAnnotation */ - Block.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.Block) + TextAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.TextAnnotation) return object; - var message = new $root.google.cloud.vision.v1p2beta1.Block(); - if (object.property != null) { - if (typeof object.property !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.Block.property: object expected"); - message.property = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.fromObject(object.property); - } - if (object.boundingBox != null) { - if (typeof object.boundingBox !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.Block.boundingBox: object expected"); - message.boundingBox = $root.google.cloud.vision.v1p2beta1.BoundingPoly.fromObject(object.boundingBox); - } - if (object.paragraphs) { - if (!Array.isArray(object.paragraphs)) - throw TypeError(".google.cloud.vision.v1p2beta1.Block.paragraphs: array expected"); - message.paragraphs = []; - for (var i = 0; i < object.paragraphs.length; ++i) { - if (typeof object.paragraphs[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.Block.paragraphs: object expected"); - message.paragraphs[i] = $root.google.cloud.vision.v1p2beta1.Paragraph.fromObject(object.paragraphs[i]); + var message = new $root.google.cloud.vision.v1p2beta1.TextAnnotation(); + if (object.pages) { + if (!Array.isArray(object.pages)) + throw TypeError(".google.cloud.vision.v1p2beta1.TextAnnotation.pages: array expected"); + message.pages = []; + for (var i = 0; i < object.pages.length; ++i) { + if (typeof object.pages[i] !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.TextAnnotation.pages: object expected"); + message.pages[i] = $root.google.cloud.vision.v1p2beta1.Page.fromObject(object.pages[i]); } } - switch (object.blockType) { - case "UNKNOWN": - case 0: - message.blockType = 0; - break; - case "TEXT": - case 1: - message.blockType = 1; - break; - case "TABLE": - case 2: - message.blockType = 2; - break; - case "PICTURE": - case 3: - message.blockType = 3; - break; - case "RULER": - case 4: - message.blockType = 4; - break; - case "BARCODE": - case 5: - message.blockType = 5; - break; - } - if (object.confidence != null) - message.confidence = Number(object.confidence); + if (object.text != null) + message.text = String(object.text); return message; }; /** - * Creates a plain object from a Block message. Also converts values to other types if specified. + * Creates a plain object from a TextAnnotation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.Block + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation * @static - * @param {google.cloud.vision.v1p2beta1.Block} message Block + * @param {google.cloud.vision.v1p2beta1.TextAnnotation} message TextAnnotation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Block.toObject = function toObject(message, options) { + TextAnnotation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.paragraphs = []; - if (options.defaults) { - object.property = null; - object.boundingBox = null; - object.blockType = options.enums === String ? "UNKNOWN" : 0; - object.confidence = 0; - } - if (message.property != null && message.hasOwnProperty("property")) - object.property = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.toObject(message.property, options); - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) - object.boundingBox = $root.google.cloud.vision.v1p2beta1.BoundingPoly.toObject(message.boundingBox, options); - if (message.paragraphs && message.paragraphs.length) { - object.paragraphs = []; - for (var j = 0; j < message.paragraphs.length; ++j) - object.paragraphs[j] = $root.google.cloud.vision.v1p2beta1.Paragraph.toObject(message.paragraphs[j], options); + object.pages = []; + if (options.defaults) + object.text = ""; + if (message.pages && message.pages.length) { + object.pages = []; + for (var j = 0; j < message.pages.length; ++j) + object.pages[j] = $root.google.cloud.vision.v1p2beta1.Page.toObject(message.pages[j], options); } - if (message.blockType != null && message.hasOwnProperty("blockType")) - object.blockType = options.enums === String ? $root.google.cloud.vision.v1p2beta1.Block.BlockType[message.blockType] : message.blockType; - if (message.confidence != null && message.hasOwnProperty("confidence")) - object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; return object; }; /** - * Converts this Block to JSON. + * Converts this TextAnnotation to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.Block + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation * @instance * @returns {Object.} JSON object */ - Block.prototype.toJSON = function toJSON() { + TextAnnotation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * BlockType enum. - * @name google.cloud.vision.v1p2beta1.Block.BlockType - * @enum {string} - * @property {number} UNKNOWN=0 UNKNOWN value - * @property {number} TEXT=1 TEXT value - * @property {number} TABLE=2 TABLE value - * @property {number} PICTURE=3 PICTURE value - * @property {number} RULER=4 RULER value - * @property {number} BARCODE=5 BARCODE value - */ - Block.BlockType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "UNKNOWN"] = 0; - values[valuesById[1] = "TEXT"] = 1; - values[valuesById[2] = "TABLE"] = 2; - values[valuesById[3] = "PICTURE"] = 3; - values[valuesById[4] = "RULER"] = 4; - values[valuesById[5] = "BARCODE"] = 5; - return values; - })(); + TextAnnotation.DetectedLanguage = (function() { - return Block; - })(); + /** + * Properties of a DetectedLanguage. + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation + * @interface IDetectedLanguage + * @property {string|null} [languageCode] DetectedLanguage languageCode + * @property {number|null} [confidence] DetectedLanguage confidence + */ - v1p2beta1.Paragraph = (function() { + /** + * Constructs a new DetectedLanguage. + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation + * @classdesc Represents a DetectedLanguage. + * @implements IDetectedLanguage + * @constructor + * @param {google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedLanguage=} [properties] Properties to set + */ + function DetectedLanguage(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]]; + } - /** - * Properties of a Paragraph. - * @memberof google.cloud.vision.v1p2beta1 - * @interface IParagraph - * @property {google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null} [property] Paragraph property - * @property {google.cloud.vision.v1p2beta1.IBoundingPoly|null} [boundingBox] Paragraph boundingBox - * @property {Array.|null} [words] Paragraph words - * @property {number|null} [confidence] Paragraph confidence - */ + /** + * DetectedLanguage languageCode. + * @member {string} languageCode + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage + * @instance + */ + DetectedLanguage.prototype.languageCode = ""; - /** - * Constructs a new Paragraph. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a Paragraph. - * @implements IParagraph - * @constructor - * @param {google.cloud.vision.v1p2beta1.IParagraph=} [properties] Properties to set - */ - function Paragraph(properties) { - this.words = []; - 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]]; - } + /** + * DetectedLanguage confidence. + * @member {number} confidence + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage + * @instance + */ + DetectedLanguage.prototype.confidence = 0; - /** - * Paragraph property. - * @member {google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null|undefined} property - * @memberof google.cloud.vision.v1p2beta1.Paragraph - * @instance - */ - Paragraph.prototype.property = null; + /** + * Creates a new DetectedLanguage instance using the specified properties. + * @function create + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage + * @static + * @param {google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedLanguage=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage} DetectedLanguage instance + */ + DetectedLanguage.create = function create(properties) { + return new DetectedLanguage(properties); + }; - /** - * Paragraph boundingBox. - * @member {google.cloud.vision.v1p2beta1.IBoundingPoly|null|undefined} boundingBox - * @memberof google.cloud.vision.v1p2beta1.Paragraph - * @instance - */ - Paragraph.prototype.boundingBox = null; + /** + * Encodes the specified DetectedLanguage message. Does not implicitly {@link google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage.verify|verify} messages. + * @function encode + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage + * @static + * @param {google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedLanguage} message DetectedLanguage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectedLanguage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.languageCode); + if (message.confidence != null && message.hasOwnProperty("confidence")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); + return writer; + }; - /** - * Paragraph words. - * @member {Array.} words - * @memberof google.cloud.vision.v1p2beta1.Paragraph - * @instance - */ - Paragraph.prototype.words = $util.emptyArray; + /** + * Encodes the specified DetectedLanguage message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage + * @static + * @param {google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedLanguage} message DetectedLanguage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectedLanguage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Paragraph confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p2beta1.Paragraph - * @instance - */ - Paragraph.prototype.confidence = 0; + /** + * Decodes a DetectedLanguage message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage} DetectedLanguage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectedLanguage.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.vision.v1p2beta1.TextAnnotation.DetectedLanguage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.languageCode = reader.string(); + break; + case 2: + message.confidence = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Creates a new Paragraph instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.Paragraph - * @static - * @param {google.cloud.vision.v1p2beta1.IParagraph=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.Paragraph} Paragraph instance - */ - Paragraph.create = function create(properties) { - return new Paragraph(properties); - }; + /** + * Decodes a DetectedLanguage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage} DetectedLanguage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectedLanguage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Encodes the specified Paragraph message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Paragraph.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.Paragraph - * @static - * @param {google.cloud.vision.v1p2beta1.IParagraph} message Paragraph message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Paragraph.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.property != null && message.hasOwnProperty("property")) - $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) - $root.google.cloud.vision.v1p2beta1.BoundingPoly.encode(message.boundingBox, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.words != null && message.words.length) - for (var i = 0; i < message.words.length; ++i) - $root.google.cloud.vision.v1p2beta1.Word.encode(message.words[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.confidence != null && message.hasOwnProperty("confidence")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.confidence); - return writer; - }; + /** + * Verifies a DetectedLanguage message. + * @function verify + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DetectedLanguage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + return null; + }; - /** - * Encodes the specified Paragraph message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.Paragraph.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.Paragraph - * @static - * @param {google.cloud.vision.v1p2beta1.IParagraph} message Paragraph message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Paragraph.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Creates a DetectedLanguage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage} DetectedLanguage + */ + DetectedLanguage.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage) + return object; + var message = new $root.google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage(); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.confidence != null) + message.confidence = Number(object.confidence); + return message; + }; - /** - * Decodes a Paragraph message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p2beta1.Paragraph - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.Paragraph} Paragraph - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Paragraph.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.vision.v1p2beta1.Paragraph(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.property = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.decode(reader, reader.uint32()); - break; - case 2: - message.boundingBox = $root.google.cloud.vision.v1p2beta1.BoundingPoly.decode(reader, reader.uint32()); - break; - case 3: - if (!(message.words && message.words.length)) - message.words = []; - message.words.push($root.google.cloud.vision.v1p2beta1.Word.decode(reader, reader.uint32())); - break; - case 4: - message.confidence = reader.float(); - break; - default: - reader.skipType(tag & 7); - break; + /** + * Creates a plain object from a DetectedLanguage message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage + * @static + * @param {google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage} message DetectedLanguage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DetectedLanguage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.languageCode = ""; + object.confidence = 0; } - } - return message; - }; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + return object; + }; - /** - * Decodes a Paragraph message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.Paragraph - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.Paragraph} Paragraph - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Paragraph.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Converts this DetectedLanguage to JSON. + * @function toJSON + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage + * @instance + * @returns {Object.} JSON object + */ + DetectedLanguage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Verifies a Paragraph message. - * @function verify - * @memberof google.cloud.vision.v1p2beta1.Paragraph - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Paragraph.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.property != null && message.hasOwnProperty("property")) { - var error = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.verify(message.property); - if (error) - return "property." + error; - } - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) { - var error = $root.google.cloud.vision.v1p2beta1.BoundingPoly.verify(message.boundingBox); - if (error) - return "boundingBox." + error; - } - if (message.words != null && message.hasOwnProperty("words")) { - if (!Array.isArray(message.words)) - return "words: array expected"; - for (var i = 0; i < message.words.length; ++i) { - var error = $root.google.cloud.vision.v1p2beta1.Word.verify(message.words[i]); - if (error) - return "words." + error; - } - } - if (message.confidence != null && message.hasOwnProperty("confidence")) - if (typeof message.confidence !== "number") - return "confidence: number expected"; - return null; - }; + return DetectedLanguage; + })(); - /** - * Creates a Paragraph message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.Paragraph - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.Paragraph} Paragraph - */ - Paragraph.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.Paragraph) - return object; - var message = new $root.google.cloud.vision.v1p2beta1.Paragraph(); - if (object.property != null) { - if (typeof object.property !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.Paragraph.property: object expected"); - message.property = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.fromObject(object.property); - } - if (object.boundingBox != null) { - if (typeof object.boundingBox !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.Paragraph.boundingBox: object expected"); - message.boundingBox = $root.google.cloud.vision.v1p2beta1.BoundingPoly.fromObject(object.boundingBox); - } - if (object.words) { - if (!Array.isArray(object.words)) - throw TypeError(".google.cloud.vision.v1p2beta1.Paragraph.words: array expected"); - message.words = []; - for (var i = 0; i < object.words.length; ++i) { - if (typeof object.words[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.Paragraph.words: object expected"); - message.words[i] = $root.google.cloud.vision.v1p2beta1.Word.fromObject(object.words[i]); - } - } - if (object.confidence != null) - message.confidence = Number(object.confidence); - return message; - }; + TextAnnotation.DetectedBreak = (function() { - /** - * Creates a plain object from a Paragraph message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.Paragraph - * @static - * @param {google.cloud.vision.v1p2beta1.Paragraph} message Paragraph - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Paragraph.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.words = []; - if (options.defaults) { - object.property = null; - object.boundingBox = null; - object.confidence = 0; - } - if (message.property != null && message.hasOwnProperty("property")) - object.property = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.toObject(message.property, options); - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) - object.boundingBox = $root.google.cloud.vision.v1p2beta1.BoundingPoly.toObject(message.boundingBox, options); - if (message.words && message.words.length) { - object.words = []; - for (var j = 0; j < message.words.length; ++j) - object.words[j] = $root.google.cloud.vision.v1p2beta1.Word.toObject(message.words[j], options); - } - if (message.confidence != null && message.hasOwnProperty("confidence")) - object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; - return object; - }; + /** + * Properties of a DetectedBreak. + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation + * @interface IDetectedBreak + * @property {google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak.BreakType|null} [type] DetectedBreak type + * @property {boolean|null} [isPrefix] DetectedBreak isPrefix + */ - /** - * Converts this Paragraph to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.Paragraph - * @instance - * @returns {Object.} JSON object - */ - Paragraph.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Constructs a new DetectedBreak. + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation + * @classdesc Represents a DetectedBreak. + * @implements IDetectedBreak + * @constructor + * @param {google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedBreak=} [properties] Properties to set + */ + function DetectedBreak(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]]; + } - return Paragraph; - })(); + /** + * DetectedBreak type. + * @member {google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak.BreakType} type + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak + * @instance + */ + DetectedBreak.prototype.type = 0; - v1p2beta1.Word = (function() { + /** + * DetectedBreak isPrefix. + * @member {boolean} isPrefix + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak + * @instance + */ + DetectedBreak.prototype.isPrefix = false; - /** - * Properties of a Word. - * @memberof google.cloud.vision.v1p2beta1 - * @interface IWord - * @property {google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null} [property] Word property - * @property {google.cloud.vision.v1p2beta1.IBoundingPoly|null} [boundingBox] Word boundingBox - * @property {Array.|null} [symbols] Word symbols - * @property {number|null} [confidence] Word confidence - */ - - /** - * Constructs a new Word. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a Word. - * @implements IWord - * @constructor - * @param {google.cloud.vision.v1p2beta1.IWord=} [properties] Properties to set - */ - function Word(properties) { - this.symbols = []; - 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]]; - } - - /** - * Word property. - * @member {google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null|undefined} property - * @memberof google.cloud.vision.v1p2beta1.Word - * @instance - */ - Word.prototype.property = null; - - /** - * Word boundingBox. - * @member {google.cloud.vision.v1p2beta1.IBoundingPoly|null|undefined} boundingBox - * @memberof google.cloud.vision.v1p2beta1.Word - * @instance - */ - Word.prototype.boundingBox = null; + /** + * Creates a new DetectedBreak instance using the specified properties. + * @function create + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak + * @static + * @param {google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedBreak=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak} DetectedBreak instance + */ + DetectedBreak.create = function create(properties) { + return new DetectedBreak(properties); + }; - /** - * Word symbols. - * @member {Array.} symbols - * @memberof google.cloud.vision.v1p2beta1.Word - * @instance - */ - Word.prototype.symbols = $util.emptyArray; + /** + * Encodes the specified DetectedBreak message. Does not implicitly {@link google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak.verify|verify} messages. + * @function encode + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak + * @static + * @param {google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedBreak} message DetectedBreak message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectedBreak.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && message.hasOwnProperty("type")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); + if (message.isPrefix != null && message.hasOwnProperty("isPrefix")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.isPrefix); + return writer; + }; - /** - * Word confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p2beta1.Word - * @instance - */ - Word.prototype.confidence = 0; + /** + * Encodes the specified DetectedBreak message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak + * @static + * @param {google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedBreak} message DetectedBreak message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectedBreak.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Creates a new Word instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.Word - * @static - * @param {google.cloud.vision.v1p2beta1.IWord=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.Word} Word instance - */ - Word.create = function create(properties) { - return new Word(properties); - }; + /** + * Decodes a DetectedBreak message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak} DetectedBreak + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectedBreak.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.vision.v1p2beta1.TextAnnotation.DetectedBreak(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.int32(); + break; + case 2: + message.isPrefix = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Encodes the specified Word message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Word.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.Word - * @static - * @param {google.cloud.vision.v1p2beta1.IWord} message Word message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Word.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.property != null && message.hasOwnProperty("property")) - $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) - $root.google.cloud.vision.v1p2beta1.BoundingPoly.encode(message.boundingBox, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.symbols != null && message.symbols.length) - for (var i = 0; i < message.symbols.length; ++i) - $root.google.cloud.vision.v1p2beta1.Symbol.encode(message.symbols[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.confidence != null && message.hasOwnProperty("confidence")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.confidence); - return writer; - }; + /** + * Decodes a DetectedBreak message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak} DetectedBreak + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectedBreak.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Encodes the specified Word message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.Word.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.Word - * @static - * @param {google.cloud.vision.v1p2beta1.IWord} message Word message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Word.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Verifies a DetectedBreak message. + * @function verify + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DetectedBreak.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.isPrefix != null && message.hasOwnProperty("isPrefix")) + if (typeof message.isPrefix !== "boolean") + return "isPrefix: boolean expected"; + return null; + }; - /** - * Decodes a Word message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p2beta1.Word - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.Word} Word - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Word.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.vision.v1p2beta1.Word(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { + /** + * Creates a DetectedBreak message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak} DetectedBreak + */ + DetectedBreak.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak) + return object; + var message = new $root.google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak(); + switch (object.type) { + case "UNKNOWN": + case 0: + message.type = 0; + break; + case "SPACE": case 1: - message.property = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.decode(reader, reader.uint32()); + message.type = 1; break; + case "SURE_SPACE": case 2: - message.boundingBox = $root.google.cloud.vision.v1p2beta1.BoundingPoly.decode(reader, reader.uint32()); + message.type = 2; break; + case "EOL_SURE_SPACE": case 3: - if (!(message.symbols && message.symbols.length)) - message.symbols = []; - message.symbols.push($root.google.cloud.vision.v1p2beta1.Symbol.decode(reader, reader.uint32())); + message.type = 3; break; + case "HYPHEN": case 4: - message.confidence = reader.float(); + message.type = 4; break; - default: - reader.skipType(tag & 7); + case "LINE_BREAK": + case 5: + message.type = 5; break; } - } - return message; - }; - - /** - * Decodes a Word message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.Word - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.Word} Word - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Word.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + if (object.isPrefix != null) + message.isPrefix = Boolean(object.isPrefix); + return message; + }; - /** - * Verifies a Word message. - * @function verify - * @memberof google.cloud.vision.v1p2beta1.Word - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Word.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.property != null && message.hasOwnProperty("property")) { - var error = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.verify(message.property); - if (error) - return "property." + error; - } - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) { - var error = $root.google.cloud.vision.v1p2beta1.BoundingPoly.verify(message.boundingBox); - if (error) - return "boundingBox." + error; - } - if (message.symbols != null && message.hasOwnProperty("symbols")) { - if (!Array.isArray(message.symbols)) - return "symbols: array expected"; - for (var i = 0; i < message.symbols.length; ++i) { - var error = $root.google.cloud.vision.v1p2beta1.Symbol.verify(message.symbols[i]); - if (error) - return "symbols." + error; + /** + * Creates a plain object from a DetectedBreak message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak + * @static + * @param {google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak} message DetectedBreak + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DetectedBreak.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.type = options.enums === String ? "UNKNOWN" : 0; + object.isPrefix = false; } - } - if (message.confidence != null && message.hasOwnProperty("confidence")) - if (typeof message.confidence !== "number") - return "confidence: number expected"; - return null; - }; - - /** - * Creates a Word message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.Word - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.Word} Word - */ - Word.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.Word) + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak.BreakType[message.type] : message.type; + if (message.isPrefix != null && message.hasOwnProperty("isPrefix")) + object.isPrefix = message.isPrefix; return object; - var message = new $root.google.cloud.vision.v1p2beta1.Word(); - if (object.property != null) { - if (typeof object.property !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.Word.property: object expected"); - message.property = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.fromObject(object.property); - } - if (object.boundingBox != null) { - if (typeof object.boundingBox !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.Word.boundingBox: object expected"); - message.boundingBox = $root.google.cloud.vision.v1p2beta1.BoundingPoly.fromObject(object.boundingBox); - } - if (object.symbols) { - if (!Array.isArray(object.symbols)) - throw TypeError(".google.cloud.vision.v1p2beta1.Word.symbols: array expected"); - message.symbols = []; - for (var i = 0; i < object.symbols.length; ++i) { - if (typeof object.symbols[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.Word.symbols: object expected"); - message.symbols[i] = $root.google.cloud.vision.v1p2beta1.Symbol.fromObject(object.symbols[i]); - } - } - if (object.confidence != null) - message.confidence = Number(object.confidence); - return message; - }; - - /** - * Creates a plain object from a Word message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p2beta1.Word - * @static - * @param {google.cloud.vision.v1p2beta1.Word} message Word - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Word.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.symbols = []; - if (options.defaults) { - object.property = null; - object.boundingBox = null; - object.confidence = 0; - } - if (message.property != null && message.hasOwnProperty("property")) - object.property = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.toObject(message.property, options); - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) - object.boundingBox = $root.google.cloud.vision.v1p2beta1.BoundingPoly.toObject(message.boundingBox, options); - if (message.symbols && message.symbols.length) { - object.symbols = []; - for (var j = 0; j < message.symbols.length; ++j) - object.symbols[j] = $root.google.cloud.vision.v1p2beta1.Symbol.toObject(message.symbols[j], options); - } - if (message.confidence != null && message.hasOwnProperty("confidence")) - object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; - return object; - }; + }; - /** - * Converts this Word to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.Word - * @instance - * @returns {Object.} JSON object - */ - Word.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Converts this DetectedBreak to JSON. + * @function toJSON + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak + * @instance + * @returns {Object.} JSON object + */ + DetectedBreak.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return Word; - })(); + /** + * BreakType enum. + * @name google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak.BreakType + * @enum {string} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} SPACE=1 SPACE value + * @property {number} SURE_SPACE=2 SURE_SPACE value + * @property {number} EOL_SURE_SPACE=3 EOL_SURE_SPACE value + * @property {number} HYPHEN=4 HYPHEN value + * @property {number} LINE_BREAK=5 LINE_BREAK value + */ + DetectedBreak.BreakType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "SPACE"] = 1; + values[valuesById[2] = "SURE_SPACE"] = 2; + values[valuesById[3] = "EOL_SURE_SPACE"] = 3; + values[valuesById[4] = "HYPHEN"] = 4; + values[valuesById[5] = "LINE_BREAK"] = 5; + return values; + })(); - v1p2beta1.Symbol = (function() { + return DetectedBreak; + })(); - /** - * Properties of a Symbol. - * @memberof google.cloud.vision.v1p2beta1 - * @interface ISymbol - * @property {google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null} [property] Symbol property - * @property {google.cloud.vision.v1p2beta1.IBoundingPoly|null} [boundingBox] Symbol boundingBox - * @property {string|null} [text] Symbol text - * @property {number|null} [confidence] Symbol confidence - */ + TextAnnotation.TextProperty = (function() { - /** - * Constructs a new Symbol. - * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a Symbol. - * @implements ISymbol - * @constructor - * @param {google.cloud.vision.v1p2beta1.ISymbol=} [properties] Properties to set - */ - function Symbol(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]]; - } + /** + * Properties of a TextProperty. + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation + * @interface ITextProperty + * @property {Array.|null} [detectedLanguages] TextProperty detectedLanguages + * @property {google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedBreak|null} [detectedBreak] TextProperty detectedBreak + */ - /** - * Symbol property. - * @member {google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null|undefined} property - * @memberof google.cloud.vision.v1p2beta1.Symbol - * @instance - */ - Symbol.prototype.property = null; + /** + * Constructs a new TextProperty. + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation + * @classdesc Represents a TextProperty. + * @implements ITextProperty + * @constructor + * @param {google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty=} [properties] Properties to set + */ + function TextProperty(properties) { + this.detectedLanguages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Symbol boundingBox. - * @member {google.cloud.vision.v1p2beta1.IBoundingPoly|null|undefined} boundingBox - * @memberof google.cloud.vision.v1p2beta1.Symbol + /** + * TextProperty detectedLanguages. + * @member {Array.} detectedLanguages + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty + * @instance + */ + TextProperty.prototype.detectedLanguages = $util.emptyArray; + + /** + * TextProperty detectedBreak. + * @member {google.cloud.vision.v1p2beta1.TextAnnotation.IDetectedBreak|null|undefined} detectedBreak + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty + * @instance + */ + TextProperty.prototype.detectedBreak = null; + + /** + * Creates a new TextProperty instance using the specified properties. + * @function create + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty + * @static + * @param {google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty} TextProperty instance + */ + TextProperty.create = function create(properties) { + return new TextProperty(properties); + }; + + /** + * Encodes the specified TextProperty message. Does not implicitly {@link google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.verify|verify} messages. + * @function encode + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty + * @static + * @param {google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty} message TextProperty message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextProperty.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.detectedLanguages != null && message.detectedLanguages.length) + for (var i = 0; i < message.detectedLanguages.length; ++i) + $root.google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage.encode(message.detectedLanguages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.detectedBreak != null && message.hasOwnProperty("detectedBreak")) + $root.google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak.encode(message.detectedBreak, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TextProperty message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty + * @static + * @param {google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty} message TextProperty message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextProperty.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TextProperty message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty} TextProperty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextProperty.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.vision.v1p2beta1.TextAnnotation.TextProperty(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.detectedLanguages && message.detectedLanguages.length)) + message.detectedLanguages = []; + message.detectedLanguages.push($root.google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage.decode(reader, reader.uint32())); + break; + case 2: + message.detectedBreak = $root.google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TextProperty message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty} TextProperty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextProperty.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TextProperty message. + * @function verify + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TextProperty.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.detectedLanguages != null && message.hasOwnProperty("detectedLanguages")) { + if (!Array.isArray(message.detectedLanguages)) + return "detectedLanguages: array expected"; + for (var i = 0; i < message.detectedLanguages.length; ++i) { + var error = $root.google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage.verify(message.detectedLanguages[i]); + if (error) + return "detectedLanguages." + error; + } + } + if (message.detectedBreak != null && message.hasOwnProperty("detectedBreak")) { + var error = $root.google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak.verify(message.detectedBreak); + if (error) + return "detectedBreak." + error; + } + return null; + }; + + /** + * Creates a TextProperty message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty} TextProperty + */ + TextProperty.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty) + return object; + var message = new $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty(); + if (object.detectedLanguages) { + if (!Array.isArray(object.detectedLanguages)) + throw TypeError(".google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.detectedLanguages: array expected"); + message.detectedLanguages = []; + for (var i = 0; i < object.detectedLanguages.length; ++i) { + if (typeof object.detectedLanguages[i] !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.detectedLanguages: object expected"); + message.detectedLanguages[i] = $root.google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage.fromObject(object.detectedLanguages[i]); + } + } + if (object.detectedBreak != null) { + if (typeof object.detectedBreak !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.detectedBreak: object expected"); + message.detectedBreak = $root.google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak.fromObject(object.detectedBreak); + } + return message; + }; + + /** + * Creates a plain object from a TextProperty message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty + * @static + * @param {google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty} message TextProperty + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TextProperty.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.detectedLanguages = []; + if (options.defaults) + object.detectedBreak = null; + if (message.detectedLanguages && message.detectedLanguages.length) { + object.detectedLanguages = []; + for (var j = 0; j < message.detectedLanguages.length; ++j) + object.detectedLanguages[j] = $root.google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage.toObject(message.detectedLanguages[j], options); + } + if (message.detectedBreak != null && message.hasOwnProperty("detectedBreak")) + object.detectedBreak = $root.google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak.toObject(message.detectedBreak, options); + return object; + }; + + /** + * Converts this TextProperty to JSON. + * @function toJSON + * @memberof google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty + * @instance + * @returns {Object.} JSON object + */ + TextProperty.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return TextProperty; + })(); + + return TextAnnotation; + })(); + + v1p2beta1.Page = (function() { + + /** + * Properties of a Page. + * @memberof google.cloud.vision.v1p2beta1 + * @interface IPage + * @property {google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null} [property] Page property + * @property {number|null} [width] Page width + * @property {number|null} [height] Page height + * @property {Array.|null} [blocks] Page blocks + * @property {number|null} [confidence] Page confidence + */ + + /** + * Constructs a new Page. + * @memberof google.cloud.vision.v1p2beta1 + * @classdesc Represents a Page. + * @implements IPage + * @constructor + * @param {google.cloud.vision.v1p2beta1.IPage=} [properties] Properties to set + */ + function Page(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]]; + } + + /** + * Page property. + * @member {google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null|undefined} property + * @memberof google.cloud.vision.v1p2beta1.Page * @instance */ - Symbol.prototype.boundingBox = null; + Page.prototype.property = null; /** - * Symbol text. - * @member {string} text - * @memberof google.cloud.vision.v1p2beta1.Symbol + * Page width. + * @member {number} width + * @memberof google.cloud.vision.v1p2beta1.Page * @instance */ - Symbol.prototype.text = ""; + Page.prototype.width = 0; /** - * Symbol confidence. + * Page height. + * @member {number} height + * @memberof google.cloud.vision.v1p2beta1.Page + * @instance + */ + Page.prototype.height = 0; + + /** + * Page blocks. + * @member {Array.} blocks + * @memberof google.cloud.vision.v1p2beta1.Page + * @instance + */ + Page.prototype.blocks = $util.emptyArray; + + /** + * Page confidence. * @member {number} confidence - * @memberof google.cloud.vision.v1p2beta1.Symbol + * @memberof google.cloud.vision.v1p2beta1.Page * @instance */ - Symbol.prototype.confidence = 0; + Page.prototype.confidence = 0; /** - * Creates a new Symbol instance using the specified properties. + * Creates a new Page instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.Symbol + * @memberof google.cloud.vision.v1p2beta1.Page * @static - * @param {google.cloud.vision.v1p2beta1.ISymbol=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.Symbol} Symbol instance + * @param {google.cloud.vision.v1p2beta1.IPage=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.Page} Page instance */ - Symbol.create = function create(properties) { - return new Symbol(properties); + Page.create = function create(properties) { + return new Page(properties); }; /** - * Encodes the specified Symbol message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Symbol.verify|verify} messages. + * Encodes the specified Page message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Page.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.Symbol + * @memberof google.cloud.vision.v1p2beta1.Page * @static - * @param {google.cloud.vision.v1p2beta1.ISymbol} message Symbol message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IPage} message Page message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Symbol.encode = function encode(message, writer) { + Page.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.property != null && message.hasOwnProperty("property")) $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) - $root.google.cloud.vision.v1p2beta1.BoundingPoly.encode(message.boundingBox, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.text != null && message.hasOwnProperty("text")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.text); + if (message.width != null && message.hasOwnProperty("width")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.width); + if (message.height != null && message.hasOwnProperty("height")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.height); + if (message.blocks != null && message.blocks.length) + for (var i = 0; i < message.blocks.length; ++i) + $root.google.cloud.vision.v1p2beta1.Block.encode(message.blocks[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.confidence != null && message.hasOwnProperty("confidence")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.confidence); + writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); return writer; }; /** - * Encodes the specified Symbol message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.Symbol.verify|verify} messages. + * Encodes the specified Page message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.Page.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.Symbol + * @memberof google.cloud.vision.v1p2beta1.Page * @static - * @param {google.cloud.vision.v1p2beta1.ISymbol} message Symbol message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IPage} message Page message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Symbol.encodeDelimited = function encodeDelimited(message, writer) { + Page.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Symbol message from the specified reader or buffer. + * Decodes a Page message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.Symbol + * @memberof google.cloud.vision.v1p2beta1.Page * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.Symbol} Symbol + * @returns {google.cloud.vision.v1p2beta1.Page} Page * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Symbol.decode = function decode(reader, length) { + Page.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.vision.v1p2beta1.Symbol(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.Page(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { @@ -48406,12 +47181,17 @@ message.property = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.decode(reader, reader.uint32()); break; case 2: - message.boundingBox = $root.google.cloud.vision.v1p2beta1.BoundingPoly.decode(reader, reader.uint32()); + message.width = reader.int32(); break; case 3: - message.text = reader.string(); + message.height = reader.int32(); break; case 4: + if (!(message.blocks && message.blocks.length)) + message.blocks = []; + message.blocks.push($root.google.cloud.vision.v1p2beta1.Block.decode(reader, reader.uint32())); + break; + case 5: message.confidence = reader.float(); break; default: @@ -48423,30 +47203,30 @@ }; /** - * Decodes a Symbol message from the specified reader or buffer, length delimited. + * Decodes a Page message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.Symbol + * @memberof google.cloud.vision.v1p2beta1.Page * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.Symbol} Symbol + * @returns {google.cloud.vision.v1p2beta1.Page} Page * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Symbol.decodeDelimited = function decodeDelimited(reader) { + Page.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Symbol message. + * Verifies a Page message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.Symbol + * @memberof google.cloud.vision.v1p2beta1.Page * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Symbol.verify = function verify(message) { + Page.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.property != null && message.hasOwnProperty("property")) { @@ -48454,14 +47234,21 @@ if (error) return "property." + error; } - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) { - var error = $root.google.cloud.vision.v1p2beta1.BoundingPoly.verify(message.boundingBox); - if (error) - return "boundingBox." + error; + if (message.width != null && message.hasOwnProperty("width")) + if (!$util.isInteger(message.width)) + return "width: integer expected"; + if (message.height != null && message.hasOwnProperty("height")) + if (!$util.isInteger(message.height)) + return "height: integer 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.vision.v1p2beta1.Block.verify(message.blocks[i]); + if (error) + return "blocks." + error; + } } - if (message.text != null && message.hasOwnProperty("text")) - if (!$util.isString(message.text)) - return "text: string expected"; if (message.confidence != null && message.hasOwnProperty("confidence")) if (typeof message.confidence !== "number") return "confidence: number expected"; @@ -48469,107 +47256,115 @@ }; /** - * Creates a Symbol message from a plain object. Also converts values to their respective internal types. + * Creates a Page message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.Symbol + * @memberof google.cloud.vision.v1p2beta1.Page * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.Symbol} Symbol + * @returns {google.cloud.vision.v1p2beta1.Page} Page */ - Symbol.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.Symbol) + Page.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.Page) return object; - var message = new $root.google.cloud.vision.v1p2beta1.Symbol(); + var message = new $root.google.cloud.vision.v1p2beta1.Page(); if (object.property != null) { if (typeof object.property !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.Symbol.property: object expected"); + throw TypeError(".google.cloud.vision.v1p2beta1.Page.property: object expected"); message.property = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.fromObject(object.property); } - if (object.boundingBox != null) { - if (typeof object.boundingBox !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.Symbol.boundingBox: object expected"); - message.boundingBox = $root.google.cloud.vision.v1p2beta1.BoundingPoly.fromObject(object.boundingBox); + if (object.width != null) + message.width = object.width | 0; + if (object.height != null) + message.height = object.height | 0; + if (object.blocks) { + if (!Array.isArray(object.blocks)) + throw TypeError(".google.cloud.vision.v1p2beta1.Page.blocks: array expected"); + message.blocks = []; + for (var i = 0; i < object.blocks.length; ++i) { + if (typeof object.blocks[i] !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.Page.blocks: object expected"); + message.blocks[i] = $root.google.cloud.vision.v1p2beta1.Block.fromObject(object.blocks[i]); + } } - if (object.text != null) - message.text = String(object.text); if (object.confidence != null) message.confidence = Number(object.confidence); return message; }; /** - * Creates a plain object from a Symbol message. Also converts values to other types if specified. + * Creates a plain object from a Page message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.Symbol + * @memberof google.cloud.vision.v1p2beta1.Page * @static - * @param {google.cloud.vision.v1p2beta1.Symbol} message Symbol + * @param {google.cloud.vision.v1p2beta1.Page} message Page * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Symbol.toObject = function toObject(message, options) { + Page.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.blocks = []; if (options.defaults) { object.property = null; - object.boundingBox = null; - object.text = ""; + object.width = 0; + object.height = 0; object.confidence = 0; } if (message.property != null && message.hasOwnProperty("property")) object.property = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.toObject(message.property, options); - if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) - object.boundingBox = $root.google.cloud.vision.v1p2beta1.BoundingPoly.toObject(message.boundingBox, options); - if (message.text != null && message.hasOwnProperty("text")) - object.text = message.text; + if (message.width != null && message.hasOwnProperty("width")) + object.width = message.width; + if (message.height != null && message.hasOwnProperty("height")) + object.height = message.height; + if (message.blocks && message.blocks.length) { + object.blocks = []; + for (var j = 0; j < message.blocks.length; ++j) + object.blocks[j] = $root.google.cloud.vision.v1p2beta1.Block.toObject(message.blocks[j], options); + } if (message.confidence != null && message.hasOwnProperty("confidence")) object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; return object; }; /** - * Converts this Symbol to JSON. + * Converts this Page to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.Symbol + * @memberof google.cloud.vision.v1p2beta1.Page * @instance * @returns {Object.} JSON object */ - Symbol.prototype.toJSON = function toJSON() { + Page.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Symbol; + return Page; })(); - v1p2beta1.WebDetection = (function() { + v1p2beta1.Block = (function() { /** - * Properties of a WebDetection. + * Properties of a Block. * @memberof google.cloud.vision.v1p2beta1 - * @interface IWebDetection - * @property {Array.|null} [webEntities] WebDetection webEntities - * @property {Array.|null} [fullMatchingImages] WebDetection fullMatchingImages - * @property {Array.|null} [partialMatchingImages] WebDetection partialMatchingImages - * @property {Array.|null} [pagesWithMatchingImages] WebDetection pagesWithMatchingImages - * @property {Array.|null} [visuallySimilarImages] WebDetection visuallySimilarImages - * @property {Array.|null} [bestGuessLabels] WebDetection bestGuessLabels + * @interface IBlock + * @property {google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null} [property] Block property + * @property {google.cloud.vision.v1p2beta1.IBoundingPoly|null} [boundingBox] Block boundingBox + * @property {Array.|null} [paragraphs] Block paragraphs + * @property {google.cloud.vision.v1p2beta1.Block.BlockType|null} [blockType] Block blockType + * @property {number|null} [confidence] Block confidence */ /** - * Constructs a new WebDetection. + * Constructs a new Block. * @memberof google.cloud.vision.v1p2beta1 - * @classdesc Represents a WebDetection. - * @implements IWebDetection + * @classdesc Represents a Block. + * @implements IBlock * @constructor - * @param {google.cloud.vision.v1p2beta1.IWebDetection=} [properties] Properties to set + * @param {google.cloud.vision.v1p2beta1.IBlock=} [properties] Properties to set */ - function WebDetection(properties) { - this.webEntities = []; - this.fullMatchingImages = []; - this.partialMatchingImages = []; - this.pagesWithMatchingImages = []; - this.visuallySimilarImages = []; - this.bestGuessLabels = []; + function Block(properties) { + this.paragraphs = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -48577,158 +47372,130 @@ } /** - * WebDetection webEntities. - * @member {Array.} webEntities - * @memberof google.cloud.vision.v1p2beta1.WebDetection + * Block property. + * @member {google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null|undefined} property + * @memberof google.cloud.vision.v1p2beta1.Block * @instance */ - WebDetection.prototype.webEntities = $util.emptyArray; + Block.prototype.property = null; /** - * WebDetection fullMatchingImages. - * @member {Array.} fullMatchingImages - * @memberof google.cloud.vision.v1p2beta1.WebDetection + * Block boundingBox. + * @member {google.cloud.vision.v1p2beta1.IBoundingPoly|null|undefined} boundingBox + * @memberof google.cloud.vision.v1p2beta1.Block * @instance */ - WebDetection.prototype.fullMatchingImages = $util.emptyArray; + Block.prototype.boundingBox = null; /** - * WebDetection partialMatchingImages. - * @member {Array.} partialMatchingImages - * @memberof google.cloud.vision.v1p2beta1.WebDetection + * Block paragraphs. + * @member {Array.} paragraphs + * @memberof google.cloud.vision.v1p2beta1.Block * @instance */ - WebDetection.prototype.partialMatchingImages = $util.emptyArray; + Block.prototype.paragraphs = $util.emptyArray; /** - * WebDetection pagesWithMatchingImages. - * @member {Array.} pagesWithMatchingImages - * @memberof google.cloud.vision.v1p2beta1.WebDetection + * Block blockType. + * @member {google.cloud.vision.v1p2beta1.Block.BlockType} blockType + * @memberof google.cloud.vision.v1p2beta1.Block * @instance */ - WebDetection.prototype.pagesWithMatchingImages = $util.emptyArray; + Block.prototype.blockType = 0; /** - * WebDetection visuallySimilarImages. - * @member {Array.} visuallySimilarImages - * @memberof google.cloud.vision.v1p2beta1.WebDetection - * @instance - */ - WebDetection.prototype.visuallySimilarImages = $util.emptyArray; - - /** - * WebDetection bestGuessLabels. - * @member {Array.} bestGuessLabels - * @memberof google.cloud.vision.v1p2beta1.WebDetection + * Block confidence. + * @member {number} confidence + * @memberof google.cloud.vision.v1p2beta1.Block * @instance */ - WebDetection.prototype.bestGuessLabels = $util.emptyArray; + Block.prototype.confidence = 0; /** - * Creates a new WebDetection instance using the specified properties. + * Creates a new Block instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p2beta1.WebDetection + * @memberof google.cloud.vision.v1p2beta1.Block * @static - * @param {google.cloud.vision.v1p2beta1.IWebDetection=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.WebDetection} WebDetection instance + * @param {google.cloud.vision.v1p2beta1.IBlock=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.Block} Block instance */ - WebDetection.create = function create(properties) { - return new WebDetection(properties); + Block.create = function create(properties) { + return new Block(properties); }; /** - * Encodes the specified WebDetection message. Does not implicitly {@link google.cloud.vision.v1p2beta1.WebDetection.verify|verify} messages. + * Encodes the specified Block message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Block.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p2beta1.WebDetection + * @memberof google.cloud.vision.v1p2beta1.Block * @static - * @param {google.cloud.vision.v1p2beta1.IWebDetection} message WebDetection message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IBlock} message Block message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WebDetection.encode = function encode(message, writer) { + Block.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.webEntities != null && message.webEntities.length) - for (var i = 0; i < message.webEntities.length; ++i) - $root.google.cloud.vision.v1p2beta1.WebDetection.WebEntity.encode(message.webEntities[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.fullMatchingImages != null && message.fullMatchingImages.length) - for (var i = 0; i < message.fullMatchingImages.length; ++i) - $root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.encode(message.fullMatchingImages[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.partialMatchingImages != null && message.partialMatchingImages.length) - for (var i = 0; i < message.partialMatchingImages.length; ++i) - $root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.encode(message.partialMatchingImages[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.pagesWithMatchingImages != null && message.pagesWithMatchingImages.length) - for (var i = 0; i < message.pagesWithMatchingImages.length; ++i) - $root.google.cloud.vision.v1p2beta1.WebDetection.WebPage.encode(message.pagesWithMatchingImages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.visuallySimilarImages != null && message.visuallySimilarImages.length) - for (var i = 0; i < message.visuallySimilarImages.length; ++i) - $root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.encode(message.visuallySimilarImages[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.bestGuessLabels != null && message.bestGuessLabels.length) - for (var i = 0; i < message.bestGuessLabels.length; ++i) - $root.google.cloud.vision.v1p2beta1.WebDetection.WebLabel.encode(message.bestGuessLabels[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.property != null && message.hasOwnProperty("property")) + $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) + $root.google.cloud.vision.v1p2beta1.BoundingPoly.encode(message.boundingBox, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.paragraphs != null && message.paragraphs.length) + for (var i = 0; i < message.paragraphs.length; ++i) + $root.google.cloud.vision.v1p2beta1.Paragraph.encode(message.paragraphs[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.blockType != null && message.hasOwnProperty("blockType")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.blockType); + if (message.confidence != null && message.hasOwnProperty("confidence")) + writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); return writer; }; /** - * Encodes the specified WebDetection message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.WebDetection.verify|verify} messages. + * Encodes the specified Block message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.Block.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p2beta1.WebDetection + * @memberof google.cloud.vision.v1p2beta1.Block * @static - * @param {google.cloud.vision.v1p2beta1.IWebDetection} message WebDetection message or plain object to encode + * @param {google.cloud.vision.v1p2beta1.IBlock} message Block message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WebDetection.encodeDelimited = function encodeDelimited(message, writer) { + Block.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a WebDetection message from the specified reader or buffer. + * Decodes a Block message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p2beta1.WebDetection + * @memberof google.cloud.vision.v1p2beta1.Block * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p2beta1.WebDetection} WebDetection + * @returns {google.cloud.vision.v1p2beta1.Block} Block * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WebDetection.decode = function decode(reader, length) { + Block.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.vision.v1p2beta1.WebDetection(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.Block(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.webEntities && message.webEntities.length)) - message.webEntities = []; - message.webEntities.push($root.google.cloud.vision.v1p2beta1.WebDetection.WebEntity.decode(reader, reader.uint32())); + message.property = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.decode(reader, reader.uint32()); break; case 2: - if (!(message.fullMatchingImages && message.fullMatchingImages.length)) - message.fullMatchingImages = []; - message.fullMatchingImages.push($root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.decode(reader, reader.uint32())); + message.boundingBox = $root.google.cloud.vision.v1p2beta1.BoundingPoly.decode(reader, reader.uint32()); break; case 3: - if (!(message.partialMatchingImages && message.partialMatchingImages.length)) - message.partialMatchingImages = []; - message.partialMatchingImages.push($root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.decode(reader, reader.uint32())); + if (!(message.paragraphs && message.paragraphs.length)) + message.paragraphs = []; + message.paragraphs.push($root.google.cloud.vision.v1p2beta1.Paragraph.decode(reader, reader.uint32())); break; case 4: - if (!(message.pagesWithMatchingImages && message.pagesWithMatchingImages.length)) - message.pagesWithMatchingImages = []; - message.pagesWithMatchingImages.push($root.google.cloud.vision.v1p2beta1.WebDetection.WebPage.decode(reader, reader.uint32())); - break; - case 6: - if (!(message.visuallySimilarImages && message.visuallySimilarImages.length)) - message.visuallySimilarImages = []; - message.visuallySimilarImages.push($root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.decode(reader, reader.uint32())); + message.blockType = reader.int32(); break; - case 8: - if (!(message.bestGuessLabels && message.bestGuessLabels.length)) - message.bestGuessLabels = []; - message.bestGuessLabels.push($root.google.cloud.vision.v1p2beta1.WebDetection.WebLabel.decode(reader, reader.uint32())); + case 5: + message.confidence = reader.float(); break; default: reader.skipType(tag & 7); @@ -48739,308 +47506,1541 @@ }; /** - * Decodes a WebDetection message from the specified reader or buffer, length delimited. + * Decodes a Block message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p2beta1.WebDetection + * @memberof google.cloud.vision.v1p2beta1.Block * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p2beta1.WebDetection} WebDetection + * @returns {google.cloud.vision.v1p2beta1.Block} Block * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WebDetection.decodeDelimited = function decodeDelimited(reader) { + Block.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a WebDetection message. + * Verifies a Block message. * @function verify - * @memberof google.cloud.vision.v1p2beta1.WebDetection + * @memberof google.cloud.vision.v1p2beta1.Block * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - WebDetection.verify = function verify(message) { + Block.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.webEntities != null && message.hasOwnProperty("webEntities")) { - if (!Array.isArray(message.webEntities)) - return "webEntities: array expected"; - for (var i = 0; i < message.webEntities.length; ++i) { - var error = $root.google.cloud.vision.v1p2beta1.WebDetection.WebEntity.verify(message.webEntities[i]); - if (error) - return "webEntities." + error; - } - } - if (message.fullMatchingImages != null && message.hasOwnProperty("fullMatchingImages")) { - if (!Array.isArray(message.fullMatchingImages)) - return "fullMatchingImages: array expected"; - for (var i = 0; i < message.fullMatchingImages.length; ++i) { - var error = $root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.verify(message.fullMatchingImages[i]); - if (error) - return "fullMatchingImages." + error; - } - } - if (message.partialMatchingImages != null && message.hasOwnProperty("partialMatchingImages")) { - if (!Array.isArray(message.partialMatchingImages)) - return "partialMatchingImages: array expected"; - for (var i = 0; i < message.partialMatchingImages.length; ++i) { - var error = $root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.verify(message.partialMatchingImages[i]); - if (error) - return "partialMatchingImages." + error; - } + if (message.property != null && message.hasOwnProperty("property")) { + var error = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.verify(message.property); + if (error) + return "property." + error; } - if (message.pagesWithMatchingImages != null && message.hasOwnProperty("pagesWithMatchingImages")) { - if (!Array.isArray(message.pagesWithMatchingImages)) - return "pagesWithMatchingImages: array expected"; - for (var i = 0; i < message.pagesWithMatchingImages.length; ++i) { - var error = $root.google.cloud.vision.v1p2beta1.WebDetection.WebPage.verify(message.pagesWithMatchingImages[i]); - if (error) - return "pagesWithMatchingImages." + error; - } + if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) { + var error = $root.google.cloud.vision.v1p2beta1.BoundingPoly.verify(message.boundingBox); + if (error) + return "boundingBox." + error; } - if (message.visuallySimilarImages != null && message.hasOwnProperty("visuallySimilarImages")) { - if (!Array.isArray(message.visuallySimilarImages)) - return "visuallySimilarImages: array expected"; - for (var i = 0; i < message.visuallySimilarImages.length; ++i) { - var error = $root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.verify(message.visuallySimilarImages[i]); + if (message.paragraphs != null && message.hasOwnProperty("paragraphs")) { + if (!Array.isArray(message.paragraphs)) + return "paragraphs: array expected"; + for (var i = 0; i < message.paragraphs.length; ++i) { + var error = $root.google.cloud.vision.v1p2beta1.Paragraph.verify(message.paragraphs[i]); if (error) - return "visuallySimilarImages." + error; + return "paragraphs." + error; } } - if (message.bestGuessLabels != null && message.hasOwnProperty("bestGuessLabels")) { - if (!Array.isArray(message.bestGuessLabels)) - return "bestGuessLabels: array expected"; - for (var i = 0; i < message.bestGuessLabels.length; ++i) { - var error = $root.google.cloud.vision.v1p2beta1.WebDetection.WebLabel.verify(message.bestGuessLabels[i]); - if (error) - return "bestGuessLabels." + error; + if (message.blockType != null && message.hasOwnProperty("blockType")) + switch (message.blockType) { + default: + return "blockType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; } - } + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; return null; }; /** - * Creates a WebDetection message from a plain object. Also converts values to their respective internal types. + * Creates a Block message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p2beta1.WebDetection + * @memberof google.cloud.vision.v1p2beta1.Block * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p2beta1.WebDetection} WebDetection + * @returns {google.cloud.vision.v1p2beta1.Block} Block */ - WebDetection.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p2beta1.WebDetection) + Block.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.Block) return object; - var message = new $root.google.cloud.vision.v1p2beta1.WebDetection(); - if (object.webEntities) { - if (!Array.isArray(object.webEntities)) - throw TypeError(".google.cloud.vision.v1p2beta1.WebDetection.webEntities: array expected"); - message.webEntities = []; - for (var i = 0; i < object.webEntities.length; ++i) { - if (typeof object.webEntities[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.WebDetection.webEntities: object expected"); - message.webEntities[i] = $root.google.cloud.vision.v1p2beta1.WebDetection.WebEntity.fromObject(object.webEntities[i]); - } - } - if (object.fullMatchingImages) { - if (!Array.isArray(object.fullMatchingImages)) - throw TypeError(".google.cloud.vision.v1p2beta1.WebDetection.fullMatchingImages: array expected"); - message.fullMatchingImages = []; - for (var i = 0; i < object.fullMatchingImages.length; ++i) { - if (typeof object.fullMatchingImages[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.WebDetection.fullMatchingImages: object expected"); - message.fullMatchingImages[i] = $root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.fromObject(object.fullMatchingImages[i]); - } - } - if (object.partialMatchingImages) { - if (!Array.isArray(object.partialMatchingImages)) - throw TypeError(".google.cloud.vision.v1p2beta1.WebDetection.partialMatchingImages: array expected"); - message.partialMatchingImages = []; - for (var i = 0; i < object.partialMatchingImages.length; ++i) { - if (typeof object.partialMatchingImages[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.WebDetection.partialMatchingImages: object expected"); - message.partialMatchingImages[i] = $root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.fromObject(object.partialMatchingImages[i]); - } + var message = new $root.google.cloud.vision.v1p2beta1.Block(); + if (object.property != null) { + if (typeof object.property !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.Block.property: object expected"); + message.property = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.fromObject(object.property); } - if (object.pagesWithMatchingImages) { - if (!Array.isArray(object.pagesWithMatchingImages)) - throw TypeError(".google.cloud.vision.v1p2beta1.WebDetection.pagesWithMatchingImages: array expected"); - message.pagesWithMatchingImages = []; - for (var i = 0; i < object.pagesWithMatchingImages.length; ++i) { - if (typeof object.pagesWithMatchingImages[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.WebDetection.pagesWithMatchingImages: object expected"); - message.pagesWithMatchingImages[i] = $root.google.cloud.vision.v1p2beta1.WebDetection.WebPage.fromObject(object.pagesWithMatchingImages[i]); - } + if (object.boundingBox != null) { + if (typeof object.boundingBox !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.Block.boundingBox: object expected"); + message.boundingBox = $root.google.cloud.vision.v1p2beta1.BoundingPoly.fromObject(object.boundingBox); } - if (object.visuallySimilarImages) { - if (!Array.isArray(object.visuallySimilarImages)) - throw TypeError(".google.cloud.vision.v1p2beta1.WebDetection.visuallySimilarImages: array expected"); - message.visuallySimilarImages = []; - for (var i = 0; i < object.visuallySimilarImages.length; ++i) { - if (typeof object.visuallySimilarImages[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.WebDetection.visuallySimilarImages: object expected"); - message.visuallySimilarImages[i] = $root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.fromObject(object.visuallySimilarImages[i]); + if (object.paragraphs) { + if (!Array.isArray(object.paragraphs)) + throw TypeError(".google.cloud.vision.v1p2beta1.Block.paragraphs: array expected"); + message.paragraphs = []; + for (var i = 0; i < object.paragraphs.length; ++i) { + if (typeof object.paragraphs[i] !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.Block.paragraphs: object expected"); + message.paragraphs[i] = $root.google.cloud.vision.v1p2beta1.Paragraph.fromObject(object.paragraphs[i]); } } - if (object.bestGuessLabels) { - if (!Array.isArray(object.bestGuessLabels)) - throw TypeError(".google.cloud.vision.v1p2beta1.WebDetection.bestGuessLabels: array expected"); - message.bestGuessLabels = []; - for (var i = 0; i < object.bestGuessLabels.length; ++i) { - if (typeof object.bestGuessLabels[i] !== "object") - throw TypeError(".google.cloud.vision.v1p2beta1.WebDetection.bestGuessLabels: object expected"); - message.bestGuessLabels[i] = $root.google.cloud.vision.v1p2beta1.WebDetection.WebLabel.fromObject(object.bestGuessLabels[i]); - } + switch (object.blockType) { + case "UNKNOWN": + case 0: + message.blockType = 0; + break; + case "TEXT": + case 1: + message.blockType = 1; + break; + case "TABLE": + case 2: + message.blockType = 2; + break; + case "PICTURE": + case 3: + message.blockType = 3; + break; + case "RULER": + case 4: + message.blockType = 4; + break; + case "BARCODE": + case 5: + message.blockType = 5; + break; } + if (object.confidence != null) + message.confidence = Number(object.confidence); return message; }; /** - * Creates a plain object from a WebDetection message. Also converts values to other types if specified. + * Creates a plain object from a Block message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p2beta1.WebDetection + * @memberof google.cloud.vision.v1p2beta1.Block * @static - * @param {google.cloud.vision.v1p2beta1.WebDetection} message WebDetection + * @param {google.cloud.vision.v1p2beta1.Block} message Block * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - WebDetection.toObject = function toObject(message, options) { + Block.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.webEntities = []; - object.fullMatchingImages = []; - object.partialMatchingImages = []; - object.pagesWithMatchingImages = []; - object.visuallySimilarImages = []; - object.bestGuessLabels = []; - } - if (message.webEntities && message.webEntities.length) { - object.webEntities = []; - for (var j = 0; j < message.webEntities.length; ++j) - object.webEntities[j] = $root.google.cloud.vision.v1p2beta1.WebDetection.WebEntity.toObject(message.webEntities[j], options); - } - if (message.fullMatchingImages && message.fullMatchingImages.length) { - object.fullMatchingImages = []; - for (var j = 0; j < message.fullMatchingImages.length; ++j) - object.fullMatchingImages[j] = $root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.toObject(message.fullMatchingImages[j], options); - } - if (message.partialMatchingImages && message.partialMatchingImages.length) { - object.partialMatchingImages = []; - for (var j = 0; j < message.partialMatchingImages.length; ++j) - object.partialMatchingImages[j] = $root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.toObject(message.partialMatchingImages[j], options); - } - if (message.pagesWithMatchingImages && message.pagesWithMatchingImages.length) { - object.pagesWithMatchingImages = []; - for (var j = 0; j < message.pagesWithMatchingImages.length; ++j) - object.pagesWithMatchingImages[j] = $root.google.cloud.vision.v1p2beta1.WebDetection.WebPage.toObject(message.pagesWithMatchingImages[j], options); - } - if (message.visuallySimilarImages && message.visuallySimilarImages.length) { - object.visuallySimilarImages = []; - for (var j = 0; j < message.visuallySimilarImages.length; ++j) - object.visuallySimilarImages[j] = $root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.toObject(message.visuallySimilarImages[j], options); + if (options.arrays || options.defaults) + object.paragraphs = []; + if (options.defaults) { + object.property = null; + object.boundingBox = null; + object.blockType = options.enums === String ? "UNKNOWN" : 0; + object.confidence = 0; } - if (message.bestGuessLabels && message.bestGuessLabels.length) { - object.bestGuessLabels = []; - for (var j = 0; j < message.bestGuessLabels.length; ++j) - object.bestGuessLabels[j] = $root.google.cloud.vision.v1p2beta1.WebDetection.WebLabel.toObject(message.bestGuessLabels[j], options); + if (message.property != null && message.hasOwnProperty("property")) + object.property = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.toObject(message.property, options); + if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) + object.boundingBox = $root.google.cloud.vision.v1p2beta1.BoundingPoly.toObject(message.boundingBox, options); + if (message.paragraphs && message.paragraphs.length) { + object.paragraphs = []; + for (var j = 0; j < message.paragraphs.length; ++j) + object.paragraphs[j] = $root.google.cloud.vision.v1p2beta1.Paragraph.toObject(message.paragraphs[j], options); } + if (message.blockType != null && message.hasOwnProperty("blockType")) + object.blockType = options.enums === String ? $root.google.cloud.vision.v1p2beta1.Block.BlockType[message.blockType] : message.blockType; + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; return object; }; /** - * Converts this WebDetection to JSON. + * Converts this Block to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p2beta1.WebDetection + * @memberof google.cloud.vision.v1p2beta1.Block * @instance * @returns {Object.} JSON object */ - WebDetection.prototype.toJSON = function toJSON() { + Block.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - WebDetection.WebEntity = (function() { + /** + * BlockType enum. + * @name google.cloud.vision.v1p2beta1.Block.BlockType + * @enum {string} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} TEXT=1 TEXT value + * @property {number} TABLE=2 TABLE value + * @property {number} PICTURE=3 PICTURE value + * @property {number} RULER=4 RULER value + * @property {number} BARCODE=5 BARCODE value + */ + Block.BlockType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "TEXT"] = 1; + values[valuesById[2] = "TABLE"] = 2; + values[valuesById[3] = "PICTURE"] = 3; + values[valuesById[4] = "RULER"] = 4; + values[valuesById[5] = "BARCODE"] = 5; + return values; + })(); - /** - * Properties of a WebEntity. - * @memberof google.cloud.vision.v1p2beta1.WebDetection - * @interface IWebEntity - * @property {string|null} [entityId] WebEntity entityId - * @property {number|null} [score] WebEntity score - * @property {string|null} [description] WebEntity description - */ + return Block; + })(); - /** - * Constructs a new WebEntity. - * @memberof google.cloud.vision.v1p2beta1.WebDetection - * @classdesc Represents a WebEntity. - * @implements IWebEntity - * @constructor - * @param {google.cloud.vision.v1p2beta1.WebDetection.IWebEntity=} [properties] Properties to set - */ - function WebEntity(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]]; - } + v1p2beta1.Paragraph = (function() { - /** - * WebEntity entityId. - * @member {string} entityId - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebEntity - * @instance - */ - WebEntity.prototype.entityId = ""; + /** + * Properties of a Paragraph. + * @memberof google.cloud.vision.v1p2beta1 + * @interface IParagraph + * @property {google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null} [property] Paragraph property + * @property {google.cloud.vision.v1p2beta1.IBoundingPoly|null} [boundingBox] Paragraph boundingBox + * @property {Array.|null} [words] Paragraph words + * @property {number|null} [confidence] Paragraph confidence + */ - /** - * WebEntity score. - * @member {number} score - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebEntity - * @instance - */ - WebEntity.prototype.score = 0; + /** + * Constructs a new Paragraph. + * @memberof google.cloud.vision.v1p2beta1 + * @classdesc Represents a Paragraph. + * @implements IParagraph + * @constructor + * @param {google.cloud.vision.v1p2beta1.IParagraph=} [properties] Properties to set + */ + function Paragraph(properties) { + this.words = []; + 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]]; + } - /** - * WebEntity description. - * @member {string} description - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebEntity - * @instance - */ - WebEntity.prototype.description = ""; + /** + * Paragraph property. + * @member {google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null|undefined} property + * @memberof google.cloud.vision.v1p2beta1.Paragraph + * @instance + */ + Paragraph.prototype.property = null; - /** - * Creates a new WebEntity instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebEntity - * @static - * @param {google.cloud.vision.v1p2beta1.WebDetection.IWebEntity=} [properties] Properties to set - * @returns {google.cloud.vision.v1p2beta1.WebDetection.WebEntity} WebEntity instance - */ - WebEntity.create = function create(properties) { - return new WebEntity(properties); - }; + /** + * Paragraph boundingBox. + * @member {google.cloud.vision.v1p2beta1.IBoundingPoly|null|undefined} boundingBox + * @memberof google.cloud.vision.v1p2beta1.Paragraph + * @instance + */ + Paragraph.prototype.boundingBox = null; - /** - * Encodes the specified WebEntity message. Does not implicitly {@link google.cloud.vision.v1p2beta1.WebDetection.WebEntity.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebEntity - * @static - * @param {google.cloud.vision.v1p2beta1.WebDetection.IWebEntity} message WebEntity message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - WebEntity.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.entityId != null && message.hasOwnProperty("entityId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.entityId); - if (message.score != null && message.hasOwnProperty("score")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); - if (message.description != null && message.hasOwnProperty("description")) + /** + * Paragraph words. + * @member {Array.} words + * @memberof google.cloud.vision.v1p2beta1.Paragraph + * @instance + */ + Paragraph.prototype.words = $util.emptyArray; + + /** + * Paragraph confidence. + * @member {number} confidence + * @memberof google.cloud.vision.v1p2beta1.Paragraph + * @instance + */ + Paragraph.prototype.confidence = 0; + + /** + * Creates a new Paragraph instance using the specified properties. + * @function create + * @memberof google.cloud.vision.v1p2beta1.Paragraph + * @static + * @param {google.cloud.vision.v1p2beta1.IParagraph=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.Paragraph} Paragraph instance + */ + Paragraph.create = function create(properties) { + return new Paragraph(properties); + }; + + /** + * Encodes the specified Paragraph message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Paragraph.verify|verify} messages. + * @function encode + * @memberof google.cloud.vision.v1p2beta1.Paragraph + * @static + * @param {google.cloud.vision.v1p2beta1.IParagraph} message Paragraph message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Paragraph.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.property != null && message.hasOwnProperty("property")) + $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) + $root.google.cloud.vision.v1p2beta1.BoundingPoly.encode(message.boundingBox, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.words != null && message.words.length) + for (var i = 0; i < message.words.length; ++i) + $root.google.cloud.vision.v1p2beta1.Word.encode(message.words[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.confidence != null && message.hasOwnProperty("confidence")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.confidence); + return writer; + }; + + /** + * Encodes the specified Paragraph message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.Paragraph.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.vision.v1p2beta1.Paragraph + * @static + * @param {google.cloud.vision.v1p2beta1.IParagraph} message Paragraph message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Paragraph.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Paragraph message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.vision.v1p2beta1.Paragraph + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.vision.v1p2beta1.Paragraph} Paragraph + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Paragraph.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.vision.v1p2beta1.Paragraph(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.property = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.decode(reader, reader.uint32()); + break; + case 2: + message.boundingBox = $root.google.cloud.vision.v1p2beta1.BoundingPoly.decode(reader, reader.uint32()); + break; + case 3: + if (!(message.words && message.words.length)) + message.words = []; + message.words.push($root.google.cloud.vision.v1p2beta1.Word.decode(reader, reader.uint32())); + break; + case 4: + message.confidence = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Paragraph message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.vision.v1p2beta1.Paragraph + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.vision.v1p2beta1.Paragraph} Paragraph + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Paragraph.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Paragraph message. + * @function verify + * @memberof google.cloud.vision.v1p2beta1.Paragraph + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Paragraph.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.property != null && message.hasOwnProperty("property")) { + var error = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.verify(message.property); + if (error) + return "property." + error; + } + if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) { + var error = $root.google.cloud.vision.v1p2beta1.BoundingPoly.verify(message.boundingBox); + if (error) + return "boundingBox." + error; + } + if (message.words != null && message.hasOwnProperty("words")) { + if (!Array.isArray(message.words)) + return "words: array expected"; + for (var i = 0; i < message.words.length; ++i) { + var error = $root.google.cloud.vision.v1p2beta1.Word.verify(message.words[i]); + if (error) + return "words." + error; + } + } + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + return null; + }; + + /** + * Creates a Paragraph message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.vision.v1p2beta1.Paragraph + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.vision.v1p2beta1.Paragraph} Paragraph + */ + Paragraph.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.Paragraph) + return object; + var message = new $root.google.cloud.vision.v1p2beta1.Paragraph(); + if (object.property != null) { + if (typeof object.property !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.Paragraph.property: object expected"); + message.property = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.fromObject(object.property); + } + if (object.boundingBox != null) { + if (typeof object.boundingBox !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.Paragraph.boundingBox: object expected"); + message.boundingBox = $root.google.cloud.vision.v1p2beta1.BoundingPoly.fromObject(object.boundingBox); + } + if (object.words) { + if (!Array.isArray(object.words)) + throw TypeError(".google.cloud.vision.v1p2beta1.Paragraph.words: array expected"); + message.words = []; + for (var i = 0; i < object.words.length; ++i) { + if (typeof object.words[i] !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.Paragraph.words: object expected"); + message.words[i] = $root.google.cloud.vision.v1p2beta1.Word.fromObject(object.words[i]); + } + } + if (object.confidence != null) + message.confidence = Number(object.confidence); + return message; + }; + + /** + * Creates a plain object from a Paragraph message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.vision.v1p2beta1.Paragraph + * @static + * @param {google.cloud.vision.v1p2beta1.Paragraph} message Paragraph + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Paragraph.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.words = []; + if (options.defaults) { + object.property = null; + object.boundingBox = null; + object.confidence = 0; + } + if (message.property != null && message.hasOwnProperty("property")) + object.property = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.toObject(message.property, options); + if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) + object.boundingBox = $root.google.cloud.vision.v1p2beta1.BoundingPoly.toObject(message.boundingBox, options); + if (message.words && message.words.length) { + object.words = []; + for (var j = 0; j < message.words.length; ++j) + object.words[j] = $root.google.cloud.vision.v1p2beta1.Word.toObject(message.words[j], options); + } + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + return object; + }; + + /** + * Converts this Paragraph to JSON. + * @function toJSON + * @memberof google.cloud.vision.v1p2beta1.Paragraph + * @instance + * @returns {Object.} JSON object + */ + Paragraph.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Paragraph; + })(); + + v1p2beta1.Word = (function() { + + /** + * Properties of a Word. + * @memberof google.cloud.vision.v1p2beta1 + * @interface IWord + * @property {google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null} [property] Word property + * @property {google.cloud.vision.v1p2beta1.IBoundingPoly|null} [boundingBox] Word boundingBox + * @property {Array.|null} [symbols] Word symbols + * @property {number|null} [confidence] Word confidence + */ + + /** + * Constructs a new Word. + * @memberof google.cloud.vision.v1p2beta1 + * @classdesc Represents a Word. + * @implements IWord + * @constructor + * @param {google.cloud.vision.v1p2beta1.IWord=} [properties] Properties to set + */ + function Word(properties) { + this.symbols = []; + 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]]; + } + + /** + * Word property. + * @member {google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null|undefined} property + * @memberof google.cloud.vision.v1p2beta1.Word + * @instance + */ + Word.prototype.property = null; + + /** + * Word boundingBox. + * @member {google.cloud.vision.v1p2beta1.IBoundingPoly|null|undefined} boundingBox + * @memberof google.cloud.vision.v1p2beta1.Word + * @instance + */ + Word.prototype.boundingBox = null; + + /** + * Word symbols. + * @member {Array.} symbols + * @memberof google.cloud.vision.v1p2beta1.Word + * @instance + */ + Word.prototype.symbols = $util.emptyArray; + + /** + * Word confidence. + * @member {number} confidence + * @memberof google.cloud.vision.v1p2beta1.Word + * @instance + */ + Word.prototype.confidence = 0; + + /** + * Creates a new Word instance using the specified properties. + * @function create + * @memberof google.cloud.vision.v1p2beta1.Word + * @static + * @param {google.cloud.vision.v1p2beta1.IWord=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.Word} Word instance + */ + Word.create = function create(properties) { + return new Word(properties); + }; + + /** + * Encodes the specified Word message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Word.verify|verify} messages. + * @function encode + * @memberof google.cloud.vision.v1p2beta1.Word + * @static + * @param {google.cloud.vision.v1p2beta1.IWord} message Word message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Word.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.property != null && message.hasOwnProperty("property")) + $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) + $root.google.cloud.vision.v1p2beta1.BoundingPoly.encode(message.boundingBox, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.symbols != null && message.symbols.length) + for (var i = 0; i < message.symbols.length; ++i) + $root.google.cloud.vision.v1p2beta1.Symbol.encode(message.symbols[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.confidence != null && message.hasOwnProperty("confidence")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.confidence); + return writer; + }; + + /** + * Encodes the specified Word message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.Word.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.vision.v1p2beta1.Word + * @static + * @param {google.cloud.vision.v1p2beta1.IWord} message Word message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Word.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Word message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.vision.v1p2beta1.Word + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.vision.v1p2beta1.Word} Word + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Word.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.vision.v1p2beta1.Word(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.property = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.decode(reader, reader.uint32()); + break; + case 2: + message.boundingBox = $root.google.cloud.vision.v1p2beta1.BoundingPoly.decode(reader, reader.uint32()); + break; + case 3: + if (!(message.symbols && message.symbols.length)) + message.symbols = []; + message.symbols.push($root.google.cloud.vision.v1p2beta1.Symbol.decode(reader, reader.uint32())); + break; + case 4: + message.confidence = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Word message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.vision.v1p2beta1.Word + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.vision.v1p2beta1.Word} Word + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Word.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Word message. + * @function verify + * @memberof google.cloud.vision.v1p2beta1.Word + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Word.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.property != null && message.hasOwnProperty("property")) { + var error = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.verify(message.property); + if (error) + return "property." + error; + } + if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) { + var error = $root.google.cloud.vision.v1p2beta1.BoundingPoly.verify(message.boundingBox); + if (error) + return "boundingBox." + error; + } + if (message.symbols != null && message.hasOwnProperty("symbols")) { + if (!Array.isArray(message.symbols)) + return "symbols: array expected"; + for (var i = 0; i < message.symbols.length; ++i) { + var error = $root.google.cloud.vision.v1p2beta1.Symbol.verify(message.symbols[i]); + if (error) + return "symbols." + error; + } + } + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + return null; + }; + + /** + * Creates a Word message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.vision.v1p2beta1.Word + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.vision.v1p2beta1.Word} Word + */ + Word.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.Word) + return object; + var message = new $root.google.cloud.vision.v1p2beta1.Word(); + if (object.property != null) { + if (typeof object.property !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.Word.property: object expected"); + message.property = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.fromObject(object.property); + } + if (object.boundingBox != null) { + if (typeof object.boundingBox !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.Word.boundingBox: object expected"); + message.boundingBox = $root.google.cloud.vision.v1p2beta1.BoundingPoly.fromObject(object.boundingBox); + } + if (object.symbols) { + if (!Array.isArray(object.symbols)) + throw TypeError(".google.cloud.vision.v1p2beta1.Word.symbols: array expected"); + message.symbols = []; + for (var i = 0; i < object.symbols.length; ++i) { + if (typeof object.symbols[i] !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.Word.symbols: object expected"); + message.symbols[i] = $root.google.cloud.vision.v1p2beta1.Symbol.fromObject(object.symbols[i]); + } + } + if (object.confidence != null) + message.confidence = Number(object.confidence); + return message; + }; + + /** + * Creates a plain object from a Word message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.vision.v1p2beta1.Word + * @static + * @param {google.cloud.vision.v1p2beta1.Word} message Word + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Word.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.symbols = []; + if (options.defaults) { + object.property = null; + object.boundingBox = null; + object.confidence = 0; + } + if (message.property != null && message.hasOwnProperty("property")) + object.property = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.toObject(message.property, options); + if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) + object.boundingBox = $root.google.cloud.vision.v1p2beta1.BoundingPoly.toObject(message.boundingBox, options); + if (message.symbols && message.symbols.length) { + object.symbols = []; + for (var j = 0; j < message.symbols.length; ++j) + object.symbols[j] = $root.google.cloud.vision.v1p2beta1.Symbol.toObject(message.symbols[j], options); + } + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + return object; + }; + + /** + * Converts this Word to JSON. + * @function toJSON + * @memberof google.cloud.vision.v1p2beta1.Word + * @instance + * @returns {Object.} JSON object + */ + Word.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Word; + })(); + + v1p2beta1.Symbol = (function() { + + /** + * Properties of a Symbol. + * @memberof google.cloud.vision.v1p2beta1 + * @interface ISymbol + * @property {google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null} [property] Symbol property + * @property {google.cloud.vision.v1p2beta1.IBoundingPoly|null} [boundingBox] Symbol boundingBox + * @property {string|null} [text] Symbol text + * @property {number|null} [confidence] Symbol confidence + */ + + /** + * Constructs a new Symbol. + * @memberof google.cloud.vision.v1p2beta1 + * @classdesc Represents a Symbol. + * @implements ISymbol + * @constructor + * @param {google.cloud.vision.v1p2beta1.ISymbol=} [properties] Properties to set + */ + function Symbol(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]]; + } + + /** + * Symbol property. + * @member {google.cloud.vision.v1p2beta1.TextAnnotation.ITextProperty|null|undefined} property + * @memberof google.cloud.vision.v1p2beta1.Symbol + * @instance + */ + Symbol.prototype.property = null; + + /** + * Symbol boundingBox. + * @member {google.cloud.vision.v1p2beta1.IBoundingPoly|null|undefined} boundingBox + * @memberof google.cloud.vision.v1p2beta1.Symbol + * @instance + */ + Symbol.prototype.boundingBox = null; + + /** + * Symbol text. + * @member {string} text + * @memberof google.cloud.vision.v1p2beta1.Symbol + * @instance + */ + Symbol.prototype.text = ""; + + /** + * Symbol confidence. + * @member {number} confidence + * @memberof google.cloud.vision.v1p2beta1.Symbol + * @instance + */ + Symbol.prototype.confidence = 0; + + /** + * Creates a new Symbol instance using the specified properties. + * @function create + * @memberof google.cloud.vision.v1p2beta1.Symbol + * @static + * @param {google.cloud.vision.v1p2beta1.ISymbol=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.Symbol} Symbol instance + */ + Symbol.create = function create(properties) { + return new Symbol(properties); + }; + + /** + * Encodes the specified Symbol message. Does not implicitly {@link google.cloud.vision.v1p2beta1.Symbol.verify|verify} messages. + * @function encode + * @memberof google.cloud.vision.v1p2beta1.Symbol + * @static + * @param {google.cloud.vision.v1p2beta1.ISymbol} message Symbol message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Symbol.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.property != null && message.hasOwnProperty("property")) + $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.encode(message.property, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) + $root.google.cloud.vision.v1p2beta1.BoundingPoly.encode(message.boundingBox, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.text != null && message.hasOwnProperty("text")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.text); + if (message.confidence != null && message.hasOwnProperty("confidence")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.confidence); + return writer; + }; + + /** + * Encodes the specified Symbol message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.Symbol.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.vision.v1p2beta1.Symbol + * @static + * @param {google.cloud.vision.v1p2beta1.ISymbol} message Symbol message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Symbol.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Symbol message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.vision.v1p2beta1.Symbol + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.vision.v1p2beta1.Symbol} Symbol + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Symbol.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p2beta1.Symbol(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.property = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.decode(reader, reader.uint32()); + break; + case 2: + message.boundingBox = $root.google.cloud.vision.v1p2beta1.BoundingPoly.decode(reader, reader.uint32()); + break; + case 3: + message.text = reader.string(); + break; + case 4: + message.confidence = reader.float(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Symbol message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.vision.v1p2beta1.Symbol + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.vision.v1p2beta1.Symbol} Symbol + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Symbol.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Symbol message. + * @function verify + * @memberof google.cloud.vision.v1p2beta1.Symbol + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Symbol.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.property != null && message.hasOwnProperty("property")) { + var error = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.verify(message.property); + if (error) + return "property." + error; + } + if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) { + var error = $root.google.cloud.vision.v1p2beta1.BoundingPoly.verify(message.boundingBox); + if (error) + return "boundingBox." + error; + } + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + return null; + }; + + /** + * Creates a Symbol message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.vision.v1p2beta1.Symbol + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.vision.v1p2beta1.Symbol} Symbol + */ + Symbol.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.Symbol) + return object; + var message = new $root.google.cloud.vision.v1p2beta1.Symbol(); + if (object.property != null) { + if (typeof object.property !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.Symbol.property: object expected"); + message.property = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.fromObject(object.property); + } + if (object.boundingBox != null) { + if (typeof object.boundingBox !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.Symbol.boundingBox: object expected"); + message.boundingBox = $root.google.cloud.vision.v1p2beta1.BoundingPoly.fromObject(object.boundingBox); + } + if (object.text != null) + message.text = String(object.text); + if (object.confidence != null) + message.confidence = Number(object.confidence); + return message; + }; + + /** + * Creates a plain object from a Symbol message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.vision.v1p2beta1.Symbol + * @static + * @param {google.cloud.vision.v1p2beta1.Symbol} message Symbol + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Symbol.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.property = null; + object.boundingBox = null; + object.text = ""; + object.confidence = 0; + } + if (message.property != null && message.hasOwnProperty("property")) + object.property = $root.google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty.toObject(message.property, options); + if (message.boundingBox != null && message.hasOwnProperty("boundingBox")) + object.boundingBox = $root.google.cloud.vision.v1p2beta1.BoundingPoly.toObject(message.boundingBox, options); + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + return object; + }; + + /** + * Converts this Symbol to JSON. + * @function toJSON + * @memberof google.cloud.vision.v1p2beta1.Symbol + * @instance + * @returns {Object.} JSON object + */ + Symbol.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Symbol; + })(); + + v1p2beta1.WebDetection = (function() { + + /** + * Properties of a WebDetection. + * @memberof google.cloud.vision.v1p2beta1 + * @interface IWebDetection + * @property {Array.|null} [webEntities] WebDetection webEntities + * @property {Array.|null} [fullMatchingImages] WebDetection fullMatchingImages + * @property {Array.|null} [partialMatchingImages] WebDetection partialMatchingImages + * @property {Array.|null} [pagesWithMatchingImages] WebDetection pagesWithMatchingImages + * @property {Array.|null} [visuallySimilarImages] WebDetection visuallySimilarImages + * @property {Array.|null} [bestGuessLabels] WebDetection bestGuessLabels + */ + + /** + * Constructs a new WebDetection. + * @memberof google.cloud.vision.v1p2beta1 + * @classdesc Represents a WebDetection. + * @implements IWebDetection + * @constructor + * @param {google.cloud.vision.v1p2beta1.IWebDetection=} [properties] Properties to set + */ + function WebDetection(properties) { + this.webEntities = []; + this.fullMatchingImages = []; + this.partialMatchingImages = []; + this.pagesWithMatchingImages = []; + this.visuallySimilarImages = []; + this.bestGuessLabels = []; + 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]]; + } + + /** + * WebDetection webEntities. + * @member {Array.} webEntities + * @memberof google.cloud.vision.v1p2beta1.WebDetection + * @instance + */ + WebDetection.prototype.webEntities = $util.emptyArray; + + /** + * WebDetection fullMatchingImages. + * @member {Array.} fullMatchingImages + * @memberof google.cloud.vision.v1p2beta1.WebDetection + * @instance + */ + WebDetection.prototype.fullMatchingImages = $util.emptyArray; + + /** + * WebDetection partialMatchingImages. + * @member {Array.} partialMatchingImages + * @memberof google.cloud.vision.v1p2beta1.WebDetection + * @instance + */ + WebDetection.prototype.partialMatchingImages = $util.emptyArray; + + /** + * WebDetection pagesWithMatchingImages. + * @member {Array.} pagesWithMatchingImages + * @memberof google.cloud.vision.v1p2beta1.WebDetection + * @instance + */ + WebDetection.prototype.pagesWithMatchingImages = $util.emptyArray; + + /** + * WebDetection visuallySimilarImages. + * @member {Array.} visuallySimilarImages + * @memberof google.cloud.vision.v1p2beta1.WebDetection + * @instance + */ + WebDetection.prototype.visuallySimilarImages = $util.emptyArray; + + /** + * WebDetection bestGuessLabels. + * @member {Array.} bestGuessLabels + * @memberof google.cloud.vision.v1p2beta1.WebDetection + * @instance + */ + WebDetection.prototype.bestGuessLabels = $util.emptyArray; + + /** + * Creates a new WebDetection instance using the specified properties. + * @function create + * @memberof google.cloud.vision.v1p2beta1.WebDetection + * @static + * @param {google.cloud.vision.v1p2beta1.IWebDetection=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.WebDetection} WebDetection instance + */ + WebDetection.create = function create(properties) { + return new WebDetection(properties); + }; + + /** + * Encodes the specified WebDetection message. Does not implicitly {@link google.cloud.vision.v1p2beta1.WebDetection.verify|verify} messages. + * @function encode + * @memberof google.cloud.vision.v1p2beta1.WebDetection + * @static + * @param {google.cloud.vision.v1p2beta1.IWebDetection} message WebDetection message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebDetection.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.webEntities != null && message.webEntities.length) + for (var i = 0; i < message.webEntities.length; ++i) + $root.google.cloud.vision.v1p2beta1.WebDetection.WebEntity.encode(message.webEntities[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.fullMatchingImages != null && message.fullMatchingImages.length) + for (var i = 0; i < message.fullMatchingImages.length; ++i) + $root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.encode(message.fullMatchingImages[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.partialMatchingImages != null && message.partialMatchingImages.length) + for (var i = 0; i < message.partialMatchingImages.length; ++i) + $root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.encode(message.partialMatchingImages[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.pagesWithMatchingImages != null && message.pagesWithMatchingImages.length) + for (var i = 0; i < message.pagesWithMatchingImages.length; ++i) + $root.google.cloud.vision.v1p2beta1.WebDetection.WebPage.encode(message.pagesWithMatchingImages[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.visuallySimilarImages != null && message.visuallySimilarImages.length) + for (var i = 0; i < message.visuallySimilarImages.length; ++i) + $root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.encode(message.visuallySimilarImages[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.bestGuessLabels != null && message.bestGuessLabels.length) + for (var i = 0; i < message.bestGuessLabels.length; ++i) + $root.google.cloud.vision.v1p2beta1.WebDetection.WebLabel.encode(message.bestGuessLabels[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified WebDetection message, length delimited. Does not implicitly {@link google.cloud.vision.v1p2beta1.WebDetection.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.vision.v1p2beta1.WebDetection + * @static + * @param {google.cloud.vision.v1p2beta1.IWebDetection} message WebDetection message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebDetection.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WebDetection message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.vision.v1p2beta1.WebDetection + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.vision.v1p2beta1.WebDetection} WebDetection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebDetection.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.vision.v1p2beta1.WebDetection(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.webEntities && message.webEntities.length)) + message.webEntities = []; + message.webEntities.push($root.google.cloud.vision.v1p2beta1.WebDetection.WebEntity.decode(reader, reader.uint32())); + break; + case 2: + if (!(message.fullMatchingImages && message.fullMatchingImages.length)) + message.fullMatchingImages = []; + message.fullMatchingImages.push($root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.partialMatchingImages && message.partialMatchingImages.length)) + message.partialMatchingImages = []; + message.partialMatchingImages.push($root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.decode(reader, reader.uint32())); + break; + case 4: + if (!(message.pagesWithMatchingImages && message.pagesWithMatchingImages.length)) + message.pagesWithMatchingImages = []; + message.pagesWithMatchingImages.push($root.google.cloud.vision.v1p2beta1.WebDetection.WebPage.decode(reader, reader.uint32())); + break; + case 6: + if (!(message.visuallySimilarImages && message.visuallySimilarImages.length)) + message.visuallySimilarImages = []; + message.visuallySimilarImages.push($root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.decode(reader, reader.uint32())); + break; + case 8: + if (!(message.bestGuessLabels && message.bestGuessLabels.length)) + message.bestGuessLabels = []; + message.bestGuessLabels.push($root.google.cloud.vision.v1p2beta1.WebDetection.WebLabel.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WebDetection message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.vision.v1p2beta1.WebDetection + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.vision.v1p2beta1.WebDetection} WebDetection + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebDetection.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WebDetection message. + * @function verify + * @memberof google.cloud.vision.v1p2beta1.WebDetection + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WebDetection.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.webEntities != null && message.hasOwnProperty("webEntities")) { + if (!Array.isArray(message.webEntities)) + return "webEntities: array expected"; + for (var i = 0; i < message.webEntities.length; ++i) { + var error = $root.google.cloud.vision.v1p2beta1.WebDetection.WebEntity.verify(message.webEntities[i]); + if (error) + return "webEntities." + error; + } + } + if (message.fullMatchingImages != null && message.hasOwnProperty("fullMatchingImages")) { + if (!Array.isArray(message.fullMatchingImages)) + return "fullMatchingImages: array expected"; + for (var i = 0; i < message.fullMatchingImages.length; ++i) { + var error = $root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.verify(message.fullMatchingImages[i]); + if (error) + return "fullMatchingImages." + error; + } + } + if (message.partialMatchingImages != null && message.hasOwnProperty("partialMatchingImages")) { + if (!Array.isArray(message.partialMatchingImages)) + return "partialMatchingImages: array expected"; + for (var i = 0; i < message.partialMatchingImages.length; ++i) { + var error = $root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.verify(message.partialMatchingImages[i]); + if (error) + return "partialMatchingImages." + error; + } + } + if (message.pagesWithMatchingImages != null && message.hasOwnProperty("pagesWithMatchingImages")) { + if (!Array.isArray(message.pagesWithMatchingImages)) + return "pagesWithMatchingImages: array expected"; + for (var i = 0; i < message.pagesWithMatchingImages.length; ++i) { + var error = $root.google.cloud.vision.v1p2beta1.WebDetection.WebPage.verify(message.pagesWithMatchingImages[i]); + if (error) + return "pagesWithMatchingImages." + error; + } + } + if (message.visuallySimilarImages != null && message.hasOwnProperty("visuallySimilarImages")) { + if (!Array.isArray(message.visuallySimilarImages)) + return "visuallySimilarImages: array expected"; + for (var i = 0; i < message.visuallySimilarImages.length; ++i) { + var error = $root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.verify(message.visuallySimilarImages[i]); + if (error) + return "visuallySimilarImages." + error; + } + } + if (message.bestGuessLabels != null && message.hasOwnProperty("bestGuessLabels")) { + if (!Array.isArray(message.bestGuessLabels)) + return "bestGuessLabels: array expected"; + for (var i = 0; i < message.bestGuessLabels.length; ++i) { + var error = $root.google.cloud.vision.v1p2beta1.WebDetection.WebLabel.verify(message.bestGuessLabels[i]); + if (error) + return "bestGuessLabels." + error; + } + } + return null; + }; + + /** + * Creates a WebDetection message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.vision.v1p2beta1.WebDetection + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.vision.v1p2beta1.WebDetection} WebDetection + */ + WebDetection.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p2beta1.WebDetection) + return object; + var message = new $root.google.cloud.vision.v1p2beta1.WebDetection(); + if (object.webEntities) { + if (!Array.isArray(object.webEntities)) + throw TypeError(".google.cloud.vision.v1p2beta1.WebDetection.webEntities: array expected"); + message.webEntities = []; + for (var i = 0; i < object.webEntities.length; ++i) { + if (typeof object.webEntities[i] !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.WebDetection.webEntities: object expected"); + message.webEntities[i] = $root.google.cloud.vision.v1p2beta1.WebDetection.WebEntity.fromObject(object.webEntities[i]); + } + } + if (object.fullMatchingImages) { + if (!Array.isArray(object.fullMatchingImages)) + throw TypeError(".google.cloud.vision.v1p2beta1.WebDetection.fullMatchingImages: array expected"); + message.fullMatchingImages = []; + for (var i = 0; i < object.fullMatchingImages.length; ++i) { + if (typeof object.fullMatchingImages[i] !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.WebDetection.fullMatchingImages: object expected"); + message.fullMatchingImages[i] = $root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.fromObject(object.fullMatchingImages[i]); + } + } + if (object.partialMatchingImages) { + if (!Array.isArray(object.partialMatchingImages)) + throw TypeError(".google.cloud.vision.v1p2beta1.WebDetection.partialMatchingImages: array expected"); + message.partialMatchingImages = []; + for (var i = 0; i < object.partialMatchingImages.length; ++i) { + if (typeof object.partialMatchingImages[i] !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.WebDetection.partialMatchingImages: object expected"); + message.partialMatchingImages[i] = $root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.fromObject(object.partialMatchingImages[i]); + } + } + if (object.pagesWithMatchingImages) { + if (!Array.isArray(object.pagesWithMatchingImages)) + throw TypeError(".google.cloud.vision.v1p2beta1.WebDetection.pagesWithMatchingImages: array expected"); + message.pagesWithMatchingImages = []; + for (var i = 0; i < object.pagesWithMatchingImages.length; ++i) { + if (typeof object.pagesWithMatchingImages[i] !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.WebDetection.pagesWithMatchingImages: object expected"); + message.pagesWithMatchingImages[i] = $root.google.cloud.vision.v1p2beta1.WebDetection.WebPage.fromObject(object.pagesWithMatchingImages[i]); + } + } + if (object.visuallySimilarImages) { + if (!Array.isArray(object.visuallySimilarImages)) + throw TypeError(".google.cloud.vision.v1p2beta1.WebDetection.visuallySimilarImages: array expected"); + message.visuallySimilarImages = []; + for (var i = 0; i < object.visuallySimilarImages.length; ++i) { + if (typeof object.visuallySimilarImages[i] !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.WebDetection.visuallySimilarImages: object expected"); + message.visuallySimilarImages[i] = $root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.fromObject(object.visuallySimilarImages[i]); + } + } + if (object.bestGuessLabels) { + if (!Array.isArray(object.bestGuessLabels)) + throw TypeError(".google.cloud.vision.v1p2beta1.WebDetection.bestGuessLabels: array expected"); + message.bestGuessLabels = []; + for (var i = 0; i < object.bestGuessLabels.length; ++i) { + if (typeof object.bestGuessLabels[i] !== "object") + throw TypeError(".google.cloud.vision.v1p2beta1.WebDetection.bestGuessLabels: object expected"); + message.bestGuessLabels[i] = $root.google.cloud.vision.v1p2beta1.WebDetection.WebLabel.fromObject(object.bestGuessLabels[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a WebDetection message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.vision.v1p2beta1.WebDetection + * @static + * @param {google.cloud.vision.v1p2beta1.WebDetection} message WebDetection + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WebDetection.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.webEntities = []; + object.fullMatchingImages = []; + object.partialMatchingImages = []; + object.pagesWithMatchingImages = []; + object.visuallySimilarImages = []; + object.bestGuessLabels = []; + } + if (message.webEntities && message.webEntities.length) { + object.webEntities = []; + for (var j = 0; j < message.webEntities.length; ++j) + object.webEntities[j] = $root.google.cloud.vision.v1p2beta1.WebDetection.WebEntity.toObject(message.webEntities[j], options); + } + if (message.fullMatchingImages && message.fullMatchingImages.length) { + object.fullMatchingImages = []; + for (var j = 0; j < message.fullMatchingImages.length; ++j) + object.fullMatchingImages[j] = $root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.toObject(message.fullMatchingImages[j], options); + } + if (message.partialMatchingImages && message.partialMatchingImages.length) { + object.partialMatchingImages = []; + for (var j = 0; j < message.partialMatchingImages.length; ++j) + object.partialMatchingImages[j] = $root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.toObject(message.partialMatchingImages[j], options); + } + if (message.pagesWithMatchingImages && message.pagesWithMatchingImages.length) { + object.pagesWithMatchingImages = []; + for (var j = 0; j < message.pagesWithMatchingImages.length; ++j) + object.pagesWithMatchingImages[j] = $root.google.cloud.vision.v1p2beta1.WebDetection.WebPage.toObject(message.pagesWithMatchingImages[j], options); + } + if (message.visuallySimilarImages && message.visuallySimilarImages.length) { + object.visuallySimilarImages = []; + for (var j = 0; j < message.visuallySimilarImages.length; ++j) + object.visuallySimilarImages[j] = $root.google.cloud.vision.v1p2beta1.WebDetection.WebImage.toObject(message.visuallySimilarImages[j], options); + } + if (message.bestGuessLabels && message.bestGuessLabels.length) { + object.bestGuessLabels = []; + for (var j = 0; j < message.bestGuessLabels.length; ++j) + object.bestGuessLabels[j] = $root.google.cloud.vision.v1p2beta1.WebDetection.WebLabel.toObject(message.bestGuessLabels[j], options); + } + return object; + }; + + /** + * Converts this WebDetection to JSON. + * @function toJSON + * @memberof google.cloud.vision.v1p2beta1.WebDetection + * @instance + * @returns {Object.} JSON object + */ + WebDetection.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + WebDetection.WebEntity = (function() { + + /** + * Properties of a WebEntity. + * @memberof google.cloud.vision.v1p2beta1.WebDetection + * @interface IWebEntity + * @property {string|null} [entityId] WebEntity entityId + * @property {number|null} [score] WebEntity score + * @property {string|null} [description] WebEntity description + */ + + /** + * Constructs a new WebEntity. + * @memberof google.cloud.vision.v1p2beta1.WebDetection + * @classdesc Represents a WebEntity. + * @implements IWebEntity + * @constructor + * @param {google.cloud.vision.v1p2beta1.WebDetection.IWebEntity=} [properties] Properties to set + */ + function WebEntity(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]]; + } + + /** + * WebEntity entityId. + * @member {string} entityId + * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebEntity + * @instance + */ + WebEntity.prototype.entityId = ""; + + /** + * WebEntity score. + * @member {number} score + * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebEntity + * @instance + */ + WebEntity.prototype.score = 0; + + /** + * WebEntity description. + * @member {string} description + * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebEntity + * @instance + */ + WebEntity.prototype.description = ""; + + /** + * Creates a new WebEntity instance using the specified properties. + * @function create + * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebEntity + * @static + * @param {google.cloud.vision.v1p2beta1.WebDetection.IWebEntity=} [properties] Properties to set + * @returns {google.cloud.vision.v1p2beta1.WebDetection.WebEntity} WebEntity instance + */ + WebEntity.create = function create(properties) { + return new WebEntity(properties); + }; + + /** + * Encodes the specified WebEntity message. Does not implicitly {@link google.cloud.vision.v1p2beta1.WebDetection.WebEntity.verify|verify} messages. + * @function encode + * @memberof google.cloud.vision.v1p2beta1.WebDetection.WebEntity + * @static + * @param {google.cloud.vision.v1p2beta1.WebDetection.IWebEntity} message WebEntity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebEntity.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.entityId != null && message.hasOwnProperty("entityId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.entityId); + if (message.score != null && message.hasOwnProperty("score")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); + if (message.description != null && message.hasOwnProperty("description")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); return writer; }; @@ -49949,127 +49949,235 @@ */ var v1p3beta1 = {}; - v1p3beta1.ImageAnnotator = (function() { + v1p3beta1.Vertex = (function() { /** - * Constructs a new ImageAnnotator service. + * Properties of a Vertex. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an ImageAnnotator - * @extends $protobuf.rpc.Service + * @interface IVertex + * @property {number|null} [x] Vertex x + * @property {number|null} [y] Vertex y + */ + + /** + * Constructs a new Vertex. + * @memberof google.cloud.vision.v1p3beta1 + * @classdesc Represents a Vertex. + * @implements IVertex * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @param {google.cloud.vision.v1p3beta1.IVertex=} [properties] Properties to set */ - function ImageAnnotator(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + function Vertex(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]]; } - (ImageAnnotator.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ImageAnnotator; + /** + * Vertex x. + * @member {number} x + * @memberof google.cloud.vision.v1p3beta1.Vertex + * @instance + */ + Vertex.prototype.x = 0; /** - * Creates new ImageAnnotator service using the specified rpc implementation. + * Vertex y. + * @member {number} y + * @memberof google.cloud.vision.v1p3beta1.Vertex + * @instance + */ + Vertex.prototype.y = 0; + + /** + * Creates a new Vertex instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.ImageAnnotator + * @memberof google.cloud.vision.v1p3beta1.Vertex * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {ImageAnnotator} RPC service. Useful where requests and/or responses are streamed. + * @param {google.cloud.vision.v1p3beta1.IVertex=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.Vertex} Vertex instance */ - ImageAnnotator.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); + Vertex.create = function create(properties) { + return new Vertex(properties); }; /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ImageAnnotator#batchAnnotateImages}. - * @memberof google.cloud.vision.v1p3beta1.ImageAnnotator - * @typedef BatchAnnotateImagesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse} [response] BatchAnnotateImagesResponse + * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Vertex.verify|verify} messages. + * @function encode + * @memberof google.cloud.vision.v1p3beta1.Vertex + * @static + * @param {google.cloud.vision.v1p3beta1.IVertex} message Vertex message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ + Vertex.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.x != null && message.hasOwnProperty("x")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.x); + if (message.y != null && message.hasOwnProperty("y")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.y); + return writer; + }; /** - * Calls BatchAnnotateImages. - * @function batchAnnotateImages - * @memberof google.cloud.vision.v1p3beta1.ImageAnnotator - * @instance - * @param {google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest} request BatchAnnotateImagesRequest message or plain object - * @param {google.cloud.vision.v1p3beta1.ImageAnnotator.BatchAnnotateImagesCallback} callback Node-style callback called with the error, if any, and BatchAnnotateImagesResponse - * @returns {undefined} - * @variation 1 + * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.Vertex.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.vision.v1p3beta1.Vertex + * @static + * @param {google.cloud.vision.v1p3beta1.IVertex} message Vertex message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Object.defineProperty(ImageAnnotator.prototype.batchAnnotateImages = function batchAnnotateImages(request, callback) { - return this.rpcCall(batchAnnotateImages, $root.google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest, $root.google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse, request, callback); - }, "name", { value: "BatchAnnotateImages" }); + Vertex.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * Calls BatchAnnotateImages. - * @function batchAnnotateImages - * @memberof google.cloud.vision.v1p3beta1.ImageAnnotator - * @instance - * @param {google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest} request BatchAnnotateImagesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Decodes a Vertex message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.vision.v1p3beta1.Vertex + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.vision.v1p3beta1.Vertex} Vertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ + Vertex.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.vision.v1p3beta1.Vertex(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.x = reader.int32(); + break; + case 2: + message.y = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * Callback as used by {@link google.cloud.vision.v1p3beta1.ImageAnnotator#asyncBatchAnnotateFiles}. - * @memberof google.cloud.vision.v1p3beta1.ImageAnnotator - * @typedef AsyncBatchAnnotateFilesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation + * Decodes a Vertex message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.vision.v1p3beta1.Vertex + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.vision.v1p3beta1.Vertex} Vertex + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ + Vertex.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * Calls AsyncBatchAnnotateFiles. - * @function asyncBatchAnnotateFiles - * @memberof google.cloud.vision.v1p3beta1.ImageAnnotator - * @instance - * @param {google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesRequest} request AsyncBatchAnnotateFilesRequest message or plain object - * @param {google.cloud.vision.v1p3beta1.ImageAnnotator.AsyncBatchAnnotateFilesCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 + * Verifies a Vertex message. + * @function verify + * @memberof google.cloud.vision.v1p3beta1.Vertex + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Object.defineProperty(ImageAnnotator.prototype.asyncBatchAnnotateFiles = function asyncBatchAnnotateFiles(request, callback) { - return this.rpcCall(asyncBatchAnnotateFiles, $root.google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "AsyncBatchAnnotateFiles" }); + Vertex.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.x != null && message.hasOwnProperty("x")) + if (!$util.isInteger(message.x)) + return "x: integer expected"; + if (message.y != null && message.hasOwnProperty("y")) + if (!$util.isInteger(message.y)) + return "y: integer expected"; + return null; + }; /** - * Calls AsyncBatchAnnotateFiles. - * @function asyncBatchAnnotateFiles - * @memberof google.cloud.vision.v1p3beta1.ImageAnnotator + * Creates a Vertex message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.vision.v1p3beta1.Vertex + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.vision.v1p3beta1.Vertex} Vertex + */ + Vertex.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.Vertex) + return object; + var message = new $root.google.cloud.vision.v1p3beta1.Vertex(); + if (object.x != null) + message.x = object.x | 0; + if (object.y != null) + message.y = object.y | 0; + return message; + }; + + /** + * Creates a plain object from a Vertex message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.vision.v1p3beta1.Vertex + * @static + * @param {google.cloud.vision.v1p3beta1.Vertex} message Vertex + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Vertex.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.x = 0; + object.y = 0; + } + if (message.x != null && message.hasOwnProperty("x")) + object.x = message.x; + if (message.y != null && message.hasOwnProperty("y")) + object.y = message.y; + return object; + }; + + /** + * Converts this Vertex to JSON. + * @function toJSON + * @memberof google.cloud.vision.v1p3beta1.Vertex * @instance - * @param {google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesRequest} request AsyncBatchAnnotateFilesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * @returns {Object.} JSON object */ + Vertex.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return ImageAnnotator; + return Vertex; })(); - v1p3beta1.Feature = (function() { + v1p3beta1.NormalizedVertex = (function() { /** - * Properties of a Feature. + * Properties of a NormalizedVertex. * @memberof google.cloud.vision.v1p3beta1 - * @interface IFeature - * @property {google.cloud.vision.v1p3beta1.Feature.Type|null} [type] Feature type - * @property {number|null} [maxResults] Feature maxResults - * @property {string|null} [model] Feature model + * @interface INormalizedVertex + * @property {number|null} [x] NormalizedVertex x + * @property {number|null} [y] NormalizedVertex y */ /** - * Constructs a new Feature. + * Constructs a new NormalizedVertex. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a Feature. - * @implements IFeature + * @classdesc Represents a NormalizedVertex. + * @implements INormalizedVertex * @constructor - * @param {google.cloud.vision.v1p3beta1.IFeature=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.INormalizedVertex=} [properties] Properties to set */ - function Feature(properties) { + function NormalizedVertex(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -50077,101 +50185,88 @@ } /** - * Feature type. - * @member {google.cloud.vision.v1p3beta1.Feature.Type} type - * @memberof google.cloud.vision.v1p3beta1.Feature - * @instance - */ - Feature.prototype.type = 0; - - /** - * Feature maxResults. - * @member {number} maxResults - * @memberof google.cloud.vision.v1p3beta1.Feature + * NormalizedVertex x. + * @member {number} x + * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex * @instance */ - Feature.prototype.maxResults = 0; + NormalizedVertex.prototype.x = 0; /** - * Feature model. - * @member {string} model - * @memberof google.cloud.vision.v1p3beta1.Feature + * NormalizedVertex y. + * @member {number} y + * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex * @instance */ - Feature.prototype.model = ""; + NormalizedVertex.prototype.y = 0; /** - * Creates a new Feature instance using the specified properties. + * Creates a new NormalizedVertex instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.Feature + * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex * @static - * @param {google.cloud.vision.v1p3beta1.IFeature=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.Feature} Feature instance + * @param {google.cloud.vision.v1p3beta1.INormalizedVertex=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.NormalizedVertex} NormalizedVertex instance */ - Feature.create = function create(properties) { - return new Feature(properties); + NormalizedVertex.create = function create(properties) { + return new NormalizedVertex(properties); }; /** - * Encodes the specified Feature message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Feature.verify|verify} messages. + * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.vision.v1p3beta1.NormalizedVertex.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.Feature + * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex * @static - * @param {google.cloud.vision.v1p3beta1.IFeature} message Feature message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.INormalizedVertex} message NormalizedVertex message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Feature.encode = function encode(message, writer) { + NormalizedVertex.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.type != null && message.hasOwnProperty("type")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); - if (message.maxResults != null && message.hasOwnProperty("maxResults")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.maxResults); - if (message.model != null && message.hasOwnProperty("model")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.model); + if (message.x != null && message.hasOwnProperty("x")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); + if (message.y != null && message.hasOwnProperty("y")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); return writer; }; /** - * Encodes the specified Feature message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.Feature.verify|verify} messages. + * Encodes the specified NormalizedVertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.NormalizedVertex.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.Feature + * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex * @static - * @param {google.cloud.vision.v1p3beta1.IFeature} message Feature message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.INormalizedVertex} message NormalizedVertex message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Feature.encodeDelimited = function encodeDelimited(message, writer) { + NormalizedVertex.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Feature message from the specified reader or buffer. + * Decodes a NormalizedVertex message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.Feature + * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.Feature} Feature + * @returns {google.cloud.vision.v1p3beta1.NormalizedVertex} NormalizedVertex * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Feature.decode = function decode(reader, length) { + NormalizedVertex.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.vision.v1p3beta1.Feature(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.NormalizedVertex(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.type = reader.int32(); + message.x = reader.float(); break; case 2: - message.maxResults = reader.int32(); - break; - case 3: - message.model = reader.string(); + message.y = reader.float(); break; default: reader.skipType(tag & 7); @@ -50182,229 +50277,119 @@ }; /** - * Decodes a Feature message from the specified reader or buffer, length delimited. + * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.Feature + * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.Feature} Feature + * @returns {google.cloud.vision.v1p3beta1.NormalizedVertex} NormalizedVertex * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Feature.decodeDelimited = function decodeDelimited(reader) { + NormalizedVertex.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Feature message. + * Verifies a NormalizedVertex message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.Feature + * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Feature.verify = function verify(message) { + NormalizedVertex.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 11: - case 6: - case 7: - case 9: - case 10: - case 12: - case 19: - break; - } - if (message.maxResults != null && message.hasOwnProperty("maxResults")) - if (!$util.isInteger(message.maxResults)) - return "maxResults: integer expected"; - if (message.model != null && message.hasOwnProperty("model")) - if (!$util.isString(message.model)) - return "model: string expected"; + if (message.x != null && message.hasOwnProperty("x")) + if (typeof message.x !== "number") + return "x: number expected"; + if (message.y != null && message.hasOwnProperty("y")) + if (typeof message.y !== "number") + return "y: number expected"; return null; }; /** - * Creates a Feature message from a plain object. Also converts values to their respective internal types. + * Creates a NormalizedVertex message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.Feature + * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.Feature} Feature + * @returns {google.cloud.vision.v1p3beta1.NormalizedVertex} NormalizedVertex */ - Feature.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.Feature) + NormalizedVertex.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.NormalizedVertex) return object; - var message = new $root.google.cloud.vision.v1p3beta1.Feature(); - switch (object.type) { - case "TYPE_UNSPECIFIED": - case 0: - message.type = 0; - break; - case "FACE_DETECTION": - case 1: - message.type = 1; - break; - case "LANDMARK_DETECTION": - case 2: - message.type = 2; - break; - case "LOGO_DETECTION": - case 3: - message.type = 3; - break; - case "LABEL_DETECTION": - case 4: - message.type = 4; - break; - case "TEXT_DETECTION": - case 5: - message.type = 5; - break; - case "DOCUMENT_TEXT_DETECTION": - case 11: - message.type = 11; - break; - case "SAFE_SEARCH_DETECTION": - case 6: - message.type = 6; - break; - case "IMAGE_PROPERTIES": - case 7: - message.type = 7; - break; - case "CROP_HINTS": - case 9: - message.type = 9; - break; - case "WEB_DETECTION": - case 10: - message.type = 10; - break; - case "PRODUCT_SEARCH": - case 12: - message.type = 12; - break; - case "OBJECT_LOCALIZATION": - case 19: - message.type = 19; - break; - } - if (object.maxResults != null) - message.maxResults = object.maxResults | 0; - if (object.model != null) - message.model = String(object.model); + var message = new $root.google.cloud.vision.v1p3beta1.NormalizedVertex(); + if (object.x != null) + message.x = Number(object.x); + if (object.y != null) + message.y = Number(object.y); return message; }; /** - * Creates a plain object from a Feature message. Also converts values to other types if specified. + * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.Feature + * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex * @static - * @param {google.cloud.vision.v1p3beta1.Feature} message Feature + * @param {google.cloud.vision.v1p3beta1.NormalizedVertex} message NormalizedVertex * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Feature.toObject = function toObject(message, options) { + NormalizedVertex.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; - object.maxResults = 0; - object.model = ""; + object.x = 0; + object.y = 0; } - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.vision.v1p3beta1.Feature.Type[message.type] : message.type; - if (message.maxResults != null && message.hasOwnProperty("maxResults")) - object.maxResults = message.maxResults; - if (message.model != null && message.hasOwnProperty("model")) - object.model = message.model; + if (message.x != null && message.hasOwnProperty("x")) + object.x = options.json && !isFinite(message.x) ? String(message.x) : message.x; + if (message.y != null && message.hasOwnProperty("y")) + object.y = options.json && !isFinite(message.y) ? String(message.y) : message.y; return object; }; /** - * Converts this Feature to JSON. + * Converts this NormalizedVertex to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.Feature + * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex * @instance * @returns {Object.} JSON object */ - Feature.prototype.toJSON = function toJSON() { + NormalizedVertex.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * Type enum. - * @name google.cloud.vision.v1p3beta1.Feature.Type - * @enum {string} - * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value - * @property {number} FACE_DETECTION=1 FACE_DETECTION value - * @property {number} LANDMARK_DETECTION=2 LANDMARK_DETECTION value - * @property {number} LOGO_DETECTION=3 LOGO_DETECTION value - * @property {number} LABEL_DETECTION=4 LABEL_DETECTION value - * @property {number} TEXT_DETECTION=5 TEXT_DETECTION value - * @property {number} DOCUMENT_TEXT_DETECTION=11 DOCUMENT_TEXT_DETECTION value - * @property {number} SAFE_SEARCH_DETECTION=6 SAFE_SEARCH_DETECTION value - * @property {number} IMAGE_PROPERTIES=7 IMAGE_PROPERTIES value - * @property {number} CROP_HINTS=9 CROP_HINTS value - * @property {number} WEB_DETECTION=10 WEB_DETECTION value - * @property {number} PRODUCT_SEARCH=12 PRODUCT_SEARCH value - * @property {number} OBJECT_LOCALIZATION=19 OBJECT_LOCALIZATION value - */ - Feature.Type = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "FACE_DETECTION"] = 1; - values[valuesById[2] = "LANDMARK_DETECTION"] = 2; - values[valuesById[3] = "LOGO_DETECTION"] = 3; - values[valuesById[4] = "LABEL_DETECTION"] = 4; - values[valuesById[5] = "TEXT_DETECTION"] = 5; - values[valuesById[11] = "DOCUMENT_TEXT_DETECTION"] = 11; - values[valuesById[6] = "SAFE_SEARCH_DETECTION"] = 6; - values[valuesById[7] = "IMAGE_PROPERTIES"] = 7; - values[valuesById[9] = "CROP_HINTS"] = 9; - values[valuesById[10] = "WEB_DETECTION"] = 10; - values[valuesById[12] = "PRODUCT_SEARCH"] = 12; - values[valuesById[19] = "OBJECT_LOCALIZATION"] = 19; - return values; - })(); - - return Feature; + return NormalizedVertex; })(); - v1p3beta1.ImageSource = (function() { + v1p3beta1.BoundingPoly = (function() { /** - * Properties of an ImageSource. + * Properties of a BoundingPoly. * @memberof google.cloud.vision.v1p3beta1 - * @interface IImageSource - * @property {string|null} [gcsImageUri] ImageSource gcsImageUri - * @property {string|null} [imageUri] ImageSource imageUri + * @interface IBoundingPoly + * @property {Array.|null} [vertices] BoundingPoly vertices + * @property {Array.|null} [normalizedVertices] BoundingPoly normalizedVertices */ /** - * Constructs a new ImageSource. + * Constructs a new BoundingPoly. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an ImageSource. - * @implements IImageSource + * @classdesc Represents a BoundingPoly. + * @implements IBoundingPoly * @constructor - * @param {google.cloud.vision.v1p3beta1.IImageSource=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.IBoundingPoly=} [properties] Properties to set */ - function ImageSource(properties) { + function BoundingPoly(properties) { + this.vertices = []; + this.normalizedVertices = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -50412,88 +50397,94 @@ } /** - * ImageSource gcsImageUri. - * @member {string} gcsImageUri - * @memberof google.cloud.vision.v1p3beta1.ImageSource + * BoundingPoly vertices. + * @member {Array.} vertices + * @memberof google.cloud.vision.v1p3beta1.BoundingPoly * @instance */ - ImageSource.prototype.gcsImageUri = ""; + BoundingPoly.prototype.vertices = $util.emptyArray; /** - * ImageSource imageUri. - * @member {string} imageUri - * @memberof google.cloud.vision.v1p3beta1.ImageSource + * BoundingPoly normalizedVertices. + * @member {Array.} normalizedVertices + * @memberof google.cloud.vision.v1p3beta1.BoundingPoly * @instance */ - ImageSource.prototype.imageUri = ""; + BoundingPoly.prototype.normalizedVertices = $util.emptyArray; /** - * Creates a new ImageSource instance using the specified properties. + * Creates a new BoundingPoly instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.ImageSource + * @memberof google.cloud.vision.v1p3beta1.BoundingPoly * @static - * @param {google.cloud.vision.v1p3beta1.IImageSource=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.ImageSource} ImageSource instance + * @param {google.cloud.vision.v1p3beta1.IBoundingPoly=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.BoundingPoly} BoundingPoly instance */ - ImageSource.create = function create(properties) { - return new ImageSource(properties); + BoundingPoly.create = function create(properties) { + return new BoundingPoly(properties); }; /** - * Encodes the specified ImageSource message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImageSource.verify|verify} messages. + * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.vision.v1p3beta1.BoundingPoly.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.ImageSource + * @memberof google.cloud.vision.v1p3beta1.BoundingPoly * @static - * @param {google.cloud.vision.v1p3beta1.IImageSource} message ImageSource message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IBoundingPoly} message BoundingPoly message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageSource.encode = function encode(message, writer) { + BoundingPoly.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.gcsImageUri != null && message.hasOwnProperty("gcsImageUri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsImageUri); - if (message.imageUri != null && message.hasOwnProperty("imageUri")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.imageUri); + if (message.vertices != null && message.vertices.length) + for (var i = 0; i < message.vertices.length; ++i) + $root.google.cloud.vision.v1p3beta1.Vertex.encode(message.vertices[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.normalizedVertices != null && message.normalizedVertices.length) + for (var i = 0; i < message.normalizedVertices.length; ++i) + $root.google.cloud.vision.v1p3beta1.NormalizedVertex.encode(message.normalizedVertices[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified ImageSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImageSource.verify|verify} messages. + * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.BoundingPoly.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ImageSource + * @memberof google.cloud.vision.v1p3beta1.BoundingPoly * @static - * @param {google.cloud.vision.v1p3beta1.IImageSource} message ImageSource message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IBoundingPoly} message BoundingPoly message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageSource.encodeDelimited = function encodeDelimited(message, writer) { + BoundingPoly.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImageSource message from the specified reader or buffer. + * Decodes a BoundingPoly message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.ImageSource + * @memberof google.cloud.vision.v1p3beta1.BoundingPoly * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.ImageSource} ImageSource + * @returns {google.cloud.vision.v1p3beta1.BoundingPoly} BoundingPoly * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageSource.decode = function decode(reader, length) { + BoundingPoly.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.vision.v1p3beta1.ImageSource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.BoundingPoly(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.gcsImageUri = reader.string(); + if (!(message.vertices && message.vertices.length)) + message.vertices = []; + message.vertices.push($root.google.cloud.vision.v1p3beta1.Vertex.decode(reader, reader.uint32())); break; case 2: - message.imageUri = reader.string(); + if (!(message.normalizedVertices && message.normalizedVertices.length)) + message.normalizedVertices = []; + message.normalizedVertices.push($root.google.cloud.vision.v1p3beta1.NormalizedVertex.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -50504,117 +50495,151 @@ }; /** - * Decodes an ImageSource message from the specified reader or buffer, length delimited. + * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ImageSource + * @memberof google.cloud.vision.v1p3beta1.BoundingPoly * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.ImageSource} ImageSource + * @returns {google.cloud.vision.v1p3beta1.BoundingPoly} BoundingPoly * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageSource.decodeDelimited = function decodeDelimited(reader) { + BoundingPoly.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImageSource message. + * Verifies a BoundingPoly message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.ImageSource + * @memberof google.cloud.vision.v1p3beta1.BoundingPoly * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImageSource.verify = function verify(message) { + BoundingPoly.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.gcsImageUri != null && message.hasOwnProperty("gcsImageUri")) - if (!$util.isString(message.gcsImageUri)) - return "gcsImageUri: string expected"; - if (message.imageUri != null && message.hasOwnProperty("imageUri")) - if (!$util.isString(message.imageUri)) - return "imageUri: string expected"; + if (message.vertices != null && message.hasOwnProperty("vertices")) { + if (!Array.isArray(message.vertices)) + return "vertices: array expected"; + for (var i = 0; i < message.vertices.length; ++i) { + var error = $root.google.cloud.vision.v1p3beta1.Vertex.verify(message.vertices[i]); + if (error) + return "vertices." + error; + } + } + if (message.normalizedVertices != null && message.hasOwnProperty("normalizedVertices")) { + if (!Array.isArray(message.normalizedVertices)) + return "normalizedVertices: array expected"; + for (var i = 0; i < message.normalizedVertices.length; ++i) { + var error = $root.google.cloud.vision.v1p3beta1.NormalizedVertex.verify(message.normalizedVertices[i]); + if (error) + return "normalizedVertices." + error; + } + } return null; }; /** - * Creates an ImageSource message from a plain object. Also converts values to their respective internal types. + * Creates a BoundingPoly message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.ImageSource + * @memberof google.cloud.vision.v1p3beta1.BoundingPoly * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.ImageSource} ImageSource + * @returns {google.cloud.vision.v1p3beta1.BoundingPoly} BoundingPoly */ - ImageSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.ImageSource) + BoundingPoly.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.BoundingPoly) return object; - var message = new $root.google.cloud.vision.v1p3beta1.ImageSource(); - if (object.gcsImageUri != null) - message.gcsImageUri = String(object.gcsImageUri); - if (object.imageUri != null) - message.imageUri = String(object.imageUri); + var message = new $root.google.cloud.vision.v1p3beta1.BoundingPoly(); + if (object.vertices) { + if (!Array.isArray(object.vertices)) + throw TypeError(".google.cloud.vision.v1p3beta1.BoundingPoly.vertices: array expected"); + message.vertices = []; + for (var i = 0; i < object.vertices.length; ++i) { + if (typeof object.vertices[i] !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.BoundingPoly.vertices: object expected"); + message.vertices[i] = $root.google.cloud.vision.v1p3beta1.Vertex.fromObject(object.vertices[i]); + } + } + if (object.normalizedVertices) { + if (!Array.isArray(object.normalizedVertices)) + throw TypeError(".google.cloud.vision.v1p3beta1.BoundingPoly.normalizedVertices: array expected"); + message.normalizedVertices = []; + for (var i = 0; i < object.normalizedVertices.length; ++i) { + if (typeof object.normalizedVertices[i] !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.BoundingPoly.normalizedVertices: object expected"); + message.normalizedVertices[i] = $root.google.cloud.vision.v1p3beta1.NormalizedVertex.fromObject(object.normalizedVertices[i]); + } + } return message; }; /** - * Creates a plain object from an ImageSource message. Also converts values to other types if specified. + * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.ImageSource + * @memberof google.cloud.vision.v1p3beta1.BoundingPoly * @static - * @param {google.cloud.vision.v1p3beta1.ImageSource} message ImageSource + * @param {google.cloud.vision.v1p3beta1.BoundingPoly} message BoundingPoly * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImageSource.toObject = function toObject(message, options) { + BoundingPoly.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.gcsImageUri = ""; - object.imageUri = ""; + if (options.arrays || options.defaults) { + object.vertices = []; + object.normalizedVertices = []; + } + if (message.vertices && message.vertices.length) { + object.vertices = []; + for (var j = 0; j < message.vertices.length; ++j) + object.vertices[j] = $root.google.cloud.vision.v1p3beta1.Vertex.toObject(message.vertices[j], options); + } + if (message.normalizedVertices && message.normalizedVertices.length) { + object.normalizedVertices = []; + for (var j = 0; j < message.normalizedVertices.length; ++j) + object.normalizedVertices[j] = $root.google.cloud.vision.v1p3beta1.NormalizedVertex.toObject(message.normalizedVertices[j], options); } - if (message.gcsImageUri != null && message.hasOwnProperty("gcsImageUri")) - object.gcsImageUri = message.gcsImageUri; - if (message.imageUri != null && message.hasOwnProperty("imageUri")) - object.imageUri = message.imageUri; return object; }; /** - * Converts this ImageSource to JSON. + * Converts this BoundingPoly to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.ImageSource + * @memberof google.cloud.vision.v1p3beta1.BoundingPoly * @instance * @returns {Object.} JSON object */ - ImageSource.prototype.toJSON = function toJSON() { + BoundingPoly.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImageSource; + return BoundingPoly; })(); - v1p3beta1.Image = (function() { + v1p3beta1.NormalizedBoundingPoly = (function() { /** - * Properties of an Image. + * Properties of a NormalizedBoundingPoly. * @memberof google.cloud.vision.v1p3beta1 - * @interface IImage - * @property {Uint8Array|null} [content] Image content - * @property {google.cloud.vision.v1p3beta1.IImageSource|null} [source] Image source + * @interface INormalizedBoundingPoly + * @property {Array.|null} [vertices] NormalizedBoundingPoly vertices */ /** - * Constructs a new Image. + * Constructs a new NormalizedBoundingPoly. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an Image. - * @implements IImage + * @classdesc Represents a NormalizedBoundingPoly. + * @implements INormalizedBoundingPoly * @constructor - * @param {google.cloud.vision.v1p3beta1.IImage=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.INormalizedBoundingPoly=} [properties] Properties to set */ - function Image(properties) { + function NormalizedBoundingPoly(properties) { + this.vertices = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -50622,88 +50647,78 @@ } /** - * Image content. - * @member {Uint8Array} content - * @memberof google.cloud.vision.v1p3beta1.Image - * @instance - */ - Image.prototype.content = $util.newBuffer([]); - - /** - * Image source. - * @member {google.cloud.vision.v1p3beta1.IImageSource|null|undefined} source - * @memberof google.cloud.vision.v1p3beta1.Image + * NormalizedBoundingPoly vertices. + * @member {Array.} vertices + * @memberof google.cloud.vision.v1p3beta1.NormalizedBoundingPoly * @instance */ - Image.prototype.source = null; + NormalizedBoundingPoly.prototype.vertices = $util.emptyArray; /** - * Creates a new Image instance using the specified properties. + * Creates a new NormalizedBoundingPoly instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.Image + * @memberof google.cloud.vision.v1p3beta1.NormalizedBoundingPoly * @static - * @param {google.cloud.vision.v1p3beta1.IImage=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.Image} Image instance + * @param {google.cloud.vision.v1p3beta1.INormalizedBoundingPoly=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.NormalizedBoundingPoly} NormalizedBoundingPoly instance */ - Image.create = function create(properties) { - return new Image(properties); + NormalizedBoundingPoly.create = function create(properties) { + return new NormalizedBoundingPoly(properties); }; /** - * Encodes the specified Image message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Image.verify|verify} messages. + * Encodes the specified NormalizedBoundingPoly message. Does not implicitly {@link google.cloud.vision.v1p3beta1.NormalizedBoundingPoly.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.Image + * @memberof google.cloud.vision.v1p3beta1.NormalizedBoundingPoly * @static - * @param {google.cloud.vision.v1p3beta1.IImage} message Image message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.INormalizedBoundingPoly} message NormalizedBoundingPoly message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Image.encode = function encode(message, writer) { + NormalizedBoundingPoly.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.content != null && message.hasOwnProperty("content")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.content); - if (message.source != null && message.hasOwnProperty("source")) - $root.google.cloud.vision.v1p3beta1.ImageSource.encode(message.source, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.vertices != null && message.vertices.length) + for (var i = 0; i < message.vertices.length; ++i) + $root.google.cloud.vision.v1p3beta1.NormalizedVertex.encode(message.vertices[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.Image.verify|verify} messages. + * Encodes the specified NormalizedBoundingPoly message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.NormalizedBoundingPoly.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.Image + * @memberof google.cloud.vision.v1p3beta1.NormalizedBoundingPoly * @static - * @param {google.cloud.vision.v1p3beta1.IImage} message Image message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.INormalizedBoundingPoly} message NormalizedBoundingPoly message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Image.encodeDelimited = function encodeDelimited(message, writer) { + NormalizedBoundingPoly.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Image message from the specified reader or buffer. + * Decodes a NormalizedBoundingPoly message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.Image + * @memberof google.cloud.vision.v1p3beta1.NormalizedBoundingPoly * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.Image} Image + * @returns {google.cloud.vision.v1p3beta1.NormalizedBoundingPoly} NormalizedBoundingPoly * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Image.decode = function decode(reader, length) { + NormalizedBoundingPoly.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.vision.v1p3beta1.Image(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.NormalizedBoundingPoly(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.content = reader.bytes(); - break; - case 2: - message.source = $root.google.cloud.vision.v1p3beta1.ImageSource.decode(reader, reader.uint32()); + if (!(message.vertices && message.vertices.length)) + message.vertices = []; + message.vertices.push($root.google.cloud.vision.v1p3beta1.NormalizedVertex.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -50714,145 +50729,126 @@ }; /** - * Decodes an Image message from the specified reader or buffer, length delimited. + * Decodes a NormalizedBoundingPoly message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.Image + * @memberof google.cloud.vision.v1p3beta1.NormalizedBoundingPoly * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.Image} Image + * @returns {google.cloud.vision.v1p3beta1.NormalizedBoundingPoly} NormalizedBoundingPoly * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Image.decodeDelimited = function decodeDelimited(reader) { + NormalizedBoundingPoly.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Image message. + * Verifies a NormalizedBoundingPoly message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.Image + * @memberof google.cloud.vision.v1p3beta1.NormalizedBoundingPoly * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Image.verify = function verify(message) { + NormalizedBoundingPoly.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.content != null && message.hasOwnProperty("content")) - if (!(message.content && typeof message.content.length === "number" || $util.isString(message.content))) - return "content: buffer expected"; - if (message.source != null && message.hasOwnProperty("source")) { - var error = $root.google.cloud.vision.v1p3beta1.ImageSource.verify(message.source); - if (error) - return "source." + error; + if (message.vertices != null && message.hasOwnProperty("vertices")) { + if (!Array.isArray(message.vertices)) + return "vertices: array expected"; + for (var i = 0; i < message.vertices.length; ++i) { + var error = $root.google.cloud.vision.v1p3beta1.NormalizedVertex.verify(message.vertices[i]); + if (error) + return "vertices." + error; + } } return null; }; /** - * Creates an Image message from a plain object. Also converts values to their respective internal types. + * Creates a NormalizedBoundingPoly message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.Image + * @memberof google.cloud.vision.v1p3beta1.NormalizedBoundingPoly * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.Image} Image + * @returns {google.cloud.vision.v1p3beta1.NormalizedBoundingPoly} NormalizedBoundingPoly */ - Image.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.Image) + NormalizedBoundingPoly.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.NormalizedBoundingPoly) return object; - var message = new $root.google.cloud.vision.v1p3beta1.Image(); - if (object.content != null) - if (typeof object.content === "string") - $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); - else if (object.content.length) - message.content = object.content; - if (object.source != null) { - if (typeof object.source !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.Image.source: object expected"); - message.source = $root.google.cloud.vision.v1p3beta1.ImageSource.fromObject(object.source); + var message = new $root.google.cloud.vision.v1p3beta1.NormalizedBoundingPoly(); + if (object.vertices) { + if (!Array.isArray(object.vertices)) + throw TypeError(".google.cloud.vision.v1p3beta1.NormalizedBoundingPoly.vertices: array expected"); + message.vertices = []; + for (var i = 0; i < object.vertices.length; ++i) { + if (typeof object.vertices[i] !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.NormalizedBoundingPoly.vertices: object expected"); + message.vertices[i] = $root.google.cloud.vision.v1p3beta1.NormalizedVertex.fromObject(object.vertices[i]); + } } return message; }; /** - * Creates a plain object from an Image message. Also converts values to other types if specified. + * Creates a plain object from a NormalizedBoundingPoly message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.Image + * @memberof google.cloud.vision.v1p3beta1.NormalizedBoundingPoly * @static - * @param {google.cloud.vision.v1p3beta1.Image} message Image + * @param {google.cloud.vision.v1p3beta1.NormalizedBoundingPoly} message NormalizedBoundingPoly * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Image.toObject = function toObject(message, options) { + NormalizedBoundingPoly.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - if (options.bytes === String) - object.content = ""; - else { - object.content = []; - if (options.bytes !== Array) - object.content = $util.newBuffer(object.content); - } - object.source = null; + if (options.arrays || options.defaults) + object.vertices = []; + if (message.vertices && message.vertices.length) { + object.vertices = []; + for (var j = 0; j < message.vertices.length; ++j) + object.vertices[j] = $root.google.cloud.vision.v1p3beta1.NormalizedVertex.toObject(message.vertices[j], options); } - if (message.content != null && message.hasOwnProperty("content")) - object.content = options.bytes === String ? $util.base64.encode(message.content, 0, message.content.length) : options.bytes === Array ? Array.prototype.slice.call(message.content) : message.content; - if (message.source != null && message.hasOwnProperty("source")) - object.source = $root.google.cloud.vision.v1p3beta1.ImageSource.toObject(message.source, options); return object; }; /** - * Converts this Image to JSON. + * Converts this NormalizedBoundingPoly to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.Image + * @memberof google.cloud.vision.v1p3beta1.NormalizedBoundingPoly * @instance * @returns {Object.} JSON object */ - Image.prototype.toJSON = function toJSON() { + NormalizedBoundingPoly.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Image; + return NormalizedBoundingPoly; })(); - v1p3beta1.FaceAnnotation = (function() { + v1p3beta1.Position = (function() { /** - * Properties of a FaceAnnotation. + * Properties of a Position. * @memberof google.cloud.vision.v1p3beta1 - * @interface IFaceAnnotation - * @property {google.cloud.vision.v1p3beta1.IBoundingPoly|null} [boundingPoly] FaceAnnotation boundingPoly - * @property {google.cloud.vision.v1p3beta1.IBoundingPoly|null} [fdBoundingPoly] FaceAnnotation fdBoundingPoly - * @property {Array.|null} [landmarks] FaceAnnotation landmarks - * @property {number|null} [rollAngle] FaceAnnotation rollAngle - * @property {number|null} [panAngle] FaceAnnotation panAngle - * @property {number|null} [tiltAngle] FaceAnnotation tiltAngle - * @property {number|null} [detectionConfidence] FaceAnnotation detectionConfidence - * @property {number|null} [landmarkingConfidence] FaceAnnotation landmarkingConfidence - * @property {google.cloud.vision.v1p3beta1.Likelihood|null} [joyLikelihood] FaceAnnotation joyLikelihood - * @property {google.cloud.vision.v1p3beta1.Likelihood|null} [sorrowLikelihood] FaceAnnotation sorrowLikelihood - * @property {google.cloud.vision.v1p3beta1.Likelihood|null} [angerLikelihood] FaceAnnotation angerLikelihood - * @property {google.cloud.vision.v1p3beta1.Likelihood|null} [surpriseLikelihood] FaceAnnotation surpriseLikelihood - * @property {google.cloud.vision.v1p3beta1.Likelihood|null} [underExposedLikelihood] FaceAnnotation underExposedLikelihood - * @property {google.cloud.vision.v1p3beta1.Likelihood|null} [blurredLikelihood] FaceAnnotation blurredLikelihood - * @property {google.cloud.vision.v1p3beta1.Likelihood|null} [headwearLikelihood] FaceAnnotation headwearLikelihood + * @interface IPosition + * @property {number|null} [x] Position x + * @property {number|null} [y] Position y + * @property {number|null} [z] Position z */ /** - * Constructs a new FaceAnnotation. + * Constructs a new Position. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a FaceAnnotation. - * @implements IFaceAnnotation + * @classdesc Represents a Position. + * @implements IPosition * @constructor - * @param {google.cloud.vision.v1p3beta1.IFaceAnnotation=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.IPosition=} [properties] Properties to set */ - function FaceAnnotation(properties) { - this.landmarks = []; + function Position(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -50860,1216 +50856,667 @@ } /** - * FaceAnnotation boundingPoly. - * @member {google.cloud.vision.v1p3beta1.IBoundingPoly|null|undefined} boundingPoly - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.boundingPoly = null; - - /** - * FaceAnnotation fdBoundingPoly. - * @member {google.cloud.vision.v1p3beta1.IBoundingPoly|null|undefined} fdBoundingPoly - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.fdBoundingPoly = null; - - /** - * FaceAnnotation landmarks. - * @member {Array.} landmarks - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.landmarks = $util.emptyArray; - - /** - * FaceAnnotation rollAngle. - * @member {number} rollAngle - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.rollAngle = 0; - - /** - * FaceAnnotation panAngle. - * @member {number} panAngle - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.panAngle = 0; - - /** - * FaceAnnotation tiltAngle. - * @member {number} tiltAngle - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.tiltAngle = 0; - - /** - * FaceAnnotation detectionConfidence. - * @member {number} detectionConfidence - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.detectionConfidence = 0; - - /** - * FaceAnnotation landmarkingConfidence. - * @member {number} landmarkingConfidence - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.landmarkingConfidence = 0; - - /** - * FaceAnnotation joyLikelihood. - * @member {google.cloud.vision.v1p3beta1.Likelihood} joyLikelihood - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.joyLikelihood = 0; - - /** - * FaceAnnotation sorrowLikelihood. - * @member {google.cloud.vision.v1p3beta1.Likelihood} sorrowLikelihood - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.sorrowLikelihood = 0; - - /** - * FaceAnnotation angerLikelihood. - * @member {google.cloud.vision.v1p3beta1.Likelihood} angerLikelihood - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.angerLikelihood = 0; - - /** - * FaceAnnotation surpriseLikelihood. - * @member {google.cloud.vision.v1p3beta1.Likelihood} surpriseLikelihood - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.surpriseLikelihood = 0; - - /** - * FaceAnnotation underExposedLikelihood. - * @member {google.cloud.vision.v1p3beta1.Likelihood} underExposedLikelihood - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation + * Position x. + * @member {number} x + * @memberof google.cloud.vision.v1p3beta1.Position * @instance */ - FaceAnnotation.prototype.underExposedLikelihood = 0; + Position.prototype.x = 0; /** - * FaceAnnotation blurredLikelihood. - * @member {google.cloud.vision.v1p3beta1.Likelihood} blurredLikelihood - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation + * Position y. + * @member {number} y + * @memberof google.cloud.vision.v1p3beta1.Position * @instance */ - FaceAnnotation.prototype.blurredLikelihood = 0; + Position.prototype.y = 0; /** - * FaceAnnotation headwearLikelihood. - * @member {google.cloud.vision.v1p3beta1.Likelihood} headwearLikelihood - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation + * Position z. + * @member {number} z + * @memberof google.cloud.vision.v1p3beta1.Position * @instance */ - FaceAnnotation.prototype.headwearLikelihood = 0; + Position.prototype.z = 0; /** - * Creates a new FaceAnnotation instance using the specified properties. + * Creates a new Position instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p3beta1.Position * @static - * @param {google.cloud.vision.v1p3beta1.IFaceAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.FaceAnnotation} FaceAnnotation instance + * @param {google.cloud.vision.v1p3beta1.IPosition=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.Position} Position instance */ - FaceAnnotation.create = function create(properties) { - return new FaceAnnotation(properties); + Position.create = function create(properties) { + return new Position(properties); }; /** - * Encodes the specified FaceAnnotation message. Does not implicitly {@link google.cloud.vision.v1p3beta1.FaceAnnotation.verify|verify} messages. + * Encodes the specified Position message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Position.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p3beta1.Position * @static - * @param {google.cloud.vision.v1p3beta1.IFaceAnnotation} message FaceAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IPosition} message Position message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FaceAnnotation.encode = function encode(message, writer) { + Position.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - $root.google.cloud.vision.v1p3beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.fdBoundingPoly != null && message.hasOwnProperty("fdBoundingPoly")) - $root.google.cloud.vision.v1p3beta1.BoundingPoly.encode(message.fdBoundingPoly, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.landmarks != null && message.landmarks.length) - for (var i = 0; i < message.landmarks.length; ++i) - $root.google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark.encode(message.landmarks[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.rollAngle != null && message.hasOwnProperty("rollAngle")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.rollAngle); - if (message.panAngle != null && message.hasOwnProperty("panAngle")) - writer.uint32(/* id 5, wireType 5 =*/45).float(message.panAngle); - if (message.tiltAngle != null && message.hasOwnProperty("tiltAngle")) - writer.uint32(/* id 6, wireType 5 =*/53).float(message.tiltAngle); - if (message.detectionConfidence != null && message.hasOwnProperty("detectionConfidence")) - writer.uint32(/* id 7, wireType 5 =*/61).float(message.detectionConfidence); - if (message.landmarkingConfidence != null && message.hasOwnProperty("landmarkingConfidence")) - writer.uint32(/* id 8, wireType 5 =*/69).float(message.landmarkingConfidence); - if (message.joyLikelihood != null && message.hasOwnProperty("joyLikelihood")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.joyLikelihood); - if (message.sorrowLikelihood != null && message.hasOwnProperty("sorrowLikelihood")) - writer.uint32(/* id 10, wireType 0 =*/80).int32(message.sorrowLikelihood); - if (message.angerLikelihood != null && message.hasOwnProperty("angerLikelihood")) - writer.uint32(/* id 11, wireType 0 =*/88).int32(message.angerLikelihood); - if (message.surpriseLikelihood != null && message.hasOwnProperty("surpriseLikelihood")) - writer.uint32(/* id 12, wireType 0 =*/96).int32(message.surpriseLikelihood); - if (message.underExposedLikelihood != null && message.hasOwnProperty("underExposedLikelihood")) - writer.uint32(/* id 13, wireType 0 =*/104).int32(message.underExposedLikelihood); - if (message.blurredLikelihood != null && message.hasOwnProperty("blurredLikelihood")) - writer.uint32(/* id 14, wireType 0 =*/112).int32(message.blurredLikelihood); - if (message.headwearLikelihood != null && message.hasOwnProperty("headwearLikelihood")) - writer.uint32(/* id 15, wireType 0 =*/120).int32(message.headwearLikelihood); - return writer; - }; - - /** - * Encodes the specified FaceAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.FaceAnnotation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation - * @static - * @param {google.cloud.vision.v1p3beta1.IFaceAnnotation} message FaceAnnotation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FaceAnnotation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FaceAnnotation message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.FaceAnnotation} FaceAnnotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FaceAnnotation.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.vision.v1p3beta1.FaceAnnotation(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.boundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.decode(reader, reader.uint32()); - break; - case 2: - message.fdBoundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.decode(reader, reader.uint32()); - break; - case 3: - if (!(message.landmarks && message.landmarks.length)) - message.landmarks = []; - message.landmarks.push($root.google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark.decode(reader, reader.uint32())); - break; - case 4: - message.rollAngle = reader.float(); - break; - case 5: - message.panAngle = reader.float(); - break; - case 6: - message.tiltAngle = reader.float(); - break; - case 7: - message.detectionConfidence = reader.float(); - break; - case 8: - message.landmarkingConfidence = reader.float(); - break; - case 9: - message.joyLikelihood = reader.int32(); - break; - case 10: - message.sorrowLikelihood = reader.int32(); - break; - case 11: - message.angerLikelihood = reader.int32(); - break; - case 12: - message.surpriseLikelihood = reader.int32(); - break; - case 13: - message.underExposedLikelihood = reader.int32(); - break; - case 14: - message.blurredLikelihood = reader.int32(); - break; - case 15: - message.headwearLikelihood = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FaceAnnotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.FaceAnnotation} FaceAnnotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FaceAnnotation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FaceAnnotation message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FaceAnnotation.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { - var error = $root.google.cloud.vision.v1p3beta1.BoundingPoly.verify(message.boundingPoly); - if (error) - return "boundingPoly." + error; - } - if (message.fdBoundingPoly != null && message.hasOwnProperty("fdBoundingPoly")) { - var error = $root.google.cloud.vision.v1p3beta1.BoundingPoly.verify(message.fdBoundingPoly); - if (error) - return "fdBoundingPoly." + error; - } - if (message.landmarks != null && message.hasOwnProperty("landmarks")) { - if (!Array.isArray(message.landmarks)) - return "landmarks: array expected"; - for (var i = 0; i < message.landmarks.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark.verify(message.landmarks[i]); - if (error) - return "landmarks." + error; - } - } - if (message.rollAngle != null && message.hasOwnProperty("rollAngle")) - if (typeof message.rollAngle !== "number") - return "rollAngle: number expected"; - if (message.panAngle != null && message.hasOwnProperty("panAngle")) - if (typeof message.panAngle !== "number") - return "panAngle: number expected"; - if (message.tiltAngle != null && message.hasOwnProperty("tiltAngle")) - if (typeof message.tiltAngle !== "number") - return "tiltAngle: number expected"; - if (message.detectionConfidence != null && message.hasOwnProperty("detectionConfidence")) - if (typeof message.detectionConfidence !== "number") - return "detectionConfidence: number expected"; - if (message.landmarkingConfidence != null && message.hasOwnProperty("landmarkingConfidence")) - if (typeof message.landmarkingConfidence !== "number") - return "landmarkingConfidence: number expected"; - if (message.joyLikelihood != null && message.hasOwnProperty("joyLikelihood")) - switch (message.joyLikelihood) { - default: - return "joyLikelihood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.sorrowLikelihood != null && message.hasOwnProperty("sorrowLikelihood")) - switch (message.sorrowLikelihood) { - default: - return "sorrowLikelihood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.angerLikelihood != null && message.hasOwnProperty("angerLikelihood")) - switch (message.angerLikelihood) { - default: - return "angerLikelihood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.surpriseLikelihood != null && message.hasOwnProperty("surpriseLikelihood")) - switch (message.surpriseLikelihood) { - default: - return "surpriseLikelihood: enum value expected"; - case 0: + if (message.x != null && message.hasOwnProperty("x")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); + if (message.y != null && message.hasOwnProperty("y")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); + if (message.z != null && message.hasOwnProperty("z")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.z); + return writer; + }; + + /** + * Encodes the specified Position message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.Position.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.vision.v1p3beta1.Position + * @static + * @param {google.cloud.vision.v1p3beta1.IPosition} message Position message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Position.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Position message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.vision.v1p3beta1.Position + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.vision.v1p3beta1.Position} Position + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Position.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.vision.v1p3beta1.Position(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { case 1: - case 2: - case 3: - case 4: - case 5: + message.x = reader.float(); break; - } - if (message.underExposedLikelihood != null && message.hasOwnProperty("underExposedLikelihood")) - switch (message.underExposedLikelihood) { - default: - return "underExposedLikelihood: enum value expected"; - case 0: - case 1: case 2: - case 3: - case 4: - case 5: + message.y = reader.float(); break; - } - if (message.blurredLikelihood != null && message.hasOwnProperty("blurredLikelihood")) - switch (message.blurredLikelihood) { - default: - return "blurredLikelihood: enum value expected"; - case 0: - case 1: - case 2: case 3: - case 4: - case 5: + message.z = reader.float(); break; - } - if (message.headwearLikelihood != null && message.hasOwnProperty("headwearLikelihood")) - switch (message.headwearLikelihood) { default: - return "headwearLikelihood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: + reader.skipType(tag & 7); break; } + } + return message; + }; + + /** + * Decodes a Position message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.vision.v1p3beta1.Position + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.vision.v1p3beta1.Position} Position + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Position.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Position message. + * @function verify + * @memberof google.cloud.vision.v1p3beta1.Position + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Position.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.x != null && message.hasOwnProperty("x")) + if (typeof message.x !== "number") + return "x: number expected"; + if (message.y != null && message.hasOwnProperty("y")) + if (typeof message.y !== "number") + return "y: number expected"; + if (message.z != null && message.hasOwnProperty("z")) + if (typeof message.z !== "number") + return "z: number expected"; return null; }; /** - * Creates a FaceAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates a Position message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p3beta1.Position * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.FaceAnnotation} FaceAnnotation + * @returns {google.cloud.vision.v1p3beta1.Position} Position */ - FaceAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.FaceAnnotation) + Position.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.Position) return object; - var message = new $root.google.cloud.vision.v1p3beta1.FaceAnnotation(); - if (object.boundingPoly != null) { - if (typeof object.boundingPoly !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.FaceAnnotation.boundingPoly: object expected"); - message.boundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.fromObject(object.boundingPoly); - } - if (object.fdBoundingPoly != null) { - if (typeof object.fdBoundingPoly !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.FaceAnnotation.fdBoundingPoly: object expected"); - message.fdBoundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.fromObject(object.fdBoundingPoly); - } - if (object.landmarks) { - if (!Array.isArray(object.landmarks)) - throw TypeError(".google.cloud.vision.v1p3beta1.FaceAnnotation.landmarks: array expected"); - message.landmarks = []; - for (var i = 0; i < object.landmarks.length; ++i) { - if (typeof object.landmarks[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.FaceAnnotation.landmarks: object expected"); - message.landmarks[i] = $root.google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark.fromObject(object.landmarks[i]); - } - } - if (object.rollAngle != null) - message.rollAngle = Number(object.rollAngle); - if (object.panAngle != null) - message.panAngle = Number(object.panAngle); - if (object.tiltAngle != null) - message.tiltAngle = Number(object.tiltAngle); - if (object.detectionConfidence != null) - message.detectionConfidence = Number(object.detectionConfidence); - if (object.landmarkingConfidence != null) - message.landmarkingConfidence = Number(object.landmarkingConfidence); - switch (object.joyLikelihood) { - case "UNKNOWN": - case 0: - message.joyLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.joyLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.joyLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.joyLikelihood = 3; - break; - case "LIKELY": - case 4: - message.joyLikelihood = 4; - break; - case "VERY_LIKELY": - case 5: - message.joyLikelihood = 5; - break; - } - switch (object.sorrowLikelihood) { - case "UNKNOWN": - case 0: - message.sorrowLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.sorrowLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.sorrowLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.sorrowLikelihood = 3; - break; - case "LIKELY": - case 4: - message.sorrowLikelihood = 4; - break; - case "VERY_LIKELY": - case 5: - message.sorrowLikelihood = 5; - break; - } - switch (object.angerLikelihood) { - case "UNKNOWN": - case 0: - message.angerLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.angerLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.angerLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.angerLikelihood = 3; - break; - case "LIKELY": - case 4: - message.angerLikelihood = 4; - break; - case "VERY_LIKELY": - case 5: - message.angerLikelihood = 5; - break; - } - switch (object.surpriseLikelihood) { - case "UNKNOWN": - case 0: - message.surpriseLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.surpriseLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.surpriseLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.surpriseLikelihood = 3; - break; - case "LIKELY": - case 4: - message.surpriseLikelihood = 4; - break; - case "VERY_LIKELY": - case 5: - message.surpriseLikelihood = 5; - break; - } - switch (object.underExposedLikelihood) { - case "UNKNOWN": - case 0: - message.underExposedLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.underExposedLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.underExposedLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.underExposedLikelihood = 3; - break; - case "LIKELY": - case 4: - message.underExposedLikelihood = 4; - break; - case "VERY_LIKELY": - case 5: - message.underExposedLikelihood = 5; - break; - } - switch (object.blurredLikelihood) { - case "UNKNOWN": - case 0: - message.blurredLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.blurredLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.blurredLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.blurredLikelihood = 3; - break; - case "LIKELY": - case 4: - message.blurredLikelihood = 4; - break; - case "VERY_LIKELY": - case 5: - message.blurredLikelihood = 5; - break; - } - switch (object.headwearLikelihood) { - case "UNKNOWN": - case 0: - message.headwearLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.headwearLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.headwearLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.headwearLikelihood = 3; - break; - case "LIKELY": - case 4: - message.headwearLikelihood = 4; - break; - case "VERY_LIKELY": - case 5: - message.headwearLikelihood = 5; - break; - } + var message = new $root.google.cloud.vision.v1p3beta1.Position(); + if (object.x != null) + message.x = Number(object.x); + if (object.y != null) + message.y = Number(object.y); + if (object.z != null) + message.z = Number(object.z); return message; }; /** - * Creates a plain object from a FaceAnnotation message. Also converts values to other types if specified. + * Creates a plain object from a Position message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p3beta1.Position * @static - * @param {google.cloud.vision.v1p3beta1.FaceAnnotation} message FaceAnnotation + * @param {google.cloud.vision.v1p3beta1.Position} message Position * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FaceAnnotation.toObject = function toObject(message, options) { + Position.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.landmarks = []; if (options.defaults) { - object.boundingPoly = null; - object.fdBoundingPoly = null; - object.rollAngle = 0; - object.panAngle = 0; - object.tiltAngle = 0; - object.detectionConfidence = 0; - object.landmarkingConfidence = 0; - object.joyLikelihood = options.enums === String ? "UNKNOWN" : 0; - object.sorrowLikelihood = options.enums === String ? "UNKNOWN" : 0; - object.angerLikelihood = options.enums === String ? "UNKNOWN" : 0; - object.surpriseLikelihood = options.enums === String ? "UNKNOWN" : 0; - object.underExposedLikelihood = options.enums === String ? "UNKNOWN" : 0; - object.blurredLikelihood = options.enums === String ? "UNKNOWN" : 0; - object.headwearLikelihood = options.enums === String ? "UNKNOWN" : 0; - } - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - object.boundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.toObject(message.boundingPoly, options); - if (message.fdBoundingPoly != null && message.hasOwnProperty("fdBoundingPoly")) - object.fdBoundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.toObject(message.fdBoundingPoly, options); - if (message.landmarks && message.landmarks.length) { - object.landmarks = []; - for (var j = 0; j < message.landmarks.length; ++j) - object.landmarks[j] = $root.google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark.toObject(message.landmarks[j], options); + object.x = 0; + object.y = 0; + object.z = 0; } - if (message.rollAngle != null && message.hasOwnProperty("rollAngle")) - object.rollAngle = options.json && !isFinite(message.rollAngle) ? String(message.rollAngle) : message.rollAngle; - if (message.panAngle != null && message.hasOwnProperty("panAngle")) - object.panAngle = options.json && !isFinite(message.panAngle) ? String(message.panAngle) : message.panAngle; - if (message.tiltAngle != null && message.hasOwnProperty("tiltAngle")) - object.tiltAngle = options.json && !isFinite(message.tiltAngle) ? String(message.tiltAngle) : message.tiltAngle; - if (message.detectionConfidence != null && message.hasOwnProperty("detectionConfidence")) - object.detectionConfidence = options.json && !isFinite(message.detectionConfidence) ? String(message.detectionConfidence) : message.detectionConfidence; - if (message.landmarkingConfidence != null && message.hasOwnProperty("landmarkingConfidence")) - object.landmarkingConfidence = options.json && !isFinite(message.landmarkingConfidence) ? String(message.landmarkingConfidence) : message.landmarkingConfidence; - if (message.joyLikelihood != null && message.hasOwnProperty("joyLikelihood")) - object.joyLikelihood = options.enums === String ? $root.google.cloud.vision.v1p3beta1.Likelihood[message.joyLikelihood] : message.joyLikelihood; - if (message.sorrowLikelihood != null && message.hasOwnProperty("sorrowLikelihood")) - object.sorrowLikelihood = options.enums === String ? $root.google.cloud.vision.v1p3beta1.Likelihood[message.sorrowLikelihood] : message.sorrowLikelihood; - if (message.angerLikelihood != null && message.hasOwnProperty("angerLikelihood")) - object.angerLikelihood = options.enums === String ? $root.google.cloud.vision.v1p3beta1.Likelihood[message.angerLikelihood] : message.angerLikelihood; - if (message.surpriseLikelihood != null && message.hasOwnProperty("surpriseLikelihood")) - object.surpriseLikelihood = options.enums === String ? $root.google.cloud.vision.v1p3beta1.Likelihood[message.surpriseLikelihood] : message.surpriseLikelihood; - if (message.underExposedLikelihood != null && message.hasOwnProperty("underExposedLikelihood")) - object.underExposedLikelihood = options.enums === String ? $root.google.cloud.vision.v1p3beta1.Likelihood[message.underExposedLikelihood] : message.underExposedLikelihood; - if (message.blurredLikelihood != null && message.hasOwnProperty("blurredLikelihood")) - object.blurredLikelihood = options.enums === String ? $root.google.cloud.vision.v1p3beta1.Likelihood[message.blurredLikelihood] : message.blurredLikelihood; - if (message.headwearLikelihood != null && message.hasOwnProperty("headwearLikelihood")) - object.headwearLikelihood = options.enums === String ? $root.google.cloud.vision.v1p3beta1.Likelihood[message.headwearLikelihood] : message.headwearLikelihood; + if (message.x != null && message.hasOwnProperty("x")) + object.x = options.json && !isFinite(message.x) ? String(message.x) : message.x; + if (message.y != null && message.hasOwnProperty("y")) + object.y = options.json && !isFinite(message.y) ? String(message.y) : message.y; + if (message.z != null && message.hasOwnProperty("z")) + object.z = options.json && !isFinite(message.z) ? String(message.z) : message.z; return object; }; /** - * Converts this FaceAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation + * Converts this Position to JSON. + * @function toJSON + * @memberof google.cloud.vision.v1p3beta1.Position + * @instance + * @returns {Object.} JSON object + */ + Position.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Position; + })(); + + v1p3beta1.ImageAnnotator = (function() { + + /** + * Constructs a new ImageAnnotator service. + * @memberof google.cloud.vision.v1p3beta1 + * @classdesc Represents an ImageAnnotator + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function ImageAnnotator(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (ImageAnnotator.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ImageAnnotator; + + /** + * Creates new ImageAnnotator service using the specified rpc implementation. + * @function create + * @memberof google.cloud.vision.v1p3beta1.ImageAnnotator + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {ImageAnnotator} RPC service. Useful where requests and/or responses are streamed. + */ + ImageAnnotator.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.vision.v1p3beta1.ImageAnnotator#batchAnnotateImages}. + * @memberof google.cloud.vision.v1p3beta1.ImageAnnotator + * @typedef BatchAnnotateImagesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse} [response] BatchAnnotateImagesResponse + */ + + /** + * Calls BatchAnnotateImages. + * @function batchAnnotateImages + * @memberof google.cloud.vision.v1p3beta1.ImageAnnotator + * @instance + * @param {google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest} request BatchAnnotateImagesRequest message or plain object + * @param {google.cloud.vision.v1p3beta1.ImageAnnotator.BatchAnnotateImagesCallback} callback Node-style callback called with the error, if any, and BatchAnnotateImagesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ImageAnnotator.prototype.batchAnnotateImages = function batchAnnotateImages(request, callback) { + return this.rpcCall(batchAnnotateImages, $root.google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest, $root.google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse, request, callback); + }, "name", { value: "BatchAnnotateImages" }); + + /** + * Calls BatchAnnotateImages. + * @function batchAnnotateImages + * @memberof google.cloud.vision.v1p3beta1.ImageAnnotator + * @instance + * @param {google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest} request BatchAnnotateImagesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.vision.v1p3beta1.ImageAnnotator#asyncBatchAnnotateFiles}. + * @memberof google.cloud.vision.v1p3beta1.ImageAnnotator + * @typedef AsyncBatchAnnotateFilesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls AsyncBatchAnnotateFiles. + * @function asyncBatchAnnotateFiles + * @memberof google.cloud.vision.v1p3beta1.ImageAnnotator + * @instance + * @param {google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesRequest} request AsyncBatchAnnotateFilesRequest message or plain object + * @param {google.cloud.vision.v1p3beta1.ImageAnnotator.AsyncBatchAnnotateFilesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ImageAnnotator.prototype.asyncBatchAnnotateFiles = function asyncBatchAnnotateFiles(request, callback) { + return this.rpcCall(asyncBatchAnnotateFiles, $root.google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "AsyncBatchAnnotateFiles" }); + + /** + * Calls AsyncBatchAnnotateFiles. + * @function asyncBatchAnnotateFiles + * @memberof google.cloud.vision.v1p3beta1.ImageAnnotator * @instance - * @returns {Object.} JSON object + * @param {google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesRequest} request AsyncBatchAnnotateFilesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - FaceAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - FaceAnnotation.Landmark = (function() { - /** - * Properties of a Landmark. - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation - * @interface ILandmark - * @property {google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark.Type|null} [type] Landmark type - * @property {google.cloud.vision.v1p3beta1.IPosition|null} [position] Landmark position - */ + return ImageAnnotator; + })(); - /** - * Constructs a new Landmark. - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation - * @classdesc Represents a Landmark. - * @implements ILandmark - * @constructor - * @param {google.cloud.vision.v1p3beta1.FaceAnnotation.ILandmark=} [properties] Properties to set - */ - function Landmark(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]]; - } + v1p3beta1.Feature = (function() { - /** - * Landmark type. - * @member {google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark.Type} type - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark - * @instance - */ - Landmark.prototype.type = 0; + /** + * Properties of a Feature. + * @memberof google.cloud.vision.v1p3beta1 + * @interface IFeature + * @property {google.cloud.vision.v1p3beta1.Feature.Type|null} [type] Feature type + * @property {number|null} [maxResults] Feature maxResults + * @property {string|null} [model] Feature model + */ - /** - * Landmark position. - * @member {google.cloud.vision.v1p3beta1.IPosition|null|undefined} position - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark - * @instance - */ - Landmark.prototype.position = null; + /** + * Constructs a new Feature. + * @memberof google.cloud.vision.v1p3beta1 + * @classdesc Represents a Feature. + * @implements IFeature + * @constructor + * @param {google.cloud.vision.v1p3beta1.IFeature=} [properties] Properties to set + */ + function Feature(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Creates a new Landmark instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark - * @static - * @param {google.cloud.vision.v1p3beta1.FaceAnnotation.ILandmark=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark} Landmark instance - */ - Landmark.create = function create(properties) { - return new Landmark(properties); - }; + /** + * Feature type. + * @member {google.cloud.vision.v1p3beta1.Feature.Type} type + * @memberof google.cloud.vision.v1p3beta1.Feature + * @instance + */ + Feature.prototype.type = 0; - /** - * Encodes the specified Landmark message. Does not implicitly {@link google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark - * @static - * @param {google.cloud.vision.v1p3beta1.FaceAnnotation.ILandmark} message Landmark message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Landmark.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.type != null && message.hasOwnProperty("type")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); - if (message.position != null && message.hasOwnProperty("position")) - $root.google.cloud.vision.v1p3beta1.Position.encode(message.position, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; + /** + * Feature maxResults. + * @member {number} maxResults + * @memberof google.cloud.vision.v1p3beta1.Feature + * @instance + */ + Feature.prototype.maxResults = 0; - /** - * Encodes the specified Landmark message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark - * @static - * @param {google.cloud.vision.v1p3beta1.FaceAnnotation.ILandmark} message Landmark message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Landmark.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Feature model. + * @member {string} model + * @memberof google.cloud.vision.v1p3beta1.Feature + * @instance + */ + Feature.prototype.model = ""; - /** - * Decodes a Landmark message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark} Landmark - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Landmark.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.vision.v1p3beta1.FaceAnnotation.Landmark(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 3: - message.type = reader.int32(); - break; - case 4: - message.position = $root.google.cloud.vision.v1p3beta1.Position.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Creates a new Feature instance using the specified properties. + * @function create + * @memberof google.cloud.vision.v1p3beta1.Feature + * @static + * @param {google.cloud.vision.v1p3beta1.IFeature=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.Feature} Feature instance + */ + Feature.create = function create(properties) { + return new Feature(properties); + }; - /** - * Decodes a Landmark message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark} Landmark - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Landmark.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Encodes the specified Feature message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Feature.verify|verify} messages. + * @function encode + * @memberof google.cloud.vision.v1p3beta1.Feature + * @static + * @param {google.cloud.vision.v1p3beta1.IFeature} message Feature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Feature.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && message.hasOwnProperty("type")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.maxResults); + if (message.model != null && message.hasOwnProperty("model")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.model); + return writer; + }; - /** - * Verifies a Landmark message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Landmark.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - case 30: - case 31: - case 32: - case 33: - case 34: - break; - } - if (message.position != null && message.hasOwnProperty("position")) { - var error = $root.google.cloud.vision.v1p3beta1.Position.verify(message.position); - if (error) - return "position." + error; - } - return null; - }; + /** + * Encodes the specified Feature message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.Feature.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.vision.v1p3beta1.Feature + * @static + * @param {google.cloud.vision.v1p3beta1.IFeature} message Feature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Feature.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Creates a Landmark message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark} Landmark - */ - Landmark.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark(); - switch (object.type) { - case "UNKNOWN_LANDMARK": - case 0: - message.type = 0; - break; - case "LEFT_EYE": + /** + * Decodes a Feature message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.vision.v1p3beta1.Feature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.vision.v1p3beta1.Feature} Feature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Feature.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.vision.v1p3beta1.Feature(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { case 1: - message.type = 1; + message.type = reader.int32(); break; - case "RIGHT_EYE": case 2: - message.type = 2; + message.maxResults = reader.int32(); break; - case "LEFT_OF_LEFT_EYEBROW": case 3: - message.type = 3; - break; - case "RIGHT_OF_LEFT_EYEBROW": - case 4: - message.type = 4; - break; - case "LEFT_OF_RIGHT_EYEBROW": - case 5: - message.type = 5; - break; - case "RIGHT_OF_RIGHT_EYEBROW": - case 6: - message.type = 6; - break; - case "MIDPOINT_BETWEEN_EYES": - case 7: - message.type = 7; - break; - case "NOSE_TIP": - case 8: - message.type = 8; - break; - case "UPPER_LIP": - case 9: - message.type = 9; - break; - case "LOWER_LIP": - case 10: - message.type = 10; - break; - case "MOUTH_LEFT": - case 11: - message.type = 11; - break; - case "MOUTH_RIGHT": - case 12: - message.type = 12; - break; - case "MOUTH_CENTER": - case 13: - message.type = 13; - break; - case "NOSE_BOTTOM_RIGHT": - case 14: - message.type = 14; - break; - case "NOSE_BOTTOM_LEFT": - case 15: - message.type = 15; - break; - case "NOSE_BOTTOM_CENTER": - case 16: - message.type = 16; - break; - case "LEFT_EYE_TOP_BOUNDARY": - case 17: - message.type = 17; - break; - case "LEFT_EYE_RIGHT_CORNER": - case 18: - message.type = 18; - break; - case "LEFT_EYE_BOTTOM_BOUNDARY": - case 19: - message.type = 19; - break; - case "LEFT_EYE_LEFT_CORNER": - case 20: - message.type = 20; - break; - case "RIGHT_EYE_TOP_BOUNDARY": - case 21: - message.type = 21; - break; - case "RIGHT_EYE_RIGHT_CORNER": - case 22: - message.type = 22; - break; - case "RIGHT_EYE_BOTTOM_BOUNDARY": - case 23: - message.type = 23; - break; - case "RIGHT_EYE_LEFT_CORNER": - case 24: - message.type = 24; - break; - case "LEFT_EYEBROW_UPPER_MIDPOINT": - case 25: - message.type = 25; - break; - case "RIGHT_EYEBROW_UPPER_MIDPOINT": - case 26: - message.type = 26; - break; - case "LEFT_EAR_TRAGION": - case 27: - message.type = 27; - break; - case "RIGHT_EAR_TRAGION": - case 28: - message.type = 28; - break; - case "LEFT_EYE_PUPIL": - case 29: - message.type = 29; - break; - case "RIGHT_EYE_PUPIL": - case 30: - message.type = 30; - break; - case "FOREHEAD_GLABELLA": - case 31: - message.type = 31; - break; - case "CHIN_GNATHION": - case 32: - message.type = 32; - break; - case "CHIN_LEFT_GONION": - case 33: - message.type = 33; + message.model = reader.string(); break; - case "CHIN_RIGHT_GONION": - case 34: - message.type = 34; + default: + reader.skipType(tag & 7); break; } - if (object.position != null) { - if (typeof object.position !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark.position: object expected"); - message.position = $root.google.cloud.vision.v1p3beta1.Position.fromObject(object.position); - } - return message; - }; + } + return message; + }; - /** - * Creates a plain object from a Landmark message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark - * @static - * @param {google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark} message Landmark - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Landmark.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.type = options.enums === String ? "UNKNOWN_LANDMARK" : 0; - object.position = null; + /** + * Decodes a Feature message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.vision.v1p3beta1.Feature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.vision.v1p3beta1.Feature} Feature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Feature.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Feature message. + * @function verify + * @memberof google.cloud.vision.v1p3beta1.Feature + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Feature.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 11: + case 6: + case 7: + case 9: + case 10: + case 12: + case 19: + break; } - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark.Type[message.type] : message.type; - if (message.position != null && message.hasOwnProperty("position")) - object.position = $root.google.cloud.vision.v1p3beta1.Position.toObject(message.position, options); + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + if (!$util.isInteger(message.maxResults)) + return "maxResults: integer expected"; + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; + return null; + }; + + /** + * Creates a Feature message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.vision.v1p3beta1.Feature + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.vision.v1p3beta1.Feature} Feature + */ + Feature.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.Feature) return object; - }; + var message = new $root.google.cloud.vision.v1p3beta1.Feature(); + switch (object.type) { + case "TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "FACE_DETECTION": + case 1: + message.type = 1; + break; + case "LANDMARK_DETECTION": + case 2: + message.type = 2; + break; + case "LOGO_DETECTION": + case 3: + message.type = 3; + break; + case "LABEL_DETECTION": + case 4: + message.type = 4; + break; + case "TEXT_DETECTION": + case 5: + message.type = 5; + break; + case "DOCUMENT_TEXT_DETECTION": + case 11: + message.type = 11; + break; + case "SAFE_SEARCH_DETECTION": + case 6: + message.type = 6; + break; + case "IMAGE_PROPERTIES": + case 7: + message.type = 7; + break; + case "CROP_HINTS": + case 9: + message.type = 9; + break; + case "WEB_DETECTION": + case 10: + message.type = 10; + break; + case "PRODUCT_SEARCH": + case 12: + message.type = 12; + break; + case "OBJECT_LOCALIZATION": + case 19: + message.type = 19; + break; + } + if (object.maxResults != null) + message.maxResults = object.maxResults | 0; + if (object.model != null) + message.model = String(object.model); + return message; + }; - /** - * Converts this Landmark to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark - * @instance - * @returns {Object.} JSON object - */ - Landmark.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Creates a plain object from a Feature message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.vision.v1p3beta1.Feature + * @static + * @param {google.cloud.vision.v1p3beta1.Feature} message Feature + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Feature.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + object.maxResults = 0; + object.model = ""; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.vision.v1p3beta1.Feature.Type[message.type] : message.type; + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + object.maxResults = message.maxResults; + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; + return object; + }; - /** - * Type enum. - * @name google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark.Type - * @enum {string} - * @property {number} UNKNOWN_LANDMARK=0 UNKNOWN_LANDMARK value - * @property {number} LEFT_EYE=1 LEFT_EYE value - * @property {number} RIGHT_EYE=2 RIGHT_EYE value - * @property {number} LEFT_OF_LEFT_EYEBROW=3 LEFT_OF_LEFT_EYEBROW value - * @property {number} RIGHT_OF_LEFT_EYEBROW=4 RIGHT_OF_LEFT_EYEBROW value - * @property {number} LEFT_OF_RIGHT_EYEBROW=5 LEFT_OF_RIGHT_EYEBROW value - * @property {number} RIGHT_OF_RIGHT_EYEBROW=6 RIGHT_OF_RIGHT_EYEBROW value - * @property {number} MIDPOINT_BETWEEN_EYES=7 MIDPOINT_BETWEEN_EYES value - * @property {number} NOSE_TIP=8 NOSE_TIP value - * @property {number} UPPER_LIP=9 UPPER_LIP value - * @property {number} LOWER_LIP=10 LOWER_LIP value - * @property {number} MOUTH_LEFT=11 MOUTH_LEFT value - * @property {number} MOUTH_RIGHT=12 MOUTH_RIGHT value - * @property {number} MOUTH_CENTER=13 MOUTH_CENTER value - * @property {number} NOSE_BOTTOM_RIGHT=14 NOSE_BOTTOM_RIGHT value - * @property {number} NOSE_BOTTOM_LEFT=15 NOSE_BOTTOM_LEFT value - * @property {number} NOSE_BOTTOM_CENTER=16 NOSE_BOTTOM_CENTER value - * @property {number} LEFT_EYE_TOP_BOUNDARY=17 LEFT_EYE_TOP_BOUNDARY value - * @property {number} LEFT_EYE_RIGHT_CORNER=18 LEFT_EYE_RIGHT_CORNER value - * @property {number} LEFT_EYE_BOTTOM_BOUNDARY=19 LEFT_EYE_BOTTOM_BOUNDARY value - * @property {number} LEFT_EYE_LEFT_CORNER=20 LEFT_EYE_LEFT_CORNER value - * @property {number} RIGHT_EYE_TOP_BOUNDARY=21 RIGHT_EYE_TOP_BOUNDARY value - * @property {number} RIGHT_EYE_RIGHT_CORNER=22 RIGHT_EYE_RIGHT_CORNER value - * @property {number} RIGHT_EYE_BOTTOM_BOUNDARY=23 RIGHT_EYE_BOTTOM_BOUNDARY value - * @property {number} RIGHT_EYE_LEFT_CORNER=24 RIGHT_EYE_LEFT_CORNER value - * @property {number} LEFT_EYEBROW_UPPER_MIDPOINT=25 LEFT_EYEBROW_UPPER_MIDPOINT value - * @property {number} RIGHT_EYEBROW_UPPER_MIDPOINT=26 RIGHT_EYEBROW_UPPER_MIDPOINT value - * @property {number} LEFT_EAR_TRAGION=27 LEFT_EAR_TRAGION value - * @property {number} RIGHT_EAR_TRAGION=28 RIGHT_EAR_TRAGION value - * @property {number} LEFT_EYE_PUPIL=29 LEFT_EYE_PUPIL value - * @property {number} RIGHT_EYE_PUPIL=30 RIGHT_EYE_PUPIL value - * @property {number} FOREHEAD_GLABELLA=31 FOREHEAD_GLABELLA value - * @property {number} CHIN_GNATHION=32 CHIN_GNATHION value - * @property {number} CHIN_LEFT_GONION=33 CHIN_LEFT_GONION value - * @property {number} CHIN_RIGHT_GONION=34 CHIN_RIGHT_GONION value - */ - Landmark.Type = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "UNKNOWN_LANDMARK"] = 0; - values[valuesById[1] = "LEFT_EYE"] = 1; - values[valuesById[2] = "RIGHT_EYE"] = 2; - values[valuesById[3] = "LEFT_OF_LEFT_EYEBROW"] = 3; - values[valuesById[4] = "RIGHT_OF_LEFT_EYEBROW"] = 4; - values[valuesById[5] = "LEFT_OF_RIGHT_EYEBROW"] = 5; - values[valuesById[6] = "RIGHT_OF_RIGHT_EYEBROW"] = 6; - values[valuesById[7] = "MIDPOINT_BETWEEN_EYES"] = 7; - values[valuesById[8] = "NOSE_TIP"] = 8; - values[valuesById[9] = "UPPER_LIP"] = 9; - values[valuesById[10] = "LOWER_LIP"] = 10; - values[valuesById[11] = "MOUTH_LEFT"] = 11; - values[valuesById[12] = "MOUTH_RIGHT"] = 12; - values[valuesById[13] = "MOUTH_CENTER"] = 13; - values[valuesById[14] = "NOSE_BOTTOM_RIGHT"] = 14; - values[valuesById[15] = "NOSE_BOTTOM_LEFT"] = 15; - values[valuesById[16] = "NOSE_BOTTOM_CENTER"] = 16; - values[valuesById[17] = "LEFT_EYE_TOP_BOUNDARY"] = 17; - values[valuesById[18] = "LEFT_EYE_RIGHT_CORNER"] = 18; - values[valuesById[19] = "LEFT_EYE_BOTTOM_BOUNDARY"] = 19; - values[valuesById[20] = "LEFT_EYE_LEFT_CORNER"] = 20; - values[valuesById[21] = "RIGHT_EYE_TOP_BOUNDARY"] = 21; - values[valuesById[22] = "RIGHT_EYE_RIGHT_CORNER"] = 22; - values[valuesById[23] = "RIGHT_EYE_BOTTOM_BOUNDARY"] = 23; - values[valuesById[24] = "RIGHT_EYE_LEFT_CORNER"] = 24; - values[valuesById[25] = "LEFT_EYEBROW_UPPER_MIDPOINT"] = 25; - values[valuesById[26] = "RIGHT_EYEBROW_UPPER_MIDPOINT"] = 26; - values[valuesById[27] = "LEFT_EAR_TRAGION"] = 27; - values[valuesById[28] = "RIGHT_EAR_TRAGION"] = 28; - values[valuesById[29] = "LEFT_EYE_PUPIL"] = 29; - values[valuesById[30] = "RIGHT_EYE_PUPIL"] = 30; - values[valuesById[31] = "FOREHEAD_GLABELLA"] = 31; - values[valuesById[32] = "CHIN_GNATHION"] = 32; - values[valuesById[33] = "CHIN_LEFT_GONION"] = 33; - values[valuesById[34] = "CHIN_RIGHT_GONION"] = 34; - return values; - })(); + /** + * Converts this Feature to JSON. + * @function toJSON + * @memberof google.cloud.vision.v1p3beta1.Feature + * @instance + * @returns {Object.} JSON object + */ + Feature.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return Landmark; + /** + * Type enum. + * @name google.cloud.vision.v1p3beta1.Feature.Type + * @enum {string} + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} FACE_DETECTION=1 FACE_DETECTION value + * @property {number} LANDMARK_DETECTION=2 LANDMARK_DETECTION value + * @property {number} LOGO_DETECTION=3 LOGO_DETECTION value + * @property {number} LABEL_DETECTION=4 LABEL_DETECTION value + * @property {number} TEXT_DETECTION=5 TEXT_DETECTION value + * @property {number} DOCUMENT_TEXT_DETECTION=11 DOCUMENT_TEXT_DETECTION value + * @property {number} SAFE_SEARCH_DETECTION=6 SAFE_SEARCH_DETECTION value + * @property {number} IMAGE_PROPERTIES=7 IMAGE_PROPERTIES value + * @property {number} CROP_HINTS=9 CROP_HINTS value + * @property {number} WEB_DETECTION=10 WEB_DETECTION value + * @property {number} PRODUCT_SEARCH=12 PRODUCT_SEARCH value + * @property {number} OBJECT_LOCALIZATION=19 OBJECT_LOCALIZATION value + */ + Feature.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "FACE_DETECTION"] = 1; + values[valuesById[2] = "LANDMARK_DETECTION"] = 2; + values[valuesById[3] = "LOGO_DETECTION"] = 3; + values[valuesById[4] = "LABEL_DETECTION"] = 4; + values[valuesById[5] = "TEXT_DETECTION"] = 5; + values[valuesById[11] = "DOCUMENT_TEXT_DETECTION"] = 11; + values[valuesById[6] = "SAFE_SEARCH_DETECTION"] = 6; + values[valuesById[7] = "IMAGE_PROPERTIES"] = 7; + values[valuesById[9] = "CROP_HINTS"] = 9; + values[valuesById[10] = "WEB_DETECTION"] = 10; + values[valuesById[12] = "PRODUCT_SEARCH"] = 12; + values[valuesById[19] = "OBJECT_LOCALIZATION"] = 19; + return values; })(); - return FaceAnnotation; + return Feature; })(); - v1p3beta1.LocationInfo = (function() { + v1p3beta1.ImageSource = (function() { /** - * Properties of a LocationInfo. + * Properties of an ImageSource. * @memberof google.cloud.vision.v1p3beta1 - * @interface ILocationInfo - * @property {google.type.ILatLng|null} [latLng] LocationInfo latLng + * @interface IImageSource + * @property {string|null} [gcsImageUri] ImageSource gcsImageUri + * @property {string|null} [imageUri] ImageSource imageUri */ /** - * Constructs a new LocationInfo. + * Constructs a new ImageSource. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a LocationInfo. - * @implements ILocationInfo + * @classdesc Represents an ImageSource. + * @implements IImageSource * @constructor - * @param {google.cloud.vision.v1p3beta1.ILocationInfo=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.IImageSource=} [properties] Properties to set */ - function LocationInfo(properties) { + function ImageSource(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -52077,75 +51524,88 @@ } /** - * LocationInfo latLng. - * @member {google.type.ILatLng|null|undefined} latLng - * @memberof google.cloud.vision.v1p3beta1.LocationInfo + * ImageSource gcsImageUri. + * @member {string} gcsImageUri + * @memberof google.cloud.vision.v1p3beta1.ImageSource * @instance */ - LocationInfo.prototype.latLng = null; + ImageSource.prototype.gcsImageUri = ""; /** - * Creates a new LocationInfo instance using the specified properties. + * ImageSource imageUri. + * @member {string} imageUri + * @memberof google.cloud.vision.v1p3beta1.ImageSource + * @instance + */ + ImageSource.prototype.imageUri = ""; + + /** + * Creates a new ImageSource instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.LocationInfo + * @memberof google.cloud.vision.v1p3beta1.ImageSource * @static - * @param {google.cloud.vision.v1p3beta1.ILocationInfo=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.LocationInfo} LocationInfo instance + * @param {google.cloud.vision.v1p3beta1.IImageSource=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.ImageSource} ImageSource instance */ - LocationInfo.create = function create(properties) { - return new LocationInfo(properties); + ImageSource.create = function create(properties) { + return new ImageSource(properties); }; /** - * Encodes the specified LocationInfo message. Does not implicitly {@link google.cloud.vision.v1p3beta1.LocationInfo.verify|verify} messages. + * Encodes the specified ImageSource message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImageSource.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.LocationInfo + * @memberof google.cloud.vision.v1p3beta1.ImageSource * @static - * @param {google.cloud.vision.v1p3beta1.ILocationInfo} message LocationInfo message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IImageSource} message ImageSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - LocationInfo.encode = function encode(message, writer) { + ImageSource.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.latLng != null && message.hasOwnProperty("latLng")) - $root.google.type.LatLng.encode(message.latLng, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.gcsImageUri != null && message.hasOwnProperty("gcsImageUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsImageUri); + if (message.imageUri != null && message.hasOwnProperty("imageUri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.imageUri); return writer; }; /** - * Encodes the specified LocationInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.LocationInfo.verify|verify} messages. + * Encodes the specified ImageSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImageSource.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.LocationInfo + * @memberof google.cloud.vision.v1p3beta1.ImageSource * @static - * @param {google.cloud.vision.v1p3beta1.ILocationInfo} message LocationInfo message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IImageSource} message ImageSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - LocationInfo.encodeDelimited = function encodeDelimited(message, writer) { + ImageSource.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a LocationInfo message from the specified reader or buffer. + * Decodes an ImageSource message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.LocationInfo + * @memberof google.cloud.vision.v1p3beta1.ImageSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.LocationInfo} LocationInfo + * @returns {google.cloud.vision.v1p3beta1.ImageSource} ImageSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - LocationInfo.decode = function decode(reader, length) { + ImageSource.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.vision.v1p3beta1.LocationInfo(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.ImageSource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.latLng = $root.google.type.LatLng.decode(reader, reader.uint32()); + message.gcsImageUri = reader.string(); + break; + case 2: + message.imageUri = reader.string(); break; default: reader.skipType(tag & 7); @@ -52156,114 +51616,117 @@ }; /** - * Decodes a LocationInfo message from the specified reader or buffer, length delimited. + * Decodes an ImageSource message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.LocationInfo + * @memberof google.cloud.vision.v1p3beta1.ImageSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.LocationInfo} LocationInfo + * @returns {google.cloud.vision.v1p3beta1.ImageSource} ImageSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - LocationInfo.decodeDelimited = function decodeDelimited(reader) { + ImageSource.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a LocationInfo message. + * Verifies an ImageSource message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.LocationInfo + * @memberof google.cloud.vision.v1p3beta1.ImageSource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - LocationInfo.verify = function verify(message) { + ImageSource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.latLng != null && message.hasOwnProperty("latLng")) { - var error = $root.google.type.LatLng.verify(message.latLng); - if (error) - return "latLng." + error; - } + if (message.gcsImageUri != null && message.hasOwnProperty("gcsImageUri")) + if (!$util.isString(message.gcsImageUri)) + return "gcsImageUri: string expected"; + if (message.imageUri != null && message.hasOwnProperty("imageUri")) + if (!$util.isString(message.imageUri)) + return "imageUri: string expected"; return null; }; /** - * Creates a LocationInfo message from a plain object. Also converts values to their respective internal types. + * Creates an ImageSource message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.LocationInfo + * @memberof google.cloud.vision.v1p3beta1.ImageSource * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.LocationInfo} LocationInfo + * @returns {google.cloud.vision.v1p3beta1.ImageSource} ImageSource */ - LocationInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.LocationInfo) + ImageSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.ImageSource) return object; - var message = new $root.google.cloud.vision.v1p3beta1.LocationInfo(); - if (object.latLng != null) { - if (typeof object.latLng !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.LocationInfo.latLng: object expected"); - message.latLng = $root.google.type.LatLng.fromObject(object.latLng); - } + var message = new $root.google.cloud.vision.v1p3beta1.ImageSource(); + if (object.gcsImageUri != null) + message.gcsImageUri = String(object.gcsImageUri); + if (object.imageUri != null) + message.imageUri = String(object.imageUri); return message; }; /** - * Creates a plain object from a LocationInfo message. Also converts values to other types if specified. + * Creates a plain object from an ImageSource message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.LocationInfo + * @memberof google.cloud.vision.v1p3beta1.ImageSource * @static - * @param {google.cloud.vision.v1p3beta1.LocationInfo} message LocationInfo + * @param {google.cloud.vision.v1p3beta1.ImageSource} message ImageSource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - LocationInfo.toObject = function toObject(message, options) { + ImageSource.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.latLng = null; - if (message.latLng != null && message.hasOwnProperty("latLng")) - object.latLng = $root.google.type.LatLng.toObject(message.latLng, options); + if (options.defaults) { + object.gcsImageUri = ""; + object.imageUri = ""; + } + if (message.gcsImageUri != null && message.hasOwnProperty("gcsImageUri")) + object.gcsImageUri = message.gcsImageUri; + if (message.imageUri != null && message.hasOwnProperty("imageUri")) + object.imageUri = message.imageUri; return object; }; /** - * Converts this LocationInfo to JSON. + * Converts this ImageSource to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.LocationInfo + * @memberof google.cloud.vision.v1p3beta1.ImageSource * @instance * @returns {Object.} JSON object */ - LocationInfo.prototype.toJSON = function toJSON() { + ImageSource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return LocationInfo; + return ImageSource; })(); - v1p3beta1.Property = (function() { + v1p3beta1.Image = (function() { /** - * Properties of a Property. + * Properties of an Image. * @memberof google.cloud.vision.v1p3beta1 - * @interface IProperty - * @property {string|null} [name] Property name - * @property {string|null} [value] Property value - * @property {number|Long|null} [uint64Value] Property uint64Value + * @interface IImage + * @property {Uint8Array|null} [content] Image content + * @property {google.cloud.vision.v1p3beta1.IImageSource|null} [source] Image source */ /** - * Constructs a new Property. + * Constructs a new Image. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a Property. - * @implements IProperty + * @classdesc Represents an Image. + * @implements IImage * @constructor - * @param {google.cloud.vision.v1p3beta1.IProperty=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.IImage=} [properties] Properties to set */ - function Property(properties) { + function Image(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -52271,101 +51734,88 @@ } /** - * Property name. - * @member {string} name - * @memberof google.cloud.vision.v1p3beta1.Property - * @instance - */ - Property.prototype.name = ""; - - /** - * Property value. - * @member {string} value - * @memberof google.cloud.vision.v1p3beta1.Property + * Image content. + * @member {Uint8Array} content + * @memberof google.cloud.vision.v1p3beta1.Image * @instance */ - Property.prototype.value = ""; + Image.prototype.content = $util.newBuffer([]); /** - * Property uint64Value. - * @member {number|Long} uint64Value - * @memberof google.cloud.vision.v1p3beta1.Property + * Image source. + * @member {google.cloud.vision.v1p3beta1.IImageSource|null|undefined} source + * @memberof google.cloud.vision.v1p3beta1.Image * @instance */ - Property.prototype.uint64Value = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + Image.prototype.source = null; /** - * Creates a new Property instance using the specified properties. + * Creates a new Image instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.Property + * @memberof google.cloud.vision.v1p3beta1.Image * @static - * @param {google.cloud.vision.v1p3beta1.IProperty=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.Property} Property instance + * @param {google.cloud.vision.v1p3beta1.IImage=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.Image} Image instance */ - Property.create = function create(properties) { - return new Property(properties); + Image.create = function create(properties) { + return new Image(properties); }; /** - * Encodes the specified Property message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Property.verify|verify} messages. + * Encodes the specified Image message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Image.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.Property + * @memberof google.cloud.vision.v1p3beta1.Image * @static - * @param {google.cloud.vision.v1p3beta1.IProperty} message Property message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IImage} message Image message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Property.encode = function encode(message, writer) { + Image.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.value != null && message.hasOwnProperty("value")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); - if (message.uint64Value != null && message.hasOwnProperty("uint64Value")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.uint64Value); + if (message.content != null && message.hasOwnProperty("content")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.content); + if (message.source != null && message.hasOwnProperty("source")) + $root.google.cloud.vision.v1p3beta1.ImageSource.encode(message.source, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified Property message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.Property.verify|verify} messages. + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.Image.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.Property + * @memberof google.cloud.vision.v1p3beta1.Image * @static - * @param {google.cloud.vision.v1p3beta1.IProperty} message Property message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IImage} message Image message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Property.encodeDelimited = function encodeDelimited(message, writer) { + Image.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Property message from the specified reader or buffer. + * Decodes an Image message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.Property + * @memberof google.cloud.vision.v1p3beta1.Image * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.Property} Property + * @returns {google.cloud.vision.v1p3beta1.Image} Image * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Property.decode = function decode(reader, length) { + Image.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.vision.v1p3beta1.Property(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.Image(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.name = reader.string(); + message.content = reader.bytes(); break; case 2: - message.value = reader.string(); - break; - case 3: - message.uint64Value = reader.uint64(); + message.source = $root.google.cloud.vision.v1p3beta1.ImageSource.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -52376,148 +51826,145 @@ }; /** - * Decodes a Property message from the specified reader or buffer, length delimited. + * Decodes an Image message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.Property + * @memberof google.cloud.vision.v1p3beta1.Image * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.Property} Property + * @returns {google.cloud.vision.v1p3beta1.Image} Image * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Property.decodeDelimited = function decodeDelimited(reader) { + Image.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Property message. + * Verifies an Image message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.Property + * @memberof google.cloud.vision.v1p3beta1.Image * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Property.verify = function verify(message) { + Image.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isString(message.value)) - return "value: string expected"; - if (message.uint64Value != null && message.hasOwnProperty("uint64Value")) - if (!$util.isInteger(message.uint64Value) && !(message.uint64Value && $util.isInteger(message.uint64Value.low) && $util.isInteger(message.uint64Value.high))) - return "uint64Value: integer|Long expected"; + if (message.content != null && message.hasOwnProperty("content")) + if (!(message.content && typeof message.content.length === "number" || $util.isString(message.content))) + return "content: buffer expected"; + if (message.source != null && message.hasOwnProperty("source")) { + var error = $root.google.cloud.vision.v1p3beta1.ImageSource.verify(message.source); + if (error) + return "source." + error; + } return null; }; /** - * Creates a Property message from a plain object. Also converts values to their respective internal types. + * Creates an Image message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.Property + * @memberof google.cloud.vision.v1p3beta1.Image * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.Property} Property + * @returns {google.cloud.vision.v1p3beta1.Image} Image */ - Property.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.Property) + Image.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.Image) return object; - var message = new $root.google.cloud.vision.v1p3beta1.Property(); - if (object.name != null) - message.name = String(object.name); - if (object.value != null) - message.value = String(object.value); - if (object.uint64Value != null) - if ($util.Long) - (message.uint64Value = $util.Long.fromValue(object.uint64Value)).unsigned = true; - else if (typeof object.uint64Value === "string") - message.uint64Value = parseInt(object.uint64Value, 10); - else if (typeof object.uint64Value === "number") - message.uint64Value = object.uint64Value; - else if (typeof object.uint64Value === "object") - message.uint64Value = new $util.LongBits(object.uint64Value.low >>> 0, object.uint64Value.high >>> 0).toNumber(true); + var message = new $root.google.cloud.vision.v1p3beta1.Image(); + if (object.content != null) + if (typeof object.content === "string") + $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); + else if (object.content.length) + message.content = object.content; + if (object.source != null) { + if (typeof object.source !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.Image.source: object expected"); + message.source = $root.google.cloud.vision.v1p3beta1.ImageSource.fromObject(object.source); + } return message; }; /** - * Creates a plain object from a Property message. Also converts values to other types if specified. + * Creates a plain object from an Image message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.Property + * @memberof google.cloud.vision.v1p3beta1.Image * @static - * @param {google.cloud.vision.v1p3beta1.Property} message Property + * @param {google.cloud.vision.v1p3beta1.Image} message Image * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Property.toObject = function toObject(message, options) { + Image.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.name = ""; - object.value = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, true); - object.uint64Value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.uint64Value = options.longs === String ? "0" : 0; + if (options.bytes === String) + object.content = ""; + else { + object.content = []; + if (options.bytes !== Array) + object.content = $util.newBuffer(object.content); + } + object.source = null; } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - if (message.uint64Value != null && message.hasOwnProperty("uint64Value")) - if (typeof message.uint64Value === "number") - object.uint64Value = options.longs === String ? String(message.uint64Value) : message.uint64Value; - else - object.uint64Value = options.longs === String ? $util.Long.prototype.toString.call(message.uint64Value) : options.longs === Number ? new $util.LongBits(message.uint64Value.low >>> 0, message.uint64Value.high >>> 0).toNumber(true) : message.uint64Value; + if (message.content != null && message.hasOwnProperty("content")) + object.content = options.bytes === String ? $util.base64.encode(message.content, 0, message.content.length) : options.bytes === Array ? Array.prototype.slice.call(message.content) : message.content; + if (message.source != null && message.hasOwnProperty("source")) + object.source = $root.google.cloud.vision.v1p3beta1.ImageSource.toObject(message.source, options); return object; }; /** - * Converts this Property to JSON. + * Converts this Image to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.Property + * @memberof google.cloud.vision.v1p3beta1.Image * @instance * @returns {Object.} JSON object */ - Property.prototype.toJSON = function toJSON() { + Image.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Property; + return Image; })(); - v1p3beta1.EntityAnnotation = (function() { + v1p3beta1.FaceAnnotation = (function() { /** - * Properties of an EntityAnnotation. + * Properties of a FaceAnnotation. * @memberof google.cloud.vision.v1p3beta1 - * @interface IEntityAnnotation - * @property {string|null} [mid] EntityAnnotation mid - * @property {string|null} [locale] EntityAnnotation locale - * @property {string|null} [description] EntityAnnotation description - * @property {number|null} [score] EntityAnnotation score - * @property {number|null} [confidence] EntityAnnotation confidence - * @property {number|null} [topicality] EntityAnnotation topicality - * @property {google.cloud.vision.v1p3beta1.IBoundingPoly|null} [boundingPoly] EntityAnnotation boundingPoly - * @property {Array.|null} [locations] EntityAnnotation locations - * @property {Array.|null} [properties] EntityAnnotation properties + * @interface IFaceAnnotation + * @property {google.cloud.vision.v1p3beta1.IBoundingPoly|null} [boundingPoly] FaceAnnotation boundingPoly + * @property {google.cloud.vision.v1p3beta1.IBoundingPoly|null} [fdBoundingPoly] FaceAnnotation fdBoundingPoly + * @property {Array.|null} [landmarks] FaceAnnotation landmarks + * @property {number|null} [rollAngle] FaceAnnotation rollAngle + * @property {number|null} [panAngle] FaceAnnotation panAngle + * @property {number|null} [tiltAngle] FaceAnnotation tiltAngle + * @property {number|null} [detectionConfidence] FaceAnnotation detectionConfidence + * @property {number|null} [landmarkingConfidence] FaceAnnotation landmarkingConfidence + * @property {google.cloud.vision.v1p3beta1.Likelihood|null} [joyLikelihood] FaceAnnotation joyLikelihood + * @property {google.cloud.vision.v1p3beta1.Likelihood|null} [sorrowLikelihood] FaceAnnotation sorrowLikelihood + * @property {google.cloud.vision.v1p3beta1.Likelihood|null} [angerLikelihood] FaceAnnotation angerLikelihood + * @property {google.cloud.vision.v1p3beta1.Likelihood|null} [surpriseLikelihood] FaceAnnotation surpriseLikelihood + * @property {google.cloud.vision.v1p3beta1.Likelihood|null} [underExposedLikelihood] FaceAnnotation underExposedLikelihood + * @property {google.cloud.vision.v1p3beta1.Likelihood|null} [blurredLikelihood] FaceAnnotation blurredLikelihood + * @property {google.cloud.vision.v1p3beta1.Likelihood|null} [headwearLikelihood] FaceAnnotation headwearLikelihood */ /** - * Constructs a new EntityAnnotation. + * Constructs a new FaceAnnotation. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an EntityAnnotation. - * @implements IEntityAnnotation + * @classdesc Represents a FaceAnnotation. + * @implements IFaceAnnotation * @constructor - * @param {google.cloud.vision.v1p3beta1.IEntityAnnotation=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.IFaceAnnotation=} [properties] Properties to set */ - function EntityAnnotation(properties) { - this.locations = []; - this.properties = []; + function FaceAnnotation(properties) { + this.landmarks = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -52525,687 +51972,1216 @@ } /** - * EntityAnnotation mid. - * @member {string} mid - * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation + * FaceAnnotation boundingPoly. + * @member {google.cloud.vision.v1p3beta1.IBoundingPoly|null|undefined} boundingPoly + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation * @instance */ - EntityAnnotation.prototype.mid = ""; + FaceAnnotation.prototype.boundingPoly = null; /** - * EntityAnnotation locale. - * @member {string} locale - * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation + * FaceAnnotation fdBoundingPoly. + * @member {google.cloud.vision.v1p3beta1.IBoundingPoly|null|undefined} fdBoundingPoly + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation * @instance */ - EntityAnnotation.prototype.locale = ""; + FaceAnnotation.prototype.fdBoundingPoly = null; /** - * EntityAnnotation description. - * @member {string} description - * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation + * FaceAnnotation landmarks. + * @member {Array.} landmarks + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation * @instance */ - EntityAnnotation.prototype.description = ""; + FaceAnnotation.prototype.landmarks = $util.emptyArray; /** - * EntityAnnotation score. - * @member {number} score - * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation + * FaceAnnotation rollAngle. + * @member {number} rollAngle + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation * @instance */ - EntityAnnotation.prototype.score = 0; + FaceAnnotation.prototype.rollAngle = 0; /** - * EntityAnnotation confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation + * FaceAnnotation panAngle. + * @member {number} panAngle + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation * @instance */ - EntityAnnotation.prototype.confidence = 0; + FaceAnnotation.prototype.panAngle = 0; /** - * EntityAnnotation topicality. - * @member {number} topicality - * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation + * FaceAnnotation tiltAngle. + * @member {number} tiltAngle + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation * @instance */ - EntityAnnotation.prototype.topicality = 0; + FaceAnnotation.prototype.tiltAngle = 0; /** - * EntityAnnotation boundingPoly. - * @member {google.cloud.vision.v1p3beta1.IBoundingPoly|null|undefined} boundingPoly - * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation + * FaceAnnotation detectionConfidence. + * @member {number} detectionConfidence + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation * @instance */ - EntityAnnotation.prototype.boundingPoly = null; + FaceAnnotation.prototype.detectionConfidence = 0; /** - * EntityAnnotation locations. - * @member {Array.} locations - * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation + * FaceAnnotation landmarkingConfidence. + * @member {number} landmarkingConfidence + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation * @instance */ - EntityAnnotation.prototype.locations = $util.emptyArray; + FaceAnnotation.prototype.landmarkingConfidence = 0; /** - * EntityAnnotation properties. - * @member {Array.} properties - * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation + * FaceAnnotation joyLikelihood. + * @member {google.cloud.vision.v1p3beta1.Likelihood} joyLikelihood + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation * @instance */ - EntityAnnotation.prototype.properties = $util.emptyArray; + FaceAnnotation.prototype.joyLikelihood = 0; /** - * Creates a new EntityAnnotation instance using the specified properties. + * FaceAnnotation sorrowLikelihood. + * @member {google.cloud.vision.v1p3beta1.Likelihood} sorrowLikelihood + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.sorrowLikelihood = 0; + + /** + * FaceAnnotation angerLikelihood. + * @member {google.cloud.vision.v1p3beta1.Likelihood} angerLikelihood + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.angerLikelihood = 0; + + /** + * FaceAnnotation surpriseLikelihood. + * @member {google.cloud.vision.v1p3beta1.Likelihood} surpriseLikelihood + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.surpriseLikelihood = 0; + + /** + * FaceAnnotation underExposedLikelihood. + * @member {google.cloud.vision.v1p3beta1.Likelihood} underExposedLikelihood + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.underExposedLikelihood = 0; + + /** + * FaceAnnotation blurredLikelihood. + * @member {google.cloud.vision.v1p3beta1.Likelihood} blurredLikelihood + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.blurredLikelihood = 0; + + /** + * FaceAnnotation headwearLikelihood. + * @member {google.cloud.vision.v1p3beta1.Likelihood} headwearLikelihood + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.headwearLikelihood = 0; + + /** + * Creates a new FaceAnnotation instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation * @static - * @param {google.cloud.vision.v1p3beta1.IEntityAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.EntityAnnotation} EntityAnnotation instance + * @param {google.cloud.vision.v1p3beta1.IFaceAnnotation=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.FaceAnnotation} FaceAnnotation instance */ - EntityAnnotation.create = function create(properties) { - return new EntityAnnotation(properties); + FaceAnnotation.create = function create(properties) { + return new FaceAnnotation(properties); }; /** - * Encodes the specified EntityAnnotation message. Does not implicitly {@link google.cloud.vision.v1p3beta1.EntityAnnotation.verify|verify} messages. + * Encodes the specified FaceAnnotation message. Does not implicitly {@link google.cloud.vision.v1p3beta1.FaceAnnotation.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation * @static - * @param {google.cloud.vision.v1p3beta1.IEntityAnnotation} message EntityAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IFaceAnnotation} message FaceAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EntityAnnotation.encode = function encode(message, writer) { + FaceAnnotation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.mid != null && message.hasOwnProperty("mid")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.mid); - if (message.locale != null && message.hasOwnProperty("locale")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.locale); - if (message.description != null && message.hasOwnProperty("description")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); - if (message.score != null && message.hasOwnProperty("score")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.score); - if (message.confidence != null && message.hasOwnProperty("confidence")) - writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); - if (message.topicality != null && message.hasOwnProperty("topicality")) - writer.uint32(/* id 6, wireType 5 =*/53).float(message.topicality); if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - $root.google.cloud.vision.v1p3beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.locations != null && message.locations.length) - for (var i = 0; i < message.locations.length; ++i) - $root.google.cloud.vision.v1p3beta1.LocationInfo.encode(message.locations[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.properties != null && message.properties.length) - for (var i = 0; i < message.properties.length; ++i) - $root.google.cloud.vision.v1p3beta1.Property.encode(message.properties[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + $root.google.cloud.vision.v1p3beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.fdBoundingPoly != null && message.hasOwnProperty("fdBoundingPoly")) + $root.google.cloud.vision.v1p3beta1.BoundingPoly.encode(message.fdBoundingPoly, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.landmarks != null && message.landmarks.length) + for (var i = 0; i < message.landmarks.length; ++i) + $root.google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark.encode(message.landmarks[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.rollAngle != null && message.hasOwnProperty("rollAngle")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.rollAngle); + if (message.panAngle != null && message.hasOwnProperty("panAngle")) + writer.uint32(/* id 5, wireType 5 =*/45).float(message.panAngle); + if (message.tiltAngle != null && message.hasOwnProperty("tiltAngle")) + writer.uint32(/* id 6, wireType 5 =*/53).float(message.tiltAngle); + if (message.detectionConfidence != null && message.hasOwnProperty("detectionConfidence")) + writer.uint32(/* id 7, wireType 5 =*/61).float(message.detectionConfidence); + if (message.landmarkingConfidence != null && message.hasOwnProperty("landmarkingConfidence")) + writer.uint32(/* id 8, wireType 5 =*/69).float(message.landmarkingConfidence); + if (message.joyLikelihood != null && message.hasOwnProperty("joyLikelihood")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.joyLikelihood); + if (message.sorrowLikelihood != null && message.hasOwnProperty("sorrowLikelihood")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.sorrowLikelihood); + if (message.angerLikelihood != null && message.hasOwnProperty("angerLikelihood")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.angerLikelihood); + if (message.surpriseLikelihood != null && message.hasOwnProperty("surpriseLikelihood")) + writer.uint32(/* id 12, wireType 0 =*/96).int32(message.surpriseLikelihood); + if (message.underExposedLikelihood != null && message.hasOwnProperty("underExposedLikelihood")) + writer.uint32(/* id 13, wireType 0 =*/104).int32(message.underExposedLikelihood); + if (message.blurredLikelihood != null && message.hasOwnProperty("blurredLikelihood")) + writer.uint32(/* id 14, wireType 0 =*/112).int32(message.blurredLikelihood); + if (message.headwearLikelihood != null && message.hasOwnProperty("headwearLikelihood")) + writer.uint32(/* id 15, wireType 0 =*/120).int32(message.headwearLikelihood); return writer; }; /** - * Encodes the specified EntityAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.EntityAnnotation.verify|verify} messages. + * Encodes the specified FaceAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.FaceAnnotation.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation * @static - * @param {google.cloud.vision.v1p3beta1.IEntityAnnotation} message EntityAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IFaceAnnotation} message FaceAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EntityAnnotation.encodeDelimited = function encodeDelimited(message, writer) { + FaceAnnotation.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an EntityAnnotation message from the specified reader or buffer. + * Decodes a FaceAnnotation message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.EntityAnnotation} EntityAnnotation + * @returns {google.cloud.vision.v1p3beta1.FaceAnnotation} FaceAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EntityAnnotation.decode = function decode(reader, length) { + FaceAnnotation.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.vision.v1p3beta1.EntityAnnotation(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.FaceAnnotation(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.mid = reader.string(); - break; + message.boundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.decode(reader, reader.uint32()); + break; + case 2: + message.fdBoundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.decode(reader, reader.uint32()); + break; + case 3: + if (!(message.landmarks && message.landmarks.length)) + message.landmarks = []; + message.landmarks.push($root.google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark.decode(reader, reader.uint32())); + break; + case 4: + message.rollAngle = reader.float(); + break; + case 5: + message.panAngle = reader.float(); + break; + case 6: + message.tiltAngle = reader.float(); + break; + case 7: + message.detectionConfidence = reader.float(); + break; + case 8: + message.landmarkingConfidence = reader.float(); + break; + case 9: + message.joyLikelihood = reader.int32(); + break; + case 10: + message.sorrowLikelihood = reader.int32(); + break; + case 11: + message.angerLikelihood = reader.int32(); + break; + case 12: + message.surpriseLikelihood = reader.int32(); + break; + case 13: + message.underExposedLikelihood = reader.int32(); + break; + case 14: + message.blurredLikelihood = reader.int32(); + break; + case 15: + message.headwearLikelihood = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FaceAnnotation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.vision.v1p3beta1.FaceAnnotation} FaceAnnotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FaceAnnotation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FaceAnnotation message. + * @function verify + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FaceAnnotation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { + var error = $root.google.cloud.vision.v1p3beta1.BoundingPoly.verify(message.boundingPoly); + if (error) + return "boundingPoly." + error; + } + if (message.fdBoundingPoly != null && message.hasOwnProperty("fdBoundingPoly")) { + var error = $root.google.cloud.vision.v1p3beta1.BoundingPoly.verify(message.fdBoundingPoly); + if (error) + return "fdBoundingPoly." + error; + } + if (message.landmarks != null && message.hasOwnProperty("landmarks")) { + if (!Array.isArray(message.landmarks)) + return "landmarks: array expected"; + for (var i = 0; i < message.landmarks.length; ++i) { + var error = $root.google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark.verify(message.landmarks[i]); + if (error) + return "landmarks." + error; + } + } + if (message.rollAngle != null && message.hasOwnProperty("rollAngle")) + if (typeof message.rollAngle !== "number") + return "rollAngle: number expected"; + if (message.panAngle != null && message.hasOwnProperty("panAngle")) + if (typeof message.panAngle !== "number") + return "panAngle: number expected"; + if (message.tiltAngle != null && message.hasOwnProperty("tiltAngle")) + if (typeof message.tiltAngle !== "number") + return "tiltAngle: number expected"; + if (message.detectionConfidence != null && message.hasOwnProperty("detectionConfidence")) + if (typeof message.detectionConfidence !== "number") + return "detectionConfidence: number expected"; + if (message.landmarkingConfidence != null && message.hasOwnProperty("landmarkingConfidence")) + if (typeof message.landmarkingConfidence !== "number") + return "landmarkingConfidence: number expected"; + if (message.joyLikelihood != null && message.hasOwnProperty("joyLikelihood")) + switch (message.joyLikelihood) { + default: + return "joyLikelihood: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.sorrowLikelihood != null && message.hasOwnProperty("sorrowLikelihood")) + switch (message.sorrowLikelihood) { + default: + return "sorrowLikelihood: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.angerLikelihood != null && message.hasOwnProperty("angerLikelihood")) + switch (message.angerLikelihood) { + default: + return "angerLikelihood: enum value expected"; + case 0: + case 1: case 2: - message.locale = reader.string(); - break; case 3: - message.description = reader.string(); - break; case 4: - message.score = reader.float(); - break; case 5: - message.confidence = reader.float(); - break; - case 6: - message.topicality = reader.float(); - break; - case 7: - message.boundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.decode(reader, reader.uint32()); - break; - case 8: - if (!(message.locations && message.locations.length)) - message.locations = []; - message.locations.push($root.google.cloud.vision.v1p3beta1.LocationInfo.decode(reader, reader.uint32())); break; - case 9: - if (!(message.properties && message.properties.length)) - message.properties = []; - message.properties.push($root.google.cloud.vision.v1p3beta1.Property.decode(reader, reader.uint32())); + } + if (message.surpriseLikelihood != null && message.hasOwnProperty("surpriseLikelihood")) + switch (message.surpriseLikelihood) { + default: + return "surpriseLikelihood: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: break; + } + if (message.underExposedLikelihood != null && message.hasOwnProperty("underExposedLikelihood")) + switch (message.underExposedLikelihood) { default: - reader.skipType(tag & 7); + return "underExposedLikelihood: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: break; } - } - return message; - }; - - /** - * Decodes an EntityAnnotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.EntityAnnotation} EntityAnnotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EntityAnnotation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an EntityAnnotation message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - EntityAnnotation.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.mid != null && message.hasOwnProperty("mid")) - if (!$util.isString(message.mid)) - return "mid: string expected"; - if (message.locale != null && message.hasOwnProperty("locale")) - if (!$util.isString(message.locale)) - return "locale: string expected"; - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; - if (message.confidence != null && message.hasOwnProperty("confidence")) - if (typeof message.confidence !== "number") - return "confidence: number expected"; - if (message.topicality != null && message.hasOwnProperty("topicality")) - if (typeof message.topicality !== "number") - return "topicality: number expected"; - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { - var error = $root.google.cloud.vision.v1p3beta1.BoundingPoly.verify(message.boundingPoly); - if (error) - return "boundingPoly." + error; - } - if (message.locations != null && message.hasOwnProperty("locations")) { - if (!Array.isArray(message.locations)) - return "locations: array expected"; - for (var i = 0; i < message.locations.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.LocationInfo.verify(message.locations[i]); - if (error) - return "locations." + error; + if (message.blurredLikelihood != null && message.hasOwnProperty("blurredLikelihood")) + switch (message.blurredLikelihood) { + default: + return "blurredLikelihood: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; } - } - if (message.properties != null && message.hasOwnProperty("properties")) { - if (!Array.isArray(message.properties)) - return "properties: array expected"; - for (var i = 0; i < message.properties.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.Property.verify(message.properties[i]); - if (error) - return "properties." + error; + if (message.headwearLikelihood != null && message.hasOwnProperty("headwearLikelihood")) + switch (message.headwearLikelihood) { + default: + return "headwearLikelihood: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; } - } return null; }; /** - * Creates an EntityAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates a FaceAnnotation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.EntityAnnotation} EntityAnnotation + * @returns {google.cloud.vision.v1p3beta1.FaceAnnotation} FaceAnnotation */ - EntityAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.EntityAnnotation) + FaceAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.FaceAnnotation) return object; - var message = new $root.google.cloud.vision.v1p3beta1.EntityAnnotation(); - if (object.mid != null) - message.mid = String(object.mid); - if (object.locale != null) - message.locale = String(object.locale); - if (object.description != null) - message.description = String(object.description); - if (object.score != null) - message.score = Number(object.score); - if (object.confidence != null) - message.confidence = Number(object.confidence); - if (object.topicality != null) - message.topicality = Number(object.topicality); + var message = new $root.google.cloud.vision.v1p3beta1.FaceAnnotation(); if (object.boundingPoly != null) { if (typeof object.boundingPoly !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.EntityAnnotation.boundingPoly: object expected"); + throw TypeError(".google.cloud.vision.v1p3beta1.FaceAnnotation.boundingPoly: object expected"); message.boundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.fromObject(object.boundingPoly); } - if (object.locations) { - if (!Array.isArray(object.locations)) - throw TypeError(".google.cloud.vision.v1p3beta1.EntityAnnotation.locations: array expected"); - message.locations = []; - for (var i = 0; i < object.locations.length; ++i) { - if (typeof object.locations[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.EntityAnnotation.locations: object expected"); - message.locations[i] = $root.google.cloud.vision.v1p3beta1.LocationInfo.fromObject(object.locations[i]); - } + if (object.fdBoundingPoly != null) { + if (typeof object.fdBoundingPoly !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.FaceAnnotation.fdBoundingPoly: object expected"); + message.fdBoundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.fromObject(object.fdBoundingPoly); } - if (object.properties) { - if (!Array.isArray(object.properties)) - throw TypeError(".google.cloud.vision.v1p3beta1.EntityAnnotation.properties: array expected"); - message.properties = []; - for (var i = 0; i < object.properties.length; ++i) { - if (typeof object.properties[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.EntityAnnotation.properties: object expected"); - message.properties[i] = $root.google.cloud.vision.v1p3beta1.Property.fromObject(object.properties[i]); + if (object.landmarks) { + if (!Array.isArray(object.landmarks)) + throw TypeError(".google.cloud.vision.v1p3beta1.FaceAnnotation.landmarks: array expected"); + message.landmarks = []; + for (var i = 0; i < object.landmarks.length; ++i) { + if (typeof object.landmarks[i] !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.FaceAnnotation.landmarks: object expected"); + message.landmarks[i] = $root.google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark.fromObject(object.landmarks[i]); } } + if (object.rollAngle != null) + message.rollAngle = Number(object.rollAngle); + if (object.panAngle != null) + message.panAngle = Number(object.panAngle); + if (object.tiltAngle != null) + message.tiltAngle = Number(object.tiltAngle); + if (object.detectionConfidence != null) + message.detectionConfidence = Number(object.detectionConfidence); + if (object.landmarkingConfidence != null) + message.landmarkingConfidence = Number(object.landmarkingConfidence); + switch (object.joyLikelihood) { + case "UNKNOWN": + case 0: + message.joyLikelihood = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.joyLikelihood = 1; + break; + case "UNLIKELY": + case 2: + message.joyLikelihood = 2; + break; + case "POSSIBLE": + case 3: + message.joyLikelihood = 3; + break; + case "LIKELY": + case 4: + message.joyLikelihood = 4; + break; + case "VERY_LIKELY": + case 5: + message.joyLikelihood = 5; + break; + } + switch (object.sorrowLikelihood) { + case "UNKNOWN": + case 0: + message.sorrowLikelihood = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.sorrowLikelihood = 1; + break; + case "UNLIKELY": + case 2: + message.sorrowLikelihood = 2; + break; + case "POSSIBLE": + case 3: + message.sorrowLikelihood = 3; + break; + case "LIKELY": + case 4: + message.sorrowLikelihood = 4; + break; + case "VERY_LIKELY": + case 5: + message.sorrowLikelihood = 5; + break; + } + switch (object.angerLikelihood) { + case "UNKNOWN": + case 0: + message.angerLikelihood = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.angerLikelihood = 1; + break; + case "UNLIKELY": + case 2: + message.angerLikelihood = 2; + break; + case "POSSIBLE": + case 3: + message.angerLikelihood = 3; + break; + case "LIKELY": + case 4: + message.angerLikelihood = 4; + break; + case "VERY_LIKELY": + case 5: + message.angerLikelihood = 5; + break; + } + switch (object.surpriseLikelihood) { + case "UNKNOWN": + case 0: + message.surpriseLikelihood = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.surpriseLikelihood = 1; + break; + case "UNLIKELY": + case 2: + message.surpriseLikelihood = 2; + break; + case "POSSIBLE": + case 3: + message.surpriseLikelihood = 3; + break; + case "LIKELY": + case 4: + message.surpriseLikelihood = 4; + break; + case "VERY_LIKELY": + case 5: + message.surpriseLikelihood = 5; + break; + } + switch (object.underExposedLikelihood) { + case "UNKNOWN": + case 0: + message.underExposedLikelihood = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.underExposedLikelihood = 1; + break; + case "UNLIKELY": + case 2: + message.underExposedLikelihood = 2; + break; + case "POSSIBLE": + case 3: + message.underExposedLikelihood = 3; + break; + case "LIKELY": + case 4: + message.underExposedLikelihood = 4; + break; + case "VERY_LIKELY": + case 5: + message.underExposedLikelihood = 5; + break; + } + switch (object.blurredLikelihood) { + case "UNKNOWN": + case 0: + message.blurredLikelihood = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.blurredLikelihood = 1; + break; + case "UNLIKELY": + case 2: + message.blurredLikelihood = 2; + break; + case "POSSIBLE": + case 3: + message.blurredLikelihood = 3; + break; + case "LIKELY": + case 4: + message.blurredLikelihood = 4; + break; + case "VERY_LIKELY": + case 5: + message.blurredLikelihood = 5; + break; + } + switch (object.headwearLikelihood) { + case "UNKNOWN": + case 0: + message.headwearLikelihood = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.headwearLikelihood = 1; + break; + case "UNLIKELY": + case 2: + message.headwearLikelihood = 2; + break; + case "POSSIBLE": + case 3: + message.headwearLikelihood = 3; + break; + case "LIKELY": + case 4: + message.headwearLikelihood = 4; + break; + case "VERY_LIKELY": + case 5: + message.headwearLikelihood = 5; + break; + } return message; }; /** - * Creates a plain object from an EntityAnnotation message. Also converts values to other types if specified. + * Creates a plain object from a FaceAnnotation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation * @static - * @param {google.cloud.vision.v1p3beta1.EntityAnnotation} message EntityAnnotation + * @param {google.cloud.vision.v1p3beta1.FaceAnnotation} message FaceAnnotation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EntityAnnotation.toObject = function toObject(message, options) { + FaceAnnotation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.locations = []; - object.properties = []; - } + if (options.arrays || options.defaults) + object.landmarks = []; if (options.defaults) { - object.mid = ""; - object.locale = ""; - object.description = ""; - object.score = 0; - object.confidence = 0; - object.topicality = 0; object.boundingPoly = null; + object.fdBoundingPoly = null; + object.rollAngle = 0; + object.panAngle = 0; + object.tiltAngle = 0; + object.detectionConfidence = 0; + object.landmarkingConfidence = 0; + object.joyLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.sorrowLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.angerLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.surpriseLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.underExposedLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.blurredLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.headwearLikelihood = options.enums === String ? "UNKNOWN" : 0; } - if (message.mid != null && message.hasOwnProperty("mid")) - object.mid = message.mid; - if (message.locale != null && message.hasOwnProperty("locale")) - object.locale = message.locale; - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - if (message.confidence != null && message.hasOwnProperty("confidence")) - object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; - if (message.topicality != null && message.hasOwnProperty("topicality")) - object.topicality = options.json && !isFinite(message.topicality) ? String(message.topicality) : message.topicality; if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) object.boundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.toObject(message.boundingPoly, options); - if (message.locations && message.locations.length) { - object.locations = []; - for (var j = 0; j < message.locations.length; ++j) - object.locations[j] = $root.google.cloud.vision.v1p3beta1.LocationInfo.toObject(message.locations[j], options); - } - if (message.properties && message.properties.length) { - object.properties = []; - for (var j = 0; j < message.properties.length; ++j) - object.properties[j] = $root.google.cloud.vision.v1p3beta1.Property.toObject(message.properties[j], options); + if (message.fdBoundingPoly != null && message.hasOwnProperty("fdBoundingPoly")) + object.fdBoundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.toObject(message.fdBoundingPoly, options); + if (message.landmarks && message.landmarks.length) { + object.landmarks = []; + for (var j = 0; j < message.landmarks.length; ++j) + object.landmarks[j] = $root.google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark.toObject(message.landmarks[j], options); } - return object; - }; - - /** - * Converts this EntityAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation - * @instance - * @returns {Object.} JSON object - */ - EntityAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return EntityAnnotation; - })(); - - v1p3beta1.LocalizedObjectAnnotation = (function() { - - /** - * Properties of a LocalizedObjectAnnotation. - * @memberof google.cloud.vision.v1p3beta1 - * @interface ILocalizedObjectAnnotation - * @property {string|null} [mid] LocalizedObjectAnnotation mid - * @property {string|null} [languageCode] LocalizedObjectAnnotation languageCode - * @property {string|null} [name] LocalizedObjectAnnotation name - * @property {number|null} [score] LocalizedObjectAnnotation score - * @property {google.cloud.vision.v1p3beta1.IBoundingPoly|null} [boundingPoly] LocalizedObjectAnnotation boundingPoly - */ - - /** - * Constructs a new LocalizedObjectAnnotation. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a LocalizedObjectAnnotation. - * @implements ILocalizedObjectAnnotation - * @constructor - * @param {google.cloud.vision.v1p3beta1.ILocalizedObjectAnnotation=} [properties] Properties to set - */ - function LocalizedObjectAnnotation(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]]; - } + if (message.rollAngle != null && message.hasOwnProperty("rollAngle")) + object.rollAngle = options.json && !isFinite(message.rollAngle) ? String(message.rollAngle) : message.rollAngle; + if (message.panAngle != null && message.hasOwnProperty("panAngle")) + object.panAngle = options.json && !isFinite(message.panAngle) ? String(message.panAngle) : message.panAngle; + if (message.tiltAngle != null && message.hasOwnProperty("tiltAngle")) + object.tiltAngle = options.json && !isFinite(message.tiltAngle) ? String(message.tiltAngle) : message.tiltAngle; + if (message.detectionConfidence != null && message.hasOwnProperty("detectionConfidence")) + object.detectionConfidence = options.json && !isFinite(message.detectionConfidence) ? String(message.detectionConfidence) : message.detectionConfidence; + if (message.landmarkingConfidence != null && message.hasOwnProperty("landmarkingConfidence")) + object.landmarkingConfidence = options.json && !isFinite(message.landmarkingConfidence) ? String(message.landmarkingConfidence) : message.landmarkingConfidence; + if (message.joyLikelihood != null && message.hasOwnProperty("joyLikelihood")) + object.joyLikelihood = options.enums === String ? $root.google.cloud.vision.v1p3beta1.Likelihood[message.joyLikelihood] : message.joyLikelihood; + if (message.sorrowLikelihood != null && message.hasOwnProperty("sorrowLikelihood")) + object.sorrowLikelihood = options.enums === String ? $root.google.cloud.vision.v1p3beta1.Likelihood[message.sorrowLikelihood] : message.sorrowLikelihood; + if (message.angerLikelihood != null && message.hasOwnProperty("angerLikelihood")) + object.angerLikelihood = options.enums === String ? $root.google.cloud.vision.v1p3beta1.Likelihood[message.angerLikelihood] : message.angerLikelihood; + if (message.surpriseLikelihood != null && message.hasOwnProperty("surpriseLikelihood")) + object.surpriseLikelihood = options.enums === String ? $root.google.cloud.vision.v1p3beta1.Likelihood[message.surpriseLikelihood] : message.surpriseLikelihood; + if (message.underExposedLikelihood != null && message.hasOwnProperty("underExposedLikelihood")) + object.underExposedLikelihood = options.enums === String ? $root.google.cloud.vision.v1p3beta1.Likelihood[message.underExposedLikelihood] : message.underExposedLikelihood; + if (message.blurredLikelihood != null && message.hasOwnProperty("blurredLikelihood")) + object.blurredLikelihood = options.enums === String ? $root.google.cloud.vision.v1p3beta1.Likelihood[message.blurredLikelihood] : message.blurredLikelihood; + if (message.headwearLikelihood != null && message.hasOwnProperty("headwearLikelihood")) + object.headwearLikelihood = options.enums === String ? $root.google.cloud.vision.v1p3beta1.Likelihood[message.headwearLikelihood] : message.headwearLikelihood; + return object; + }; /** - * LocalizedObjectAnnotation mid. - * @member {string} mid - * @memberof google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation + * Converts this FaceAnnotation to JSON. + * @function toJSON + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation * @instance + * @returns {Object.} JSON object */ - LocalizedObjectAnnotation.prototype.mid = ""; + FaceAnnotation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * LocalizedObjectAnnotation languageCode. - * @member {string} languageCode - * @memberof google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation - * @instance - */ - LocalizedObjectAnnotation.prototype.languageCode = ""; + FaceAnnotation.Landmark = (function() { - /** - * LocalizedObjectAnnotation name. - * @member {string} name - * @memberof google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation - * @instance - */ - LocalizedObjectAnnotation.prototype.name = ""; + /** + * Properties of a Landmark. + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation + * @interface ILandmark + * @property {google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark.Type|null} [type] Landmark type + * @property {google.cloud.vision.v1p3beta1.IPosition|null} [position] Landmark position + */ - /** - * LocalizedObjectAnnotation score. - * @member {number} score - * @memberof google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation - * @instance - */ - LocalizedObjectAnnotation.prototype.score = 0; + /** + * Constructs a new Landmark. + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation + * @classdesc Represents a Landmark. + * @implements ILandmark + * @constructor + * @param {google.cloud.vision.v1p3beta1.FaceAnnotation.ILandmark=} [properties] Properties to set + */ + function Landmark(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]]; + } - /** - * LocalizedObjectAnnotation boundingPoly. - * @member {google.cloud.vision.v1p3beta1.IBoundingPoly|null|undefined} boundingPoly - * @memberof google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation - * @instance - */ - LocalizedObjectAnnotation.prototype.boundingPoly = null; + /** + * Landmark type. + * @member {google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark.Type} type + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark + * @instance + */ + Landmark.prototype.type = 0; - /** - * Creates a new LocalizedObjectAnnotation instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation - * @static - * @param {google.cloud.vision.v1p3beta1.ILocalizedObjectAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation} LocalizedObjectAnnotation instance - */ - LocalizedObjectAnnotation.create = function create(properties) { - return new LocalizedObjectAnnotation(properties); - }; + /** + * Landmark position. + * @member {google.cloud.vision.v1p3beta1.IPosition|null|undefined} position + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark + * @instance + */ + Landmark.prototype.position = null; - /** - * Encodes the specified LocalizedObjectAnnotation message. Does not implicitly {@link google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation - * @static - * @param {google.cloud.vision.v1p3beta1.ILocalizedObjectAnnotation} message LocalizedObjectAnnotation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LocalizedObjectAnnotation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.mid != null && message.hasOwnProperty("mid")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.mid); - if (message.languageCode != null && message.hasOwnProperty("languageCode")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); - if (message.name != null && message.hasOwnProperty("name")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); - if (message.score != null && message.hasOwnProperty("score")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.score); - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - $root.google.cloud.vision.v1p3beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - return writer; - }; + /** + * Creates a new Landmark instance using the specified properties. + * @function create + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark + * @static + * @param {google.cloud.vision.v1p3beta1.FaceAnnotation.ILandmark=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark} Landmark instance + */ + Landmark.create = function create(properties) { + return new Landmark(properties); + }; - /** - * Encodes the specified LocalizedObjectAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation - * @static - * @param {google.cloud.vision.v1p3beta1.ILocalizedObjectAnnotation} message LocalizedObjectAnnotation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LocalizedObjectAnnotation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Encodes the specified Landmark message. Does not implicitly {@link google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark.verify|verify} messages. + * @function encode + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark + * @static + * @param {google.cloud.vision.v1p3beta1.FaceAnnotation.ILandmark} message Landmark message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Landmark.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && message.hasOwnProperty("type")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); + if (message.position != null && message.hasOwnProperty("position")) + $root.google.cloud.vision.v1p3beta1.Position.encode(message.position, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; - /** - * Decodes a LocalizedObjectAnnotation message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation} LocalizedObjectAnnotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LocalizedObjectAnnotation.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.vision.v1p3beta1.LocalizedObjectAnnotation(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { + /** + * Encodes the specified Landmark message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark + * @static + * @param {google.cloud.vision.v1p3beta1.FaceAnnotation.ILandmark} message Landmark message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Landmark.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Landmark message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark} Landmark + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Landmark.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.vision.v1p3beta1.FaceAnnotation.Landmark(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + message.type = reader.int32(); + break; + case 4: + message.position = $root.google.cloud.vision.v1p3beta1.Position.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Landmark message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark} Landmark + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Landmark.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Landmark message. + * @function verify + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Landmark.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + case 24: + case 25: + case 26: + case 27: + case 28: + case 29: + case 30: + case 31: + case 32: + case 33: + case 34: + break; + } + if (message.position != null && message.hasOwnProperty("position")) { + var error = $root.google.cloud.vision.v1p3beta1.Position.verify(message.position); + if (error) + return "position." + error; + } + return null; + }; + + /** + * Creates a Landmark message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark} Landmark + */ + Landmark.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark) + return object; + var message = new $root.google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark(); + switch (object.type) { + case "UNKNOWN_LANDMARK": + case 0: + message.type = 0; + break; + case "LEFT_EYE": case 1: - message.mid = reader.string(); + message.type = 1; break; + case "RIGHT_EYE": case 2: - message.languageCode = reader.string(); + message.type = 2; break; + case "LEFT_OF_LEFT_EYEBROW": case 3: - message.name = reader.string(); + message.type = 3; break; + case "RIGHT_OF_LEFT_EYEBROW": case 4: - message.score = reader.float(); + message.type = 4; break; + case "LEFT_OF_RIGHT_EYEBROW": case 5: - message.boundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.decode(reader, reader.uint32()); + message.type = 5; break; - default: - reader.skipType(tag & 7); + case "RIGHT_OF_RIGHT_EYEBROW": + case 6: + message.type = 6; + break; + case "MIDPOINT_BETWEEN_EYES": + case 7: + message.type = 7; + break; + case "NOSE_TIP": + case 8: + message.type = 8; + break; + case "UPPER_LIP": + case 9: + message.type = 9; + break; + case "LOWER_LIP": + case 10: + message.type = 10; + break; + case "MOUTH_LEFT": + case 11: + message.type = 11; + break; + case "MOUTH_RIGHT": + case 12: + message.type = 12; + break; + case "MOUTH_CENTER": + case 13: + message.type = 13; + break; + case "NOSE_BOTTOM_RIGHT": + case 14: + message.type = 14; + break; + case "NOSE_BOTTOM_LEFT": + case 15: + message.type = 15; + break; + case "NOSE_BOTTOM_CENTER": + case 16: + message.type = 16; + break; + case "LEFT_EYE_TOP_BOUNDARY": + case 17: + message.type = 17; + break; + case "LEFT_EYE_RIGHT_CORNER": + case 18: + message.type = 18; + break; + case "LEFT_EYE_BOTTOM_BOUNDARY": + case 19: + message.type = 19; + break; + case "LEFT_EYE_LEFT_CORNER": + case 20: + message.type = 20; + break; + case "RIGHT_EYE_TOP_BOUNDARY": + case 21: + message.type = 21; + break; + case "RIGHT_EYE_RIGHT_CORNER": + case 22: + message.type = 22; + break; + case "RIGHT_EYE_BOTTOM_BOUNDARY": + case 23: + message.type = 23; + break; + case "RIGHT_EYE_LEFT_CORNER": + case 24: + message.type = 24; + break; + case "LEFT_EYEBROW_UPPER_MIDPOINT": + case 25: + message.type = 25; + break; + case "RIGHT_EYEBROW_UPPER_MIDPOINT": + case 26: + message.type = 26; + break; + case "LEFT_EAR_TRAGION": + case 27: + message.type = 27; + break; + case "RIGHT_EAR_TRAGION": + case 28: + message.type = 28; + break; + case "LEFT_EYE_PUPIL": + case 29: + message.type = 29; + break; + case "RIGHT_EYE_PUPIL": + case 30: + message.type = 30; + break; + case "FOREHEAD_GLABELLA": + case 31: + message.type = 31; + break; + case "CHIN_GNATHION": + case 32: + message.type = 32; + break; + case "CHIN_LEFT_GONION": + case 33: + message.type = 33; + break; + case "CHIN_RIGHT_GONION": + case 34: + message.type = 34; break; } - } - return message; - }; - - /** - * Decodes a LocalizedObjectAnnotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation} LocalizedObjectAnnotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LocalizedObjectAnnotation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a LocalizedObjectAnnotation message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - LocalizedObjectAnnotation.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.mid != null && message.hasOwnProperty("mid")) - if (!$util.isString(message.mid)) - return "mid: string expected"; - if (message.languageCode != null && message.hasOwnProperty("languageCode")) - if (!$util.isString(message.languageCode)) - return "languageCode: string expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { - var error = $root.google.cloud.vision.v1p3beta1.BoundingPoly.verify(message.boundingPoly); - if (error) - return "boundingPoly." + error; - } - return null; - }; - - /** - * Creates a LocalizedObjectAnnotation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation} LocalizedObjectAnnotation - */ - LocalizedObjectAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation) + if (object.position != null) { + if (typeof object.position !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark.position: object expected"); + message.position = $root.google.cloud.vision.v1p3beta1.Position.fromObject(object.position); + } + return message; + }; + + /** + * Creates a plain object from a Landmark message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark + * @static + * @param {google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark} message Landmark + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Landmark.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.type = options.enums === String ? "UNKNOWN_LANDMARK" : 0; + object.position = null; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark.Type[message.type] : message.type; + if (message.position != null && message.hasOwnProperty("position")) + object.position = $root.google.cloud.vision.v1p3beta1.Position.toObject(message.position, options); return object; - var message = new $root.google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation(); - if (object.mid != null) - message.mid = String(object.mid); - if (object.languageCode != null) - message.languageCode = String(object.languageCode); - if (object.name != null) - message.name = String(object.name); - if (object.score != null) - message.score = Number(object.score); - if (object.boundingPoly != null) { - if (typeof object.boundingPoly !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation.boundingPoly: object expected"); - message.boundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.fromObject(object.boundingPoly); - } - return message; - }; + }; - /** - * Creates a plain object from a LocalizedObjectAnnotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation - * @static - * @param {google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation} message LocalizedObjectAnnotation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - LocalizedObjectAnnotation.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.mid = ""; - object.languageCode = ""; - object.name = ""; - object.score = 0; - object.boundingPoly = null; - } - if (message.mid != null && message.hasOwnProperty("mid")) - object.mid = message.mid; - if (message.languageCode != null && message.hasOwnProperty("languageCode")) - object.languageCode = message.languageCode; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - object.boundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.toObject(message.boundingPoly, options); - return object; - }; + /** + * Converts this Landmark to JSON. + * @function toJSON + * @memberof google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark + * @instance + * @returns {Object.} JSON object + */ + Landmark.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this LocalizedObjectAnnotation to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation - * @instance - * @returns {Object.} JSON object - */ - LocalizedObjectAnnotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Type enum. + * @name google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark.Type + * @enum {string} + * @property {number} UNKNOWN_LANDMARK=0 UNKNOWN_LANDMARK value + * @property {number} LEFT_EYE=1 LEFT_EYE value + * @property {number} RIGHT_EYE=2 RIGHT_EYE value + * @property {number} LEFT_OF_LEFT_EYEBROW=3 LEFT_OF_LEFT_EYEBROW value + * @property {number} RIGHT_OF_LEFT_EYEBROW=4 RIGHT_OF_LEFT_EYEBROW value + * @property {number} LEFT_OF_RIGHT_EYEBROW=5 LEFT_OF_RIGHT_EYEBROW value + * @property {number} RIGHT_OF_RIGHT_EYEBROW=6 RIGHT_OF_RIGHT_EYEBROW value + * @property {number} MIDPOINT_BETWEEN_EYES=7 MIDPOINT_BETWEEN_EYES value + * @property {number} NOSE_TIP=8 NOSE_TIP value + * @property {number} UPPER_LIP=9 UPPER_LIP value + * @property {number} LOWER_LIP=10 LOWER_LIP value + * @property {number} MOUTH_LEFT=11 MOUTH_LEFT value + * @property {number} MOUTH_RIGHT=12 MOUTH_RIGHT value + * @property {number} MOUTH_CENTER=13 MOUTH_CENTER value + * @property {number} NOSE_BOTTOM_RIGHT=14 NOSE_BOTTOM_RIGHT value + * @property {number} NOSE_BOTTOM_LEFT=15 NOSE_BOTTOM_LEFT value + * @property {number} NOSE_BOTTOM_CENTER=16 NOSE_BOTTOM_CENTER value + * @property {number} LEFT_EYE_TOP_BOUNDARY=17 LEFT_EYE_TOP_BOUNDARY value + * @property {number} LEFT_EYE_RIGHT_CORNER=18 LEFT_EYE_RIGHT_CORNER value + * @property {number} LEFT_EYE_BOTTOM_BOUNDARY=19 LEFT_EYE_BOTTOM_BOUNDARY value + * @property {number} LEFT_EYE_LEFT_CORNER=20 LEFT_EYE_LEFT_CORNER value + * @property {number} RIGHT_EYE_TOP_BOUNDARY=21 RIGHT_EYE_TOP_BOUNDARY value + * @property {number} RIGHT_EYE_RIGHT_CORNER=22 RIGHT_EYE_RIGHT_CORNER value + * @property {number} RIGHT_EYE_BOTTOM_BOUNDARY=23 RIGHT_EYE_BOTTOM_BOUNDARY value + * @property {number} RIGHT_EYE_LEFT_CORNER=24 RIGHT_EYE_LEFT_CORNER value + * @property {number} LEFT_EYEBROW_UPPER_MIDPOINT=25 LEFT_EYEBROW_UPPER_MIDPOINT value + * @property {number} RIGHT_EYEBROW_UPPER_MIDPOINT=26 RIGHT_EYEBROW_UPPER_MIDPOINT value + * @property {number} LEFT_EAR_TRAGION=27 LEFT_EAR_TRAGION value + * @property {number} RIGHT_EAR_TRAGION=28 RIGHT_EAR_TRAGION value + * @property {number} LEFT_EYE_PUPIL=29 LEFT_EYE_PUPIL value + * @property {number} RIGHT_EYE_PUPIL=30 RIGHT_EYE_PUPIL value + * @property {number} FOREHEAD_GLABELLA=31 FOREHEAD_GLABELLA value + * @property {number} CHIN_GNATHION=32 CHIN_GNATHION value + * @property {number} CHIN_LEFT_GONION=33 CHIN_LEFT_GONION value + * @property {number} CHIN_RIGHT_GONION=34 CHIN_RIGHT_GONION value + */ + Landmark.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN_LANDMARK"] = 0; + values[valuesById[1] = "LEFT_EYE"] = 1; + values[valuesById[2] = "RIGHT_EYE"] = 2; + values[valuesById[3] = "LEFT_OF_LEFT_EYEBROW"] = 3; + values[valuesById[4] = "RIGHT_OF_LEFT_EYEBROW"] = 4; + values[valuesById[5] = "LEFT_OF_RIGHT_EYEBROW"] = 5; + values[valuesById[6] = "RIGHT_OF_RIGHT_EYEBROW"] = 6; + values[valuesById[7] = "MIDPOINT_BETWEEN_EYES"] = 7; + values[valuesById[8] = "NOSE_TIP"] = 8; + values[valuesById[9] = "UPPER_LIP"] = 9; + values[valuesById[10] = "LOWER_LIP"] = 10; + values[valuesById[11] = "MOUTH_LEFT"] = 11; + values[valuesById[12] = "MOUTH_RIGHT"] = 12; + values[valuesById[13] = "MOUTH_CENTER"] = 13; + values[valuesById[14] = "NOSE_BOTTOM_RIGHT"] = 14; + values[valuesById[15] = "NOSE_BOTTOM_LEFT"] = 15; + values[valuesById[16] = "NOSE_BOTTOM_CENTER"] = 16; + values[valuesById[17] = "LEFT_EYE_TOP_BOUNDARY"] = 17; + values[valuesById[18] = "LEFT_EYE_RIGHT_CORNER"] = 18; + values[valuesById[19] = "LEFT_EYE_BOTTOM_BOUNDARY"] = 19; + values[valuesById[20] = "LEFT_EYE_LEFT_CORNER"] = 20; + values[valuesById[21] = "RIGHT_EYE_TOP_BOUNDARY"] = 21; + values[valuesById[22] = "RIGHT_EYE_RIGHT_CORNER"] = 22; + values[valuesById[23] = "RIGHT_EYE_BOTTOM_BOUNDARY"] = 23; + values[valuesById[24] = "RIGHT_EYE_LEFT_CORNER"] = 24; + values[valuesById[25] = "LEFT_EYEBROW_UPPER_MIDPOINT"] = 25; + values[valuesById[26] = "RIGHT_EYEBROW_UPPER_MIDPOINT"] = 26; + values[valuesById[27] = "LEFT_EAR_TRAGION"] = 27; + values[valuesById[28] = "RIGHT_EAR_TRAGION"] = 28; + values[valuesById[29] = "LEFT_EYE_PUPIL"] = 29; + values[valuesById[30] = "RIGHT_EYE_PUPIL"] = 30; + values[valuesById[31] = "FOREHEAD_GLABELLA"] = 31; + values[valuesById[32] = "CHIN_GNATHION"] = 32; + values[valuesById[33] = "CHIN_LEFT_GONION"] = 33; + values[valuesById[34] = "CHIN_RIGHT_GONION"] = 34; + return values; + })(); - return LocalizedObjectAnnotation; + return Landmark; + })(); + + return FaceAnnotation; })(); - v1p3beta1.SafeSearchAnnotation = (function() { + v1p3beta1.LocationInfo = (function() { /** - * Properties of a SafeSearchAnnotation. + * Properties of a LocationInfo. * @memberof google.cloud.vision.v1p3beta1 - * @interface ISafeSearchAnnotation - * @property {google.cloud.vision.v1p3beta1.Likelihood|null} [adult] SafeSearchAnnotation adult - * @property {google.cloud.vision.v1p3beta1.Likelihood|null} [spoof] SafeSearchAnnotation spoof - * @property {google.cloud.vision.v1p3beta1.Likelihood|null} [medical] SafeSearchAnnotation medical - * @property {google.cloud.vision.v1p3beta1.Likelihood|null} [violence] SafeSearchAnnotation violence - * @property {google.cloud.vision.v1p3beta1.Likelihood|null} [racy] SafeSearchAnnotation racy + * @interface ILocationInfo + * @property {google.type.ILatLng|null} [latLng] LocationInfo latLng */ /** - * Constructs a new SafeSearchAnnotation. + * Constructs a new LocationInfo. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a SafeSearchAnnotation. - * @implements ISafeSearchAnnotation + * @classdesc Represents a LocationInfo. + * @implements ILocationInfo * @constructor - * @param {google.cloud.vision.v1p3beta1.ISafeSearchAnnotation=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.ILocationInfo=} [properties] Properties to set */ - function SafeSearchAnnotation(properties) { + function LocationInfo(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -53213,437 +53189,193 @@ } /** - * SafeSearchAnnotation adult. - * @member {google.cloud.vision.v1p3beta1.Likelihood} adult - * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation - * @instance - */ - SafeSearchAnnotation.prototype.adult = 0; - - /** - * SafeSearchAnnotation spoof. - * @member {google.cloud.vision.v1p3beta1.Likelihood} spoof - * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation - * @instance - */ - SafeSearchAnnotation.prototype.spoof = 0; - - /** - * SafeSearchAnnotation medical. - * @member {google.cloud.vision.v1p3beta1.Likelihood} medical - * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation - * @instance - */ - SafeSearchAnnotation.prototype.medical = 0; - - /** - * SafeSearchAnnotation violence. - * @member {google.cloud.vision.v1p3beta1.Likelihood} violence - * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation - * @instance - */ - SafeSearchAnnotation.prototype.violence = 0; - - /** - * SafeSearchAnnotation racy. - * @member {google.cloud.vision.v1p3beta1.Likelihood} racy - * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation + * LocationInfo latLng. + * @member {google.type.ILatLng|null|undefined} latLng + * @memberof google.cloud.vision.v1p3beta1.LocationInfo * @instance */ - SafeSearchAnnotation.prototype.racy = 0; + LocationInfo.prototype.latLng = null; /** - * Creates a new SafeSearchAnnotation instance using the specified properties. + * Creates a new LocationInfo instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation + * @memberof google.cloud.vision.v1p3beta1.LocationInfo * @static - * @param {google.cloud.vision.v1p3beta1.ISafeSearchAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.SafeSearchAnnotation} SafeSearchAnnotation instance + * @param {google.cloud.vision.v1p3beta1.ILocationInfo=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.LocationInfo} LocationInfo instance */ - SafeSearchAnnotation.create = function create(properties) { - return new SafeSearchAnnotation(properties); + LocationInfo.create = function create(properties) { + return new LocationInfo(properties); }; /** - * Encodes the specified SafeSearchAnnotation message. Does not implicitly {@link google.cloud.vision.v1p3beta1.SafeSearchAnnotation.verify|verify} messages. + * Encodes the specified LocationInfo message. Does not implicitly {@link google.cloud.vision.v1p3beta1.LocationInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation + * @memberof google.cloud.vision.v1p3beta1.LocationInfo * @static - * @param {google.cloud.vision.v1p3beta1.ISafeSearchAnnotation} message SafeSearchAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.ILocationInfo} message LocationInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SafeSearchAnnotation.encode = function encode(message, writer) { + LocationInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.adult != null && message.hasOwnProperty("adult")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.adult); - if (message.spoof != null && message.hasOwnProperty("spoof")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.spoof); - if (message.medical != null && message.hasOwnProperty("medical")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.medical); - if (message.violence != null && message.hasOwnProperty("violence")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.violence); - if (message.racy != null && message.hasOwnProperty("racy")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.racy); + if (message.latLng != null && message.hasOwnProperty("latLng")) + $root.google.type.LatLng.encode(message.latLng, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified SafeSearchAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.SafeSearchAnnotation.verify|verify} messages. + * Encodes the specified LocationInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.LocationInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation + * @memberof google.cloud.vision.v1p3beta1.LocationInfo * @static - * @param {google.cloud.vision.v1p3beta1.ISafeSearchAnnotation} message SafeSearchAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.ILocationInfo} message LocationInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SafeSearchAnnotation.encodeDelimited = function encodeDelimited(message, writer) { + LocationInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SafeSearchAnnotation message from the specified reader or buffer. + * Decodes a LocationInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation + * @memberof google.cloud.vision.v1p3beta1.LocationInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.SafeSearchAnnotation} SafeSearchAnnotation + * @returns {google.cloud.vision.v1p3beta1.LocationInfo} LocationInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SafeSearchAnnotation.decode = function decode(reader, length) { + LocationInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.SafeSearchAnnotation(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.LocationInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.adult = reader.int32(); - break; - case 2: - message.spoof = reader.int32(); - break; - case 3: - message.medical = reader.int32(); - break; - case 4: - message.violence = reader.int32(); - break; - case 9: - message.racy = reader.int32(); + message.latLng = $root.google.type.LatLng.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); break; - } - } - return message; - }; - - /** - * Decodes a SafeSearchAnnotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.SafeSearchAnnotation} SafeSearchAnnotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SafeSearchAnnotation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SafeSearchAnnotation message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SafeSearchAnnotation.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.adult != null && message.hasOwnProperty("adult")) - switch (message.adult) { - default: - return "adult: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.spoof != null && message.hasOwnProperty("spoof")) - switch (message.spoof) { - default: - return "spoof: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.medical != null && message.hasOwnProperty("medical")) - switch (message.medical) { - default: - return "medical: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.violence != null && message.hasOwnProperty("violence")) - switch (message.violence) { - default: - return "violence: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.racy != null && message.hasOwnProperty("racy")) - switch (message.racy) { - default: - return "racy: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - return null; - }; - - /** - * Creates a SafeSearchAnnotation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.SafeSearchAnnotation} SafeSearchAnnotation - */ - SafeSearchAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.SafeSearchAnnotation) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.SafeSearchAnnotation(); - switch (object.adult) { - case "UNKNOWN": - case 0: - message.adult = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.adult = 1; - break; - case "UNLIKELY": - case 2: - message.adult = 2; - break; - case "POSSIBLE": - case 3: - message.adult = 3; - break; - case "LIKELY": - case 4: - message.adult = 4; - break; - case "VERY_LIKELY": - case 5: - message.adult = 5; - break; - } - switch (object.spoof) { - case "UNKNOWN": - case 0: - message.spoof = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.spoof = 1; - break; - case "UNLIKELY": - case 2: - message.spoof = 2; - break; - case "POSSIBLE": - case 3: - message.spoof = 3; - break; - case "LIKELY": - case 4: - message.spoof = 4; - break; - case "VERY_LIKELY": - case 5: - message.spoof = 5; - break; - } - switch (object.medical) { - case "UNKNOWN": - case 0: - message.medical = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.medical = 1; - break; - case "UNLIKELY": - case 2: - message.medical = 2; - break; - case "POSSIBLE": - case 3: - message.medical = 3; - break; - case "LIKELY": - case 4: - message.medical = 4; - break; - case "VERY_LIKELY": - case 5: - message.medical = 5; - break; - } - switch (object.violence) { - case "UNKNOWN": - case 0: - message.violence = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.violence = 1; - break; - case "UNLIKELY": - case 2: - message.violence = 2; - break; - case "POSSIBLE": - case 3: - message.violence = 3; - break; - case "LIKELY": - case 4: - message.violence = 4; - break; - case "VERY_LIKELY": - case 5: - message.violence = 5; - break; + } } - switch (object.racy) { - case "UNKNOWN": - case 0: - message.racy = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.racy = 1; - break; - case "UNLIKELY": - case 2: - message.racy = 2; - break; - case "POSSIBLE": - case 3: - message.racy = 3; - break; - case "LIKELY": - case 4: - message.racy = 4; - break; - case "VERY_LIKELY": - case 5: - message.racy = 5; - break; + return message; + }; + + /** + * Decodes a LocationInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.vision.v1p3beta1.LocationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.vision.v1p3beta1.LocationInfo} LocationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LocationInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LocationInfo message. + * @function verify + * @memberof google.cloud.vision.v1p3beta1.LocationInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LocationInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.latLng != null && message.hasOwnProperty("latLng")) { + var error = $root.google.type.LatLng.verify(message.latLng); + if (error) + return "latLng." + error; + } + return null; + }; + + /** + * Creates a LocationInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.vision.v1p3beta1.LocationInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.vision.v1p3beta1.LocationInfo} LocationInfo + */ + LocationInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.LocationInfo) + return object; + var message = new $root.google.cloud.vision.v1p3beta1.LocationInfo(); + if (object.latLng != null) { + if (typeof object.latLng !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.LocationInfo.latLng: object expected"); + message.latLng = $root.google.type.LatLng.fromObject(object.latLng); } return message; }; /** - * Creates a plain object from a SafeSearchAnnotation message. Also converts values to other types if specified. + * Creates a plain object from a LocationInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation + * @memberof google.cloud.vision.v1p3beta1.LocationInfo * @static - * @param {google.cloud.vision.v1p3beta1.SafeSearchAnnotation} message SafeSearchAnnotation + * @param {google.cloud.vision.v1p3beta1.LocationInfo} message LocationInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SafeSearchAnnotation.toObject = function toObject(message, options) { + LocationInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.adult = options.enums === String ? "UNKNOWN" : 0; - object.spoof = options.enums === String ? "UNKNOWN" : 0; - object.medical = options.enums === String ? "UNKNOWN" : 0; - object.violence = options.enums === String ? "UNKNOWN" : 0; - object.racy = options.enums === String ? "UNKNOWN" : 0; - } - if (message.adult != null && message.hasOwnProperty("adult")) - object.adult = options.enums === String ? $root.google.cloud.vision.v1p3beta1.Likelihood[message.adult] : message.adult; - if (message.spoof != null && message.hasOwnProperty("spoof")) - object.spoof = options.enums === String ? $root.google.cloud.vision.v1p3beta1.Likelihood[message.spoof] : message.spoof; - if (message.medical != null && message.hasOwnProperty("medical")) - object.medical = options.enums === String ? $root.google.cloud.vision.v1p3beta1.Likelihood[message.medical] : message.medical; - if (message.violence != null && message.hasOwnProperty("violence")) - object.violence = options.enums === String ? $root.google.cloud.vision.v1p3beta1.Likelihood[message.violence] : message.violence; - if (message.racy != null && message.hasOwnProperty("racy")) - object.racy = options.enums === String ? $root.google.cloud.vision.v1p3beta1.Likelihood[message.racy] : message.racy; + if (options.defaults) + object.latLng = null; + if (message.latLng != null && message.hasOwnProperty("latLng")) + object.latLng = $root.google.type.LatLng.toObject(message.latLng, options); return object; }; /** - * Converts this SafeSearchAnnotation to JSON. + * Converts this LocationInfo to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation + * @memberof google.cloud.vision.v1p3beta1.LocationInfo * @instance * @returns {Object.} JSON object */ - SafeSearchAnnotation.prototype.toJSON = function toJSON() { + LocationInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return SafeSearchAnnotation; + return LocationInfo; })(); - v1p3beta1.LatLongRect = (function() { + v1p3beta1.Property = (function() { /** - * Properties of a LatLongRect. + * Properties of a Property. * @memberof google.cloud.vision.v1p3beta1 - * @interface ILatLongRect - * @property {google.type.ILatLng|null} [minLatLng] LatLongRect minLatLng - * @property {google.type.ILatLng|null} [maxLatLng] LatLongRect maxLatLng + * @interface IProperty + * @property {string|null} [name] Property name + * @property {string|null} [value] Property value + * @property {number|Long|null} [uint64Value] Property uint64Value */ /** - * Constructs a new LatLongRect. + * Constructs a new Property. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a LatLongRect. - * @implements ILatLongRect + * @classdesc Represents a Property. + * @implements IProperty * @constructor - * @param {google.cloud.vision.v1p3beta1.ILatLongRect=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.IProperty=} [properties] Properties to set */ - function LatLongRect(properties) { + function Property(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -53651,88 +53383,101 @@ } /** - * LatLongRect minLatLng. - * @member {google.type.ILatLng|null|undefined} minLatLng - * @memberof google.cloud.vision.v1p3beta1.LatLongRect + * Property name. + * @member {string} name + * @memberof google.cloud.vision.v1p3beta1.Property * @instance */ - LatLongRect.prototype.minLatLng = null; + Property.prototype.name = ""; /** - * LatLongRect maxLatLng. - * @member {google.type.ILatLng|null|undefined} maxLatLng - * @memberof google.cloud.vision.v1p3beta1.LatLongRect + * Property value. + * @member {string} value + * @memberof google.cloud.vision.v1p3beta1.Property * @instance */ - LatLongRect.prototype.maxLatLng = null; + Property.prototype.value = ""; /** - * Creates a new LatLongRect instance using the specified properties. + * Property uint64Value. + * @member {number|Long} uint64Value + * @memberof google.cloud.vision.v1p3beta1.Property + * @instance + */ + Property.prototype.uint64Value = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Creates a new Property instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.LatLongRect + * @memberof google.cloud.vision.v1p3beta1.Property * @static - * @param {google.cloud.vision.v1p3beta1.ILatLongRect=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.LatLongRect} LatLongRect instance + * @param {google.cloud.vision.v1p3beta1.IProperty=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.Property} Property instance */ - LatLongRect.create = function create(properties) { - return new LatLongRect(properties); + Property.create = function create(properties) { + return new Property(properties); }; /** - * Encodes the specified LatLongRect message. Does not implicitly {@link google.cloud.vision.v1p3beta1.LatLongRect.verify|verify} messages. + * Encodes the specified Property message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Property.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.LatLongRect + * @memberof google.cloud.vision.v1p3beta1.Property * @static - * @param {google.cloud.vision.v1p3beta1.ILatLongRect} message LatLongRect message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IProperty} message Property message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - LatLongRect.encode = function encode(message, writer) { + Property.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.minLatLng != null && message.hasOwnProperty("minLatLng")) - $root.google.type.LatLng.encode(message.minLatLng, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.maxLatLng != null && message.hasOwnProperty("maxLatLng")) - $root.google.type.LatLng.encode(message.maxLatLng, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.value != null && message.hasOwnProperty("value")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); + if (message.uint64Value != null && message.hasOwnProperty("uint64Value")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.uint64Value); return writer; }; /** - * Encodes the specified LatLongRect message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.LatLongRect.verify|verify} messages. + * Encodes the specified Property message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.Property.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.LatLongRect + * @memberof google.cloud.vision.v1p3beta1.Property * @static - * @param {google.cloud.vision.v1p3beta1.ILatLongRect} message LatLongRect message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IProperty} message Property message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - LatLongRect.encodeDelimited = function encodeDelimited(message, writer) { + Property.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a LatLongRect message from the specified reader or buffer. + * Decodes a Property message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.LatLongRect + * @memberof google.cloud.vision.v1p3beta1.Property * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.LatLongRect} LatLongRect + * @returns {google.cloud.vision.v1p3beta1.Property} Property * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - LatLongRect.decode = function decode(reader, length) { + Property.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.LatLongRect(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.Property(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.minLatLng = $root.google.type.LatLng.decode(reader, reader.uint32()); + message.name = reader.string(); break; case 2: - message.maxLatLng = $root.google.type.LatLng.decode(reader, reader.uint32()); + message.value = reader.string(); + break; + case 3: + message.uint64Value = reader.uint64(); break; default: reader.skipType(tag & 7); @@ -53743,128 +53488,148 @@ }; /** - * Decodes a LatLongRect message from the specified reader or buffer, length delimited. + * Decodes a Property message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.LatLongRect + * @memberof google.cloud.vision.v1p3beta1.Property * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.LatLongRect} LatLongRect + * @returns {google.cloud.vision.v1p3beta1.Property} Property * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - LatLongRect.decodeDelimited = function decodeDelimited(reader) { + Property.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a LatLongRect message. + * Verifies a Property message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.LatLongRect + * @memberof google.cloud.vision.v1p3beta1.Property * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - LatLongRect.verify = function verify(message) { + Property.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.minLatLng != null && message.hasOwnProperty("minLatLng")) { - var error = $root.google.type.LatLng.verify(message.minLatLng); - if (error) - return "minLatLng." + error; - } - if (message.maxLatLng != null && message.hasOwnProperty("maxLatLng")) { - var error = $root.google.type.LatLng.verify(message.maxLatLng); - if (error) - return "maxLatLng." + error; - } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + if (message.uint64Value != null && message.hasOwnProperty("uint64Value")) + if (!$util.isInteger(message.uint64Value) && !(message.uint64Value && $util.isInteger(message.uint64Value.low) && $util.isInteger(message.uint64Value.high))) + return "uint64Value: integer|Long expected"; return null; }; /** - * Creates a LatLongRect message from a plain object. Also converts values to their respective internal types. + * Creates a Property message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.LatLongRect + * @memberof google.cloud.vision.v1p3beta1.Property * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.LatLongRect} LatLongRect + * @returns {google.cloud.vision.v1p3beta1.Property} Property */ - LatLongRect.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.LatLongRect) + Property.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.Property) return object; - var message = new $root.google.cloud.vision.v1p3beta1.LatLongRect(); - if (object.minLatLng != null) { - if (typeof object.minLatLng !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.LatLongRect.minLatLng: object expected"); - message.minLatLng = $root.google.type.LatLng.fromObject(object.minLatLng); - } - if (object.maxLatLng != null) { - if (typeof object.maxLatLng !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.LatLongRect.maxLatLng: object expected"); - message.maxLatLng = $root.google.type.LatLng.fromObject(object.maxLatLng); - } + var message = new $root.google.cloud.vision.v1p3beta1.Property(); + if (object.name != null) + message.name = String(object.name); + if (object.value != null) + message.value = String(object.value); + if (object.uint64Value != null) + if ($util.Long) + (message.uint64Value = $util.Long.fromValue(object.uint64Value)).unsigned = true; + else if (typeof object.uint64Value === "string") + message.uint64Value = parseInt(object.uint64Value, 10); + else if (typeof object.uint64Value === "number") + message.uint64Value = object.uint64Value; + else if (typeof object.uint64Value === "object") + message.uint64Value = new $util.LongBits(object.uint64Value.low >>> 0, object.uint64Value.high >>> 0).toNumber(true); return message; }; /** - * Creates a plain object from a LatLongRect message. Also converts values to other types if specified. + * Creates a plain object from a Property message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.LatLongRect + * @memberof google.cloud.vision.v1p3beta1.Property * @static - * @param {google.cloud.vision.v1p3beta1.LatLongRect} message LatLongRect + * @param {google.cloud.vision.v1p3beta1.Property} message Property * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - LatLongRect.toObject = function toObject(message, options) { + Property.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.minLatLng = null; - object.maxLatLng = null; + object.name = ""; + object.value = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.uint64Value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.uint64Value = options.longs === String ? "0" : 0; } - if (message.minLatLng != null && message.hasOwnProperty("minLatLng")) - object.minLatLng = $root.google.type.LatLng.toObject(message.minLatLng, options); - if (message.maxLatLng != null && message.hasOwnProperty("maxLatLng")) - object.maxLatLng = $root.google.type.LatLng.toObject(message.maxLatLng, options); + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.uint64Value != null && message.hasOwnProperty("uint64Value")) + if (typeof message.uint64Value === "number") + object.uint64Value = options.longs === String ? String(message.uint64Value) : message.uint64Value; + else + object.uint64Value = options.longs === String ? $util.Long.prototype.toString.call(message.uint64Value) : options.longs === Number ? new $util.LongBits(message.uint64Value.low >>> 0, message.uint64Value.high >>> 0).toNumber(true) : message.uint64Value; return object; }; /** - * Converts this LatLongRect to JSON. + * Converts this Property to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.LatLongRect + * @memberof google.cloud.vision.v1p3beta1.Property * @instance * @returns {Object.} JSON object */ - LatLongRect.prototype.toJSON = function toJSON() { + Property.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return LatLongRect; + return Property; })(); - v1p3beta1.ColorInfo = (function() { + v1p3beta1.EntityAnnotation = (function() { /** - * Properties of a ColorInfo. + * Properties of an EntityAnnotation. * @memberof google.cloud.vision.v1p3beta1 - * @interface IColorInfo - * @property {google.type.IColor|null} [color] ColorInfo color - * @property {number|null} [score] ColorInfo score - * @property {number|null} [pixelFraction] ColorInfo pixelFraction + * @interface IEntityAnnotation + * @property {string|null} [mid] EntityAnnotation mid + * @property {string|null} [locale] EntityAnnotation locale + * @property {string|null} [description] EntityAnnotation description + * @property {number|null} [score] EntityAnnotation score + * @property {number|null} [confidence] EntityAnnotation confidence + * @property {number|null} [topicality] EntityAnnotation topicality + * @property {google.cloud.vision.v1p3beta1.IBoundingPoly|null} [boundingPoly] EntityAnnotation boundingPoly + * @property {Array.|null} [locations] EntityAnnotation locations + * @property {Array.|null} [properties] EntityAnnotation properties */ /** - * Constructs a new ColorInfo. + * Constructs a new EntityAnnotation. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a ColorInfo. - * @implements IColorInfo + * @classdesc Represents an EntityAnnotation. + * @implements IEntityAnnotation * @constructor - * @param {google.cloud.vision.v1p3beta1.IColorInfo=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.IEntityAnnotation=} [properties] Properties to set */ - function ColorInfo(properties) { + function EntityAnnotation(properties) { + this.locations = []; + this.properties = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -53872,101 +53637,185 @@ } /** - * ColorInfo color. - * @member {google.type.IColor|null|undefined} color - * @memberof google.cloud.vision.v1p3beta1.ColorInfo + * EntityAnnotation mid. + * @member {string} mid + * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation * @instance */ - ColorInfo.prototype.color = null; + EntityAnnotation.prototype.mid = ""; /** - * ColorInfo score. + * EntityAnnotation locale. + * @member {string} locale + * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.locale = ""; + + /** + * EntityAnnotation description. + * @member {string} description + * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.description = ""; + + /** + * EntityAnnotation score. * @member {number} score - * @memberof google.cloud.vision.v1p3beta1.ColorInfo + * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation * @instance */ - ColorInfo.prototype.score = 0; + EntityAnnotation.prototype.score = 0; /** - * ColorInfo pixelFraction. - * @member {number} pixelFraction - * @memberof google.cloud.vision.v1p3beta1.ColorInfo + * EntityAnnotation confidence. + * @member {number} confidence + * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation * @instance */ - ColorInfo.prototype.pixelFraction = 0; + EntityAnnotation.prototype.confidence = 0; /** - * Creates a new ColorInfo instance using the specified properties. + * EntityAnnotation topicality. + * @member {number} topicality + * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.topicality = 0; + + /** + * EntityAnnotation boundingPoly. + * @member {google.cloud.vision.v1p3beta1.IBoundingPoly|null|undefined} boundingPoly + * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.boundingPoly = null; + + /** + * EntityAnnotation locations. + * @member {Array.} locations + * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.locations = $util.emptyArray; + + /** + * EntityAnnotation properties. + * @member {Array.} properties + * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.properties = $util.emptyArray; + + /** + * Creates a new EntityAnnotation instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.ColorInfo + * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation * @static - * @param {google.cloud.vision.v1p3beta1.IColorInfo=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.ColorInfo} ColorInfo instance + * @param {google.cloud.vision.v1p3beta1.IEntityAnnotation=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.EntityAnnotation} EntityAnnotation instance */ - ColorInfo.create = function create(properties) { - return new ColorInfo(properties); + EntityAnnotation.create = function create(properties) { + return new EntityAnnotation(properties); }; /** - * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ColorInfo.verify|verify} messages. + * Encodes the specified EntityAnnotation message. Does not implicitly {@link google.cloud.vision.v1p3beta1.EntityAnnotation.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.ColorInfo + * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation * @static - * @param {google.cloud.vision.v1p3beta1.IColorInfo} message ColorInfo message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IEntityAnnotation} message EntityAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ColorInfo.encode = function encode(message, writer) { + EntityAnnotation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.color != null && message.hasOwnProperty("color")) - $root.google.type.Color.encode(message.color, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.mid != null && message.hasOwnProperty("mid")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.mid); + if (message.locale != null && message.hasOwnProperty("locale")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.locale); + if (message.description != null && message.hasOwnProperty("description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); if (message.score != null && message.hasOwnProperty("score")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); - if (message.pixelFraction != null && message.hasOwnProperty("pixelFraction")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.pixelFraction); + writer.uint32(/* id 4, wireType 5 =*/37).float(message.score); + if (message.confidence != null && message.hasOwnProperty("confidence")) + writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); + if (message.topicality != null && message.hasOwnProperty("topicality")) + writer.uint32(/* id 6, wireType 5 =*/53).float(message.topicality); + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + $root.google.cloud.vision.v1p3beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.locations != null && message.locations.length) + for (var i = 0; i < message.locations.length; ++i) + $root.google.cloud.vision.v1p3beta1.LocationInfo.encode(message.locations[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.properties != null && message.properties.length) + for (var i = 0; i < message.properties.length; ++i) + $root.google.cloud.vision.v1p3beta1.Property.encode(message.properties[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); return writer; }; /** - * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ColorInfo.verify|verify} messages. + * Encodes the specified EntityAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.EntityAnnotation.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ColorInfo + * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation * @static - * @param {google.cloud.vision.v1p3beta1.IColorInfo} message ColorInfo message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IEntityAnnotation} message EntityAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ColorInfo.encodeDelimited = function encodeDelimited(message, writer) { + EntityAnnotation.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ColorInfo message from the specified reader or buffer. + * Decodes an EntityAnnotation message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.ColorInfo + * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.ColorInfo} ColorInfo + * @returns {google.cloud.vision.v1p3beta1.EntityAnnotation} EntityAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ColorInfo.decode = function decode(reader, length) { + EntityAnnotation.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.vision.v1p3beta1.ColorInfo(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.EntityAnnotation(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.color = $root.google.type.Color.decode(reader, reader.uint32()); + message.mid = reader.string(); break; case 2: - message.score = reader.float(); + message.locale = reader.string(); break; case 3: - message.pixelFraction = reader.float(); + message.description = reader.string(); + break; + case 4: + message.score = reader.float(); + break; + case 5: + message.confidence = reader.float(); + break; + case 6: + message.topicality = reader.float(); + break; + case 7: + message.boundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.decode(reader, reader.uint32()); + break; + case 8: + if (!(message.locations && message.locations.length)) + message.locations = []; + message.locations.push($root.google.cloud.vision.v1p3beta1.LocationInfo.decode(reader, reader.uint32())); + break; + case 9: + if (!(message.properties && message.properties.length)) + message.properties = []; + message.properties.push($root.google.cloud.vision.v1p3beta1.Property.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -53977,130 +53826,217 @@ }; /** - * Decodes a ColorInfo message from the specified reader or buffer, length delimited. + * Decodes an EntityAnnotation message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ColorInfo + * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.ColorInfo} ColorInfo + * @returns {google.cloud.vision.v1p3beta1.EntityAnnotation} EntityAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ColorInfo.decodeDelimited = function decodeDelimited(reader) { + EntityAnnotation.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ColorInfo message. + * Verifies an EntityAnnotation message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.ColorInfo + * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ColorInfo.verify = function verify(message) { + EntityAnnotation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.color != null && message.hasOwnProperty("color")) { - var error = $root.google.type.Color.verify(message.color); - if (error) - return "color." + error; - } + if (message.mid != null && message.hasOwnProperty("mid")) + if (!$util.isString(message.mid)) + return "mid: string expected"; + if (message.locale != null && message.hasOwnProperty("locale")) + if (!$util.isString(message.locale)) + return "locale: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; if (message.score != null && message.hasOwnProperty("score")) if (typeof message.score !== "number") return "score: number expected"; - if (message.pixelFraction != null && message.hasOwnProperty("pixelFraction")) - if (typeof message.pixelFraction !== "number") - return "pixelFraction: number expected"; + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + if (message.topicality != null && message.hasOwnProperty("topicality")) + if (typeof message.topicality !== "number") + return "topicality: number expected"; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { + var error = $root.google.cloud.vision.v1p3beta1.BoundingPoly.verify(message.boundingPoly); + if (error) + return "boundingPoly." + error; + } + if (message.locations != null && message.hasOwnProperty("locations")) { + if (!Array.isArray(message.locations)) + return "locations: array expected"; + for (var i = 0; i < message.locations.length; ++i) { + var error = $root.google.cloud.vision.v1p3beta1.LocationInfo.verify(message.locations[i]); + if (error) + return "locations." + error; + } + } + if (message.properties != null && message.hasOwnProperty("properties")) { + if (!Array.isArray(message.properties)) + return "properties: array expected"; + for (var i = 0; i < message.properties.length; ++i) { + var error = $root.google.cloud.vision.v1p3beta1.Property.verify(message.properties[i]); + if (error) + return "properties." + error; + } + } return null; }; /** - * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. + * Creates an EntityAnnotation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.ColorInfo + * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.ColorInfo} ColorInfo + * @returns {google.cloud.vision.v1p3beta1.EntityAnnotation} EntityAnnotation */ - ColorInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.ColorInfo) + EntityAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.EntityAnnotation) return object; - var message = new $root.google.cloud.vision.v1p3beta1.ColorInfo(); - if (object.color != null) { - if (typeof object.color !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.ColorInfo.color: object expected"); - message.color = $root.google.type.Color.fromObject(object.color); - } + var message = new $root.google.cloud.vision.v1p3beta1.EntityAnnotation(); + if (object.mid != null) + message.mid = String(object.mid); + if (object.locale != null) + message.locale = String(object.locale); + if (object.description != null) + message.description = String(object.description); if (object.score != null) message.score = Number(object.score); - if (object.pixelFraction != null) - message.pixelFraction = Number(object.pixelFraction); + if (object.confidence != null) + message.confidence = Number(object.confidence); + if (object.topicality != null) + message.topicality = Number(object.topicality); + if (object.boundingPoly != null) { + if (typeof object.boundingPoly !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.EntityAnnotation.boundingPoly: object expected"); + message.boundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.fromObject(object.boundingPoly); + } + if (object.locations) { + if (!Array.isArray(object.locations)) + throw TypeError(".google.cloud.vision.v1p3beta1.EntityAnnotation.locations: array expected"); + message.locations = []; + for (var i = 0; i < object.locations.length; ++i) { + if (typeof object.locations[i] !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.EntityAnnotation.locations: object expected"); + message.locations[i] = $root.google.cloud.vision.v1p3beta1.LocationInfo.fromObject(object.locations[i]); + } + } + if (object.properties) { + if (!Array.isArray(object.properties)) + throw TypeError(".google.cloud.vision.v1p3beta1.EntityAnnotation.properties: array expected"); + message.properties = []; + for (var i = 0; i < object.properties.length; ++i) { + if (typeof object.properties[i] !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.EntityAnnotation.properties: object expected"); + message.properties[i] = $root.google.cloud.vision.v1p3beta1.Property.fromObject(object.properties[i]); + } + } return message; }; /** - * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. + * Creates a plain object from an EntityAnnotation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.ColorInfo + * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation * @static - * @param {google.cloud.vision.v1p3beta1.ColorInfo} message ColorInfo + * @param {google.cloud.vision.v1p3beta1.EntityAnnotation} message EntityAnnotation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ColorInfo.toObject = function toObject(message, options) { + EntityAnnotation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) { + object.locations = []; + object.properties = []; + } if (options.defaults) { - object.color = null; + object.mid = ""; + object.locale = ""; + object.description = ""; object.score = 0; - object.pixelFraction = 0; + object.confidence = 0; + object.topicality = 0; + object.boundingPoly = null; } - if (message.color != null && message.hasOwnProperty("color")) - object.color = $root.google.type.Color.toObject(message.color, options); + if (message.mid != null && message.hasOwnProperty("mid")) + object.mid = message.mid; + if (message.locale != null && message.hasOwnProperty("locale")) + object.locale = message.locale; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; if (message.score != null && message.hasOwnProperty("score")) object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - if (message.pixelFraction != null && message.hasOwnProperty("pixelFraction")) - object.pixelFraction = options.json && !isFinite(message.pixelFraction) ? String(message.pixelFraction) : message.pixelFraction; + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + if (message.topicality != null && message.hasOwnProperty("topicality")) + object.topicality = options.json && !isFinite(message.topicality) ? String(message.topicality) : message.topicality; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + object.boundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.toObject(message.boundingPoly, options); + if (message.locations && message.locations.length) { + object.locations = []; + for (var j = 0; j < message.locations.length; ++j) + object.locations[j] = $root.google.cloud.vision.v1p3beta1.LocationInfo.toObject(message.locations[j], options); + } + if (message.properties && message.properties.length) { + object.properties = []; + for (var j = 0; j < message.properties.length; ++j) + object.properties[j] = $root.google.cloud.vision.v1p3beta1.Property.toObject(message.properties[j], options); + } return object; }; /** - * Converts this ColorInfo to JSON. + * Converts this EntityAnnotation to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.ColorInfo + * @memberof google.cloud.vision.v1p3beta1.EntityAnnotation * @instance * @returns {Object.} JSON object */ - ColorInfo.prototype.toJSON = function toJSON() { + EntityAnnotation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ColorInfo; + return EntityAnnotation; })(); - v1p3beta1.DominantColorsAnnotation = (function() { + v1p3beta1.LocalizedObjectAnnotation = (function() { /** - * Properties of a DominantColorsAnnotation. + * Properties of a LocalizedObjectAnnotation. * @memberof google.cloud.vision.v1p3beta1 - * @interface IDominantColorsAnnotation - * @property {Array.|null} [colors] DominantColorsAnnotation colors + * @interface ILocalizedObjectAnnotation + * @property {string|null} [mid] LocalizedObjectAnnotation mid + * @property {string|null} [languageCode] LocalizedObjectAnnotation languageCode + * @property {string|null} [name] LocalizedObjectAnnotation name + * @property {number|null} [score] LocalizedObjectAnnotation score + * @property {google.cloud.vision.v1p3beta1.IBoundingPoly|null} [boundingPoly] LocalizedObjectAnnotation boundingPoly */ /** - * Constructs a new DominantColorsAnnotation. + * Constructs a new LocalizedObjectAnnotation. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a DominantColorsAnnotation. - * @implements IDominantColorsAnnotation + * @classdesc Represents a LocalizedObjectAnnotation. + * @implements ILocalizedObjectAnnotation * @constructor - * @param {google.cloud.vision.v1p3beta1.IDominantColorsAnnotation=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.ILocalizedObjectAnnotation=} [properties] Properties to set */ - function DominantColorsAnnotation(properties) { - this.colors = []; + function LocalizedObjectAnnotation(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -54108,78 +54044,127 @@ } /** - * DominantColorsAnnotation colors. - * @member {Array.} colors - * @memberof google.cloud.vision.v1p3beta1.DominantColorsAnnotation + * LocalizedObjectAnnotation mid. + * @member {string} mid + * @memberof google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation * @instance */ - DominantColorsAnnotation.prototype.colors = $util.emptyArray; + LocalizedObjectAnnotation.prototype.mid = ""; /** - * Creates a new DominantColorsAnnotation instance using the specified properties. + * LocalizedObjectAnnotation languageCode. + * @member {string} languageCode + * @memberof google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation + * @instance + */ + LocalizedObjectAnnotation.prototype.languageCode = ""; + + /** + * LocalizedObjectAnnotation name. + * @member {string} name + * @memberof google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation + * @instance + */ + LocalizedObjectAnnotation.prototype.name = ""; + + /** + * LocalizedObjectAnnotation score. + * @member {number} score + * @memberof google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation + * @instance + */ + LocalizedObjectAnnotation.prototype.score = 0; + + /** + * LocalizedObjectAnnotation boundingPoly. + * @member {google.cloud.vision.v1p3beta1.IBoundingPoly|null|undefined} boundingPoly + * @memberof google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation + * @instance + */ + LocalizedObjectAnnotation.prototype.boundingPoly = null; + + /** + * Creates a new LocalizedObjectAnnotation instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation * @static - * @param {google.cloud.vision.v1p3beta1.IDominantColorsAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.DominantColorsAnnotation} DominantColorsAnnotation instance + * @param {google.cloud.vision.v1p3beta1.ILocalizedObjectAnnotation=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation} LocalizedObjectAnnotation instance */ - DominantColorsAnnotation.create = function create(properties) { - return new DominantColorsAnnotation(properties); + LocalizedObjectAnnotation.create = function create(properties) { + return new LocalizedObjectAnnotation(properties); }; /** - * Encodes the specified DominantColorsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p3beta1.DominantColorsAnnotation.verify|verify} messages. + * Encodes the specified LocalizedObjectAnnotation message. Does not implicitly {@link google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation * @static - * @param {google.cloud.vision.v1p3beta1.IDominantColorsAnnotation} message DominantColorsAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.ILocalizedObjectAnnotation} message LocalizedObjectAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DominantColorsAnnotation.encode = function encode(message, writer) { + LocalizedObjectAnnotation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.colors != null && message.colors.length) - for (var i = 0; i < message.colors.length; ++i) - $root.google.cloud.vision.v1p3beta1.ColorInfo.encode(message.colors[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.mid != null && message.hasOwnProperty("mid")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.mid); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); + if (message.score != null && message.hasOwnProperty("score")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.score); + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + $root.google.cloud.vision.v1p3beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; /** - * Encodes the specified DominantColorsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.DominantColorsAnnotation.verify|verify} messages. + * Encodes the specified LocalizedObjectAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation * @static - * @param {google.cloud.vision.v1p3beta1.IDominantColorsAnnotation} message DominantColorsAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.ILocalizedObjectAnnotation} message LocalizedObjectAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DominantColorsAnnotation.encodeDelimited = function encodeDelimited(message, writer) { + LocalizedObjectAnnotation.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a DominantColorsAnnotation message from the specified reader or buffer. + * Decodes a LocalizedObjectAnnotation message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.DominantColorsAnnotation} DominantColorsAnnotation + * @returns {google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation} LocalizedObjectAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DominantColorsAnnotation.decode = function decode(reader, length) { + LocalizedObjectAnnotation.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.vision.v1p3beta1.DominantColorsAnnotation(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.colors && message.colors.length)) - message.colors = []; - message.colors.push($root.google.cloud.vision.v1p3beta1.ColorInfo.decode(reader, reader.uint32())); + message.mid = reader.string(); + break; + case 2: + message.languageCode = reader.string(); + break; + case 3: + message.name = reader.string(); + break; + case 4: + message.score = reader.float(); + break; + case 5: + message.boundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -54190,124 +54175,149 @@ }; /** - * Decodes a DominantColorsAnnotation message from the specified reader or buffer, length delimited. + * Decodes a LocalizedObjectAnnotation message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.DominantColorsAnnotation} DominantColorsAnnotation + * @returns {google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation} LocalizedObjectAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DominantColorsAnnotation.decodeDelimited = function decodeDelimited(reader) { + LocalizedObjectAnnotation.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a DominantColorsAnnotation message. + * Verifies a LocalizedObjectAnnotation message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DominantColorsAnnotation.verify = function verify(message) { + LocalizedObjectAnnotation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.colors != null && message.hasOwnProperty("colors")) { - if (!Array.isArray(message.colors)) - return "colors: array expected"; - for (var i = 0; i < message.colors.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.ColorInfo.verify(message.colors[i]); - if (error) - return "colors." + error; - } + if (message.mid != null && message.hasOwnProperty("mid")) + if (!$util.isString(message.mid)) + return "mid: string expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.score != null && message.hasOwnProperty("score")) + if (typeof message.score !== "number") + return "score: number expected"; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { + var error = $root.google.cloud.vision.v1p3beta1.BoundingPoly.verify(message.boundingPoly); + if (error) + return "boundingPoly." + error; } return null; }; /** - * Creates a DominantColorsAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates a LocalizedObjectAnnotation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.DominantColorsAnnotation} DominantColorsAnnotation + * @returns {google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation} LocalizedObjectAnnotation */ - DominantColorsAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.DominantColorsAnnotation) + LocalizedObjectAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation) return object; - var message = new $root.google.cloud.vision.v1p3beta1.DominantColorsAnnotation(); - if (object.colors) { - if (!Array.isArray(object.colors)) - throw TypeError(".google.cloud.vision.v1p3beta1.DominantColorsAnnotation.colors: array expected"); - message.colors = []; - for (var i = 0; i < object.colors.length; ++i) { - if (typeof object.colors[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.DominantColorsAnnotation.colors: object expected"); - message.colors[i] = $root.google.cloud.vision.v1p3beta1.ColorInfo.fromObject(object.colors[i]); - } + var message = new $root.google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation(); + if (object.mid != null) + message.mid = String(object.mid); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.name != null) + message.name = String(object.name); + if (object.score != null) + message.score = Number(object.score); + if (object.boundingPoly != null) { + if (typeof object.boundingPoly !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation.boundingPoly: object expected"); + message.boundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.fromObject(object.boundingPoly); } return message; }; /** - * Creates a plain object from a DominantColorsAnnotation message. Also converts values to other types if specified. + * Creates a plain object from a LocalizedObjectAnnotation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation * @static - * @param {google.cloud.vision.v1p3beta1.DominantColorsAnnotation} message DominantColorsAnnotation + * @param {google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation} message LocalizedObjectAnnotation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DominantColorsAnnotation.toObject = function toObject(message, options) { + LocalizedObjectAnnotation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.colors = []; - if (message.colors && message.colors.length) { - object.colors = []; - for (var j = 0; j < message.colors.length; ++j) - object.colors[j] = $root.google.cloud.vision.v1p3beta1.ColorInfo.toObject(message.colors[j], options); + if (options.defaults) { + object.mid = ""; + object.languageCode = ""; + object.name = ""; + object.score = 0; + object.boundingPoly = null; } + if (message.mid != null && message.hasOwnProperty("mid")) + object.mid = message.mid; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.score != null && message.hasOwnProperty("score")) + object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + object.boundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.toObject(message.boundingPoly, options); return object; }; /** - * Converts this DominantColorsAnnotation to JSON. + * Converts this LocalizedObjectAnnotation to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation * @instance * @returns {Object.} JSON object */ - DominantColorsAnnotation.prototype.toJSON = function toJSON() { + LocalizedObjectAnnotation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return DominantColorsAnnotation; + return LocalizedObjectAnnotation; })(); - v1p3beta1.ImageProperties = (function() { + v1p3beta1.SafeSearchAnnotation = (function() { /** - * Properties of an ImageProperties. + * Properties of a SafeSearchAnnotation. * @memberof google.cloud.vision.v1p3beta1 - * @interface IImageProperties - * @property {google.cloud.vision.v1p3beta1.IDominantColorsAnnotation|null} [dominantColors] ImageProperties dominantColors + * @interface ISafeSearchAnnotation + * @property {google.cloud.vision.v1p3beta1.Likelihood|null} [adult] SafeSearchAnnotation adult + * @property {google.cloud.vision.v1p3beta1.Likelihood|null} [spoof] SafeSearchAnnotation spoof + * @property {google.cloud.vision.v1p3beta1.Likelihood|null} [medical] SafeSearchAnnotation medical + * @property {google.cloud.vision.v1p3beta1.Likelihood|null} [violence] SafeSearchAnnotation violence + * @property {google.cloud.vision.v1p3beta1.Likelihood|null} [racy] SafeSearchAnnotation racy */ /** - * Constructs a new ImageProperties. + * Constructs a new SafeSearchAnnotation. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an ImageProperties. - * @implements IImageProperties + * @classdesc Represents a SafeSearchAnnotation. + * @implements ISafeSearchAnnotation * @constructor - * @param {google.cloud.vision.v1p3beta1.IImageProperties=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.ISafeSearchAnnotation=} [properties] Properties to set */ - function ImageProperties(properties) { + function SafeSearchAnnotation(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -54315,75 +54325,127 @@ } /** - * ImageProperties dominantColors. - * @member {google.cloud.vision.v1p3beta1.IDominantColorsAnnotation|null|undefined} dominantColors - * @memberof google.cloud.vision.v1p3beta1.ImageProperties + * SafeSearchAnnotation adult. + * @member {google.cloud.vision.v1p3beta1.Likelihood} adult + * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation * @instance */ - ImageProperties.prototype.dominantColors = null; + SafeSearchAnnotation.prototype.adult = 0; /** - * Creates a new ImageProperties instance using the specified properties. + * SafeSearchAnnotation spoof. + * @member {google.cloud.vision.v1p3beta1.Likelihood} spoof + * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation + * @instance + */ + SafeSearchAnnotation.prototype.spoof = 0; + + /** + * SafeSearchAnnotation medical. + * @member {google.cloud.vision.v1p3beta1.Likelihood} medical + * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation + * @instance + */ + SafeSearchAnnotation.prototype.medical = 0; + + /** + * SafeSearchAnnotation violence. + * @member {google.cloud.vision.v1p3beta1.Likelihood} violence + * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation + * @instance + */ + SafeSearchAnnotation.prototype.violence = 0; + + /** + * SafeSearchAnnotation racy. + * @member {google.cloud.vision.v1p3beta1.Likelihood} racy + * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation + * @instance + */ + SafeSearchAnnotation.prototype.racy = 0; + + /** + * Creates a new SafeSearchAnnotation instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.ImageProperties + * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation * @static - * @param {google.cloud.vision.v1p3beta1.IImageProperties=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.ImageProperties} ImageProperties instance + * @param {google.cloud.vision.v1p3beta1.ISafeSearchAnnotation=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.SafeSearchAnnotation} SafeSearchAnnotation instance */ - ImageProperties.create = function create(properties) { - return new ImageProperties(properties); + SafeSearchAnnotation.create = function create(properties) { + return new SafeSearchAnnotation(properties); }; /** - * Encodes the specified ImageProperties message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImageProperties.verify|verify} messages. + * Encodes the specified SafeSearchAnnotation message. Does not implicitly {@link google.cloud.vision.v1p3beta1.SafeSearchAnnotation.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.ImageProperties + * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation * @static - * @param {google.cloud.vision.v1p3beta1.IImageProperties} message ImageProperties message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.ISafeSearchAnnotation} message SafeSearchAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageProperties.encode = function encode(message, writer) { + SafeSearchAnnotation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.dominantColors != null && message.hasOwnProperty("dominantColors")) - $root.google.cloud.vision.v1p3beta1.DominantColorsAnnotation.encode(message.dominantColors, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.adult != null && message.hasOwnProperty("adult")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.adult); + if (message.spoof != null && message.hasOwnProperty("spoof")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.spoof); + if (message.medical != null && message.hasOwnProperty("medical")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.medical); + if (message.violence != null && message.hasOwnProperty("violence")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.violence); + if (message.racy != null && message.hasOwnProperty("racy")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.racy); return writer; }; /** - * Encodes the specified ImageProperties message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImageProperties.verify|verify} messages. + * Encodes the specified SafeSearchAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.SafeSearchAnnotation.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ImageProperties + * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation * @static - * @param {google.cloud.vision.v1p3beta1.IImageProperties} message ImageProperties message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.ISafeSearchAnnotation} message SafeSearchAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageProperties.encodeDelimited = function encodeDelimited(message, writer) { + SafeSearchAnnotation.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImageProperties message from the specified reader or buffer. + * Decodes a SafeSearchAnnotation message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.ImageProperties + * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.ImageProperties} ImageProperties + * @returns {google.cloud.vision.v1p3beta1.SafeSearchAnnotation} SafeSearchAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageProperties.decode = function decode(reader, length) { + SafeSearchAnnotation.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.vision.v1p3beta1.ImageProperties(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.SafeSearchAnnotation(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.dominantColors = $root.google.cloud.vision.v1p3beta1.DominantColorsAnnotation.decode(reader, reader.uint32()); + message.adult = reader.int32(); + break; + case 2: + message.spoof = reader.int32(); + break; + case 3: + message.medical = reader.int32(); + break; + case 4: + message.violence = reader.int32(); + break; + case 9: + message.racy = reader.int32(); break; default: reader.skipType(tag & 7); @@ -54394,114 +54456,306 @@ }; /** - * Decodes an ImageProperties message from the specified reader or buffer, length delimited. + * Decodes a SafeSearchAnnotation message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ImageProperties + * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.ImageProperties} ImageProperties + * @returns {google.cloud.vision.v1p3beta1.SafeSearchAnnotation} SafeSearchAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageProperties.decodeDelimited = function decodeDelimited(reader) { + SafeSearchAnnotation.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImageProperties message. + * Verifies a SafeSearchAnnotation message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.ImageProperties + * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImageProperties.verify = function verify(message) { + SafeSearchAnnotation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.dominantColors != null && message.hasOwnProperty("dominantColors")) { - var error = $root.google.cloud.vision.v1p3beta1.DominantColorsAnnotation.verify(message.dominantColors); - if (error) - return "dominantColors." + error; - } + if (message.adult != null && message.hasOwnProperty("adult")) + switch (message.adult) { + default: + return "adult: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.spoof != null && message.hasOwnProperty("spoof")) + switch (message.spoof) { + default: + return "spoof: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.medical != null && message.hasOwnProperty("medical")) + switch (message.medical) { + default: + return "medical: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.violence != null && message.hasOwnProperty("violence")) + switch (message.violence) { + default: + return "violence: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.racy != null && message.hasOwnProperty("racy")) + switch (message.racy) { + default: + return "racy: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } return null; }; /** - * Creates an ImageProperties message from a plain object. Also converts values to their respective internal types. + * Creates a SafeSearchAnnotation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.ImageProperties + * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.ImageProperties} ImageProperties + * @returns {google.cloud.vision.v1p3beta1.SafeSearchAnnotation} SafeSearchAnnotation */ - ImageProperties.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.ImageProperties) + SafeSearchAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.SafeSearchAnnotation) return object; - var message = new $root.google.cloud.vision.v1p3beta1.ImageProperties(); - if (object.dominantColors != null) { - if (typeof object.dominantColors !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.ImageProperties.dominantColors: object expected"); - message.dominantColors = $root.google.cloud.vision.v1p3beta1.DominantColorsAnnotation.fromObject(object.dominantColors); + var message = new $root.google.cloud.vision.v1p3beta1.SafeSearchAnnotation(); + switch (object.adult) { + case "UNKNOWN": + case 0: + message.adult = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.adult = 1; + break; + case "UNLIKELY": + case 2: + message.adult = 2; + break; + case "POSSIBLE": + case 3: + message.adult = 3; + break; + case "LIKELY": + case 4: + message.adult = 4; + break; + case "VERY_LIKELY": + case 5: + message.adult = 5; + break; + } + switch (object.spoof) { + case "UNKNOWN": + case 0: + message.spoof = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.spoof = 1; + break; + case "UNLIKELY": + case 2: + message.spoof = 2; + break; + case "POSSIBLE": + case 3: + message.spoof = 3; + break; + case "LIKELY": + case 4: + message.spoof = 4; + break; + case "VERY_LIKELY": + case 5: + message.spoof = 5; + break; + } + switch (object.medical) { + case "UNKNOWN": + case 0: + message.medical = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.medical = 1; + break; + case "UNLIKELY": + case 2: + message.medical = 2; + break; + case "POSSIBLE": + case 3: + message.medical = 3; + break; + case "LIKELY": + case 4: + message.medical = 4; + break; + case "VERY_LIKELY": + case 5: + message.medical = 5; + break; + } + switch (object.violence) { + case "UNKNOWN": + case 0: + message.violence = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.violence = 1; + break; + case "UNLIKELY": + case 2: + message.violence = 2; + break; + case "POSSIBLE": + case 3: + message.violence = 3; + break; + case "LIKELY": + case 4: + message.violence = 4; + break; + case "VERY_LIKELY": + case 5: + message.violence = 5; + break; + } + switch (object.racy) { + case "UNKNOWN": + case 0: + message.racy = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.racy = 1; + break; + case "UNLIKELY": + case 2: + message.racy = 2; + break; + case "POSSIBLE": + case 3: + message.racy = 3; + break; + case "LIKELY": + case 4: + message.racy = 4; + break; + case "VERY_LIKELY": + case 5: + message.racy = 5; + break; } return message; }; /** - * Creates a plain object from an ImageProperties message. Also converts values to other types if specified. + * Creates a plain object from a SafeSearchAnnotation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.ImageProperties + * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation * @static - * @param {google.cloud.vision.v1p3beta1.ImageProperties} message ImageProperties + * @param {google.cloud.vision.v1p3beta1.SafeSearchAnnotation} message SafeSearchAnnotation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImageProperties.toObject = function toObject(message, options) { + SafeSearchAnnotation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.dominantColors = null; - if (message.dominantColors != null && message.hasOwnProperty("dominantColors")) - object.dominantColors = $root.google.cloud.vision.v1p3beta1.DominantColorsAnnotation.toObject(message.dominantColors, options); + if (options.defaults) { + object.adult = options.enums === String ? "UNKNOWN" : 0; + object.spoof = options.enums === String ? "UNKNOWN" : 0; + object.medical = options.enums === String ? "UNKNOWN" : 0; + object.violence = options.enums === String ? "UNKNOWN" : 0; + object.racy = options.enums === String ? "UNKNOWN" : 0; + } + if (message.adult != null && message.hasOwnProperty("adult")) + object.adult = options.enums === String ? $root.google.cloud.vision.v1p3beta1.Likelihood[message.adult] : message.adult; + if (message.spoof != null && message.hasOwnProperty("spoof")) + object.spoof = options.enums === String ? $root.google.cloud.vision.v1p3beta1.Likelihood[message.spoof] : message.spoof; + if (message.medical != null && message.hasOwnProperty("medical")) + object.medical = options.enums === String ? $root.google.cloud.vision.v1p3beta1.Likelihood[message.medical] : message.medical; + if (message.violence != null && message.hasOwnProperty("violence")) + object.violence = options.enums === String ? $root.google.cloud.vision.v1p3beta1.Likelihood[message.violence] : message.violence; + if (message.racy != null && message.hasOwnProperty("racy")) + object.racy = options.enums === String ? $root.google.cloud.vision.v1p3beta1.Likelihood[message.racy] : message.racy; return object; }; /** - * Converts this ImageProperties to JSON. + * Converts this SafeSearchAnnotation to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.ImageProperties + * @memberof google.cloud.vision.v1p3beta1.SafeSearchAnnotation * @instance * @returns {Object.} JSON object */ - ImageProperties.prototype.toJSON = function toJSON() { + SafeSearchAnnotation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImageProperties; + return SafeSearchAnnotation; })(); - v1p3beta1.CropHint = (function() { + v1p3beta1.LatLongRect = (function() { /** - * Properties of a CropHint. + * Properties of a LatLongRect. * @memberof google.cloud.vision.v1p3beta1 - * @interface ICropHint - * @property {google.cloud.vision.v1p3beta1.IBoundingPoly|null} [boundingPoly] CropHint boundingPoly - * @property {number|null} [confidence] CropHint confidence - * @property {number|null} [importanceFraction] CropHint importanceFraction + * @interface ILatLongRect + * @property {google.type.ILatLng|null} [minLatLng] LatLongRect minLatLng + * @property {google.type.ILatLng|null} [maxLatLng] LatLongRect maxLatLng */ /** - * Constructs a new CropHint. + * Constructs a new LatLongRect. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a CropHint. - * @implements ICropHint + * @classdesc Represents a LatLongRect. + * @implements ILatLongRect * @constructor - * @param {google.cloud.vision.v1p3beta1.ICropHint=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.ILatLongRect=} [properties] Properties to set */ - function CropHint(properties) { + function LatLongRect(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -54509,101 +54763,88 @@ } /** - * CropHint boundingPoly. - * @member {google.cloud.vision.v1p3beta1.IBoundingPoly|null|undefined} boundingPoly - * @memberof google.cloud.vision.v1p3beta1.CropHint - * @instance - */ - CropHint.prototype.boundingPoly = null; - - /** - * CropHint confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p3beta1.CropHint + * LatLongRect minLatLng. + * @member {google.type.ILatLng|null|undefined} minLatLng + * @memberof google.cloud.vision.v1p3beta1.LatLongRect * @instance */ - CropHint.prototype.confidence = 0; + LatLongRect.prototype.minLatLng = null; /** - * CropHint importanceFraction. - * @member {number} importanceFraction - * @memberof google.cloud.vision.v1p3beta1.CropHint + * LatLongRect maxLatLng. + * @member {google.type.ILatLng|null|undefined} maxLatLng + * @memberof google.cloud.vision.v1p3beta1.LatLongRect * @instance */ - CropHint.prototype.importanceFraction = 0; + LatLongRect.prototype.maxLatLng = null; /** - * Creates a new CropHint instance using the specified properties. + * Creates a new LatLongRect instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.CropHint + * @memberof google.cloud.vision.v1p3beta1.LatLongRect * @static - * @param {google.cloud.vision.v1p3beta1.ICropHint=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.CropHint} CropHint instance + * @param {google.cloud.vision.v1p3beta1.ILatLongRect=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.LatLongRect} LatLongRect instance */ - CropHint.create = function create(properties) { - return new CropHint(properties); + LatLongRect.create = function create(properties) { + return new LatLongRect(properties); }; /** - * Encodes the specified CropHint message. Does not implicitly {@link google.cloud.vision.v1p3beta1.CropHint.verify|verify} messages. + * Encodes the specified LatLongRect message. Does not implicitly {@link google.cloud.vision.v1p3beta1.LatLongRect.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.CropHint + * @memberof google.cloud.vision.v1p3beta1.LatLongRect * @static - * @param {google.cloud.vision.v1p3beta1.ICropHint} message CropHint message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.ILatLongRect} message LatLongRect message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CropHint.encode = function encode(message, writer) { + LatLongRect.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - $root.google.cloud.vision.v1p3beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.confidence != null && message.hasOwnProperty("confidence")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); - if (message.importanceFraction != null && message.hasOwnProperty("importanceFraction")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.importanceFraction); + if (message.minLatLng != null && message.hasOwnProperty("minLatLng")) + $root.google.type.LatLng.encode(message.minLatLng, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.maxLatLng != null && message.hasOwnProperty("maxLatLng")) + $root.google.type.LatLng.encode(message.maxLatLng, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified CropHint message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.CropHint.verify|verify} messages. + * Encodes the specified LatLongRect message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.LatLongRect.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.CropHint + * @memberof google.cloud.vision.v1p3beta1.LatLongRect * @static - * @param {google.cloud.vision.v1p3beta1.ICropHint} message CropHint message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.ILatLongRect} message LatLongRect message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CropHint.encodeDelimited = function encodeDelimited(message, writer) { + LatLongRect.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CropHint message from the specified reader or buffer. + * Decodes a LatLongRect message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.CropHint + * @memberof google.cloud.vision.v1p3beta1.LatLongRect * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.CropHint} CropHint + * @returns {google.cloud.vision.v1p3beta1.LatLongRect} LatLongRect * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CropHint.decode = function decode(reader, length) { + LatLongRect.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.vision.v1p3beta1.CropHint(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.LatLongRect(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.boundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.decode(reader, reader.uint32()); + message.minLatLng = $root.google.type.LatLng.decode(reader, reader.uint32()); break; case 2: - message.confidence = reader.float(); - break; - case 3: - message.importanceFraction = reader.float(); + message.maxLatLng = $root.google.type.LatLng.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -54614,130 +54855,128 @@ }; /** - * Decodes a CropHint message from the specified reader or buffer, length delimited. + * Decodes a LatLongRect message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.CropHint + * @memberof google.cloud.vision.v1p3beta1.LatLongRect * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.CropHint} CropHint + * @returns {google.cloud.vision.v1p3beta1.LatLongRect} LatLongRect * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CropHint.decodeDelimited = function decodeDelimited(reader) { + LatLongRect.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CropHint message. + * Verifies a LatLongRect message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.CropHint + * @memberof google.cloud.vision.v1p3beta1.LatLongRect * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CropHint.verify = function verify(message) { + LatLongRect.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { - var error = $root.google.cloud.vision.v1p3beta1.BoundingPoly.verify(message.boundingPoly); + if (message.minLatLng != null && message.hasOwnProperty("minLatLng")) { + var error = $root.google.type.LatLng.verify(message.minLatLng); if (error) - return "boundingPoly." + error; + return "minLatLng." + error; + } + if (message.maxLatLng != null && message.hasOwnProperty("maxLatLng")) { + var error = $root.google.type.LatLng.verify(message.maxLatLng); + if (error) + return "maxLatLng." + error; } - if (message.confidence != null && message.hasOwnProperty("confidence")) - if (typeof message.confidence !== "number") - return "confidence: number expected"; - if (message.importanceFraction != null && message.hasOwnProperty("importanceFraction")) - if (typeof message.importanceFraction !== "number") - return "importanceFraction: number expected"; return null; }; /** - * Creates a CropHint message from a plain object. Also converts values to their respective internal types. + * Creates a LatLongRect message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.CropHint + * @memberof google.cloud.vision.v1p3beta1.LatLongRect * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.CropHint} CropHint + * @returns {google.cloud.vision.v1p3beta1.LatLongRect} LatLongRect */ - CropHint.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.CropHint) + LatLongRect.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.LatLongRect) return object; - var message = new $root.google.cloud.vision.v1p3beta1.CropHint(); - if (object.boundingPoly != null) { - if (typeof object.boundingPoly !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.CropHint.boundingPoly: object expected"); - message.boundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.fromObject(object.boundingPoly); + var message = new $root.google.cloud.vision.v1p3beta1.LatLongRect(); + if (object.minLatLng != null) { + if (typeof object.minLatLng !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.LatLongRect.minLatLng: object expected"); + message.minLatLng = $root.google.type.LatLng.fromObject(object.minLatLng); + } + if (object.maxLatLng != null) { + if (typeof object.maxLatLng !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.LatLongRect.maxLatLng: object expected"); + message.maxLatLng = $root.google.type.LatLng.fromObject(object.maxLatLng); } - if (object.confidence != null) - message.confidence = Number(object.confidence); - if (object.importanceFraction != null) - message.importanceFraction = Number(object.importanceFraction); return message; }; /** - * Creates a plain object from a CropHint message. Also converts values to other types if specified. + * Creates a plain object from a LatLongRect message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.CropHint + * @memberof google.cloud.vision.v1p3beta1.LatLongRect * @static - * @param {google.cloud.vision.v1p3beta1.CropHint} message CropHint + * @param {google.cloud.vision.v1p3beta1.LatLongRect} message LatLongRect * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CropHint.toObject = function toObject(message, options) { + LatLongRect.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.boundingPoly = null; - object.confidence = 0; - object.importanceFraction = 0; + object.minLatLng = null; + object.maxLatLng = null; } - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - object.boundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.toObject(message.boundingPoly, options); - if (message.confidence != null && message.hasOwnProperty("confidence")) - object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; - if (message.importanceFraction != null && message.hasOwnProperty("importanceFraction")) - object.importanceFraction = options.json && !isFinite(message.importanceFraction) ? String(message.importanceFraction) : message.importanceFraction; + if (message.minLatLng != null && message.hasOwnProperty("minLatLng")) + object.minLatLng = $root.google.type.LatLng.toObject(message.minLatLng, options); + if (message.maxLatLng != null && message.hasOwnProperty("maxLatLng")) + object.maxLatLng = $root.google.type.LatLng.toObject(message.maxLatLng, options); return object; }; /** - * Converts this CropHint to JSON. + * Converts this LatLongRect to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.CropHint + * @memberof google.cloud.vision.v1p3beta1.LatLongRect * @instance * @returns {Object.} JSON object */ - CropHint.prototype.toJSON = function toJSON() { + LatLongRect.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CropHint; + return LatLongRect; })(); - v1p3beta1.CropHintsAnnotation = (function() { + v1p3beta1.ColorInfo = (function() { /** - * Properties of a CropHintsAnnotation. + * Properties of a ColorInfo. * @memberof google.cloud.vision.v1p3beta1 - * @interface ICropHintsAnnotation - * @property {Array.|null} [cropHints] CropHintsAnnotation cropHints + * @interface IColorInfo + * @property {google.type.IColor|null} [color] ColorInfo color + * @property {number|null} [score] ColorInfo score + * @property {number|null} [pixelFraction] ColorInfo pixelFraction */ /** - * Constructs a new CropHintsAnnotation. + * Constructs a new ColorInfo. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a CropHintsAnnotation. - * @implements ICropHintsAnnotation + * @classdesc Represents a ColorInfo. + * @implements IColorInfo * @constructor - * @param {google.cloud.vision.v1p3beta1.ICropHintsAnnotation=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.IColorInfo=} [properties] Properties to set */ - function CropHintsAnnotation(properties) { - this.cropHints = []; + function ColorInfo(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -54745,78 +54984,101 @@ } /** - * CropHintsAnnotation cropHints. - * @member {Array.} cropHints - * @memberof google.cloud.vision.v1p3beta1.CropHintsAnnotation + * ColorInfo color. + * @member {google.type.IColor|null|undefined} color + * @memberof google.cloud.vision.v1p3beta1.ColorInfo + * @instance + */ + ColorInfo.prototype.color = null; + + /** + * ColorInfo score. + * @member {number} score + * @memberof google.cloud.vision.v1p3beta1.ColorInfo + * @instance + */ + ColorInfo.prototype.score = 0; + + /** + * ColorInfo pixelFraction. + * @member {number} pixelFraction + * @memberof google.cloud.vision.v1p3beta1.ColorInfo * @instance */ - CropHintsAnnotation.prototype.cropHints = $util.emptyArray; + ColorInfo.prototype.pixelFraction = 0; /** - * Creates a new CropHintsAnnotation instance using the specified properties. + * Creates a new ColorInfo instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p3beta1.ColorInfo * @static - * @param {google.cloud.vision.v1p3beta1.ICropHintsAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.CropHintsAnnotation} CropHintsAnnotation instance + * @param {google.cloud.vision.v1p3beta1.IColorInfo=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.ColorInfo} ColorInfo instance */ - CropHintsAnnotation.create = function create(properties) { - return new CropHintsAnnotation(properties); + ColorInfo.create = function create(properties) { + return new ColorInfo(properties); }; /** - * Encodes the specified CropHintsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p3beta1.CropHintsAnnotation.verify|verify} messages. + * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ColorInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p3beta1.ColorInfo * @static - * @param {google.cloud.vision.v1p3beta1.ICropHintsAnnotation} message CropHintsAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IColorInfo} message ColorInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CropHintsAnnotation.encode = function encode(message, writer) { + ColorInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.cropHints != null && message.cropHints.length) - for (var i = 0; i < message.cropHints.length; ++i) - $root.google.cloud.vision.v1p3beta1.CropHint.encode(message.cropHints[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.color != null && message.hasOwnProperty("color")) + $root.google.type.Color.encode(message.color, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.score != null && message.hasOwnProperty("score")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); + if (message.pixelFraction != null && message.hasOwnProperty("pixelFraction")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.pixelFraction); return writer; }; /** - * Encodes the specified CropHintsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.CropHintsAnnotation.verify|verify} messages. + * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ColorInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p3beta1.ColorInfo * @static - * @param {google.cloud.vision.v1p3beta1.ICropHintsAnnotation} message CropHintsAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IColorInfo} message ColorInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CropHintsAnnotation.encodeDelimited = function encodeDelimited(message, writer) { + ColorInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CropHintsAnnotation message from the specified reader or buffer. + * Decodes a ColorInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p3beta1.ColorInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.CropHintsAnnotation} CropHintsAnnotation + * @returns {google.cloud.vision.v1p3beta1.ColorInfo} ColorInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CropHintsAnnotation.decode = function decode(reader, length) { + ColorInfo.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.vision.v1p3beta1.CropHintsAnnotation(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.ColorInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.cropHints && message.cropHints.length)) - message.cropHints = []; - message.cropHints.push($root.google.cloud.vision.v1p3beta1.CropHint.decode(reader, reader.uint32())); + message.color = $root.google.type.Color.decode(reader, reader.uint32()); + break; + case 2: + message.score = reader.float(); + break; + case 3: + message.pixelFraction = reader.float(); break; default: reader.skipType(tag & 7); @@ -54827,125 +55089,130 @@ }; /** - * Decodes a CropHintsAnnotation message from the specified reader or buffer, length delimited. + * Decodes a ColorInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p3beta1.ColorInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.CropHintsAnnotation} CropHintsAnnotation + * @returns {google.cloud.vision.v1p3beta1.ColorInfo} ColorInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CropHintsAnnotation.decodeDelimited = function decodeDelimited(reader) { + ColorInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CropHintsAnnotation message. + * Verifies a ColorInfo message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p3beta1.ColorInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CropHintsAnnotation.verify = function verify(message) { + ColorInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.cropHints != null && message.hasOwnProperty("cropHints")) { - if (!Array.isArray(message.cropHints)) - return "cropHints: array expected"; - for (var i = 0; i < message.cropHints.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.CropHint.verify(message.cropHints[i]); - if (error) - return "cropHints." + error; - } + if (message.color != null && message.hasOwnProperty("color")) { + var error = $root.google.type.Color.verify(message.color); + if (error) + return "color." + error; } + if (message.score != null && message.hasOwnProperty("score")) + if (typeof message.score !== "number") + return "score: number expected"; + if (message.pixelFraction != null && message.hasOwnProperty("pixelFraction")) + if (typeof message.pixelFraction !== "number") + return "pixelFraction: number expected"; return null; }; /** - * Creates a CropHintsAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p3beta1.ColorInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.CropHintsAnnotation} CropHintsAnnotation + * @returns {google.cloud.vision.v1p3beta1.ColorInfo} ColorInfo */ - CropHintsAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.CropHintsAnnotation) + ColorInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.ColorInfo) return object; - var message = new $root.google.cloud.vision.v1p3beta1.CropHintsAnnotation(); - if (object.cropHints) { - if (!Array.isArray(object.cropHints)) - throw TypeError(".google.cloud.vision.v1p3beta1.CropHintsAnnotation.cropHints: array expected"); - message.cropHints = []; - for (var i = 0; i < object.cropHints.length; ++i) { - if (typeof object.cropHints[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.CropHintsAnnotation.cropHints: object expected"); - message.cropHints[i] = $root.google.cloud.vision.v1p3beta1.CropHint.fromObject(object.cropHints[i]); - } + var message = new $root.google.cloud.vision.v1p3beta1.ColorInfo(); + if (object.color != null) { + if (typeof object.color !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.ColorInfo.color: object expected"); + message.color = $root.google.type.Color.fromObject(object.color); } + if (object.score != null) + message.score = Number(object.score); + if (object.pixelFraction != null) + message.pixelFraction = Number(object.pixelFraction); return message; }; /** - * Creates a plain object from a CropHintsAnnotation message. Also converts values to other types if specified. + * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p3beta1.ColorInfo * @static - * @param {google.cloud.vision.v1p3beta1.CropHintsAnnotation} message CropHintsAnnotation + * @param {google.cloud.vision.v1p3beta1.ColorInfo} message ColorInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CropHintsAnnotation.toObject = function toObject(message, options) { + ColorInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.cropHints = []; - if (message.cropHints && message.cropHints.length) { - object.cropHints = []; - for (var j = 0; j < message.cropHints.length; ++j) - object.cropHints[j] = $root.google.cloud.vision.v1p3beta1.CropHint.toObject(message.cropHints[j], options); + if (options.defaults) { + object.color = null; + object.score = 0; + object.pixelFraction = 0; } + if (message.color != null && message.hasOwnProperty("color")) + object.color = $root.google.type.Color.toObject(message.color, options); + if (message.score != null && message.hasOwnProperty("score")) + object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; + if (message.pixelFraction != null && message.hasOwnProperty("pixelFraction")) + object.pixelFraction = options.json && !isFinite(message.pixelFraction) ? String(message.pixelFraction) : message.pixelFraction; return object; }; /** - * Converts this CropHintsAnnotation to JSON. + * Converts this ColorInfo to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p3beta1.ColorInfo * @instance * @returns {Object.} JSON object */ - CropHintsAnnotation.prototype.toJSON = function toJSON() { + ColorInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CropHintsAnnotation; + return ColorInfo; })(); - v1p3beta1.CropHintsParams = (function() { + v1p3beta1.DominantColorsAnnotation = (function() { /** - * Properties of a CropHintsParams. + * Properties of a DominantColorsAnnotation. * @memberof google.cloud.vision.v1p3beta1 - * @interface ICropHintsParams - * @property {Array.|null} [aspectRatios] CropHintsParams aspectRatios + * @interface IDominantColorsAnnotation + * @property {Array.|null} [colors] DominantColorsAnnotation colors */ /** - * Constructs a new CropHintsParams. + * Constructs a new DominantColorsAnnotation. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a CropHintsParams. - * @implements ICropHintsParams + * @classdesc Represents a DominantColorsAnnotation. + * @implements IDominantColorsAnnotation * @constructor - * @param {google.cloud.vision.v1p3beta1.ICropHintsParams=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.IDominantColorsAnnotation=} [properties] Properties to set */ - function CropHintsParams(properties) { - this.aspectRatios = []; + function DominantColorsAnnotation(properties) { + this.colors = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -54953,86 +55220,78 @@ } /** - * CropHintsParams aspectRatios. - * @member {Array.} aspectRatios - * @memberof google.cloud.vision.v1p3beta1.CropHintsParams + * DominantColorsAnnotation colors. + * @member {Array.} colors + * @memberof google.cloud.vision.v1p3beta1.DominantColorsAnnotation * @instance */ - CropHintsParams.prototype.aspectRatios = $util.emptyArray; + DominantColorsAnnotation.prototype.colors = $util.emptyArray; /** - * Creates a new CropHintsParams instance using the specified properties. + * Creates a new DominantColorsAnnotation instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.CropHintsParams + * @memberof google.cloud.vision.v1p3beta1.DominantColorsAnnotation * @static - * @param {google.cloud.vision.v1p3beta1.ICropHintsParams=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.CropHintsParams} CropHintsParams instance + * @param {google.cloud.vision.v1p3beta1.IDominantColorsAnnotation=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.DominantColorsAnnotation} DominantColorsAnnotation instance */ - CropHintsParams.create = function create(properties) { - return new CropHintsParams(properties); + DominantColorsAnnotation.create = function create(properties) { + return new DominantColorsAnnotation(properties); }; /** - * Encodes the specified CropHintsParams message. Does not implicitly {@link google.cloud.vision.v1p3beta1.CropHintsParams.verify|verify} messages. + * Encodes the specified DominantColorsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p3beta1.DominantColorsAnnotation.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.CropHintsParams + * @memberof google.cloud.vision.v1p3beta1.DominantColorsAnnotation * @static - * @param {google.cloud.vision.v1p3beta1.ICropHintsParams} message CropHintsParams message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IDominantColorsAnnotation} message DominantColorsAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CropHintsParams.encode = function encode(message, writer) { + DominantColorsAnnotation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.aspectRatios != null && message.aspectRatios.length) { - writer.uint32(/* id 1, wireType 2 =*/10).fork(); - for (var i = 0; i < message.aspectRatios.length; ++i) - writer.float(message.aspectRatios[i]); - writer.ldelim(); - } + if (message.colors != null && message.colors.length) + for (var i = 0; i < message.colors.length; ++i) + $root.google.cloud.vision.v1p3beta1.ColorInfo.encode(message.colors[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified CropHintsParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.CropHintsParams.verify|verify} messages. + * Encodes the specified DominantColorsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.DominantColorsAnnotation.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.CropHintsParams + * @memberof google.cloud.vision.v1p3beta1.DominantColorsAnnotation * @static - * @param {google.cloud.vision.v1p3beta1.ICropHintsParams} message CropHintsParams message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IDominantColorsAnnotation} message DominantColorsAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CropHintsParams.encodeDelimited = function encodeDelimited(message, writer) { + DominantColorsAnnotation.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CropHintsParams message from the specified reader or buffer. + * Decodes a DominantColorsAnnotation message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.CropHintsParams + * @memberof google.cloud.vision.v1p3beta1.DominantColorsAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.CropHintsParams} CropHintsParams + * @returns {google.cloud.vision.v1p3beta1.DominantColorsAnnotation} DominantColorsAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CropHintsParams.decode = function decode(reader, length) { + DominantColorsAnnotation.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.vision.v1p3beta1.CropHintsParams(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.DominantColorsAnnotation(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.aspectRatios && message.aspectRatios.length)) - message.aspectRatios = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.aspectRatios.push(reader.float()); - } else - message.aspectRatios.push(reader.float()); + if (!(message.colors && message.colors.length)) + message.colors = []; + message.colors.push($root.google.cloud.vision.v1p3beta1.ColorInfo.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -55043,119 +55302,124 @@ }; /** - * Decodes a CropHintsParams message from the specified reader or buffer, length delimited. + * Decodes a DominantColorsAnnotation message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.CropHintsParams + * @memberof google.cloud.vision.v1p3beta1.DominantColorsAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.CropHintsParams} CropHintsParams + * @returns {google.cloud.vision.v1p3beta1.DominantColorsAnnotation} DominantColorsAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CropHintsParams.decodeDelimited = function decodeDelimited(reader) { + DominantColorsAnnotation.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CropHintsParams message. + * Verifies a DominantColorsAnnotation message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.CropHintsParams + * @memberof google.cloud.vision.v1p3beta1.DominantColorsAnnotation * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CropHintsParams.verify = function verify(message) { + DominantColorsAnnotation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.aspectRatios != null && message.hasOwnProperty("aspectRatios")) { - if (!Array.isArray(message.aspectRatios)) - return "aspectRatios: array expected"; - for (var i = 0; i < message.aspectRatios.length; ++i) - if (typeof message.aspectRatios[i] !== "number") - return "aspectRatios: number[] expected"; + if (message.colors != null && message.hasOwnProperty("colors")) { + if (!Array.isArray(message.colors)) + return "colors: array expected"; + for (var i = 0; i < message.colors.length; ++i) { + var error = $root.google.cloud.vision.v1p3beta1.ColorInfo.verify(message.colors[i]); + if (error) + return "colors." + error; + } } return null; }; /** - * Creates a CropHintsParams message from a plain object. Also converts values to their respective internal types. + * Creates a DominantColorsAnnotation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.CropHintsParams + * @memberof google.cloud.vision.v1p3beta1.DominantColorsAnnotation * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.CropHintsParams} CropHintsParams + * @returns {google.cloud.vision.v1p3beta1.DominantColorsAnnotation} DominantColorsAnnotation */ - CropHintsParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.CropHintsParams) + DominantColorsAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.DominantColorsAnnotation) return object; - var message = new $root.google.cloud.vision.v1p3beta1.CropHintsParams(); - if (object.aspectRatios) { - if (!Array.isArray(object.aspectRatios)) - throw TypeError(".google.cloud.vision.v1p3beta1.CropHintsParams.aspectRatios: array expected"); - message.aspectRatios = []; - for (var i = 0; i < object.aspectRatios.length; ++i) - message.aspectRatios[i] = Number(object.aspectRatios[i]); + var message = new $root.google.cloud.vision.v1p3beta1.DominantColorsAnnotation(); + if (object.colors) { + if (!Array.isArray(object.colors)) + throw TypeError(".google.cloud.vision.v1p3beta1.DominantColorsAnnotation.colors: array expected"); + message.colors = []; + for (var i = 0; i < object.colors.length; ++i) { + if (typeof object.colors[i] !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.DominantColorsAnnotation.colors: object expected"); + message.colors[i] = $root.google.cloud.vision.v1p3beta1.ColorInfo.fromObject(object.colors[i]); + } } return message; }; /** - * Creates a plain object from a CropHintsParams message. Also converts values to other types if specified. + * Creates a plain object from a DominantColorsAnnotation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.CropHintsParams + * @memberof google.cloud.vision.v1p3beta1.DominantColorsAnnotation * @static - * @param {google.cloud.vision.v1p3beta1.CropHintsParams} message CropHintsParams + * @param {google.cloud.vision.v1p3beta1.DominantColorsAnnotation} message DominantColorsAnnotation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CropHintsParams.toObject = function toObject(message, options) { + DominantColorsAnnotation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.aspectRatios = []; - if (message.aspectRatios && message.aspectRatios.length) { - object.aspectRatios = []; - for (var j = 0; j < message.aspectRatios.length; ++j) - object.aspectRatios[j] = options.json && !isFinite(message.aspectRatios[j]) ? String(message.aspectRatios[j]) : message.aspectRatios[j]; + object.colors = []; + if (message.colors && message.colors.length) { + object.colors = []; + for (var j = 0; j < message.colors.length; ++j) + object.colors[j] = $root.google.cloud.vision.v1p3beta1.ColorInfo.toObject(message.colors[j], options); } return object; }; /** - * Converts this CropHintsParams to JSON. + * Converts this DominantColorsAnnotation to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.CropHintsParams + * @memberof google.cloud.vision.v1p3beta1.DominantColorsAnnotation * @instance * @returns {Object.} JSON object */ - CropHintsParams.prototype.toJSON = function toJSON() { + DominantColorsAnnotation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CropHintsParams; + return DominantColorsAnnotation; })(); - v1p3beta1.WebDetectionParams = (function() { + v1p3beta1.ImageProperties = (function() { /** - * Properties of a WebDetectionParams. + * Properties of an ImageProperties. * @memberof google.cloud.vision.v1p3beta1 - * @interface IWebDetectionParams - * @property {boolean|null} [includeGeoResults] WebDetectionParams includeGeoResults + * @interface IImageProperties + * @property {google.cloud.vision.v1p3beta1.IDominantColorsAnnotation|null} [dominantColors] ImageProperties dominantColors */ /** - * Constructs a new WebDetectionParams. + * Constructs a new ImageProperties. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a WebDetectionParams. - * @implements IWebDetectionParams + * @classdesc Represents an ImageProperties. + * @implements IImageProperties * @constructor - * @param {google.cloud.vision.v1p3beta1.IWebDetectionParams=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.IImageProperties=} [properties] Properties to set */ - function WebDetectionParams(properties) { + function ImageProperties(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -55163,75 +55427,75 @@ } /** - * WebDetectionParams includeGeoResults. - * @member {boolean} includeGeoResults - * @memberof google.cloud.vision.v1p3beta1.WebDetectionParams + * ImageProperties dominantColors. + * @member {google.cloud.vision.v1p3beta1.IDominantColorsAnnotation|null|undefined} dominantColors + * @memberof google.cloud.vision.v1p3beta1.ImageProperties * @instance */ - WebDetectionParams.prototype.includeGeoResults = false; + ImageProperties.prototype.dominantColors = null; /** - * Creates a new WebDetectionParams instance using the specified properties. + * Creates a new ImageProperties instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p3beta1.ImageProperties * @static - * @param {google.cloud.vision.v1p3beta1.IWebDetectionParams=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.WebDetectionParams} WebDetectionParams instance + * @param {google.cloud.vision.v1p3beta1.IImageProperties=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.ImageProperties} ImageProperties instance */ - WebDetectionParams.create = function create(properties) { - return new WebDetectionParams(properties); + ImageProperties.create = function create(properties) { + return new ImageProperties(properties); }; /** - * Encodes the specified WebDetectionParams message. Does not implicitly {@link google.cloud.vision.v1p3beta1.WebDetectionParams.verify|verify} messages. + * Encodes the specified ImageProperties message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImageProperties.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p3beta1.ImageProperties * @static - * @param {google.cloud.vision.v1p3beta1.IWebDetectionParams} message WebDetectionParams message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IImageProperties} message ImageProperties message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WebDetectionParams.encode = function encode(message, writer) { + ImageProperties.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.includeGeoResults != null && message.hasOwnProperty("includeGeoResults")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.includeGeoResults); + if (message.dominantColors != null && message.hasOwnProperty("dominantColors")) + $root.google.cloud.vision.v1p3beta1.DominantColorsAnnotation.encode(message.dominantColors, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified WebDetectionParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.WebDetectionParams.verify|verify} messages. + * Encodes the specified ImageProperties message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImageProperties.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p3beta1.ImageProperties * @static - * @param {google.cloud.vision.v1p3beta1.IWebDetectionParams} message WebDetectionParams message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IImageProperties} message ImageProperties message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WebDetectionParams.encodeDelimited = function encodeDelimited(message, writer) { + ImageProperties.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a WebDetectionParams message from the specified reader or buffer. + * Decodes an ImageProperties message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p3beta1.ImageProperties * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.WebDetectionParams} WebDetectionParams + * @returns {google.cloud.vision.v1p3beta1.ImageProperties} ImageProperties * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WebDetectionParams.decode = function decode(reader, length) { + ImageProperties.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.vision.v1p3beta1.WebDetectionParams(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.ImageProperties(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 2: - message.includeGeoResults = reader.bool(); + case 1: + message.dominantColors = $root.google.cloud.vision.v1p3beta1.DominantColorsAnnotation.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -55242,112 +55506,114 @@ }; /** - * Decodes a WebDetectionParams message from the specified reader or buffer, length delimited. + * Decodes an ImageProperties message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p3beta1.ImageProperties * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.WebDetectionParams} WebDetectionParams + * @returns {google.cloud.vision.v1p3beta1.ImageProperties} ImageProperties * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WebDetectionParams.decodeDelimited = function decodeDelimited(reader) { + ImageProperties.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a WebDetectionParams message. + * Verifies an ImageProperties message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p3beta1.ImageProperties * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - WebDetectionParams.verify = function verify(message) { + ImageProperties.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.includeGeoResults != null && message.hasOwnProperty("includeGeoResults")) - if (typeof message.includeGeoResults !== "boolean") - return "includeGeoResults: boolean expected"; + if (message.dominantColors != null && message.hasOwnProperty("dominantColors")) { + var error = $root.google.cloud.vision.v1p3beta1.DominantColorsAnnotation.verify(message.dominantColors); + if (error) + return "dominantColors." + error; + } return null; }; /** - * Creates a WebDetectionParams message from a plain object. Also converts values to their respective internal types. + * Creates an ImageProperties message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p3beta1.ImageProperties * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.WebDetectionParams} WebDetectionParams + * @returns {google.cloud.vision.v1p3beta1.ImageProperties} ImageProperties */ - WebDetectionParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.WebDetectionParams) + ImageProperties.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.ImageProperties) return object; - var message = new $root.google.cloud.vision.v1p3beta1.WebDetectionParams(); - if (object.includeGeoResults != null) - message.includeGeoResults = Boolean(object.includeGeoResults); + var message = new $root.google.cloud.vision.v1p3beta1.ImageProperties(); + if (object.dominantColors != null) { + if (typeof object.dominantColors !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.ImageProperties.dominantColors: object expected"); + message.dominantColors = $root.google.cloud.vision.v1p3beta1.DominantColorsAnnotation.fromObject(object.dominantColors); + } return message; }; /** - * Creates a plain object from a WebDetectionParams message. Also converts values to other types if specified. + * Creates a plain object from an ImageProperties message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p3beta1.ImageProperties * @static - * @param {google.cloud.vision.v1p3beta1.WebDetectionParams} message WebDetectionParams + * @param {google.cloud.vision.v1p3beta1.ImageProperties} message ImageProperties * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - WebDetectionParams.toObject = function toObject(message, options) { + ImageProperties.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) - object.includeGeoResults = false; - if (message.includeGeoResults != null && message.hasOwnProperty("includeGeoResults")) - object.includeGeoResults = message.includeGeoResults; + object.dominantColors = null; + if (message.dominantColors != null && message.hasOwnProperty("dominantColors")) + object.dominantColors = $root.google.cloud.vision.v1p3beta1.DominantColorsAnnotation.toObject(message.dominantColors, options); return object; }; /** - * Converts this WebDetectionParams to JSON. + * Converts this ImageProperties to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p3beta1.ImageProperties * @instance * @returns {Object.} JSON object */ - WebDetectionParams.prototype.toJSON = function toJSON() { + ImageProperties.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return WebDetectionParams; + return ImageProperties; })(); - v1p3beta1.ImageContext = (function() { + v1p3beta1.CropHint = (function() { /** - * Properties of an ImageContext. + * Properties of a CropHint. * @memberof google.cloud.vision.v1p3beta1 - * @interface IImageContext - * @property {google.cloud.vision.v1p3beta1.ILatLongRect|null} [latLongRect] ImageContext latLongRect - * @property {Array.|null} [languageHints] ImageContext languageHints - * @property {google.cloud.vision.v1p3beta1.ICropHintsParams|null} [cropHintsParams] ImageContext cropHintsParams - * @property {google.cloud.vision.v1p3beta1.IProductSearchParams|null} [productSearchParams] ImageContext productSearchParams - * @property {google.cloud.vision.v1p3beta1.IWebDetectionParams|null} [webDetectionParams] ImageContext webDetectionParams + * @interface ICropHint + * @property {google.cloud.vision.v1p3beta1.IBoundingPoly|null} [boundingPoly] CropHint boundingPoly + * @property {number|null} [confidence] CropHint confidence + * @property {number|null} [importanceFraction] CropHint importanceFraction */ /** - * Constructs a new ImageContext. + * Constructs a new CropHint. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an ImageContext. - * @implements IImageContext + * @classdesc Represents a CropHint. + * @implements ICropHint * @constructor - * @param {google.cloud.vision.v1p3beta1.IImageContext=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.ICropHint=} [properties] Properties to set */ - function ImageContext(properties) { - this.languageHints = []; + function CropHint(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -55355,130 +55621,101 @@ } /** - * ImageContext latLongRect. - * @member {google.cloud.vision.v1p3beta1.ILatLongRect|null|undefined} latLongRect - * @memberof google.cloud.vision.v1p3beta1.ImageContext - * @instance - */ - ImageContext.prototype.latLongRect = null; - - /** - * ImageContext languageHints. - * @member {Array.} languageHints - * @memberof google.cloud.vision.v1p3beta1.ImageContext - * @instance - */ - ImageContext.prototype.languageHints = $util.emptyArray; - - /** - * ImageContext cropHintsParams. - * @member {google.cloud.vision.v1p3beta1.ICropHintsParams|null|undefined} cropHintsParams - * @memberof google.cloud.vision.v1p3beta1.ImageContext + * CropHint boundingPoly. + * @member {google.cloud.vision.v1p3beta1.IBoundingPoly|null|undefined} boundingPoly + * @memberof google.cloud.vision.v1p3beta1.CropHint * @instance */ - ImageContext.prototype.cropHintsParams = null; + CropHint.prototype.boundingPoly = null; - /** - * ImageContext productSearchParams. - * @member {google.cloud.vision.v1p3beta1.IProductSearchParams|null|undefined} productSearchParams - * @memberof google.cloud.vision.v1p3beta1.ImageContext + /** + * CropHint confidence. + * @member {number} confidence + * @memberof google.cloud.vision.v1p3beta1.CropHint * @instance */ - ImageContext.prototype.productSearchParams = null; + CropHint.prototype.confidence = 0; /** - * ImageContext webDetectionParams. - * @member {google.cloud.vision.v1p3beta1.IWebDetectionParams|null|undefined} webDetectionParams - * @memberof google.cloud.vision.v1p3beta1.ImageContext + * CropHint importanceFraction. + * @member {number} importanceFraction + * @memberof google.cloud.vision.v1p3beta1.CropHint * @instance */ - ImageContext.prototype.webDetectionParams = null; + CropHint.prototype.importanceFraction = 0; /** - * Creates a new ImageContext instance using the specified properties. + * Creates a new CropHint instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.ImageContext + * @memberof google.cloud.vision.v1p3beta1.CropHint * @static - * @param {google.cloud.vision.v1p3beta1.IImageContext=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.ImageContext} ImageContext instance + * @param {google.cloud.vision.v1p3beta1.ICropHint=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.CropHint} CropHint instance */ - ImageContext.create = function create(properties) { - return new ImageContext(properties); + CropHint.create = function create(properties) { + return new CropHint(properties); }; /** - * Encodes the specified ImageContext message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImageContext.verify|verify} messages. + * Encodes the specified CropHint message. Does not implicitly {@link google.cloud.vision.v1p3beta1.CropHint.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.ImageContext + * @memberof google.cloud.vision.v1p3beta1.CropHint * @static - * @param {google.cloud.vision.v1p3beta1.IImageContext} message ImageContext message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.ICropHint} message CropHint message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageContext.encode = function encode(message, writer) { + CropHint.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.latLongRect != null && message.hasOwnProperty("latLongRect")) - $root.google.cloud.vision.v1p3beta1.LatLongRect.encode(message.latLongRect, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.languageHints != null && message.languageHints.length) - for (var i = 0; i < message.languageHints.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageHints[i]); - if (message.cropHintsParams != null && message.hasOwnProperty("cropHintsParams")) - $root.google.cloud.vision.v1p3beta1.CropHintsParams.encode(message.cropHintsParams, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.productSearchParams != null && message.hasOwnProperty("productSearchParams")) - $root.google.cloud.vision.v1p3beta1.ProductSearchParams.encode(message.productSearchParams, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.webDetectionParams != null && message.hasOwnProperty("webDetectionParams")) - $root.google.cloud.vision.v1p3beta1.WebDetectionParams.encode(message.webDetectionParams, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + $root.google.cloud.vision.v1p3beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.confidence != null && message.hasOwnProperty("confidence")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); + if (message.importanceFraction != null && message.hasOwnProperty("importanceFraction")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.importanceFraction); return writer; }; /** - * Encodes the specified ImageContext message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImageContext.verify|verify} messages. + * Encodes the specified CropHint message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.CropHint.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ImageContext + * @memberof google.cloud.vision.v1p3beta1.CropHint * @static - * @param {google.cloud.vision.v1p3beta1.IImageContext} message ImageContext message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.ICropHint} message CropHint message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageContext.encodeDelimited = function encodeDelimited(message, writer) { + CropHint.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImageContext message from the specified reader or buffer. + * Decodes a CropHint message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.ImageContext + * @memberof google.cloud.vision.v1p3beta1.CropHint * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.ImageContext} ImageContext + * @returns {google.cloud.vision.v1p3beta1.CropHint} CropHint * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageContext.decode = function decode(reader, length) { + CropHint.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.vision.v1p3beta1.ImageContext(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.CropHint(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.latLongRect = $root.google.cloud.vision.v1p3beta1.LatLongRect.decode(reader, reader.uint32()); + message.boundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.decode(reader, reader.uint32()); break; case 2: - if (!(message.languageHints && message.languageHints.length)) - message.languageHints = []; - message.languageHints.push(reader.string()); - break; - case 4: - message.cropHintsParams = $root.google.cloud.vision.v1p3beta1.CropHintsParams.decode(reader, reader.uint32()); - break; - case 5: - message.productSearchParams = $root.google.cloud.vision.v1p3beta1.ProductSearchParams.decode(reader, reader.uint32()); + message.confidence = reader.float(); break; - case 6: - message.webDetectionParams = $root.google.cloud.vision.v1p3beta1.WebDetectionParams.decode(reader, reader.uint32()); + case 3: + message.importanceFraction = reader.float(); break; default: reader.skipType(tag & 7); @@ -55489,176 +55726,130 @@ }; /** - * Decodes an ImageContext message from the specified reader or buffer, length delimited. + * Decodes a CropHint message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ImageContext + * @memberof google.cloud.vision.v1p3beta1.CropHint * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.ImageContext} ImageContext + * @returns {google.cloud.vision.v1p3beta1.CropHint} CropHint * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageContext.decodeDelimited = function decodeDelimited(reader) { + CropHint.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImageContext message. + * Verifies a CropHint message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.ImageContext + * @memberof google.cloud.vision.v1p3beta1.CropHint * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImageContext.verify = function verify(message) { + CropHint.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.latLongRect != null && message.hasOwnProperty("latLongRect")) { - var error = $root.google.cloud.vision.v1p3beta1.LatLongRect.verify(message.latLongRect); - if (error) - return "latLongRect." + error; - } - if (message.languageHints != null && message.hasOwnProperty("languageHints")) { - if (!Array.isArray(message.languageHints)) - return "languageHints: array expected"; - for (var i = 0; i < message.languageHints.length; ++i) - if (!$util.isString(message.languageHints[i])) - return "languageHints: string[] expected"; - } - if (message.cropHintsParams != null && message.hasOwnProperty("cropHintsParams")) { - var error = $root.google.cloud.vision.v1p3beta1.CropHintsParams.verify(message.cropHintsParams); - if (error) - return "cropHintsParams." + error; - } - if (message.productSearchParams != null && message.hasOwnProperty("productSearchParams")) { - var error = $root.google.cloud.vision.v1p3beta1.ProductSearchParams.verify(message.productSearchParams); - if (error) - return "productSearchParams." + error; - } - if (message.webDetectionParams != null && message.hasOwnProperty("webDetectionParams")) { - var error = $root.google.cloud.vision.v1p3beta1.WebDetectionParams.verify(message.webDetectionParams); + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { + var error = $root.google.cloud.vision.v1p3beta1.BoundingPoly.verify(message.boundingPoly); if (error) - return "webDetectionParams." + error; + return "boundingPoly." + error; } + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + if (message.importanceFraction != null && message.hasOwnProperty("importanceFraction")) + if (typeof message.importanceFraction !== "number") + return "importanceFraction: number expected"; return null; }; /** - * Creates an ImageContext message from a plain object. Also converts values to their respective internal types. + * Creates a CropHint message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.ImageContext + * @memberof google.cloud.vision.v1p3beta1.CropHint * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.ImageContext} ImageContext + * @returns {google.cloud.vision.v1p3beta1.CropHint} CropHint */ - ImageContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.ImageContext) + CropHint.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.CropHint) return object; - var message = new $root.google.cloud.vision.v1p3beta1.ImageContext(); - if (object.latLongRect != null) { - if (typeof object.latLongRect !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.ImageContext.latLongRect: object expected"); - message.latLongRect = $root.google.cloud.vision.v1p3beta1.LatLongRect.fromObject(object.latLongRect); - } - if (object.languageHints) { - if (!Array.isArray(object.languageHints)) - throw TypeError(".google.cloud.vision.v1p3beta1.ImageContext.languageHints: array expected"); - message.languageHints = []; - for (var i = 0; i < object.languageHints.length; ++i) - message.languageHints[i] = String(object.languageHints[i]); - } - if (object.cropHintsParams != null) { - if (typeof object.cropHintsParams !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.ImageContext.cropHintsParams: object expected"); - message.cropHintsParams = $root.google.cloud.vision.v1p3beta1.CropHintsParams.fromObject(object.cropHintsParams); - } - if (object.productSearchParams != null) { - if (typeof object.productSearchParams !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.ImageContext.productSearchParams: object expected"); - message.productSearchParams = $root.google.cloud.vision.v1p3beta1.ProductSearchParams.fromObject(object.productSearchParams); - } - if (object.webDetectionParams != null) { - if (typeof object.webDetectionParams !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.ImageContext.webDetectionParams: object expected"); - message.webDetectionParams = $root.google.cloud.vision.v1p3beta1.WebDetectionParams.fromObject(object.webDetectionParams); + var message = new $root.google.cloud.vision.v1p3beta1.CropHint(); + if (object.boundingPoly != null) { + if (typeof object.boundingPoly !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.CropHint.boundingPoly: object expected"); + message.boundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.fromObject(object.boundingPoly); } + if (object.confidence != null) + message.confidence = Number(object.confidence); + if (object.importanceFraction != null) + message.importanceFraction = Number(object.importanceFraction); return message; }; /** - * Creates a plain object from an ImageContext message. Also converts values to other types if specified. + * Creates a plain object from a CropHint message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.ImageContext + * @memberof google.cloud.vision.v1p3beta1.CropHint * @static - * @param {google.cloud.vision.v1p3beta1.ImageContext} message ImageContext + * @param {google.cloud.vision.v1p3beta1.CropHint} message CropHint * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImageContext.toObject = function toObject(message, options) { + CropHint.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.languageHints = []; if (options.defaults) { - object.latLongRect = null; - object.cropHintsParams = null; - object.productSearchParams = null; - object.webDetectionParams = null; - } - if (message.latLongRect != null && message.hasOwnProperty("latLongRect")) - object.latLongRect = $root.google.cloud.vision.v1p3beta1.LatLongRect.toObject(message.latLongRect, options); - if (message.languageHints && message.languageHints.length) { - object.languageHints = []; - for (var j = 0; j < message.languageHints.length; ++j) - object.languageHints[j] = message.languageHints[j]; + object.boundingPoly = null; + object.confidence = 0; + object.importanceFraction = 0; } - if (message.cropHintsParams != null && message.hasOwnProperty("cropHintsParams")) - object.cropHintsParams = $root.google.cloud.vision.v1p3beta1.CropHintsParams.toObject(message.cropHintsParams, options); - if (message.productSearchParams != null && message.hasOwnProperty("productSearchParams")) - object.productSearchParams = $root.google.cloud.vision.v1p3beta1.ProductSearchParams.toObject(message.productSearchParams, options); - if (message.webDetectionParams != null && message.hasOwnProperty("webDetectionParams")) - object.webDetectionParams = $root.google.cloud.vision.v1p3beta1.WebDetectionParams.toObject(message.webDetectionParams, options); + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + object.boundingPoly = $root.google.cloud.vision.v1p3beta1.BoundingPoly.toObject(message.boundingPoly, options); + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + if (message.importanceFraction != null && message.hasOwnProperty("importanceFraction")) + object.importanceFraction = options.json && !isFinite(message.importanceFraction) ? String(message.importanceFraction) : message.importanceFraction; return object; }; /** - * Converts this ImageContext to JSON. + * Converts this CropHint to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.ImageContext + * @memberof google.cloud.vision.v1p3beta1.CropHint * @instance * @returns {Object.} JSON object */ - ImageContext.prototype.toJSON = function toJSON() { + CropHint.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImageContext; + return CropHint; })(); - v1p3beta1.AnnotateImageRequest = (function() { + v1p3beta1.CropHintsAnnotation = (function() { /** - * Properties of an AnnotateImageRequest. + * Properties of a CropHintsAnnotation. * @memberof google.cloud.vision.v1p3beta1 - * @interface IAnnotateImageRequest - * @property {google.cloud.vision.v1p3beta1.IImage|null} [image] AnnotateImageRequest image - * @property {Array.|null} [features] AnnotateImageRequest features - * @property {google.cloud.vision.v1p3beta1.IImageContext|null} [imageContext] AnnotateImageRequest imageContext + * @interface ICropHintsAnnotation + * @property {Array.|null} [cropHints] CropHintsAnnotation cropHints */ /** - * Constructs a new AnnotateImageRequest. + * Constructs a new CropHintsAnnotation. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an AnnotateImageRequest. - * @implements IAnnotateImageRequest + * @classdesc Represents a CropHintsAnnotation. + * @implements ICropHintsAnnotation * @constructor - * @param {google.cloud.vision.v1p3beta1.IAnnotateImageRequest=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.ICropHintsAnnotation=} [properties] Properties to set */ - function AnnotateImageRequest(properties) { - this.features = []; + function CropHintsAnnotation(properties) { + this.cropHints = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -55666,104 +55857,78 @@ } /** - * AnnotateImageRequest image. - * @member {google.cloud.vision.v1p3beta1.IImage|null|undefined} image - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest - * @instance - */ - AnnotateImageRequest.prototype.image = null; - - /** - * AnnotateImageRequest features. - * @member {Array.} features - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest - * @instance - */ - AnnotateImageRequest.prototype.features = $util.emptyArray; - - /** - * AnnotateImageRequest imageContext. - * @member {google.cloud.vision.v1p3beta1.IImageContext|null|undefined} imageContext - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest + * CropHintsAnnotation cropHints. + * @member {Array.} cropHints + * @memberof google.cloud.vision.v1p3beta1.CropHintsAnnotation * @instance */ - AnnotateImageRequest.prototype.imageContext = null; + CropHintsAnnotation.prototype.cropHints = $util.emptyArray; /** - * Creates a new AnnotateImageRequest instance using the specified properties. + * Creates a new CropHintsAnnotation instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p3beta1.CropHintsAnnotation * @static - * @param {google.cloud.vision.v1p3beta1.IAnnotateImageRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.AnnotateImageRequest} AnnotateImageRequest instance + * @param {google.cloud.vision.v1p3beta1.ICropHintsAnnotation=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.CropHintsAnnotation} CropHintsAnnotation instance */ - AnnotateImageRequest.create = function create(properties) { - return new AnnotateImageRequest(properties); + CropHintsAnnotation.create = function create(properties) { + return new CropHintsAnnotation(properties); }; /** - * Encodes the specified AnnotateImageRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.AnnotateImageRequest.verify|verify} messages. + * Encodes the specified CropHintsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p3beta1.CropHintsAnnotation.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p3beta1.CropHintsAnnotation * @static - * @param {google.cloud.vision.v1p3beta1.IAnnotateImageRequest} message AnnotateImageRequest message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.ICropHintsAnnotation} message CropHintsAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateImageRequest.encode = function encode(message, writer) { + CropHintsAnnotation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.image != null && message.hasOwnProperty("image")) - $root.google.cloud.vision.v1p3beta1.Image.encode(message.image, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.features != null && message.features.length) - for (var i = 0; i < message.features.length; ++i) - $root.google.cloud.vision.v1p3beta1.Feature.encode(message.features[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.imageContext != null && message.hasOwnProperty("imageContext")) - $root.google.cloud.vision.v1p3beta1.ImageContext.encode(message.imageContext, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.cropHints != null && message.cropHints.length) + for (var i = 0; i < message.cropHints.length; ++i) + $root.google.cloud.vision.v1p3beta1.CropHint.encode(message.cropHints[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified AnnotateImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.AnnotateImageRequest.verify|verify} messages. + * Encodes the specified CropHintsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.CropHintsAnnotation.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p3beta1.CropHintsAnnotation * @static - * @param {google.cloud.vision.v1p3beta1.IAnnotateImageRequest} message AnnotateImageRequest message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.ICropHintsAnnotation} message CropHintsAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateImageRequest.encodeDelimited = function encodeDelimited(message, writer) { + CropHintsAnnotation.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AnnotateImageRequest message from the specified reader or buffer. + * Decodes a CropHintsAnnotation message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p3beta1.CropHintsAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.AnnotateImageRequest} AnnotateImageRequest + * @returns {google.cloud.vision.v1p3beta1.CropHintsAnnotation} CropHintsAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateImageRequest.decode = function decode(reader, length) { + CropHintsAnnotation.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.vision.v1p3beta1.AnnotateImageRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.CropHintsAnnotation(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.image = $root.google.cloud.vision.v1p3beta1.Image.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.features && message.features.length)) - message.features = []; - message.features.push($root.google.cloud.vision.v1p3beta1.Feature.decode(reader, reader.uint32())); - break; - case 3: - message.imageContext = $root.google.cloud.vision.v1p3beta1.ImageContext.decode(reader, reader.uint32()); + if (!(message.cropHints && message.cropHints.length)) + message.cropHints = []; + message.cropHints.push($root.google.cloud.vision.v1p3beta1.CropHint.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -55774,153 +55939,125 @@ }; /** - * Decodes an AnnotateImageRequest message from the specified reader or buffer, length delimited. + * Decodes a CropHintsAnnotation message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p3beta1.CropHintsAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.AnnotateImageRequest} AnnotateImageRequest + * @returns {google.cloud.vision.v1p3beta1.CropHintsAnnotation} CropHintsAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateImageRequest.decodeDelimited = function decodeDelimited(reader) { + CropHintsAnnotation.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AnnotateImageRequest message. + * Verifies a CropHintsAnnotation message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p3beta1.CropHintsAnnotation * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AnnotateImageRequest.verify = function verify(message) { + CropHintsAnnotation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.image != null && message.hasOwnProperty("image")) { - var error = $root.google.cloud.vision.v1p3beta1.Image.verify(message.image); - if (error) - return "image." + error; - } - if (message.features != null && message.hasOwnProperty("features")) { - if (!Array.isArray(message.features)) - return "features: array expected"; - for (var i = 0; i < message.features.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.Feature.verify(message.features[i]); + if (message.cropHints != null && message.hasOwnProperty("cropHints")) { + if (!Array.isArray(message.cropHints)) + return "cropHints: array expected"; + for (var i = 0; i < message.cropHints.length; ++i) { + var error = $root.google.cloud.vision.v1p3beta1.CropHint.verify(message.cropHints[i]); if (error) - return "features." + error; + return "cropHints." + error; } } - if (message.imageContext != null && message.hasOwnProperty("imageContext")) { - var error = $root.google.cloud.vision.v1p3beta1.ImageContext.verify(message.imageContext); - if (error) - return "imageContext." + error; - } return null; }; /** - * Creates an AnnotateImageRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CropHintsAnnotation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p3beta1.CropHintsAnnotation * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.AnnotateImageRequest} AnnotateImageRequest + * @returns {google.cloud.vision.v1p3beta1.CropHintsAnnotation} CropHintsAnnotation */ - AnnotateImageRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.AnnotateImageRequest) + CropHintsAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.CropHintsAnnotation) return object; - var message = new $root.google.cloud.vision.v1p3beta1.AnnotateImageRequest(); - if (object.image != null) { - if (typeof object.image !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageRequest.image: object expected"); - message.image = $root.google.cloud.vision.v1p3beta1.Image.fromObject(object.image); - } - if (object.features) { - if (!Array.isArray(object.features)) - throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageRequest.features: array expected"); - message.features = []; - for (var i = 0; i < object.features.length; ++i) { - if (typeof object.features[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageRequest.features: object expected"); - message.features[i] = $root.google.cloud.vision.v1p3beta1.Feature.fromObject(object.features[i]); + var message = new $root.google.cloud.vision.v1p3beta1.CropHintsAnnotation(); + if (object.cropHints) { + if (!Array.isArray(object.cropHints)) + throw TypeError(".google.cloud.vision.v1p3beta1.CropHintsAnnotation.cropHints: array expected"); + message.cropHints = []; + for (var i = 0; i < object.cropHints.length; ++i) { + if (typeof object.cropHints[i] !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.CropHintsAnnotation.cropHints: object expected"); + message.cropHints[i] = $root.google.cloud.vision.v1p3beta1.CropHint.fromObject(object.cropHints[i]); } } - if (object.imageContext != null) { - if (typeof object.imageContext !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageRequest.imageContext: object expected"); - message.imageContext = $root.google.cloud.vision.v1p3beta1.ImageContext.fromObject(object.imageContext); - } return message; }; /** - * Creates a plain object from an AnnotateImageRequest message. Also converts values to other types if specified. + * Creates a plain object from a CropHintsAnnotation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p3beta1.CropHintsAnnotation * @static - * @param {google.cloud.vision.v1p3beta1.AnnotateImageRequest} message AnnotateImageRequest + * @param {google.cloud.vision.v1p3beta1.CropHintsAnnotation} message CropHintsAnnotation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AnnotateImageRequest.toObject = function toObject(message, options) { + CropHintsAnnotation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.features = []; - if (options.defaults) { - object.image = null; - object.imageContext = null; - } - if (message.image != null && message.hasOwnProperty("image")) - object.image = $root.google.cloud.vision.v1p3beta1.Image.toObject(message.image, options); - if (message.features && message.features.length) { - object.features = []; - for (var j = 0; j < message.features.length; ++j) - object.features[j] = $root.google.cloud.vision.v1p3beta1.Feature.toObject(message.features[j], options); + object.cropHints = []; + if (message.cropHints && message.cropHints.length) { + object.cropHints = []; + for (var j = 0; j < message.cropHints.length; ++j) + object.cropHints[j] = $root.google.cloud.vision.v1p3beta1.CropHint.toObject(message.cropHints[j], options); } - if (message.imageContext != null && message.hasOwnProperty("imageContext")) - object.imageContext = $root.google.cloud.vision.v1p3beta1.ImageContext.toObject(message.imageContext, options); return object; }; /** - * Converts this AnnotateImageRequest to JSON. + * Converts this CropHintsAnnotation to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p3beta1.CropHintsAnnotation * @instance * @returns {Object.} JSON object */ - AnnotateImageRequest.prototype.toJSON = function toJSON() { + CropHintsAnnotation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AnnotateImageRequest; + return CropHintsAnnotation; })(); - v1p3beta1.ImageAnnotationContext = (function() { + v1p3beta1.CropHintsParams = (function() { /** - * Properties of an ImageAnnotationContext. + * Properties of a CropHintsParams. * @memberof google.cloud.vision.v1p3beta1 - * @interface IImageAnnotationContext - * @property {string|null} [uri] ImageAnnotationContext uri - * @property {number|null} [pageNumber] ImageAnnotationContext pageNumber + * @interface ICropHintsParams + * @property {Array.|null} [aspectRatios] CropHintsParams aspectRatios */ /** - * Constructs a new ImageAnnotationContext. + * Constructs a new CropHintsParams. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an ImageAnnotationContext. - * @implements IImageAnnotationContext + * @classdesc Represents a CropHintsParams. + * @implements ICropHintsParams * @constructor - * @param {google.cloud.vision.v1p3beta1.IImageAnnotationContext=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.ICropHintsParams=} [properties] Properties to set */ - function ImageAnnotationContext(properties) { + function CropHintsParams(properties) { + this.aspectRatios = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -55928,88 +56065,86 @@ } /** - * ImageAnnotationContext uri. - * @member {string} uri - * @memberof google.cloud.vision.v1p3beta1.ImageAnnotationContext - * @instance - */ - ImageAnnotationContext.prototype.uri = ""; - - /** - * ImageAnnotationContext pageNumber. - * @member {number} pageNumber - * @memberof google.cloud.vision.v1p3beta1.ImageAnnotationContext + * CropHintsParams aspectRatios. + * @member {Array.} aspectRatios + * @memberof google.cloud.vision.v1p3beta1.CropHintsParams * @instance */ - ImageAnnotationContext.prototype.pageNumber = 0; + CropHintsParams.prototype.aspectRatios = $util.emptyArray; /** - * Creates a new ImageAnnotationContext instance using the specified properties. + * Creates a new CropHintsParams instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.ImageAnnotationContext + * @memberof google.cloud.vision.v1p3beta1.CropHintsParams * @static - * @param {google.cloud.vision.v1p3beta1.IImageAnnotationContext=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.ImageAnnotationContext} ImageAnnotationContext instance + * @param {google.cloud.vision.v1p3beta1.ICropHintsParams=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.CropHintsParams} CropHintsParams instance */ - ImageAnnotationContext.create = function create(properties) { - return new ImageAnnotationContext(properties); + CropHintsParams.create = function create(properties) { + return new CropHintsParams(properties); }; /** - * Encodes the specified ImageAnnotationContext message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImageAnnotationContext.verify|verify} messages. + * Encodes the specified CropHintsParams message. Does not implicitly {@link google.cloud.vision.v1p3beta1.CropHintsParams.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.ImageAnnotationContext + * @memberof google.cloud.vision.v1p3beta1.CropHintsParams * @static - * @param {google.cloud.vision.v1p3beta1.IImageAnnotationContext} message ImageAnnotationContext message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.ICropHintsParams} message CropHintsParams message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageAnnotationContext.encode = function encode(message, writer) { + CropHintsParams.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.uri != null && message.hasOwnProperty("uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); - if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageNumber); + if (message.aspectRatios != null && message.aspectRatios.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.aspectRatios.length; ++i) + writer.float(message.aspectRatios[i]); + writer.ldelim(); + } return writer; }; /** - * Encodes the specified ImageAnnotationContext message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImageAnnotationContext.verify|verify} messages. + * Encodes the specified CropHintsParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.CropHintsParams.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ImageAnnotationContext + * @memberof google.cloud.vision.v1p3beta1.CropHintsParams * @static - * @param {google.cloud.vision.v1p3beta1.IImageAnnotationContext} message ImageAnnotationContext message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.ICropHintsParams} message CropHintsParams message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageAnnotationContext.encodeDelimited = function encodeDelimited(message, writer) { + CropHintsParams.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImageAnnotationContext message from the specified reader or buffer. + * Decodes a CropHintsParams message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.ImageAnnotationContext + * @memberof google.cloud.vision.v1p3beta1.CropHintsParams * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.ImageAnnotationContext} ImageAnnotationContext + * @returns {google.cloud.vision.v1p3beta1.CropHintsParams} CropHintsParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageAnnotationContext.decode = function decode(reader, length) { + CropHintsParams.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.vision.v1p3beta1.ImageAnnotationContext(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.CropHintsParams(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.uri = reader.string(); - break; - case 2: - message.pageNumber = reader.int32(); + if (!(message.aspectRatios && message.aspectRatios.length)) + message.aspectRatios = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.aspectRatios.push(reader.float()); + } else + message.aspectRatios.push(reader.float()); break; default: reader.skipType(tag & 7); @@ -56020,135 +56155,119 @@ }; /** - * Decodes an ImageAnnotationContext message from the specified reader or buffer, length delimited. + * Decodes a CropHintsParams message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.ImageAnnotationContext + * @memberof google.cloud.vision.v1p3beta1.CropHintsParams * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.ImageAnnotationContext} ImageAnnotationContext + * @returns {google.cloud.vision.v1p3beta1.CropHintsParams} CropHintsParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageAnnotationContext.decodeDelimited = function decodeDelimited(reader) { + CropHintsParams.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImageAnnotationContext message. + * Verifies a CropHintsParams message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.ImageAnnotationContext + * @memberof google.cloud.vision.v1p3beta1.CropHintsParams * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImageAnnotationContext.verify = function verify(message) { + CropHintsParams.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) - if (!$util.isInteger(message.pageNumber)) - return "pageNumber: integer expected"; + if (message.aspectRatios != null && message.hasOwnProperty("aspectRatios")) { + if (!Array.isArray(message.aspectRatios)) + return "aspectRatios: array expected"; + for (var i = 0; i < message.aspectRatios.length; ++i) + if (typeof message.aspectRatios[i] !== "number") + return "aspectRatios: number[] expected"; + } return null; }; /** - * Creates an ImageAnnotationContext message from a plain object. Also converts values to their respective internal types. + * Creates a CropHintsParams message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.ImageAnnotationContext + * @memberof google.cloud.vision.v1p3beta1.CropHintsParams * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.ImageAnnotationContext} ImageAnnotationContext + * @returns {google.cloud.vision.v1p3beta1.CropHintsParams} CropHintsParams */ - ImageAnnotationContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.ImageAnnotationContext) + CropHintsParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.CropHintsParams) return object; - var message = new $root.google.cloud.vision.v1p3beta1.ImageAnnotationContext(); - if (object.uri != null) - message.uri = String(object.uri); - if (object.pageNumber != null) - message.pageNumber = object.pageNumber | 0; + var message = new $root.google.cloud.vision.v1p3beta1.CropHintsParams(); + if (object.aspectRatios) { + if (!Array.isArray(object.aspectRatios)) + throw TypeError(".google.cloud.vision.v1p3beta1.CropHintsParams.aspectRatios: array expected"); + message.aspectRatios = []; + for (var i = 0; i < object.aspectRatios.length; ++i) + message.aspectRatios[i] = Number(object.aspectRatios[i]); + } return message; }; /** - * Creates a plain object from an ImageAnnotationContext message. Also converts values to other types if specified. + * Creates a plain object from a CropHintsParams message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.ImageAnnotationContext + * @memberof google.cloud.vision.v1p3beta1.CropHintsParams * @static - * @param {google.cloud.vision.v1p3beta1.ImageAnnotationContext} message ImageAnnotationContext + * @param {google.cloud.vision.v1p3beta1.CropHintsParams} message CropHintsParams * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImageAnnotationContext.toObject = function toObject(message, options) { + CropHintsParams.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.uri = ""; - object.pageNumber = 0; + if (options.arrays || options.defaults) + object.aspectRatios = []; + if (message.aspectRatios && message.aspectRatios.length) { + object.aspectRatios = []; + for (var j = 0; j < message.aspectRatios.length; ++j) + object.aspectRatios[j] = options.json && !isFinite(message.aspectRatios[j]) ? String(message.aspectRatios[j]) : message.aspectRatios[j]; } - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) - object.pageNumber = message.pageNumber; return object; }; /** - * Converts this ImageAnnotationContext to JSON. + * Converts this CropHintsParams to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.ImageAnnotationContext + * @memberof google.cloud.vision.v1p3beta1.CropHintsParams * @instance * @returns {Object.} JSON object */ - ImageAnnotationContext.prototype.toJSON = function toJSON() { + CropHintsParams.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImageAnnotationContext; + return CropHintsParams; })(); - v1p3beta1.AnnotateImageResponse = (function() { + v1p3beta1.WebDetectionParams = (function() { /** - * Properties of an AnnotateImageResponse. + * Properties of a WebDetectionParams. * @memberof google.cloud.vision.v1p3beta1 - * @interface IAnnotateImageResponse - * @property {Array.|null} [faceAnnotations] AnnotateImageResponse faceAnnotations - * @property {Array.|null} [landmarkAnnotations] AnnotateImageResponse landmarkAnnotations - * @property {Array.|null} [logoAnnotations] AnnotateImageResponse logoAnnotations - * @property {Array.|null} [labelAnnotations] AnnotateImageResponse labelAnnotations - * @property {Array.|null} [localizedObjectAnnotations] AnnotateImageResponse localizedObjectAnnotations - * @property {Array.|null} [textAnnotations] AnnotateImageResponse textAnnotations - * @property {google.cloud.vision.v1p3beta1.ITextAnnotation|null} [fullTextAnnotation] AnnotateImageResponse fullTextAnnotation - * @property {google.cloud.vision.v1p3beta1.ISafeSearchAnnotation|null} [safeSearchAnnotation] AnnotateImageResponse safeSearchAnnotation - * @property {google.cloud.vision.v1p3beta1.IImageProperties|null} [imagePropertiesAnnotation] AnnotateImageResponse imagePropertiesAnnotation - * @property {google.cloud.vision.v1p3beta1.ICropHintsAnnotation|null} [cropHintsAnnotation] AnnotateImageResponse cropHintsAnnotation - * @property {google.cloud.vision.v1p3beta1.IWebDetection|null} [webDetection] AnnotateImageResponse webDetection - * @property {google.cloud.vision.v1p3beta1.IProductSearchResults|null} [productSearchResults] AnnotateImageResponse productSearchResults - * @property {google.rpc.IStatus|null} [error] AnnotateImageResponse error - * @property {google.cloud.vision.v1p3beta1.IImageAnnotationContext|null} [context] AnnotateImageResponse context + * @interface IWebDetectionParams + * @property {boolean|null} [includeGeoResults] WebDetectionParams includeGeoResults */ /** - * Constructs a new AnnotateImageResponse. + * Constructs a new WebDetectionParams. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an AnnotateImageResponse. - * @implements IAnnotateImageResponse + * @classdesc Represents a WebDetectionParams. + * @implements IWebDetectionParams * @constructor - * @param {google.cloud.vision.v1p3beta1.IAnnotateImageResponse=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.IWebDetectionParams=} [properties] Properties to set */ - function AnnotateImageResponse(properties) { - this.faceAnnotations = []; - this.landmarkAnnotations = []; - this.logoAnnotations = []; - this.labelAnnotations = []; - this.localizedObjectAnnotations = []; - this.textAnnotations = []; + function WebDetectionParams(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -56156,624 +56275,191 @@ } /** - * AnnotateImageResponse faceAnnotations. - * @member {Array.} faceAnnotations - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.faceAnnotations = $util.emptyArray; - - /** - * AnnotateImageResponse landmarkAnnotations. - * @member {Array.} landmarkAnnotations - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.landmarkAnnotations = $util.emptyArray; - - /** - * AnnotateImageResponse logoAnnotations. - * @member {Array.} logoAnnotations - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.logoAnnotations = $util.emptyArray; - - /** - * AnnotateImageResponse labelAnnotations. - * @member {Array.} labelAnnotations - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.labelAnnotations = $util.emptyArray; - - /** - * AnnotateImageResponse localizedObjectAnnotations. - * @member {Array.} localizedObjectAnnotations - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.localizedObjectAnnotations = $util.emptyArray; - - /** - * AnnotateImageResponse textAnnotations. - * @member {Array.} textAnnotations - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.textAnnotations = $util.emptyArray; - - /** - * AnnotateImageResponse fullTextAnnotation. - * @member {google.cloud.vision.v1p3beta1.ITextAnnotation|null|undefined} fullTextAnnotation - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.fullTextAnnotation = null; - - /** - * AnnotateImageResponse safeSearchAnnotation. - * @member {google.cloud.vision.v1p3beta1.ISafeSearchAnnotation|null|undefined} safeSearchAnnotation - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.safeSearchAnnotation = null; - - /** - * AnnotateImageResponse imagePropertiesAnnotation. - * @member {google.cloud.vision.v1p3beta1.IImageProperties|null|undefined} imagePropertiesAnnotation - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.imagePropertiesAnnotation = null; - - /** - * AnnotateImageResponse cropHintsAnnotation. - * @member {google.cloud.vision.v1p3beta1.ICropHintsAnnotation|null|undefined} cropHintsAnnotation - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.cropHintsAnnotation = null; - - /** - * AnnotateImageResponse webDetection. - * @member {google.cloud.vision.v1p3beta1.IWebDetection|null|undefined} webDetection - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.webDetection = null; - - /** - * AnnotateImageResponse productSearchResults. - * @member {google.cloud.vision.v1p3beta1.IProductSearchResults|null|undefined} productSearchResults - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.productSearchResults = null; - - /** - * AnnotateImageResponse error. - * @member {google.rpc.IStatus|null|undefined} error - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.error = null; - - /** - * AnnotateImageResponse context. - * @member {google.cloud.vision.v1p3beta1.IImageAnnotationContext|null|undefined} context - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse + * WebDetectionParams includeGeoResults. + * @member {boolean} includeGeoResults + * @memberof google.cloud.vision.v1p3beta1.WebDetectionParams * @instance */ - AnnotateImageResponse.prototype.context = null; + WebDetectionParams.prototype.includeGeoResults = false; /** - * Creates a new AnnotateImageResponse instance using the specified properties. + * Creates a new WebDetectionParams instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p3beta1.WebDetectionParams * @static - * @param {google.cloud.vision.v1p3beta1.IAnnotateImageResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.AnnotateImageResponse} AnnotateImageResponse instance + * @param {google.cloud.vision.v1p3beta1.IWebDetectionParams=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.WebDetectionParams} WebDetectionParams instance */ - AnnotateImageResponse.create = function create(properties) { - return new AnnotateImageResponse(properties); + WebDetectionParams.create = function create(properties) { + return new WebDetectionParams(properties); }; /** - * Encodes the specified AnnotateImageResponse message. Does not implicitly {@link google.cloud.vision.v1p3beta1.AnnotateImageResponse.verify|verify} messages. + * Encodes the specified WebDetectionParams message. Does not implicitly {@link google.cloud.vision.v1p3beta1.WebDetectionParams.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p3beta1.WebDetectionParams * @static - * @param {google.cloud.vision.v1p3beta1.IAnnotateImageResponse} message AnnotateImageResponse message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IWebDetectionParams} message WebDetectionParams message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateImageResponse.encode = function encode(message, writer) { + WebDetectionParams.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.faceAnnotations != null && message.faceAnnotations.length) - for (var i = 0; i < message.faceAnnotations.length; ++i) - $root.google.cloud.vision.v1p3beta1.FaceAnnotation.encode(message.faceAnnotations[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.landmarkAnnotations != null && message.landmarkAnnotations.length) - for (var i = 0; i < message.landmarkAnnotations.length; ++i) - $root.google.cloud.vision.v1p3beta1.EntityAnnotation.encode(message.landmarkAnnotations[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.logoAnnotations != null && message.logoAnnotations.length) - for (var i = 0; i < message.logoAnnotations.length; ++i) - $root.google.cloud.vision.v1p3beta1.EntityAnnotation.encode(message.logoAnnotations[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.labelAnnotations != null && message.labelAnnotations.length) - for (var i = 0; i < message.labelAnnotations.length; ++i) - $root.google.cloud.vision.v1p3beta1.EntityAnnotation.encode(message.labelAnnotations[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.textAnnotations != null && message.textAnnotations.length) - for (var i = 0; i < message.textAnnotations.length; ++i) - $root.google.cloud.vision.v1p3beta1.EntityAnnotation.encode(message.textAnnotations[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.safeSearchAnnotation != null && message.hasOwnProperty("safeSearchAnnotation")) - $root.google.cloud.vision.v1p3beta1.SafeSearchAnnotation.encode(message.safeSearchAnnotation, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.imagePropertiesAnnotation != null && message.hasOwnProperty("imagePropertiesAnnotation")) - $root.google.cloud.vision.v1p3beta1.ImageProperties.encode(message.imagePropertiesAnnotation, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.error != null && message.hasOwnProperty("error")) - $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.cropHintsAnnotation != null && message.hasOwnProperty("cropHintsAnnotation")) - $root.google.cloud.vision.v1p3beta1.CropHintsAnnotation.encode(message.cropHintsAnnotation, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.fullTextAnnotation != null && message.hasOwnProperty("fullTextAnnotation")) - $root.google.cloud.vision.v1p3beta1.TextAnnotation.encode(message.fullTextAnnotation, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.webDetection != null && message.hasOwnProperty("webDetection")) - $root.google.cloud.vision.v1p3beta1.WebDetection.encode(message.webDetection, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); - if (message.productSearchResults != null && message.hasOwnProperty("productSearchResults")) - $root.google.cloud.vision.v1p3beta1.ProductSearchResults.encode(message.productSearchResults, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); - if (message.context != null && message.hasOwnProperty("context")) - $root.google.cloud.vision.v1p3beta1.ImageAnnotationContext.encode(message.context, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); - if (message.localizedObjectAnnotations != null && message.localizedObjectAnnotations.length) - for (var i = 0; i < message.localizedObjectAnnotations.length; ++i) - $root.google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation.encode(message.localizedObjectAnnotations[i], writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); + if (message.includeGeoResults != null && message.hasOwnProperty("includeGeoResults")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.includeGeoResults); return writer; }; /** - * Encodes the specified AnnotateImageResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.AnnotateImageResponse.verify|verify} messages. + * Encodes the specified WebDetectionParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.WebDetectionParams.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p3beta1.WebDetectionParams * @static - * @param {google.cloud.vision.v1p3beta1.IAnnotateImageResponse} message AnnotateImageResponse message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IWebDetectionParams} message WebDetectionParams message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateImageResponse.encodeDelimited = function encodeDelimited(message, writer) { + WebDetectionParams.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AnnotateImageResponse message from the specified reader or buffer. + * Decodes a WebDetectionParams message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.AnnotateImageResponse} AnnotateImageResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AnnotateImageResponse.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.vision.v1p3beta1.AnnotateImageResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.faceAnnotations && message.faceAnnotations.length)) - message.faceAnnotations = []; - message.faceAnnotations.push($root.google.cloud.vision.v1p3beta1.FaceAnnotation.decode(reader, reader.uint32())); - break; - case 2: - if (!(message.landmarkAnnotations && message.landmarkAnnotations.length)) - message.landmarkAnnotations = []; - message.landmarkAnnotations.push($root.google.cloud.vision.v1p3beta1.EntityAnnotation.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.logoAnnotations && message.logoAnnotations.length)) - message.logoAnnotations = []; - message.logoAnnotations.push($root.google.cloud.vision.v1p3beta1.EntityAnnotation.decode(reader, reader.uint32())); - break; - case 4: - if (!(message.labelAnnotations && message.labelAnnotations.length)) - message.labelAnnotations = []; - message.labelAnnotations.push($root.google.cloud.vision.v1p3beta1.EntityAnnotation.decode(reader, reader.uint32())); - break; - case 22: - if (!(message.localizedObjectAnnotations && message.localizedObjectAnnotations.length)) - message.localizedObjectAnnotations = []; - message.localizedObjectAnnotations.push($root.google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation.decode(reader, reader.uint32())); - break; - case 5: - if (!(message.textAnnotations && message.textAnnotations.length)) - message.textAnnotations = []; - message.textAnnotations.push($root.google.cloud.vision.v1p3beta1.EntityAnnotation.decode(reader, reader.uint32())); - break; - case 12: - message.fullTextAnnotation = $root.google.cloud.vision.v1p3beta1.TextAnnotation.decode(reader, reader.uint32()); - break; - case 6: - message.safeSearchAnnotation = $root.google.cloud.vision.v1p3beta1.SafeSearchAnnotation.decode(reader, reader.uint32()); - break; - case 8: - message.imagePropertiesAnnotation = $root.google.cloud.vision.v1p3beta1.ImageProperties.decode(reader, reader.uint32()); - break; - case 11: - message.cropHintsAnnotation = $root.google.cloud.vision.v1p3beta1.CropHintsAnnotation.decode(reader, reader.uint32()); - break; - case 13: - message.webDetection = $root.google.cloud.vision.v1p3beta1.WebDetection.decode(reader, reader.uint32()); - break; - case 14: - message.productSearchResults = $root.google.cloud.vision.v1p3beta1.ProductSearchResults.decode(reader, reader.uint32()); - break; - case 9: - message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); - break; - case 21: - message.context = $root.google.cloud.vision.v1p3beta1.ImageAnnotationContext.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AnnotateImageResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.AnnotateImageResponse} AnnotateImageResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AnnotateImageResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AnnotateImageResponse message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - AnnotateImageResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.faceAnnotations != null && message.hasOwnProperty("faceAnnotations")) { - if (!Array.isArray(message.faceAnnotations)) - return "faceAnnotations: array expected"; - for (var i = 0; i < message.faceAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.FaceAnnotation.verify(message.faceAnnotations[i]); - if (error) - return "faceAnnotations." + error; - } - } - if (message.landmarkAnnotations != null && message.hasOwnProperty("landmarkAnnotations")) { - if (!Array.isArray(message.landmarkAnnotations)) - return "landmarkAnnotations: array expected"; - for (var i = 0; i < message.landmarkAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.EntityAnnotation.verify(message.landmarkAnnotations[i]); - if (error) - return "landmarkAnnotations." + error; - } - } - if (message.logoAnnotations != null && message.hasOwnProperty("logoAnnotations")) { - if (!Array.isArray(message.logoAnnotations)) - return "logoAnnotations: array expected"; - for (var i = 0; i < message.logoAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.EntityAnnotation.verify(message.logoAnnotations[i]); - if (error) - return "logoAnnotations." + error; - } - } - if (message.labelAnnotations != null && message.hasOwnProperty("labelAnnotations")) { - if (!Array.isArray(message.labelAnnotations)) - return "labelAnnotations: array expected"; - for (var i = 0; i < message.labelAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.EntityAnnotation.verify(message.labelAnnotations[i]); - if (error) - return "labelAnnotations." + error; - } - } - if (message.localizedObjectAnnotations != null && message.hasOwnProperty("localizedObjectAnnotations")) { - if (!Array.isArray(message.localizedObjectAnnotations)) - return "localizedObjectAnnotations: array expected"; - for (var i = 0; i < message.localizedObjectAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation.verify(message.localizedObjectAnnotations[i]); - if (error) - return "localizedObjectAnnotations." + error; - } - } - if (message.textAnnotations != null && message.hasOwnProperty("textAnnotations")) { - if (!Array.isArray(message.textAnnotations)) - return "textAnnotations: array expected"; - for (var i = 0; i < message.textAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.EntityAnnotation.verify(message.textAnnotations[i]); - if (error) - return "textAnnotations." + error; - } - } - if (message.fullTextAnnotation != null && message.hasOwnProperty("fullTextAnnotation")) { - var error = $root.google.cloud.vision.v1p3beta1.TextAnnotation.verify(message.fullTextAnnotation); - if (error) - return "fullTextAnnotation." + error; - } - if (message.safeSearchAnnotation != null && message.hasOwnProperty("safeSearchAnnotation")) { - var error = $root.google.cloud.vision.v1p3beta1.SafeSearchAnnotation.verify(message.safeSearchAnnotation); - if (error) - return "safeSearchAnnotation." + error; - } - if (message.imagePropertiesAnnotation != null && message.hasOwnProperty("imagePropertiesAnnotation")) { - var error = $root.google.cloud.vision.v1p3beta1.ImageProperties.verify(message.imagePropertiesAnnotation); - if (error) - return "imagePropertiesAnnotation." + error; - } - if (message.cropHintsAnnotation != null && message.hasOwnProperty("cropHintsAnnotation")) { - var error = $root.google.cloud.vision.v1p3beta1.CropHintsAnnotation.verify(message.cropHintsAnnotation); - if (error) - return "cropHintsAnnotation." + error; - } - if (message.webDetection != null && message.hasOwnProperty("webDetection")) { - var error = $root.google.cloud.vision.v1p3beta1.WebDetection.verify(message.webDetection); - if (error) - return "webDetection." + error; - } - if (message.productSearchResults != null && message.hasOwnProperty("productSearchResults")) { - var error = $root.google.cloud.vision.v1p3beta1.ProductSearchResults.verify(message.productSearchResults); - if (error) - return "productSearchResults." + error; - } - if (message.error != null && message.hasOwnProperty("error")) { - var error = $root.google.rpc.Status.verify(message.error); - if (error) - return "error." + error; - } - if (message.context != null && message.hasOwnProperty("context")) { - var error = $root.google.cloud.vision.v1p3beta1.ImageAnnotationContext.verify(message.context); - if (error) - return "context." + error; + * @memberof google.cloud.vision.v1p3beta1.WebDetectionParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.vision.v1p3beta1.WebDetectionParams} WebDetectionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebDetectionParams.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.vision.v1p3beta1.WebDetectionParams(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.includeGeoResults = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } } + return message; + }; + + /** + * Decodes a WebDetectionParams message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.vision.v1p3beta1.WebDetectionParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.vision.v1p3beta1.WebDetectionParams} WebDetectionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebDetectionParams.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WebDetectionParams message. + * @function verify + * @memberof google.cloud.vision.v1p3beta1.WebDetectionParams + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WebDetectionParams.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.includeGeoResults != null && message.hasOwnProperty("includeGeoResults")) + if (typeof message.includeGeoResults !== "boolean") + return "includeGeoResults: boolean expected"; return null; }; /** - * Creates an AnnotateImageResponse message from a plain object. Also converts values to their respective internal types. + * Creates a WebDetectionParams message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p3beta1.WebDetectionParams * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.AnnotateImageResponse} AnnotateImageResponse + * @returns {google.cloud.vision.v1p3beta1.WebDetectionParams} WebDetectionParams */ - AnnotateImageResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.AnnotateImageResponse) + WebDetectionParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.WebDetectionParams) return object; - var message = new $root.google.cloud.vision.v1p3beta1.AnnotateImageResponse(); - if (object.faceAnnotations) { - if (!Array.isArray(object.faceAnnotations)) - throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.faceAnnotations: array expected"); - message.faceAnnotations = []; - for (var i = 0; i < object.faceAnnotations.length; ++i) { - if (typeof object.faceAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.faceAnnotations: object expected"); - message.faceAnnotations[i] = $root.google.cloud.vision.v1p3beta1.FaceAnnotation.fromObject(object.faceAnnotations[i]); - } - } - if (object.landmarkAnnotations) { - if (!Array.isArray(object.landmarkAnnotations)) - throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.landmarkAnnotations: array expected"); - message.landmarkAnnotations = []; - for (var i = 0; i < object.landmarkAnnotations.length; ++i) { - if (typeof object.landmarkAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.landmarkAnnotations: object expected"); - message.landmarkAnnotations[i] = $root.google.cloud.vision.v1p3beta1.EntityAnnotation.fromObject(object.landmarkAnnotations[i]); - } - } - if (object.logoAnnotations) { - if (!Array.isArray(object.logoAnnotations)) - throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.logoAnnotations: array expected"); - message.logoAnnotations = []; - for (var i = 0; i < object.logoAnnotations.length; ++i) { - if (typeof object.logoAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.logoAnnotations: object expected"); - message.logoAnnotations[i] = $root.google.cloud.vision.v1p3beta1.EntityAnnotation.fromObject(object.logoAnnotations[i]); - } - } - if (object.labelAnnotations) { - if (!Array.isArray(object.labelAnnotations)) - throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.labelAnnotations: array expected"); - message.labelAnnotations = []; - for (var i = 0; i < object.labelAnnotations.length; ++i) { - if (typeof object.labelAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.labelAnnotations: object expected"); - message.labelAnnotations[i] = $root.google.cloud.vision.v1p3beta1.EntityAnnotation.fromObject(object.labelAnnotations[i]); - } - } - if (object.localizedObjectAnnotations) { - if (!Array.isArray(object.localizedObjectAnnotations)) - throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.localizedObjectAnnotations: array expected"); - message.localizedObjectAnnotations = []; - for (var i = 0; i < object.localizedObjectAnnotations.length; ++i) { - if (typeof object.localizedObjectAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.localizedObjectAnnotations: object expected"); - message.localizedObjectAnnotations[i] = $root.google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation.fromObject(object.localizedObjectAnnotations[i]); - } - } - if (object.textAnnotations) { - if (!Array.isArray(object.textAnnotations)) - throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.textAnnotations: array expected"); - message.textAnnotations = []; - for (var i = 0; i < object.textAnnotations.length; ++i) { - if (typeof object.textAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.textAnnotations: object expected"); - message.textAnnotations[i] = $root.google.cloud.vision.v1p3beta1.EntityAnnotation.fromObject(object.textAnnotations[i]); - } - } - if (object.fullTextAnnotation != null) { - if (typeof object.fullTextAnnotation !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.fullTextAnnotation: object expected"); - message.fullTextAnnotation = $root.google.cloud.vision.v1p3beta1.TextAnnotation.fromObject(object.fullTextAnnotation); - } - if (object.safeSearchAnnotation != null) { - if (typeof object.safeSearchAnnotation !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.safeSearchAnnotation: object expected"); - message.safeSearchAnnotation = $root.google.cloud.vision.v1p3beta1.SafeSearchAnnotation.fromObject(object.safeSearchAnnotation); - } - if (object.imagePropertiesAnnotation != null) { - if (typeof object.imagePropertiesAnnotation !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.imagePropertiesAnnotation: object expected"); - message.imagePropertiesAnnotation = $root.google.cloud.vision.v1p3beta1.ImageProperties.fromObject(object.imagePropertiesAnnotation); - } - if (object.cropHintsAnnotation != null) { - if (typeof object.cropHintsAnnotation !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.cropHintsAnnotation: object expected"); - message.cropHintsAnnotation = $root.google.cloud.vision.v1p3beta1.CropHintsAnnotation.fromObject(object.cropHintsAnnotation); - } - if (object.webDetection != null) { - if (typeof object.webDetection !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.webDetection: object expected"); - message.webDetection = $root.google.cloud.vision.v1p3beta1.WebDetection.fromObject(object.webDetection); - } - if (object.productSearchResults != null) { - if (typeof object.productSearchResults !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.productSearchResults: object expected"); - message.productSearchResults = $root.google.cloud.vision.v1p3beta1.ProductSearchResults.fromObject(object.productSearchResults); - } - if (object.error != null) { - if (typeof object.error !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.error: object expected"); - message.error = $root.google.rpc.Status.fromObject(object.error); - } - if (object.context != null) { - if (typeof object.context !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.context: object expected"); - message.context = $root.google.cloud.vision.v1p3beta1.ImageAnnotationContext.fromObject(object.context); - } + var message = new $root.google.cloud.vision.v1p3beta1.WebDetectionParams(); + if (object.includeGeoResults != null) + message.includeGeoResults = Boolean(object.includeGeoResults); return message; }; /** - * Creates a plain object from an AnnotateImageResponse message. Also converts values to other types if specified. + * Creates a plain object from a WebDetectionParams message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p3beta1.WebDetectionParams * @static - * @param {google.cloud.vision.v1p3beta1.AnnotateImageResponse} message AnnotateImageResponse + * @param {google.cloud.vision.v1p3beta1.WebDetectionParams} message WebDetectionParams * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AnnotateImageResponse.toObject = function toObject(message, options) { + WebDetectionParams.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.faceAnnotations = []; - object.landmarkAnnotations = []; - object.logoAnnotations = []; - object.labelAnnotations = []; - object.textAnnotations = []; - object.localizedObjectAnnotations = []; - } - if (options.defaults) { - object.safeSearchAnnotation = null; - object.imagePropertiesAnnotation = null; - object.error = null; - object.cropHintsAnnotation = null; - object.fullTextAnnotation = null; - object.webDetection = null; - object.productSearchResults = null; - object.context = null; - } - if (message.faceAnnotations && message.faceAnnotations.length) { - object.faceAnnotations = []; - for (var j = 0; j < message.faceAnnotations.length; ++j) - object.faceAnnotations[j] = $root.google.cloud.vision.v1p3beta1.FaceAnnotation.toObject(message.faceAnnotations[j], options); - } - if (message.landmarkAnnotations && message.landmarkAnnotations.length) { - object.landmarkAnnotations = []; - for (var j = 0; j < message.landmarkAnnotations.length; ++j) - object.landmarkAnnotations[j] = $root.google.cloud.vision.v1p3beta1.EntityAnnotation.toObject(message.landmarkAnnotations[j], options); - } - if (message.logoAnnotations && message.logoAnnotations.length) { - object.logoAnnotations = []; - for (var j = 0; j < message.logoAnnotations.length; ++j) - object.logoAnnotations[j] = $root.google.cloud.vision.v1p3beta1.EntityAnnotation.toObject(message.logoAnnotations[j], options); - } - if (message.labelAnnotations && message.labelAnnotations.length) { - object.labelAnnotations = []; - for (var j = 0; j < message.labelAnnotations.length; ++j) - object.labelAnnotations[j] = $root.google.cloud.vision.v1p3beta1.EntityAnnotation.toObject(message.labelAnnotations[j], options); - } - if (message.textAnnotations && message.textAnnotations.length) { - object.textAnnotations = []; - for (var j = 0; j < message.textAnnotations.length; ++j) - object.textAnnotations[j] = $root.google.cloud.vision.v1p3beta1.EntityAnnotation.toObject(message.textAnnotations[j], options); - } - if (message.safeSearchAnnotation != null && message.hasOwnProperty("safeSearchAnnotation")) - object.safeSearchAnnotation = $root.google.cloud.vision.v1p3beta1.SafeSearchAnnotation.toObject(message.safeSearchAnnotation, options); - if (message.imagePropertiesAnnotation != null && message.hasOwnProperty("imagePropertiesAnnotation")) - object.imagePropertiesAnnotation = $root.google.cloud.vision.v1p3beta1.ImageProperties.toObject(message.imagePropertiesAnnotation, options); - if (message.error != null && message.hasOwnProperty("error")) - object.error = $root.google.rpc.Status.toObject(message.error, options); - if (message.cropHintsAnnotation != null && message.hasOwnProperty("cropHintsAnnotation")) - object.cropHintsAnnotation = $root.google.cloud.vision.v1p3beta1.CropHintsAnnotation.toObject(message.cropHintsAnnotation, options); - if (message.fullTextAnnotation != null && message.hasOwnProperty("fullTextAnnotation")) - object.fullTextAnnotation = $root.google.cloud.vision.v1p3beta1.TextAnnotation.toObject(message.fullTextAnnotation, options); - if (message.webDetection != null && message.hasOwnProperty("webDetection")) - object.webDetection = $root.google.cloud.vision.v1p3beta1.WebDetection.toObject(message.webDetection, options); - if (message.productSearchResults != null && message.hasOwnProperty("productSearchResults")) - object.productSearchResults = $root.google.cloud.vision.v1p3beta1.ProductSearchResults.toObject(message.productSearchResults, options); - if (message.context != null && message.hasOwnProperty("context")) - object.context = $root.google.cloud.vision.v1p3beta1.ImageAnnotationContext.toObject(message.context, options); - if (message.localizedObjectAnnotations && message.localizedObjectAnnotations.length) { - object.localizedObjectAnnotations = []; - for (var j = 0; j < message.localizedObjectAnnotations.length; ++j) - object.localizedObjectAnnotations[j] = $root.google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation.toObject(message.localizedObjectAnnotations[j], options); - } + if (options.defaults) + object.includeGeoResults = false; + if (message.includeGeoResults != null && message.hasOwnProperty("includeGeoResults")) + object.includeGeoResults = message.includeGeoResults; return object; }; /** - * Converts this AnnotateImageResponse to JSON. + * Converts this WebDetectionParams to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p3beta1.WebDetectionParams * @instance * @returns {Object.} JSON object */ - AnnotateImageResponse.prototype.toJSON = function toJSON() { + WebDetectionParams.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AnnotateImageResponse; + return WebDetectionParams; })(); - v1p3beta1.AnnotateFileResponse = (function() { + v1p3beta1.ImageContext = (function() { /** - * Properties of an AnnotateFileResponse. + * Properties of an ImageContext. * @memberof google.cloud.vision.v1p3beta1 - * @interface IAnnotateFileResponse - * @property {google.cloud.vision.v1p3beta1.IInputConfig|null} [inputConfig] AnnotateFileResponse inputConfig - * @property {Array.|null} [responses] AnnotateFileResponse responses + * @interface IImageContext + * @property {google.cloud.vision.v1p3beta1.ILatLongRect|null} [latLongRect] ImageContext latLongRect + * @property {Array.|null} [languageHints] ImageContext languageHints + * @property {google.cloud.vision.v1p3beta1.ICropHintsParams|null} [cropHintsParams] ImageContext cropHintsParams + * @property {google.cloud.vision.v1p3beta1.IProductSearchParams|null} [productSearchParams] ImageContext productSearchParams + * @property {google.cloud.vision.v1p3beta1.IWebDetectionParams|null} [webDetectionParams] ImageContext webDetectionParams */ /** - * Constructs a new AnnotateFileResponse. + * Constructs a new ImageContext. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an AnnotateFileResponse. - * @implements IAnnotateFileResponse + * @classdesc Represents an ImageContext. + * @implements IImageContext * @constructor - * @param {google.cloud.vision.v1p3beta1.IAnnotateFileResponse=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.IImageContext=} [properties] Properties to set */ - function AnnotateFileResponse(properties) { - this.responses = []; + function ImageContext(properties) { + this.languageHints = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -56781,91 +56467,130 @@ } /** - * AnnotateFileResponse inputConfig. - * @member {google.cloud.vision.v1p3beta1.IInputConfig|null|undefined} inputConfig - * @memberof google.cloud.vision.v1p3beta1.AnnotateFileResponse + * ImageContext latLongRect. + * @member {google.cloud.vision.v1p3beta1.ILatLongRect|null|undefined} latLongRect + * @memberof google.cloud.vision.v1p3beta1.ImageContext * @instance */ - AnnotateFileResponse.prototype.inputConfig = null; + ImageContext.prototype.latLongRect = null; /** - * AnnotateFileResponse responses. - * @member {Array.} responses - * @memberof google.cloud.vision.v1p3beta1.AnnotateFileResponse + * ImageContext languageHints. + * @member {Array.} languageHints + * @memberof google.cloud.vision.v1p3beta1.ImageContext * @instance */ - AnnotateFileResponse.prototype.responses = $util.emptyArray; + ImageContext.prototype.languageHints = $util.emptyArray; /** - * Creates a new AnnotateFileResponse instance using the specified properties. + * ImageContext cropHintsParams. + * @member {google.cloud.vision.v1p3beta1.ICropHintsParams|null|undefined} cropHintsParams + * @memberof google.cloud.vision.v1p3beta1.ImageContext + * @instance + */ + ImageContext.prototype.cropHintsParams = null; + + /** + * ImageContext productSearchParams. + * @member {google.cloud.vision.v1p3beta1.IProductSearchParams|null|undefined} productSearchParams + * @memberof google.cloud.vision.v1p3beta1.ImageContext + * @instance + */ + ImageContext.prototype.productSearchParams = null; + + /** + * ImageContext webDetectionParams. + * @member {google.cloud.vision.v1p3beta1.IWebDetectionParams|null|undefined} webDetectionParams + * @memberof google.cloud.vision.v1p3beta1.ImageContext + * @instance + */ + ImageContext.prototype.webDetectionParams = null; + + /** + * Creates a new ImageContext instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.AnnotateFileResponse + * @memberof google.cloud.vision.v1p3beta1.ImageContext * @static - * @param {google.cloud.vision.v1p3beta1.IAnnotateFileResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.AnnotateFileResponse} AnnotateFileResponse instance + * @param {google.cloud.vision.v1p3beta1.IImageContext=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.ImageContext} ImageContext instance */ - AnnotateFileResponse.create = function create(properties) { - return new AnnotateFileResponse(properties); + ImageContext.create = function create(properties) { + return new ImageContext(properties); }; /** - * Encodes the specified AnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1p3beta1.AnnotateFileResponse.verify|verify} messages. + * Encodes the specified ImageContext message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImageContext.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.AnnotateFileResponse + * @memberof google.cloud.vision.v1p3beta1.ImageContext * @static - * @param {google.cloud.vision.v1p3beta1.IAnnotateFileResponse} message AnnotateFileResponse message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IImageContext} message ImageContext message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateFileResponse.encode = function encode(message, writer) { + ImageContext.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - $root.google.cloud.vision.v1p3beta1.InputConfig.encode(message.inputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.responses != null && message.responses.length) - for (var i = 0; i < message.responses.length; ++i) - $root.google.cloud.vision.v1p3beta1.AnnotateImageResponse.encode(message.responses[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.latLongRect != null && message.hasOwnProperty("latLongRect")) + $root.google.cloud.vision.v1p3beta1.LatLongRect.encode(message.latLongRect, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.languageHints != null && message.languageHints.length) + for (var i = 0; i < message.languageHints.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageHints[i]); + if (message.cropHintsParams != null && message.hasOwnProperty("cropHintsParams")) + $root.google.cloud.vision.v1p3beta1.CropHintsParams.encode(message.cropHintsParams, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.productSearchParams != null && message.hasOwnProperty("productSearchParams")) + $root.google.cloud.vision.v1p3beta1.ProductSearchParams.encode(message.productSearchParams, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.webDetectionParams != null && message.hasOwnProperty("webDetectionParams")) + $root.google.cloud.vision.v1p3beta1.WebDetectionParams.encode(message.webDetectionParams, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); return writer; }; /** - * Encodes the specified AnnotateFileResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.AnnotateFileResponse.verify|verify} messages. + * Encodes the specified ImageContext message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImageContext.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.AnnotateFileResponse + * @memberof google.cloud.vision.v1p3beta1.ImageContext * @static - * @param {google.cloud.vision.v1p3beta1.IAnnotateFileResponse} message AnnotateFileResponse message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IImageContext} message ImageContext message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateFileResponse.encodeDelimited = function encodeDelimited(message, writer) { + ImageContext.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AnnotateFileResponse message from the specified reader or buffer. + * Decodes an ImageContext message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.AnnotateFileResponse + * @memberof google.cloud.vision.v1p3beta1.ImageContext * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.AnnotateFileResponse} AnnotateFileResponse + * @returns {google.cloud.vision.v1p3beta1.ImageContext} ImageContext * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateFileResponse.decode = function decode(reader, length) { + ImageContext.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.vision.v1p3beta1.AnnotateFileResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.ImageContext(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.inputConfig = $root.google.cloud.vision.v1p3beta1.InputConfig.decode(reader, reader.uint32()); + message.latLongRect = $root.google.cloud.vision.v1p3beta1.LatLongRect.decode(reader, reader.uint32()); break; case 2: - if (!(message.responses && message.responses.length)) - message.responses = []; - message.responses.push($root.google.cloud.vision.v1p3beta1.AnnotateImageResponse.decode(reader, reader.uint32())); + if (!(message.languageHints && message.languageHints.length)) + message.languageHints = []; + message.languageHints.push(reader.string()); + break; + case 4: + message.cropHintsParams = $root.google.cloud.vision.v1p3beta1.CropHintsParams.decode(reader, reader.uint32()); + break; + case 5: + message.productSearchParams = $root.google.cloud.vision.v1p3beta1.ProductSearchParams.decode(reader, reader.uint32()); + break; + case 6: + message.webDetectionParams = $root.google.cloud.vision.v1p3beta1.WebDetectionParams.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -56876,139 +56601,176 @@ }; /** - * Decodes an AnnotateFileResponse message from the specified reader or buffer, length delimited. + * Decodes an ImageContext message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.AnnotateFileResponse + * @memberof google.cloud.vision.v1p3beta1.ImageContext * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.AnnotateFileResponse} AnnotateFileResponse + * @returns {google.cloud.vision.v1p3beta1.ImageContext} ImageContext * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateFileResponse.decodeDelimited = function decodeDelimited(reader) { + ImageContext.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AnnotateFileResponse message. + * Verifies an ImageContext message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.AnnotateFileResponse + * @memberof google.cloud.vision.v1p3beta1.ImageContext * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AnnotateFileResponse.verify = function verify(message) { + ImageContext.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.vision.v1p3beta1.InputConfig.verify(message.inputConfig); + if (message.latLongRect != null && message.hasOwnProperty("latLongRect")) { + var error = $root.google.cloud.vision.v1p3beta1.LatLongRect.verify(message.latLongRect); if (error) - return "inputConfig." + error; + return "latLongRect." + error; } - if (message.responses != null && message.hasOwnProperty("responses")) { - if (!Array.isArray(message.responses)) - return "responses: array expected"; - for (var i = 0; i < message.responses.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.AnnotateImageResponse.verify(message.responses[i]); - if (error) - return "responses." + error; - } + if (message.languageHints != null && message.hasOwnProperty("languageHints")) { + if (!Array.isArray(message.languageHints)) + return "languageHints: array expected"; + for (var i = 0; i < message.languageHints.length; ++i) + if (!$util.isString(message.languageHints[i])) + return "languageHints: string[] expected"; + } + if (message.cropHintsParams != null && message.hasOwnProperty("cropHintsParams")) { + var error = $root.google.cloud.vision.v1p3beta1.CropHintsParams.verify(message.cropHintsParams); + if (error) + return "cropHintsParams." + error; + } + if (message.productSearchParams != null && message.hasOwnProperty("productSearchParams")) { + var error = $root.google.cloud.vision.v1p3beta1.ProductSearchParams.verify(message.productSearchParams); + if (error) + return "productSearchParams." + error; + } + if (message.webDetectionParams != null && message.hasOwnProperty("webDetectionParams")) { + var error = $root.google.cloud.vision.v1p3beta1.WebDetectionParams.verify(message.webDetectionParams); + if (error) + return "webDetectionParams." + error; } return null; }; /** - * Creates an AnnotateFileResponse message from a plain object. Also converts values to their respective internal types. + * Creates an ImageContext message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.AnnotateFileResponse + * @memberof google.cloud.vision.v1p3beta1.ImageContext * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.AnnotateFileResponse} AnnotateFileResponse + * @returns {google.cloud.vision.v1p3beta1.ImageContext} ImageContext */ - AnnotateFileResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.AnnotateFileResponse) + ImageContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.ImageContext) return object; - var message = new $root.google.cloud.vision.v1p3beta1.AnnotateFileResponse(); - if (object.inputConfig != null) { - if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateFileResponse.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.vision.v1p3beta1.InputConfig.fromObject(object.inputConfig); + var message = new $root.google.cloud.vision.v1p3beta1.ImageContext(); + if (object.latLongRect != null) { + if (typeof object.latLongRect !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.ImageContext.latLongRect: object expected"); + message.latLongRect = $root.google.cloud.vision.v1p3beta1.LatLongRect.fromObject(object.latLongRect); } - if (object.responses) { - if (!Array.isArray(object.responses)) - throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateFileResponse.responses: array expected"); - message.responses = []; - for (var i = 0; i < object.responses.length; ++i) { - if (typeof object.responses[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateFileResponse.responses: object expected"); - message.responses[i] = $root.google.cloud.vision.v1p3beta1.AnnotateImageResponse.fromObject(object.responses[i]); - } + if (object.languageHints) { + if (!Array.isArray(object.languageHints)) + throw TypeError(".google.cloud.vision.v1p3beta1.ImageContext.languageHints: array expected"); + message.languageHints = []; + for (var i = 0; i < object.languageHints.length; ++i) + message.languageHints[i] = String(object.languageHints[i]); + } + if (object.cropHintsParams != null) { + if (typeof object.cropHintsParams !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.ImageContext.cropHintsParams: object expected"); + message.cropHintsParams = $root.google.cloud.vision.v1p3beta1.CropHintsParams.fromObject(object.cropHintsParams); + } + if (object.productSearchParams != null) { + if (typeof object.productSearchParams !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.ImageContext.productSearchParams: object expected"); + message.productSearchParams = $root.google.cloud.vision.v1p3beta1.ProductSearchParams.fromObject(object.productSearchParams); + } + if (object.webDetectionParams != null) { + if (typeof object.webDetectionParams !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.ImageContext.webDetectionParams: object expected"); + message.webDetectionParams = $root.google.cloud.vision.v1p3beta1.WebDetectionParams.fromObject(object.webDetectionParams); } return message; }; /** - * Creates a plain object from an AnnotateFileResponse message. Also converts values to other types if specified. + * Creates a plain object from an ImageContext message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.AnnotateFileResponse + * @memberof google.cloud.vision.v1p3beta1.ImageContext * @static - * @param {google.cloud.vision.v1p3beta1.AnnotateFileResponse} message AnnotateFileResponse + * @param {google.cloud.vision.v1p3beta1.ImageContext} message ImageContext * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AnnotateFileResponse.toObject = function toObject(message, options) { + ImageContext.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.responses = []; - if (options.defaults) - object.inputConfig = null; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - object.inputConfig = $root.google.cloud.vision.v1p3beta1.InputConfig.toObject(message.inputConfig, options); - if (message.responses && message.responses.length) { - object.responses = []; - for (var j = 0; j < message.responses.length; ++j) - object.responses[j] = $root.google.cloud.vision.v1p3beta1.AnnotateImageResponse.toObject(message.responses[j], options); + object.languageHints = []; + if (options.defaults) { + object.latLongRect = null; + object.cropHintsParams = null; + object.productSearchParams = null; + object.webDetectionParams = null; + } + if (message.latLongRect != null && message.hasOwnProperty("latLongRect")) + object.latLongRect = $root.google.cloud.vision.v1p3beta1.LatLongRect.toObject(message.latLongRect, options); + if (message.languageHints && message.languageHints.length) { + object.languageHints = []; + for (var j = 0; j < message.languageHints.length; ++j) + object.languageHints[j] = message.languageHints[j]; } + if (message.cropHintsParams != null && message.hasOwnProperty("cropHintsParams")) + object.cropHintsParams = $root.google.cloud.vision.v1p3beta1.CropHintsParams.toObject(message.cropHintsParams, options); + if (message.productSearchParams != null && message.hasOwnProperty("productSearchParams")) + object.productSearchParams = $root.google.cloud.vision.v1p3beta1.ProductSearchParams.toObject(message.productSearchParams, options); + if (message.webDetectionParams != null && message.hasOwnProperty("webDetectionParams")) + object.webDetectionParams = $root.google.cloud.vision.v1p3beta1.WebDetectionParams.toObject(message.webDetectionParams, options); return object; }; /** - * Converts this AnnotateFileResponse to JSON. + * Converts this ImageContext to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.AnnotateFileResponse + * @memberof google.cloud.vision.v1p3beta1.ImageContext * @instance * @returns {Object.} JSON object */ - AnnotateFileResponse.prototype.toJSON = function toJSON() { + ImageContext.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AnnotateFileResponse; + return ImageContext; })(); - v1p3beta1.BatchAnnotateImagesRequest = (function() { + v1p3beta1.AnnotateImageRequest = (function() { /** - * Properties of a BatchAnnotateImagesRequest. + * Properties of an AnnotateImageRequest. * @memberof google.cloud.vision.v1p3beta1 - * @interface IBatchAnnotateImagesRequest - * @property {Array.|null} [requests] BatchAnnotateImagesRequest requests + * @interface IAnnotateImageRequest + * @property {google.cloud.vision.v1p3beta1.IImage|null} [image] AnnotateImageRequest image + * @property {Array.|null} [features] AnnotateImageRequest features + * @property {google.cloud.vision.v1p3beta1.IImageContext|null} [imageContext] AnnotateImageRequest imageContext */ /** - * Constructs a new BatchAnnotateImagesRequest. + * Constructs a new AnnotateImageRequest. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a BatchAnnotateImagesRequest. - * @implements IBatchAnnotateImagesRequest + * @classdesc Represents an AnnotateImageRequest. + * @implements IAnnotateImageRequest * @constructor - * @param {google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.IAnnotateImageRequest=} [properties] Properties to set */ - function BatchAnnotateImagesRequest(properties) { - this.requests = []; + function AnnotateImageRequest(properties) { + this.features = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -57016,78 +56778,104 @@ } /** - * BatchAnnotateImagesRequest requests. - * @member {Array.} requests - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest + * AnnotateImageRequest image. + * @member {google.cloud.vision.v1p3beta1.IImage|null|undefined} image + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest * @instance */ - BatchAnnotateImagesRequest.prototype.requests = $util.emptyArray; + AnnotateImageRequest.prototype.image = null; /** - * Creates a new BatchAnnotateImagesRequest instance using the specified properties. + * AnnotateImageRequest features. + * @member {Array.} features + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest + * @instance + */ + AnnotateImageRequest.prototype.features = $util.emptyArray; + + /** + * AnnotateImageRequest imageContext. + * @member {google.cloud.vision.v1p3beta1.IImageContext|null|undefined} imageContext + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest + * @instance + */ + AnnotateImageRequest.prototype.imageContext = null; + + /** + * Creates a new AnnotateImageRequest instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest * @static - * @param {google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest instance + * @param {google.cloud.vision.v1p3beta1.IAnnotateImageRequest=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.AnnotateImageRequest} AnnotateImageRequest instance */ - BatchAnnotateImagesRequest.create = function create(properties) { - return new BatchAnnotateImagesRequest(properties); + AnnotateImageRequest.create = function create(properties) { + return new AnnotateImageRequest(properties); }; /** - * Encodes the specified BatchAnnotateImagesRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest.verify|verify} messages. + * Encodes the specified AnnotateImageRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.AnnotateImageRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest * @static - * @param {google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest} message BatchAnnotateImagesRequest message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IAnnotateImageRequest} message AnnotateImageRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchAnnotateImagesRequest.encode = function encode(message, writer) { + AnnotateImageRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.requests != null && message.requests.length) - for (var i = 0; i < message.requests.length; ++i) - $root.google.cloud.vision.v1p3beta1.AnnotateImageRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.image != null && message.hasOwnProperty("image")) + $root.google.cloud.vision.v1p3beta1.Image.encode(message.image, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.features != null && message.features.length) + for (var i = 0; i < message.features.length; ++i) + $root.google.cloud.vision.v1p3beta1.Feature.encode(message.features[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.imageContext != null && message.hasOwnProperty("imageContext")) + $root.google.cloud.vision.v1p3beta1.ImageContext.encode(message.imageContext, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified BatchAnnotateImagesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest.verify|verify} messages. + * Encodes the specified AnnotateImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.AnnotateImageRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest * @static - * @param {google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest} message BatchAnnotateImagesRequest message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IAnnotateImageRequest} message AnnotateImageRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchAnnotateImagesRequest.encodeDelimited = function encodeDelimited(message, writer) { + AnnotateImageRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer. + * Decodes an AnnotateImageRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest + * @returns {google.cloud.vision.v1p3beta1.AnnotateImageRequest} AnnotateImageRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchAnnotateImagesRequest.decode = function decode(reader, length) { + AnnotateImageRequest.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.vision.v1p3beta1.BatchAnnotateImagesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.AnnotateImageRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.requests && message.requests.length)) - message.requests = []; - message.requests.push($root.google.cloud.vision.v1p3beta1.AnnotateImageRequest.decode(reader, reader.uint32())); + message.image = $root.google.cloud.vision.v1p3beta1.Image.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.features && message.features.length)) + message.features = []; + message.features.push($root.google.cloud.vision.v1p3beta1.Feature.decode(reader, reader.uint32())); + break; + case 3: + message.imageContext = $root.google.cloud.vision.v1p3beta1.ImageContext.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -57098,125 +56886,153 @@ }; /** - * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. + * Decodes an AnnotateImageRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest + * @returns {google.cloud.vision.v1p3beta1.AnnotateImageRequest} AnnotateImageRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchAnnotateImagesRequest.decodeDelimited = function decodeDelimited(reader) { + AnnotateImageRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BatchAnnotateImagesRequest message. + * Verifies an AnnotateImageRequest message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BatchAnnotateImagesRequest.verify = function verify(message) { + AnnotateImageRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.requests != null && message.hasOwnProperty("requests")) { - if (!Array.isArray(message.requests)) - return "requests: array expected"; - for (var i = 0; i < message.requests.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.AnnotateImageRequest.verify(message.requests[i]); + if (message.image != null && message.hasOwnProperty("image")) { + var error = $root.google.cloud.vision.v1p3beta1.Image.verify(message.image); + if (error) + return "image." + error; + } + if (message.features != null && message.hasOwnProperty("features")) { + if (!Array.isArray(message.features)) + return "features: array expected"; + for (var i = 0; i < message.features.length; ++i) { + var error = $root.google.cloud.vision.v1p3beta1.Feature.verify(message.features[i]); if (error) - return "requests." + error; + return "features." + error; } } + if (message.imageContext != null && message.hasOwnProperty("imageContext")) { + var error = $root.google.cloud.vision.v1p3beta1.ImageContext.verify(message.imageContext); + if (error) + return "imageContext." + error; + } return null; }; /** - * Creates a BatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. + * Creates an AnnotateImageRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest + * @returns {google.cloud.vision.v1p3beta1.AnnotateImageRequest} AnnotateImageRequest */ - BatchAnnotateImagesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest) + AnnotateImageRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.AnnotateImageRequest) return object; - var message = new $root.google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest(); - if (object.requests) { - if (!Array.isArray(object.requests)) - throw TypeError(".google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest.requests: array expected"); - message.requests = []; - for (var i = 0; i < object.requests.length; ++i) { - if (typeof object.requests[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest.requests: object expected"); - message.requests[i] = $root.google.cloud.vision.v1p3beta1.AnnotateImageRequest.fromObject(object.requests[i]); + var message = new $root.google.cloud.vision.v1p3beta1.AnnotateImageRequest(); + if (object.image != null) { + if (typeof object.image !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageRequest.image: object expected"); + message.image = $root.google.cloud.vision.v1p3beta1.Image.fromObject(object.image); + } + if (object.features) { + if (!Array.isArray(object.features)) + throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageRequest.features: array expected"); + message.features = []; + for (var i = 0; i < object.features.length; ++i) { + if (typeof object.features[i] !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageRequest.features: object expected"); + message.features[i] = $root.google.cloud.vision.v1p3beta1.Feature.fromObject(object.features[i]); } } + if (object.imageContext != null) { + if (typeof object.imageContext !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageRequest.imageContext: object expected"); + message.imageContext = $root.google.cloud.vision.v1p3beta1.ImageContext.fromObject(object.imageContext); + } return message; }; /** - * Creates a plain object from a BatchAnnotateImagesRequest message. Also converts values to other types if specified. + * Creates a plain object from an AnnotateImageRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest * @static - * @param {google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest} message BatchAnnotateImagesRequest + * @param {google.cloud.vision.v1p3beta1.AnnotateImageRequest} message AnnotateImageRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BatchAnnotateImagesRequest.toObject = function toObject(message, options) { + AnnotateImageRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.requests = []; - if (message.requests && message.requests.length) { - object.requests = []; - for (var j = 0; j < message.requests.length; ++j) - object.requests[j] = $root.google.cloud.vision.v1p3beta1.AnnotateImageRequest.toObject(message.requests[j], options); + object.features = []; + if (options.defaults) { + object.image = null; + object.imageContext = null; + } + if (message.image != null && message.hasOwnProperty("image")) + object.image = $root.google.cloud.vision.v1p3beta1.Image.toObject(message.image, options); + if (message.features && message.features.length) { + object.features = []; + for (var j = 0; j < message.features.length; ++j) + object.features[j] = $root.google.cloud.vision.v1p3beta1.Feature.toObject(message.features[j], options); } + if (message.imageContext != null && message.hasOwnProperty("imageContext")) + object.imageContext = $root.google.cloud.vision.v1p3beta1.ImageContext.toObject(message.imageContext, options); return object; }; /** - * Converts this BatchAnnotateImagesRequest to JSON. + * Converts this AnnotateImageRequest to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageRequest * @instance * @returns {Object.} JSON object */ - BatchAnnotateImagesRequest.prototype.toJSON = function toJSON() { + AnnotateImageRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BatchAnnotateImagesRequest; + return AnnotateImageRequest; })(); - v1p3beta1.BatchAnnotateImagesResponse = (function() { + v1p3beta1.ImageAnnotationContext = (function() { /** - * Properties of a BatchAnnotateImagesResponse. + * Properties of an ImageAnnotationContext. * @memberof google.cloud.vision.v1p3beta1 - * @interface IBatchAnnotateImagesResponse - * @property {Array.|null} [responses] BatchAnnotateImagesResponse responses + * @interface IImageAnnotationContext + * @property {string|null} [uri] ImageAnnotationContext uri + * @property {number|null} [pageNumber] ImageAnnotationContext pageNumber */ /** - * Constructs a new BatchAnnotateImagesResponse. + * Constructs a new ImageAnnotationContext. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a BatchAnnotateImagesResponse. - * @implements IBatchAnnotateImagesResponse + * @classdesc Represents an ImageAnnotationContext. + * @implements IImageAnnotationContext * @constructor - * @param {google.cloud.vision.v1p3beta1.IBatchAnnotateImagesResponse=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.IImageAnnotationContext=} [properties] Properties to set */ - function BatchAnnotateImagesResponse(properties) { - this.responses = []; + function ImageAnnotationContext(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -57224,78 +57040,88 @@ } /** - * BatchAnnotateImagesResponse responses. - * @member {Array.} responses - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse + * ImageAnnotationContext uri. + * @member {string} uri + * @memberof google.cloud.vision.v1p3beta1.ImageAnnotationContext * @instance */ - BatchAnnotateImagesResponse.prototype.responses = $util.emptyArray; + ImageAnnotationContext.prototype.uri = ""; /** - * Creates a new BatchAnnotateImagesResponse instance using the specified properties. + * ImageAnnotationContext pageNumber. + * @member {number} pageNumber + * @memberof google.cloud.vision.v1p3beta1.ImageAnnotationContext + * @instance + */ + ImageAnnotationContext.prototype.pageNumber = 0; + + /** + * Creates a new ImageAnnotationContext instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p3beta1.ImageAnnotationContext * @static - * @param {google.cloud.vision.v1p3beta1.IBatchAnnotateImagesResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse instance + * @param {google.cloud.vision.v1p3beta1.IImageAnnotationContext=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.ImageAnnotationContext} ImageAnnotationContext instance */ - BatchAnnotateImagesResponse.create = function create(properties) { - return new BatchAnnotateImagesResponse(properties); + ImageAnnotationContext.create = function create(properties) { + return new ImageAnnotationContext(properties); }; /** - * Encodes the specified BatchAnnotateImagesResponse message. Does not implicitly {@link google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse.verify|verify} messages. + * Encodes the specified ImageAnnotationContext message. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImageAnnotationContext.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p3beta1.ImageAnnotationContext * @static - * @param {google.cloud.vision.v1p3beta1.IBatchAnnotateImagesResponse} message BatchAnnotateImagesResponse message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IImageAnnotationContext} message ImageAnnotationContext message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchAnnotateImagesResponse.encode = function encode(message, writer) { + ImageAnnotationContext.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.responses != null && message.responses.length) - for (var i = 0; i < message.responses.length; ++i) - $root.google.cloud.vision.v1p3beta1.AnnotateImageResponse.encode(message.responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.uri != null && message.hasOwnProperty("uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageNumber); return writer; }; /** - * Encodes the specified BatchAnnotateImagesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse.verify|verify} messages. + * Encodes the specified ImageAnnotationContext message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.ImageAnnotationContext.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p3beta1.ImageAnnotationContext * @static - * @param {google.cloud.vision.v1p3beta1.IBatchAnnotateImagesResponse} message BatchAnnotateImagesResponse message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IImageAnnotationContext} message ImageAnnotationContext message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchAnnotateImagesResponse.encodeDelimited = function encodeDelimited(message, writer) { + ImageAnnotationContext.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BatchAnnotateImagesResponse message from the specified reader or buffer. + * Decodes an ImageAnnotationContext message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p3beta1.ImageAnnotationContext * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse + * @returns {google.cloud.vision.v1p3beta1.ImageAnnotationContext} ImageAnnotationContext * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchAnnotateImagesResponse.decode = function decode(reader, length) { + ImageAnnotationContext.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.vision.v1p3beta1.BatchAnnotateImagesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.ImageAnnotationContext(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.responses && message.responses.length)) - message.responses = []; - message.responses.push($root.google.cloud.vision.v1p3beta1.AnnotateImageResponse.decode(reader, reader.uint32())); + message.uri = reader.string(); + break; + case 2: + message.pageNumber = reader.int32(); break; default: reader.skipType(tag & 7); @@ -57306,246 +57132,398 @@ }; /** - * Decodes a BatchAnnotateImagesResponse message from the specified reader or buffer, length delimited. + * Decodes an ImageAnnotationContext message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p3beta1.ImageAnnotationContext * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse + * @returns {google.cloud.vision.v1p3beta1.ImageAnnotationContext} ImageAnnotationContext * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchAnnotateImagesResponse.decodeDelimited = function decodeDelimited(reader) { + ImageAnnotationContext.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BatchAnnotateImagesResponse message. + * Verifies an ImageAnnotationContext message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p3beta1.ImageAnnotationContext * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BatchAnnotateImagesResponse.verify = function verify(message) { + ImageAnnotationContext.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.responses != null && message.hasOwnProperty("responses")) { - if (!Array.isArray(message.responses)) - return "responses: array expected"; - for (var i = 0; i < message.responses.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.AnnotateImageResponse.verify(message.responses[i]); - if (error) - return "responses." + error; - } - } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + if (!$util.isInteger(message.pageNumber)) + return "pageNumber: integer expected"; return null; }; /** - * Creates a BatchAnnotateImagesResponse message from a plain object. Also converts values to their respective internal types. + * Creates an ImageAnnotationContext message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p3beta1.ImageAnnotationContext * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse + * @returns {google.cloud.vision.v1p3beta1.ImageAnnotationContext} ImageAnnotationContext */ - BatchAnnotateImagesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse) + ImageAnnotationContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.ImageAnnotationContext) return object; - var message = new $root.google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse(); - if (object.responses) { - if (!Array.isArray(object.responses)) - throw TypeError(".google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse.responses: array expected"); - message.responses = []; - for (var i = 0; i < object.responses.length; ++i) { - if (typeof object.responses[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse.responses: object expected"); - message.responses[i] = $root.google.cloud.vision.v1p3beta1.AnnotateImageResponse.fromObject(object.responses[i]); - } - } + var message = new $root.google.cloud.vision.v1p3beta1.ImageAnnotationContext(); + if (object.uri != null) + message.uri = String(object.uri); + if (object.pageNumber != null) + message.pageNumber = object.pageNumber | 0; return message; }; /** - * Creates a plain object from a BatchAnnotateImagesResponse message. Also converts values to other types if specified. + * Creates a plain object from an ImageAnnotationContext message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p3beta1.ImageAnnotationContext * @static - * @param {google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse} message BatchAnnotateImagesResponse + * @param {google.cloud.vision.v1p3beta1.ImageAnnotationContext} message ImageAnnotationContext * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BatchAnnotateImagesResponse.toObject = function toObject(message, options) { + ImageAnnotationContext.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.responses = []; - if (message.responses && message.responses.length) { - object.responses = []; - for (var j = 0; j < message.responses.length; ++j) - object.responses[j] = $root.google.cloud.vision.v1p3beta1.AnnotateImageResponse.toObject(message.responses[j], options); + if (options.defaults) { + object.uri = ""; + object.pageNumber = 0; } + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + object.pageNumber = message.pageNumber; return object; }; /** - * Converts this BatchAnnotateImagesResponse to JSON. + * Converts this ImageAnnotationContext to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p3beta1.ImageAnnotationContext * @instance * @returns {Object.} JSON object */ - BatchAnnotateImagesResponse.prototype.toJSON = function toJSON() { + ImageAnnotationContext.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BatchAnnotateImagesResponse; + return ImageAnnotationContext; })(); - v1p3beta1.AsyncAnnotateFileRequest = (function() { + v1p3beta1.AnnotateImageResponse = (function() { /** - * Properties of an AsyncAnnotateFileRequest. + * Properties of an AnnotateImageResponse. * @memberof google.cloud.vision.v1p3beta1 - * @interface IAsyncAnnotateFileRequest - * @property {google.cloud.vision.v1p3beta1.IInputConfig|null} [inputConfig] AsyncAnnotateFileRequest inputConfig - * @property {Array.|null} [features] AsyncAnnotateFileRequest features - * @property {google.cloud.vision.v1p3beta1.IImageContext|null} [imageContext] AsyncAnnotateFileRequest imageContext - * @property {google.cloud.vision.v1p3beta1.IOutputConfig|null} [outputConfig] AsyncAnnotateFileRequest outputConfig + * @interface IAnnotateImageResponse + * @property {Array.|null} [faceAnnotations] AnnotateImageResponse faceAnnotations + * @property {Array.|null} [landmarkAnnotations] AnnotateImageResponse landmarkAnnotations + * @property {Array.|null} [logoAnnotations] AnnotateImageResponse logoAnnotations + * @property {Array.|null} [labelAnnotations] AnnotateImageResponse labelAnnotations + * @property {Array.|null} [localizedObjectAnnotations] AnnotateImageResponse localizedObjectAnnotations + * @property {Array.|null} [textAnnotations] AnnotateImageResponse textAnnotations + * @property {google.cloud.vision.v1p3beta1.ITextAnnotation|null} [fullTextAnnotation] AnnotateImageResponse fullTextAnnotation + * @property {google.cloud.vision.v1p3beta1.ISafeSearchAnnotation|null} [safeSearchAnnotation] AnnotateImageResponse safeSearchAnnotation + * @property {google.cloud.vision.v1p3beta1.IImageProperties|null} [imagePropertiesAnnotation] AnnotateImageResponse imagePropertiesAnnotation + * @property {google.cloud.vision.v1p3beta1.ICropHintsAnnotation|null} [cropHintsAnnotation] AnnotateImageResponse cropHintsAnnotation + * @property {google.cloud.vision.v1p3beta1.IWebDetection|null} [webDetection] AnnotateImageResponse webDetection + * @property {google.cloud.vision.v1p3beta1.IProductSearchResults|null} [productSearchResults] AnnotateImageResponse productSearchResults + * @property {google.rpc.IStatus|null} [error] AnnotateImageResponse error + * @property {google.cloud.vision.v1p3beta1.IImageAnnotationContext|null} [context] AnnotateImageResponse context + */ + + /** + * Constructs a new AnnotateImageResponse. + * @memberof google.cloud.vision.v1p3beta1 + * @classdesc Represents an AnnotateImageResponse. + * @implements IAnnotateImageResponse + * @constructor + * @param {google.cloud.vision.v1p3beta1.IAnnotateImageResponse=} [properties] Properties to set + */ + function AnnotateImageResponse(properties) { + this.faceAnnotations = []; + this.landmarkAnnotations = []; + this.logoAnnotations = []; + this.labelAnnotations = []; + this.localizedObjectAnnotations = []; + this.textAnnotations = []; + 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]]; + } + + /** + * AnnotateImageResponse faceAnnotations. + * @member {Array.} faceAnnotations + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse + * @instance + */ + AnnotateImageResponse.prototype.faceAnnotations = $util.emptyArray; + + /** + * AnnotateImageResponse landmarkAnnotations. + * @member {Array.} landmarkAnnotations + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse + * @instance + */ + AnnotateImageResponse.prototype.landmarkAnnotations = $util.emptyArray; + + /** + * AnnotateImageResponse logoAnnotations. + * @member {Array.} logoAnnotations + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse + * @instance + */ + AnnotateImageResponse.prototype.logoAnnotations = $util.emptyArray; + + /** + * AnnotateImageResponse labelAnnotations. + * @member {Array.} labelAnnotations + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse + * @instance + */ + AnnotateImageResponse.prototype.labelAnnotations = $util.emptyArray; + + /** + * AnnotateImageResponse localizedObjectAnnotations. + * @member {Array.} localizedObjectAnnotations + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse + * @instance + */ + AnnotateImageResponse.prototype.localizedObjectAnnotations = $util.emptyArray; + + /** + * AnnotateImageResponse textAnnotations. + * @member {Array.} textAnnotations + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse + * @instance + */ + AnnotateImageResponse.prototype.textAnnotations = $util.emptyArray; + + /** + * AnnotateImageResponse fullTextAnnotation. + * @member {google.cloud.vision.v1p3beta1.ITextAnnotation|null|undefined} fullTextAnnotation + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse + * @instance + */ + AnnotateImageResponse.prototype.fullTextAnnotation = null; + + /** + * AnnotateImageResponse safeSearchAnnotation. + * @member {google.cloud.vision.v1p3beta1.ISafeSearchAnnotation|null|undefined} safeSearchAnnotation + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse + * @instance */ + AnnotateImageResponse.prototype.safeSearchAnnotation = null; /** - * Constructs a new AsyncAnnotateFileRequest. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an AsyncAnnotateFileRequest. - * @implements IAsyncAnnotateFileRequest - * @constructor - * @param {google.cloud.vision.v1p3beta1.IAsyncAnnotateFileRequest=} [properties] Properties to set + * AnnotateImageResponse imagePropertiesAnnotation. + * @member {google.cloud.vision.v1p3beta1.IImageProperties|null|undefined} imagePropertiesAnnotation + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse + * @instance */ - function AsyncAnnotateFileRequest(properties) { - this.features = []; - 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]]; - } + AnnotateImageResponse.prototype.imagePropertiesAnnotation = null; /** - * AsyncAnnotateFileRequest inputConfig. - * @member {google.cloud.vision.v1p3beta1.IInputConfig|null|undefined} inputConfig - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest + * AnnotateImageResponse cropHintsAnnotation. + * @member {google.cloud.vision.v1p3beta1.ICropHintsAnnotation|null|undefined} cropHintsAnnotation + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse * @instance */ - AsyncAnnotateFileRequest.prototype.inputConfig = null; + AnnotateImageResponse.prototype.cropHintsAnnotation = null; /** - * AsyncAnnotateFileRequest features. - * @member {Array.} features - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest + * AnnotateImageResponse webDetection. + * @member {google.cloud.vision.v1p3beta1.IWebDetection|null|undefined} webDetection + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse * @instance */ - AsyncAnnotateFileRequest.prototype.features = $util.emptyArray; + AnnotateImageResponse.prototype.webDetection = null; /** - * AsyncAnnotateFileRequest imageContext. - * @member {google.cloud.vision.v1p3beta1.IImageContext|null|undefined} imageContext - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest + * AnnotateImageResponse productSearchResults. + * @member {google.cloud.vision.v1p3beta1.IProductSearchResults|null|undefined} productSearchResults + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse * @instance */ - AsyncAnnotateFileRequest.prototype.imageContext = null; + AnnotateImageResponse.prototype.productSearchResults = null; /** - * AsyncAnnotateFileRequest outputConfig. - * @member {google.cloud.vision.v1p3beta1.IOutputConfig|null|undefined} outputConfig - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest + * AnnotateImageResponse error. + * @member {google.rpc.IStatus|null|undefined} error + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse * @instance */ - AsyncAnnotateFileRequest.prototype.outputConfig = null; + AnnotateImageResponse.prototype.error = null; /** - * Creates a new AsyncAnnotateFileRequest instance using the specified properties. + * AnnotateImageResponse context. + * @member {google.cloud.vision.v1p3beta1.IImageAnnotationContext|null|undefined} context + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse + * @instance + */ + AnnotateImageResponse.prototype.context = null; + + /** + * Creates a new AnnotateImageResponse instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse * @static - * @param {google.cloud.vision.v1p3beta1.IAsyncAnnotateFileRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest instance + * @param {google.cloud.vision.v1p3beta1.IAnnotateImageResponse=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.AnnotateImageResponse} AnnotateImageResponse instance */ - AsyncAnnotateFileRequest.create = function create(properties) { - return new AsyncAnnotateFileRequest(properties); + AnnotateImageResponse.create = function create(properties) { + return new AnnotateImageResponse(properties); }; /** - * Encodes the specified AsyncAnnotateFileRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest.verify|verify} messages. + * Encodes the specified AnnotateImageResponse message. Does not implicitly {@link google.cloud.vision.v1p3beta1.AnnotateImageResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse * @static - * @param {google.cloud.vision.v1p3beta1.IAsyncAnnotateFileRequest} message AsyncAnnotateFileRequest message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IAnnotateImageResponse} message AnnotateImageResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncAnnotateFileRequest.encode = function encode(message, writer) { + AnnotateImageResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - $root.google.cloud.vision.v1p3beta1.InputConfig.encode(message.inputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.features != null && message.features.length) - for (var i = 0; i < message.features.length; ++i) - $root.google.cloud.vision.v1p3beta1.Feature.encode(message.features[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.imageContext != null && message.hasOwnProperty("imageContext")) - $root.google.cloud.vision.v1p3beta1.ImageContext.encode(message.imageContext, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) - $root.google.cloud.vision.v1p3beta1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.faceAnnotations != null && message.faceAnnotations.length) + for (var i = 0; i < message.faceAnnotations.length; ++i) + $root.google.cloud.vision.v1p3beta1.FaceAnnotation.encode(message.faceAnnotations[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.landmarkAnnotations != null && message.landmarkAnnotations.length) + for (var i = 0; i < message.landmarkAnnotations.length; ++i) + $root.google.cloud.vision.v1p3beta1.EntityAnnotation.encode(message.landmarkAnnotations[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.logoAnnotations != null && message.logoAnnotations.length) + for (var i = 0; i < message.logoAnnotations.length; ++i) + $root.google.cloud.vision.v1p3beta1.EntityAnnotation.encode(message.logoAnnotations[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.labelAnnotations != null && message.labelAnnotations.length) + for (var i = 0; i < message.labelAnnotations.length; ++i) + $root.google.cloud.vision.v1p3beta1.EntityAnnotation.encode(message.labelAnnotations[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.textAnnotations != null && message.textAnnotations.length) + for (var i = 0; i < message.textAnnotations.length; ++i) + $root.google.cloud.vision.v1p3beta1.EntityAnnotation.encode(message.textAnnotations[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.safeSearchAnnotation != null && message.hasOwnProperty("safeSearchAnnotation")) + $root.google.cloud.vision.v1p3beta1.SafeSearchAnnotation.encode(message.safeSearchAnnotation, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.imagePropertiesAnnotation != null && message.hasOwnProperty("imagePropertiesAnnotation")) + $root.google.cloud.vision.v1p3beta1.ImageProperties.encode(message.imagePropertiesAnnotation, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.error != null && message.hasOwnProperty("error")) + $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.cropHintsAnnotation != null && message.hasOwnProperty("cropHintsAnnotation")) + $root.google.cloud.vision.v1p3beta1.CropHintsAnnotation.encode(message.cropHintsAnnotation, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.fullTextAnnotation != null && message.hasOwnProperty("fullTextAnnotation")) + $root.google.cloud.vision.v1p3beta1.TextAnnotation.encode(message.fullTextAnnotation, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.webDetection != null && message.hasOwnProperty("webDetection")) + $root.google.cloud.vision.v1p3beta1.WebDetection.encode(message.webDetection, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.productSearchResults != null && message.hasOwnProperty("productSearchResults")) + $root.google.cloud.vision.v1p3beta1.ProductSearchResults.encode(message.productSearchResults, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.context != null && message.hasOwnProperty("context")) + $root.google.cloud.vision.v1p3beta1.ImageAnnotationContext.encode(message.context, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.localizedObjectAnnotations != null && message.localizedObjectAnnotations.length) + for (var i = 0; i < message.localizedObjectAnnotations.length; ++i) + $root.google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation.encode(message.localizedObjectAnnotations[i], writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); return writer; }; /** - * Encodes the specified AsyncAnnotateFileRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest.verify|verify} messages. + * Encodes the specified AnnotateImageResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.AnnotateImageResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse * @static - * @param {google.cloud.vision.v1p3beta1.IAsyncAnnotateFileRequest} message AsyncAnnotateFileRequest message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IAnnotateImageResponse} message AnnotateImageResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncAnnotateFileRequest.encodeDelimited = function encodeDelimited(message, writer) { + AnnotateImageResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer. + * Decodes an AnnotateImageResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest + * @returns {google.cloud.vision.v1p3beta1.AnnotateImageResponse} AnnotateImageResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncAnnotateFileRequest.decode = function decode(reader, length) { + AnnotateImageResponse.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.vision.v1p3beta1.AsyncAnnotateFileRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.AnnotateImageResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.inputConfig = $root.google.cloud.vision.v1p3beta1.InputConfig.decode(reader, reader.uint32()); + if (!(message.faceAnnotations && message.faceAnnotations.length)) + message.faceAnnotations = []; + message.faceAnnotations.push($root.google.cloud.vision.v1p3beta1.FaceAnnotation.decode(reader, reader.uint32())); break; case 2: - if (!(message.features && message.features.length)) - message.features = []; - message.features.push($root.google.cloud.vision.v1p3beta1.Feature.decode(reader, reader.uint32())); + if (!(message.landmarkAnnotations && message.landmarkAnnotations.length)) + message.landmarkAnnotations = []; + message.landmarkAnnotations.push($root.google.cloud.vision.v1p3beta1.EntityAnnotation.decode(reader, reader.uint32())); break; case 3: - message.imageContext = $root.google.cloud.vision.v1p3beta1.ImageContext.decode(reader, reader.uint32()); + if (!(message.logoAnnotations && message.logoAnnotations.length)) + message.logoAnnotations = []; + message.logoAnnotations.push($root.google.cloud.vision.v1p3beta1.EntityAnnotation.decode(reader, reader.uint32())); break; case 4: - message.outputConfig = $root.google.cloud.vision.v1p3beta1.OutputConfig.decode(reader, reader.uint32()); + if (!(message.labelAnnotations && message.labelAnnotations.length)) + message.labelAnnotations = []; + message.labelAnnotations.push($root.google.cloud.vision.v1p3beta1.EntityAnnotation.decode(reader, reader.uint32())); + break; + case 22: + if (!(message.localizedObjectAnnotations && message.localizedObjectAnnotations.length)) + message.localizedObjectAnnotations = []; + message.localizedObjectAnnotations.push($root.google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation.decode(reader, reader.uint32())); + break; + case 5: + if (!(message.textAnnotations && message.textAnnotations.length)) + message.textAnnotations = []; + message.textAnnotations.push($root.google.cloud.vision.v1p3beta1.EntityAnnotation.decode(reader, reader.uint32())); + break; + case 12: + message.fullTextAnnotation = $root.google.cloud.vision.v1p3beta1.TextAnnotation.decode(reader, reader.uint32()); + break; + case 6: + message.safeSearchAnnotation = $root.google.cloud.vision.v1p3beta1.SafeSearchAnnotation.decode(reader, reader.uint32()); + break; + case 8: + message.imagePropertiesAnnotation = $root.google.cloud.vision.v1p3beta1.ImageProperties.decode(reader, reader.uint32()); + break; + case 11: + message.cropHintsAnnotation = $root.google.cloud.vision.v1p3beta1.CropHintsAnnotation.decode(reader, reader.uint32()); + break; + case 13: + message.webDetection = $root.google.cloud.vision.v1p3beta1.WebDetection.decode(reader, reader.uint32()); + break; + case 14: + message.productSearchResults = $root.google.cloud.vision.v1p3beta1.ProductSearchResults.decode(reader, reader.uint32()); + break; + case 9: + message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + case 21: + message.context = $root.google.cloud.vision.v1p3beta1.ImageAnnotationContext.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -57556,165 +57534,358 @@ }; /** - * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer, length delimited. + * Decodes an AnnotateImageResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest + * @returns {google.cloud.vision.v1p3beta1.AnnotateImageResponse} AnnotateImageResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncAnnotateFileRequest.decodeDelimited = function decodeDelimited(reader) { + AnnotateImageResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AsyncAnnotateFileRequest message. + * Verifies an AnnotateImageResponse message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AsyncAnnotateFileRequest.verify = function verify(message) { + AnnotateImageResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.vision.v1p3beta1.InputConfig.verify(message.inputConfig); - if (error) - return "inputConfig." + error; + if (message.faceAnnotations != null && message.hasOwnProperty("faceAnnotations")) { + if (!Array.isArray(message.faceAnnotations)) + return "faceAnnotations: array expected"; + for (var i = 0; i < message.faceAnnotations.length; ++i) { + var error = $root.google.cloud.vision.v1p3beta1.FaceAnnotation.verify(message.faceAnnotations[i]); + if (error) + return "faceAnnotations." + error; + } } - if (message.features != null && message.hasOwnProperty("features")) { - if (!Array.isArray(message.features)) - return "features: array expected"; - for (var i = 0; i < message.features.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.Feature.verify(message.features[i]); + if (message.landmarkAnnotations != null && message.hasOwnProperty("landmarkAnnotations")) { + if (!Array.isArray(message.landmarkAnnotations)) + return "landmarkAnnotations: array expected"; + for (var i = 0; i < message.landmarkAnnotations.length; ++i) { + var error = $root.google.cloud.vision.v1p3beta1.EntityAnnotation.verify(message.landmarkAnnotations[i]); if (error) - return "features." + error; + return "landmarkAnnotations." + error; } } - if (message.imageContext != null && message.hasOwnProperty("imageContext")) { - var error = $root.google.cloud.vision.v1p3beta1.ImageContext.verify(message.imageContext); + if (message.logoAnnotations != null && message.hasOwnProperty("logoAnnotations")) { + if (!Array.isArray(message.logoAnnotations)) + return "logoAnnotations: array expected"; + for (var i = 0; i < message.logoAnnotations.length; ++i) { + var error = $root.google.cloud.vision.v1p3beta1.EntityAnnotation.verify(message.logoAnnotations[i]); + if (error) + return "logoAnnotations." + error; + } + } + if (message.labelAnnotations != null && message.hasOwnProperty("labelAnnotations")) { + if (!Array.isArray(message.labelAnnotations)) + return "labelAnnotations: array expected"; + for (var i = 0; i < message.labelAnnotations.length; ++i) { + var error = $root.google.cloud.vision.v1p3beta1.EntityAnnotation.verify(message.labelAnnotations[i]); + if (error) + return "labelAnnotations." + error; + } + } + if (message.localizedObjectAnnotations != null && message.hasOwnProperty("localizedObjectAnnotations")) { + if (!Array.isArray(message.localizedObjectAnnotations)) + return "localizedObjectAnnotations: array expected"; + for (var i = 0; i < message.localizedObjectAnnotations.length; ++i) { + var error = $root.google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation.verify(message.localizedObjectAnnotations[i]); + if (error) + return "localizedObjectAnnotations." + error; + } + } + if (message.textAnnotations != null && message.hasOwnProperty("textAnnotations")) { + if (!Array.isArray(message.textAnnotations)) + return "textAnnotations: array expected"; + for (var i = 0; i < message.textAnnotations.length; ++i) { + var error = $root.google.cloud.vision.v1p3beta1.EntityAnnotation.verify(message.textAnnotations[i]); + if (error) + return "textAnnotations." + error; + } + } + if (message.fullTextAnnotation != null && message.hasOwnProperty("fullTextAnnotation")) { + var error = $root.google.cloud.vision.v1p3beta1.TextAnnotation.verify(message.fullTextAnnotation); if (error) - return "imageContext." + error; + return "fullTextAnnotation." + error; } - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { - var error = $root.google.cloud.vision.v1p3beta1.OutputConfig.verify(message.outputConfig); + if (message.safeSearchAnnotation != null && message.hasOwnProperty("safeSearchAnnotation")) { + var error = $root.google.cloud.vision.v1p3beta1.SafeSearchAnnotation.verify(message.safeSearchAnnotation); if (error) - return "outputConfig." + error; + return "safeSearchAnnotation." + error; + } + if (message.imagePropertiesAnnotation != null && message.hasOwnProperty("imagePropertiesAnnotation")) { + var error = $root.google.cloud.vision.v1p3beta1.ImageProperties.verify(message.imagePropertiesAnnotation); + if (error) + return "imagePropertiesAnnotation." + error; + } + if (message.cropHintsAnnotation != null && message.hasOwnProperty("cropHintsAnnotation")) { + var error = $root.google.cloud.vision.v1p3beta1.CropHintsAnnotation.verify(message.cropHintsAnnotation); + if (error) + return "cropHintsAnnotation." + error; + } + if (message.webDetection != null && message.hasOwnProperty("webDetection")) { + var error = $root.google.cloud.vision.v1p3beta1.WebDetection.verify(message.webDetection); + if (error) + return "webDetection." + error; + } + if (message.productSearchResults != null && message.hasOwnProperty("productSearchResults")) { + var error = $root.google.cloud.vision.v1p3beta1.ProductSearchResults.verify(message.productSearchResults); + if (error) + return "productSearchResults." + error; + } + if (message.error != null && message.hasOwnProperty("error")) { + var error = $root.google.rpc.Status.verify(message.error); + if (error) + return "error." + error; + } + if (message.context != null && message.hasOwnProperty("context")) { + var error = $root.google.cloud.vision.v1p3beta1.ImageAnnotationContext.verify(message.context); + if (error) + return "context." + error; } return null; }; /** - * Creates an AsyncAnnotateFileRequest message from a plain object. Also converts values to their respective internal types. + * Creates an AnnotateImageResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest + * @returns {google.cloud.vision.v1p3beta1.AnnotateImageResponse} AnnotateImageResponse */ - AsyncAnnotateFileRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest) + AnnotateImageResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.AnnotateImageResponse) return object; - var message = new $root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest(); - if (object.inputConfig != null) { - if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.vision.v1p3beta1.InputConfig.fromObject(object.inputConfig); + var message = new $root.google.cloud.vision.v1p3beta1.AnnotateImageResponse(); + if (object.faceAnnotations) { + if (!Array.isArray(object.faceAnnotations)) + throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.faceAnnotations: array expected"); + message.faceAnnotations = []; + for (var i = 0; i < object.faceAnnotations.length; ++i) { + if (typeof object.faceAnnotations[i] !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.faceAnnotations: object expected"); + message.faceAnnotations[i] = $root.google.cloud.vision.v1p3beta1.FaceAnnotation.fromObject(object.faceAnnotations[i]); + } } - if (object.features) { - if (!Array.isArray(object.features)) - throw TypeError(".google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest.features: array expected"); - message.features = []; - for (var i = 0; i < object.features.length; ++i) { - if (typeof object.features[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest.features: object expected"); - message.features[i] = $root.google.cloud.vision.v1p3beta1.Feature.fromObject(object.features[i]); + if (object.landmarkAnnotations) { + if (!Array.isArray(object.landmarkAnnotations)) + throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.landmarkAnnotations: array expected"); + message.landmarkAnnotations = []; + for (var i = 0; i < object.landmarkAnnotations.length; ++i) { + if (typeof object.landmarkAnnotations[i] !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.landmarkAnnotations: object expected"); + message.landmarkAnnotations[i] = $root.google.cloud.vision.v1p3beta1.EntityAnnotation.fromObject(object.landmarkAnnotations[i]); } } - if (object.imageContext != null) { - if (typeof object.imageContext !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest.imageContext: object expected"); - message.imageContext = $root.google.cloud.vision.v1p3beta1.ImageContext.fromObject(object.imageContext); + if (object.logoAnnotations) { + if (!Array.isArray(object.logoAnnotations)) + throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.logoAnnotations: array expected"); + message.logoAnnotations = []; + for (var i = 0; i < object.logoAnnotations.length; ++i) { + if (typeof object.logoAnnotations[i] !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.logoAnnotations: object expected"); + message.logoAnnotations[i] = $root.google.cloud.vision.v1p3beta1.EntityAnnotation.fromObject(object.logoAnnotations[i]); + } } - if (object.outputConfig != null) { - if (typeof object.outputConfig !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest.outputConfig: object expected"); - message.outputConfig = $root.google.cloud.vision.v1p3beta1.OutputConfig.fromObject(object.outputConfig); + if (object.labelAnnotations) { + if (!Array.isArray(object.labelAnnotations)) + throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.labelAnnotations: array expected"); + message.labelAnnotations = []; + for (var i = 0; i < object.labelAnnotations.length; ++i) { + if (typeof object.labelAnnotations[i] !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.labelAnnotations: object expected"); + message.labelAnnotations[i] = $root.google.cloud.vision.v1p3beta1.EntityAnnotation.fromObject(object.labelAnnotations[i]); + } + } + if (object.localizedObjectAnnotations) { + if (!Array.isArray(object.localizedObjectAnnotations)) + throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.localizedObjectAnnotations: array expected"); + message.localizedObjectAnnotations = []; + for (var i = 0; i < object.localizedObjectAnnotations.length; ++i) { + if (typeof object.localizedObjectAnnotations[i] !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.localizedObjectAnnotations: object expected"); + message.localizedObjectAnnotations[i] = $root.google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation.fromObject(object.localizedObjectAnnotations[i]); + } + } + if (object.textAnnotations) { + if (!Array.isArray(object.textAnnotations)) + throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.textAnnotations: array expected"); + message.textAnnotations = []; + for (var i = 0; i < object.textAnnotations.length; ++i) { + if (typeof object.textAnnotations[i] !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.textAnnotations: object expected"); + message.textAnnotations[i] = $root.google.cloud.vision.v1p3beta1.EntityAnnotation.fromObject(object.textAnnotations[i]); + } + } + if (object.fullTextAnnotation != null) { + if (typeof object.fullTextAnnotation !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.fullTextAnnotation: object expected"); + message.fullTextAnnotation = $root.google.cloud.vision.v1p3beta1.TextAnnotation.fromObject(object.fullTextAnnotation); + } + if (object.safeSearchAnnotation != null) { + if (typeof object.safeSearchAnnotation !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.safeSearchAnnotation: object expected"); + message.safeSearchAnnotation = $root.google.cloud.vision.v1p3beta1.SafeSearchAnnotation.fromObject(object.safeSearchAnnotation); + } + if (object.imagePropertiesAnnotation != null) { + if (typeof object.imagePropertiesAnnotation !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.imagePropertiesAnnotation: object expected"); + message.imagePropertiesAnnotation = $root.google.cloud.vision.v1p3beta1.ImageProperties.fromObject(object.imagePropertiesAnnotation); + } + if (object.cropHintsAnnotation != null) { + if (typeof object.cropHintsAnnotation !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.cropHintsAnnotation: object expected"); + message.cropHintsAnnotation = $root.google.cloud.vision.v1p3beta1.CropHintsAnnotation.fromObject(object.cropHintsAnnotation); + } + if (object.webDetection != null) { + if (typeof object.webDetection !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.webDetection: object expected"); + message.webDetection = $root.google.cloud.vision.v1p3beta1.WebDetection.fromObject(object.webDetection); + } + if (object.productSearchResults != null) { + if (typeof object.productSearchResults !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.productSearchResults: object expected"); + message.productSearchResults = $root.google.cloud.vision.v1p3beta1.ProductSearchResults.fromObject(object.productSearchResults); + } + if (object.error != null) { + if (typeof object.error !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.error: object expected"); + message.error = $root.google.rpc.Status.fromObject(object.error); + } + if (object.context != null) { + if (typeof object.context !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateImageResponse.context: object expected"); + message.context = $root.google.cloud.vision.v1p3beta1.ImageAnnotationContext.fromObject(object.context); } return message; }; /** - * Creates a plain object from an AsyncAnnotateFileRequest message. Also converts values to other types if specified. + * Creates a plain object from an AnnotateImageResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse * @static - * @param {google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest} message AsyncAnnotateFileRequest + * @param {google.cloud.vision.v1p3beta1.AnnotateImageResponse} message AnnotateImageResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AsyncAnnotateFileRequest.toObject = function toObject(message, options) { + AnnotateImageResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.features = []; + if (options.arrays || options.defaults) { + object.faceAnnotations = []; + object.landmarkAnnotations = []; + object.logoAnnotations = []; + object.labelAnnotations = []; + object.textAnnotations = []; + object.localizedObjectAnnotations = []; + } if (options.defaults) { - object.inputConfig = null; - object.imageContext = null; - object.outputConfig = null; + object.safeSearchAnnotation = null; + object.imagePropertiesAnnotation = null; + object.error = null; + object.cropHintsAnnotation = null; + object.fullTextAnnotation = null; + object.webDetection = null; + object.productSearchResults = null; + object.context = null; } - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - object.inputConfig = $root.google.cloud.vision.v1p3beta1.InputConfig.toObject(message.inputConfig, options); - if (message.features && message.features.length) { - object.features = []; - for (var j = 0; j < message.features.length; ++j) - object.features[j] = $root.google.cloud.vision.v1p3beta1.Feature.toObject(message.features[j], options); + if (message.faceAnnotations && message.faceAnnotations.length) { + object.faceAnnotations = []; + for (var j = 0; j < message.faceAnnotations.length; ++j) + object.faceAnnotations[j] = $root.google.cloud.vision.v1p3beta1.FaceAnnotation.toObject(message.faceAnnotations[j], options); + } + if (message.landmarkAnnotations && message.landmarkAnnotations.length) { + object.landmarkAnnotations = []; + for (var j = 0; j < message.landmarkAnnotations.length; ++j) + object.landmarkAnnotations[j] = $root.google.cloud.vision.v1p3beta1.EntityAnnotation.toObject(message.landmarkAnnotations[j], options); + } + if (message.logoAnnotations && message.logoAnnotations.length) { + object.logoAnnotations = []; + for (var j = 0; j < message.logoAnnotations.length; ++j) + object.logoAnnotations[j] = $root.google.cloud.vision.v1p3beta1.EntityAnnotation.toObject(message.logoAnnotations[j], options); + } + if (message.labelAnnotations && message.labelAnnotations.length) { + object.labelAnnotations = []; + for (var j = 0; j < message.labelAnnotations.length; ++j) + object.labelAnnotations[j] = $root.google.cloud.vision.v1p3beta1.EntityAnnotation.toObject(message.labelAnnotations[j], options); + } + if (message.textAnnotations && message.textAnnotations.length) { + object.textAnnotations = []; + for (var j = 0; j < message.textAnnotations.length; ++j) + object.textAnnotations[j] = $root.google.cloud.vision.v1p3beta1.EntityAnnotation.toObject(message.textAnnotations[j], options); + } + if (message.safeSearchAnnotation != null && message.hasOwnProperty("safeSearchAnnotation")) + object.safeSearchAnnotation = $root.google.cloud.vision.v1p3beta1.SafeSearchAnnotation.toObject(message.safeSearchAnnotation, options); + if (message.imagePropertiesAnnotation != null && message.hasOwnProperty("imagePropertiesAnnotation")) + object.imagePropertiesAnnotation = $root.google.cloud.vision.v1p3beta1.ImageProperties.toObject(message.imagePropertiesAnnotation, options); + if (message.error != null && message.hasOwnProperty("error")) + object.error = $root.google.rpc.Status.toObject(message.error, options); + if (message.cropHintsAnnotation != null && message.hasOwnProperty("cropHintsAnnotation")) + object.cropHintsAnnotation = $root.google.cloud.vision.v1p3beta1.CropHintsAnnotation.toObject(message.cropHintsAnnotation, options); + if (message.fullTextAnnotation != null && message.hasOwnProperty("fullTextAnnotation")) + object.fullTextAnnotation = $root.google.cloud.vision.v1p3beta1.TextAnnotation.toObject(message.fullTextAnnotation, options); + if (message.webDetection != null && message.hasOwnProperty("webDetection")) + object.webDetection = $root.google.cloud.vision.v1p3beta1.WebDetection.toObject(message.webDetection, options); + if (message.productSearchResults != null && message.hasOwnProperty("productSearchResults")) + object.productSearchResults = $root.google.cloud.vision.v1p3beta1.ProductSearchResults.toObject(message.productSearchResults, options); + if (message.context != null && message.hasOwnProperty("context")) + object.context = $root.google.cloud.vision.v1p3beta1.ImageAnnotationContext.toObject(message.context, options); + if (message.localizedObjectAnnotations && message.localizedObjectAnnotations.length) { + object.localizedObjectAnnotations = []; + for (var j = 0; j < message.localizedObjectAnnotations.length; ++j) + object.localizedObjectAnnotations[j] = $root.google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation.toObject(message.localizedObjectAnnotations[j], options); } - if (message.imageContext != null && message.hasOwnProperty("imageContext")) - object.imageContext = $root.google.cloud.vision.v1p3beta1.ImageContext.toObject(message.imageContext, options); - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) - object.outputConfig = $root.google.cloud.vision.v1p3beta1.OutputConfig.toObject(message.outputConfig, options); return object; }; /** - * Converts this AsyncAnnotateFileRequest to JSON. + * Converts this AnnotateImageResponse to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1p3beta1.AnnotateImageResponse * @instance * @returns {Object.} JSON object */ - AsyncAnnotateFileRequest.prototype.toJSON = function toJSON() { + AnnotateImageResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AsyncAnnotateFileRequest; + return AnnotateImageResponse; })(); - v1p3beta1.AsyncAnnotateFileResponse = (function() { + v1p3beta1.AnnotateFileResponse = (function() { /** - * Properties of an AsyncAnnotateFileResponse. + * Properties of an AnnotateFileResponse. * @memberof google.cloud.vision.v1p3beta1 - * @interface IAsyncAnnotateFileResponse - * @property {google.cloud.vision.v1p3beta1.IOutputConfig|null} [outputConfig] AsyncAnnotateFileResponse outputConfig + * @interface IAnnotateFileResponse + * @property {google.cloud.vision.v1p3beta1.IInputConfig|null} [inputConfig] AnnotateFileResponse inputConfig + * @property {Array.|null} [responses] AnnotateFileResponse responses */ /** - * Constructs a new AsyncAnnotateFileResponse. + * Constructs a new AnnotateFileResponse. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an AsyncAnnotateFileResponse. - * @implements IAsyncAnnotateFileResponse + * @classdesc Represents an AnnotateFileResponse. + * @implements IAnnotateFileResponse * @constructor - * @param {google.cloud.vision.v1p3beta1.IAsyncAnnotateFileResponse=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.IAnnotateFileResponse=} [properties] Properties to set */ - function AsyncAnnotateFileResponse(properties) { + function AnnotateFileResponse(properties) { + this.responses = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -57722,75 +57893,91 @@ } /** - * AsyncAnnotateFileResponse outputConfig. - * @member {google.cloud.vision.v1p3beta1.IOutputConfig|null|undefined} outputConfig - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse + * AnnotateFileResponse inputConfig. + * @member {google.cloud.vision.v1p3beta1.IInputConfig|null|undefined} inputConfig + * @memberof google.cloud.vision.v1p3beta1.AnnotateFileResponse * @instance */ - AsyncAnnotateFileResponse.prototype.outputConfig = null; + AnnotateFileResponse.prototype.inputConfig = null; /** - * Creates a new AsyncAnnotateFileResponse instance using the specified properties. + * AnnotateFileResponse responses. + * @member {Array.} responses + * @memberof google.cloud.vision.v1p3beta1.AnnotateFileResponse + * @instance + */ + AnnotateFileResponse.prototype.responses = $util.emptyArray; + + /** + * Creates a new AnnotateFileResponse instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1p3beta1.AnnotateFileResponse * @static - * @param {google.cloud.vision.v1p3beta1.IAsyncAnnotateFileResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse instance + * @param {google.cloud.vision.v1p3beta1.IAnnotateFileResponse=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.AnnotateFileResponse} AnnotateFileResponse instance */ - AsyncAnnotateFileResponse.create = function create(properties) { - return new AsyncAnnotateFileResponse(properties); + AnnotateFileResponse.create = function create(properties) { + return new AnnotateFileResponse(properties); }; /** - * Encodes the specified AsyncAnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse.verify|verify} messages. + * Encodes the specified AnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1p3beta1.AnnotateFileResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1p3beta1.AnnotateFileResponse * @static - * @param {google.cloud.vision.v1p3beta1.IAsyncAnnotateFileResponse} message AsyncAnnotateFileResponse message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IAnnotateFileResponse} message AnnotateFileResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncAnnotateFileResponse.encode = function encode(message, writer) { + AnnotateFileResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) - $root.google.cloud.vision.v1p3beta1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + $root.google.cloud.vision.v1p3beta1.InputConfig.encode(message.inputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.responses != null && message.responses.length) + for (var i = 0; i < message.responses.length; ++i) + $root.google.cloud.vision.v1p3beta1.AnnotateImageResponse.encode(message.responses[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified AsyncAnnotateFileResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse.verify|verify} messages. + * Encodes the specified AnnotateFileResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.AnnotateFileResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1p3beta1.AnnotateFileResponse * @static - * @param {google.cloud.vision.v1p3beta1.IAsyncAnnotateFileResponse} message AsyncAnnotateFileResponse message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IAnnotateFileResponse} message AnnotateFileResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncAnnotateFileResponse.encodeDelimited = function encodeDelimited(message, writer) { + AnnotateFileResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer. + * Decodes an AnnotateFileResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1p3beta1.AnnotateFileResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse + * @returns {google.cloud.vision.v1p3beta1.AnnotateFileResponse} AnnotateFileResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncAnnotateFileResponse.decode = function decode(reader, length) { + AnnotateFileResponse.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.vision.v1p3beta1.AsyncAnnotateFileResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.AnnotateFileResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.outputConfig = $root.google.cloud.vision.v1p3beta1.OutputConfig.decode(reader, reader.uint32()); + message.inputConfig = $root.google.cloud.vision.v1p3beta1.InputConfig.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.responses && message.responses.length)) + message.responses = []; + message.responses.push($root.google.cloud.vision.v1p3beta1.AnnotateImageResponse.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -57801,112 +57988,138 @@ }; /** - * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer, length delimited. + * Decodes an AnnotateFileResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1p3beta1.AnnotateFileResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse + * @returns {google.cloud.vision.v1p3beta1.AnnotateFileResponse} AnnotateFileResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncAnnotateFileResponse.decodeDelimited = function decodeDelimited(reader) { + AnnotateFileResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AsyncAnnotateFileResponse message. + * Verifies an AnnotateFileResponse message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1p3beta1.AnnotateFileResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AsyncAnnotateFileResponse.verify = function verify(message) { + AnnotateFileResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { - var error = $root.google.cloud.vision.v1p3beta1.OutputConfig.verify(message.outputConfig); + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.vision.v1p3beta1.InputConfig.verify(message.inputConfig); if (error) - return "outputConfig." + error; + return "inputConfig." + error; + } + if (message.responses != null && message.hasOwnProperty("responses")) { + if (!Array.isArray(message.responses)) + return "responses: array expected"; + for (var i = 0; i < message.responses.length; ++i) { + var error = $root.google.cloud.vision.v1p3beta1.AnnotateImageResponse.verify(message.responses[i]); + if (error) + return "responses." + error; + } } return null; }; /** - * Creates an AsyncAnnotateFileResponse message from a plain object. Also converts values to their respective internal types. + * Creates an AnnotateFileResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1p3beta1.AnnotateFileResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse + * @returns {google.cloud.vision.v1p3beta1.AnnotateFileResponse} AnnotateFileResponse */ - AsyncAnnotateFileResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse) + AnnotateFileResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.AnnotateFileResponse) return object; - var message = new $root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse(); - if (object.outputConfig != null) { - if (typeof object.outputConfig !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse.outputConfig: object expected"); - message.outputConfig = $root.google.cloud.vision.v1p3beta1.OutputConfig.fromObject(object.outputConfig); + var message = new $root.google.cloud.vision.v1p3beta1.AnnotateFileResponse(); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateFileResponse.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.vision.v1p3beta1.InputConfig.fromObject(object.inputConfig); + } + if (object.responses) { + if (!Array.isArray(object.responses)) + throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateFileResponse.responses: array expected"); + message.responses = []; + for (var i = 0; i < object.responses.length; ++i) { + if (typeof object.responses[i] !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.AnnotateFileResponse.responses: object expected"); + message.responses[i] = $root.google.cloud.vision.v1p3beta1.AnnotateImageResponse.fromObject(object.responses[i]); + } } return message; }; /** - * Creates a plain object from an AsyncAnnotateFileResponse message. Also converts values to other types if specified. + * Creates a plain object from an AnnotateFileResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1p3beta1.AnnotateFileResponse * @static - * @param {google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse} message AsyncAnnotateFileResponse + * @param {google.cloud.vision.v1p3beta1.AnnotateFileResponse} message AnnotateFileResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AsyncAnnotateFileResponse.toObject = function toObject(message, options) { + AnnotateFileResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.responses = []; if (options.defaults) - object.outputConfig = null; - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) - object.outputConfig = $root.google.cloud.vision.v1p3beta1.OutputConfig.toObject(message.outputConfig, options); + object.inputConfig = null; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.vision.v1p3beta1.InputConfig.toObject(message.inputConfig, options); + if (message.responses && message.responses.length) { + object.responses = []; + for (var j = 0; j < message.responses.length; ++j) + object.responses[j] = $root.google.cloud.vision.v1p3beta1.AnnotateImageResponse.toObject(message.responses[j], options); + } return object; }; /** - * Converts this AsyncAnnotateFileResponse to JSON. + * Converts this AnnotateFileResponse to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1p3beta1.AnnotateFileResponse * @instance * @returns {Object.} JSON object */ - AsyncAnnotateFileResponse.prototype.toJSON = function toJSON() { + AnnotateFileResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AsyncAnnotateFileResponse; + return AnnotateFileResponse; })(); - v1p3beta1.AsyncBatchAnnotateFilesRequest = (function() { + v1p3beta1.BatchAnnotateImagesRequest = (function() { /** - * Properties of an AsyncBatchAnnotateFilesRequest. + * Properties of a BatchAnnotateImagesRequest. * @memberof google.cloud.vision.v1p3beta1 - * @interface IAsyncBatchAnnotateFilesRequest - * @property {Array.|null} [requests] AsyncBatchAnnotateFilesRequest requests + * @interface IBatchAnnotateImagesRequest + * @property {Array.|null} [requests] BatchAnnotateImagesRequest requests */ /** - * Constructs a new AsyncBatchAnnotateFilesRequest. + * Constructs a new BatchAnnotateImagesRequest. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an AsyncBatchAnnotateFilesRequest. - * @implements IAsyncBatchAnnotateFilesRequest + * @classdesc Represents a BatchAnnotateImagesRequest. + * @implements IBatchAnnotateImagesRequest * @constructor - * @param {google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesRequest=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest=} [properties] Properties to set */ - function AsyncBatchAnnotateFilesRequest(properties) { + function BatchAnnotateImagesRequest(properties) { this.requests = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) @@ -57915,78 +58128,78 @@ } /** - * AsyncBatchAnnotateFilesRequest requests. - * @member {Array.} requests - * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest + * BatchAnnotateImagesRequest requests. + * @member {Array.} requests + * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest * @instance */ - AsyncBatchAnnotateFilesRequest.prototype.requests = $util.emptyArray; + BatchAnnotateImagesRequest.prototype.requests = $util.emptyArray; /** - * Creates a new AsyncBatchAnnotateFilesRequest instance using the specified properties. + * Creates a new BatchAnnotateImagesRequest instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest * @static - * @param {google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest instance + * @param {google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest instance */ - AsyncBatchAnnotateFilesRequest.create = function create(properties) { - return new AsyncBatchAnnotateFilesRequest(properties); + BatchAnnotateImagesRequest.create = function create(properties) { + return new BatchAnnotateImagesRequest(properties); }; /** - * Encodes the specified AsyncBatchAnnotateFilesRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest.verify|verify} messages. + * Encodes the specified BatchAnnotateImagesRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest * @static - * @param {google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesRequest} message AsyncBatchAnnotateFilesRequest message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest} message BatchAnnotateImagesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncBatchAnnotateFilesRequest.encode = function encode(message, writer) { + BatchAnnotateImagesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.requests != null && message.requests.length) for (var i = 0; i < message.requests.length; ++i) - $root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.cloud.vision.v1p3beta1.AnnotateImageRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified AsyncBatchAnnotateFilesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest.verify|verify} messages. + * Encodes the specified BatchAnnotateImagesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest * @static - * @param {google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesRequest} message AsyncBatchAnnotateFilesRequest message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest} message BatchAnnotateImagesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncBatchAnnotateFilesRequest.encodeDelimited = function encodeDelimited(message, writer) { + BatchAnnotateImagesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AsyncBatchAnnotateFilesRequest message from the specified reader or buffer. + * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest + * @returns {google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncBatchAnnotateFilesRequest.decode = function decode(reader, length) { + BatchAnnotateImagesRequest.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.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: if (!(message.requests && message.requests.length)) message.requests = []; - message.requests.push($root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest.decode(reader, reader.uint32())); + message.requests.push($root.google.cloud.vision.v1p3beta1.AnnotateImageRequest.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -57997,37 +58210,37 @@ }; /** - * Decodes an AsyncBatchAnnotateFilesRequest message from the specified reader or buffer, length delimited. + * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest + * @returns {google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncBatchAnnotateFilesRequest.decodeDelimited = function decodeDelimited(reader) { + BatchAnnotateImagesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AsyncBatchAnnotateFilesRequest message. + * Verifies a BatchAnnotateImagesRequest message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AsyncBatchAnnotateFilesRequest.verify = function verify(message) { + BatchAnnotateImagesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.requests != null && message.hasOwnProperty("requests")) { if (!Array.isArray(message.requests)) return "requests: array expected"; for (var i = 0; i < message.requests.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest.verify(message.requests[i]); + var error = $root.google.cloud.vision.v1p3beta1.AnnotateImageRequest.verify(message.requests[i]); if (error) return "requests." + error; } @@ -58036,40 +58249,40 @@ }; /** - * Creates an AsyncBatchAnnotateFilesRequest message from a plain object. Also converts values to their respective internal types. + * Creates a BatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest + * @returns {google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest */ - AsyncBatchAnnotateFilesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest) + BatchAnnotateImagesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest) return object; - var message = new $root.google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest(); + var message = new $root.google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest(); if (object.requests) { if (!Array.isArray(object.requests)) - throw TypeError(".google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest.requests: array expected"); + throw TypeError(".google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest.requests: array expected"); message.requests = []; for (var i = 0; i < object.requests.length; ++i) { if (typeof object.requests[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest.requests: object expected"); - message.requests[i] = $root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest.fromObject(object.requests[i]); + throw TypeError(".google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest.requests: object expected"); + message.requests[i] = $root.google.cloud.vision.v1p3beta1.AnnotateImageRequest.fromObject(object.requests[i]); } } return message; }; /** - * Creates a plain object from an AsyncBatchAnnotateFilesRequest message. Also converts values to other types if specified. + * Creates a plain object from a BatchAnnotateImagesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest * @static - * @param {google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest} message AsyncBatchAnnotateFilesRequest + * @param {google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest} message BatchAnnotateImagesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AsyncBatchAnnotateFilesRequest.toObject = function toObject(message, options) { + BatchAnnotateImagesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; @@ -58078,252 +58291,44 @@ if (message.requests && message.requests.length) { object.requests = []; for (var j = 0; j < message.requests.length; ++j) - object.requests[j] = $root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest.toObject(message.requests[j], options); - } - return object; - }; - - /** - * Converts this AsyncBatchAnnotateFilesRequest to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest - * @instance - * @returns {Object.} JSON object - */ - AsyncBatchAnnotateFilesRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return AsyncBatchAnnotateFilesRequest; - })(); - - v1p3beta1.AsyncBatchAnnotateFilesResponse = (function() { - - /** - * Properties of an AsyncBatchAnnotateFilesResponse. - * @memberof google.cloud.vision.v1p3beta1 - * @interface IAsyncBatchAnnotateFilesResponse - * @property {Array.|null} [responses] AsyncBatchAnnotateFilesResponse responses - */ - - /** - * Constructs a new AsyncBatchAnnotateFilesResponse. - * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an AsyncBatchAnnotateFilesResponse. - * @implements IAsyncBatchAnnotateFilesResponse - * @constructor - * @param {google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesResponse=} [properties] Properties to set - */ - function AsyncBatchAnnotateFilesResponse(properties) { - this.responses = []; - 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]]; - } - - /** - * AsyncBatchAnnotateFilesResponse responses. - * @member {Array.} responses - * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse - * @instance - */ - AsyncBatchAnnotateFilesResponse.prototype.responses = $util.emptyArray; - - /** - * Creates a new AsyncBatchAnnotateFilesResponse instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse - * @static - * @param {google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse instance - */ - AsyncBatchAnnotateFilesResponse.create = function create(properties) { - return new AsyncBatchAnnotateFilesResponse(properties); - }; - - /** - * Encodes the specified AsyncBatchAnnotateFilesResponse message. Does not implicitly {@link google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse - * @static - * @param {google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesResponse} message AsyncBatchAnnotateFilesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AsyncBatchAnnotateFilesResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.responses != null && message.responses.length) - for (var i = 0; i < message.responses.length; ++i) - $root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse.encode(message.responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified AsyncBatchAnnotateFilesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse - * @static - * @param {google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesResponse} message AsyncBatchAnnotateFilesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AsyncBatchAnnotateFilesResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AsyncBatchAnnotateFilesResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AsyncBatchAnnotateFilesResponse.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.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (!(message.responses && message.responses.length)) - message.responses = []; - message.responses.push($root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AsyncBatchAnnotateFilesResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AsyncBatchAnnotateFilesResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AsyncBatchAnnotateFilesResponse message. - * @function verify - * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - AsyncBatchAnnotateFilesResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.responses != null && message.hasOwnProperty("responses")) { - if (!Array.isArray(message.responses)) - return "responses: array expected"; - for (var i = 0; i < message.responses.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse.verify(message.responses[i]); - if (error) - return "responses." + error; - } - } - return null; - }; - - /** - * Creates an AsyncBatchAnnotateFilesResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse - */ - AsyncBatchAnnotateFilesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse) - return object; - var message = new $root.google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse(); - if (object.responses) { - if (!Array.isArray(object.responses)) - throw TypeError(".google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse.responses: array expected"); - message.responses = []; - for (var i = 0; i < object.responses.length; ++i) { - if (typeof object.responses[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse.responses: object expected"); - message.responses[i] = $root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse.fromObject(object.responses[i]); - } - } - return message; - }; - - /** - * Creates a plain object from an AsyncBatchAnnotateFilesResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse - * @static - * @param {google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse} message AsyncBatchAnnotateFilesResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AsyncBatchAnnotateFilesResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.responses = []; - if (message.responses && message.responses.length) { - object.responses = []; - for (var j = 0; j < message.responses.length; ++j) - object.responses[j] = $root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse.toObject(message.responses[j], options); + object.requests[j] = $root.google.cloud.vision.v1p3beta1.AnnotateImageRequest.toObject(message.requests[j], options); } return object; }; /** - * Converts this AsyncBatchAnnotateFilesResponse to JSON. + * Converts this BatchAnnotateImagesRequest to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest * @instance * @returns {Object.} JSON object */ - AsyncBatchAnnotateFilesResponse.prototype.toJSON = function toJSON() { + BatchAnnotateImagesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AsyncBatchAnnotateFilesResponse; + return BatchAnnotateImagesRequest; })(); - v1p3beta1.InputConfig = (function() { + v1p3beta1.BatchAnnotateImagesResponse = (function() { /** - * Properties of an InputConfig. + * Properties of a BatchAnnotateImagesResponse. * @memberof google.cloud.vision.v1p3beta1 - * @interface IInputConfig - * @property {google.cloud.vision.v1p3beta1.IGcsSource|null} [gcsSource] InputConfig gcsSource - * @property {string|null} [mimeType] InputConfig mimeType + * @interface IBatchAnnotateImagesResponse + * @property {Array.|null} [responses] BatchAnnotateImagesResponse responses */ /** - * Constructs a new InputConfig. + * Constructs a new BatchAnnotateImagesResponse. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an InputConfig. - * @implements IInputConfig + * @classdesc Represents a BatchAnnotateImagesResponse. + * @implements IBatchAnnotateImagesResponse * @constructor - * @param {google.cloud.vision.v1p3beta1.IInputConfig=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.IBatchAnnotateImagesResponse=} [properties] Properties to set */ - function InputConfig(properties) { + function BatchAnnotateImagesResponse(properties) { + this.responses = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -58331,88 +58336,78 @@ } /** - * InputConfig gcsSource. - * @member {google.cloud.vision.v1p3beta1.IGcsSource|null|undefined} gcsSource - * @memberof google.cloud.vision.v1p3beta1.InputConfig - * @instance - */ - InputConfig.prototype.gcsSource = null; - - /** - * InputConfig mimeType. - * @member {string} mimeType - * @memberof google.cloud.vision.v1p3beta1.InputConfig + * BatchAnnotateImagesResponse responses. + * @member {Array.} responses + * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse * @instance */ - InputConfig.prototype.mimeType = ""; + BatchAnnotateImagesResponse.prototype.responses = $util.emptyArray; /** - * Creates a new InputConfig instance using the specified properties. + * Creates a new BatchAnnotateImagesResponse instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.InputConfig + * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse * @static - * @param {google.cloud.vision.v1p3beta1.IInputConfig=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.InputConfig} InputConfig instance + * @param {google.cloud.vision.v1p3beta1.IBatchAnnotateImagesResponse=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse instance */ - InputConfig.create = function create(properties) { - return new InputConfig(properties); + BatchAnnotateImagesResponse.create = function create(properties) { + return new BatchAnnotateImagesResponse(properties); }; /** - * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.vision.v1p3beta1.InputConfig.verify|verify} messages. + * Encodes the specified BatchAnnotateImagesResponse message. Does not implicitly {@link google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.InputConfig + * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse * @static - * @param {google.cloud.vision.v1p3beta1.IInputConfig} message InputConfig message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IBatchAnnotateImagesResponse} message BatchAnnotateImagesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - InputConfig.encode = function encode(message, writer) { + BatchAnnotateImagesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) - $root.google.cloud.vision.v1p3beta1.GcsSource.encode(message.gcsSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.mimeType != null && message.hasOwnProperty("mimeType")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimeType); + if (message.responses != null && message.responses.length) + for (var i = 0; i < message.responses.length; ++i) + $root.google.cloud.vision.v1p3beta1.AnnotateImageResponse.encode(message.responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified InputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.InputConfig.verify|verify} messages. + * Encodes the specified BatchAnnotateImagesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.InputConfig + * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse * @static - * @param {google.cloud.vision.v1p3beta1.IInputConfig} message InputConfig message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IBatchAnnotateImagesResponse} message BatchAnnotateImagesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - InputConfig.encodeDelimited = function encodeDelimited(message, writer) { + BatchAnnotateImagesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an InputConfig message from the specified reader or buffer. + * Decodes a BatchAnnotateImagesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.InputConfig + * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.InputConfig} InputConfig + * @returns {google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - InputConfig.decode = function decode(reader, length) { + BatchAnnotateImagesResponse.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.vision.v1p3beta1.InputConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.gcsSource = $root.google.cloud.vision.v1p3beta1.GcsSource.decode(reader, reader.uint32()); - break; - case 2: - message.mimeType = reader.string(); + if (!(message.responses && message.responses.length)) + message.responses = []; + message.responses.push($root.google.cloud.vision.v1p3beta1.AnnotateImageResponse.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -58423,122 +58418,128 @@ }; /** - * Decodes an InputConfig message from the specified reader or buffer, length delimited. + * Decodes a BatchAnnotateImagesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.InputConfig + * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.InputConfig} InputConfig + * @returns {google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - InputConfig.decodeDelimited = function decodeDelimited(reader) { + BatchAnnotateImagesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an InputConfig message. + * Verifies a BatchAnnotateImagesResponse message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.InputConfig + * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - InputConfig.verify = function verify(message) { + BatchAnnotateImagesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - var error = $root.google.cloud.vision.v1p3beta1.GcsSource.verify(message.gcsSource); - if (error) - return "gcsSource." + error; + if (message.responses != null && message.hasOwnProperty("responses")) { + if (!Array.isArray(message.responses)) + return "responses: array expected"; + for (var i = 0; i < message.responses.length; ++i) { + var error = $root.google.cloud.vision.v1p3beta1.AnnotateImageResponse.verify(message.responses[i]); + if (error) + return "responses." + error; + } } - if (message.mimeType != null && message.hasOwnProperty("mimeType")) - if (!$util.isString(message.mimeType)) - return "mimeType: string expected"; return null; }; /** - * Creates an InputConfig message from a plain object. Also converts values to their respective internal types. + * Creates a BatchAnnotateImagesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.InputConfig + * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.InputConfig} InputConfig + * @returns {google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse */ - InputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.InputConfig) + BatchAnnotateImagesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse) return object; - var message = new $root.google.cloud.vision.v1p3beta1.InputConfig(); - if (object.gcsSource != null) { - if (typeof object.gcsSource !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.InputConfig.gcsSource: object expected"); - message.gcsSource = $root.google.cloud.vision.v1p3beta1.GcsSource.fromObject(object.gcsSource); + var message = new $root.google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse(); + if (object.responses) { + if (!Array.isArray(object.responses)) + throw TypeError(".google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse.responses: array expected"); + message.responses = []; + for (var i = 0; i < object.responses.length; ++i) { + if (typeof object.responses[i] !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse.responses: object expected"); + message.responses[i] = $root.google.cloud.vision.v1p3beta1.AnnotateImageResponse.fromObject(object.responses[i]); + } } - if (object.mimeType != null) - message.mimeType = String(object.mimeType); return message; }; /** - * Creates a plain object from an InputConfig message. Also converts values to other types if specified. + * Creates a plain object from a BatchAnnotateImagesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.InputConfig + * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse * @static - * @param {google.cloud.vision.v1p3beta1.InputConfig} message InputConfig + * @param {google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse} message BatchAnnotateImagesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - InputConfig.toObject = function toObject(message, options) { + BatchAnnotateImagesResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.gcsSource = null; - object.mimeType = ""; + if (options.arrays || options.defaults) + object.responses = []; + if (message.responses && message.responses.length) { + object.responses = []; + for (var j = 0; j < message.responses.length; ++j) + object.responses[j] = $root.google.cloud.vision.v1p3beta1.AnnotateImageResponse.toObject(message.responses[j], options); } - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) - object.gcsSource = $root.google.cloud.vision.v1p3beta1.GcsSource.toObject(message.gcsSource, options); - if (message.mimeType != null && message.hasOwnProperty("mimeType")) - object.mimeType = message.mimeType; return object; }; /** - * Converts this InputConfig to JSON. + * Converts this BatchAnnotateImagesResponse to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.InputConfig + * @memberof google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse * @instance * @returns {Object.} JSON object */ - InputConfig.prototype.toJSON = function toJSON() { + BatchAnnotateImagesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return InputConfig; + return BatchAnnotateImagesResponse; })(); - v1p3beta1.OutputConfig = (function() { + v1p3beta1.AsyncAnnotateFileRequest = (function() { /** - * Properties of an OutputConfig. + * Properties of an AsyncAnnotateFileRequest. * @memberof google.cloud.vision.v1p3beta1 - * @interface IOutputConfig - * @property {google.cloud.vision.v1p3beta1.IGcsDestination|null} [gcsDestination] OutputConfig gcsDestination - * @property {number|null} [batchSize] OutputConfig batchSize + * @interface IAsyncAnnotateFileRequest + * @property {google.cloud.vision.v1p3beta1.IInputConfig|null} [inputConfig] AsyncAnnotateFileRequest inputConfig + * @property {Array.|null} [features] AsyncAnnotateFileRequest features + * @property {google.cloud.vision.v1p3beta1.IImageContext|null} [imageContext] AsyncAnnotateFileRequest imageContext + * @property {google.cloud.vision.v1p3beta1.IOutputConfig|null} [outputConfig] AsyncAnnotateFileRequest outputConfig */ /** - * Constructs a new OutputConfig. + * Constructs a new AsyncAnnotateFileRequest. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an OutputConfig. - * @implements IOutputConfig + * @classdesc Represents an AsyncAnnotateFileRequest. + * @implements IAsyncAnnotateFileRequest * @constructor - * @param {google.cloud.vision.v1p3beta1.IOutputConfig=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.IAsyncAnnotateFileRequest=} [properties] Properties to set */ - function OutputConfig(properties) { + function AsyncAnnotateFileRequest(properties) { + this.features = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -58546,88 +58547,117 @@ } /** - * OutputConfig gcsDestination. - * @member {google.cloud.vision.v1p3beta1.IGcsDestination|null|undefined} gcsDestination - * @memberof google.cloud.vision.v1p3beta1.OutputConfig + * AsyncAnnotateFileRequest inputConfig. + * @member {google.cloud.vision.v1p3beta1.IInputConfig|null|undefined} inputConfig + * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest * @instance */ - OutputConfig.prototype.gcsDestination = null; + AsyncAnnotateFileRequest.prototype.inputConfig = null; /** - * OutputConfig batchSize. - * @member {number} batchSize - * @memberof google.cloud.vision.v1p3beta1.OutputConfig + * AsyncAnnotateFileRequest features. + * @member {Array.} features + * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest * @instance */ - OutputConfig.prototype.batchSize = 0; + AsyncAnnotateFileRequest.prototype.features = $util.emptyArray; /** - * Creates a new OutputConfig instance using the specified properties. + * AsyncAnnotateFileRequest imageContext. + * @member {google.cloud.vision.v1p3beta1.IImageContext|null|undefined} imageContext + * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest + * @instance + */ + AsyncAnnotateFileRequest.prototype.imageContext = null; + + /** + * AsyncAnnotateFileRequest outputConfig. + * @member {google.cloud.vision.v1p3beta1.IOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest + * @instance + */ + AsyncAnnotateFileRequest.prototype.outputConfig = null; + + /** + * Creates a new AsyncAnnotateFileRequest instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.OutputConfig + * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest * @static - * @param {google.cloud.vision.v1p3beta1.IOutputConfig=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.OutputConfig} OutputConfig instance + * @param {google.cloud.vision.v1p3beta1.IAsyncAnnotateFileRequest=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest instance */ - OutputConfig.create = function create(properties) { - return new OutputConfig(properties); + AsyncAnnotateFileRequest.create = function create(properties) { + return new AsyncAnnotateFileRequest(properties); }; /** - * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.vision.v1p3beta1.OutputConfig.verify|verify} messages. + * Encodes the specified AsyncAnnotateFileRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.OutputConfig + * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest * @static - * @param {google.cloud.vision.v1p3beta1.IOutputConfig} message OutputConfig message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IAsyncAnnotateFileRequest} message AsyncAnnotateFileRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OutputConfig.encode = function encode(message, writer) { + AsyncAnnotateFileRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) - $root.google.cloud.vision.v1p3beta1.GcsDestination.encode(message.gcsDestination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.batchSize != null && message.hasOwnProperty("batchSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.batchSize); + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + $root.google.cloud.vision.v1p3beta1.InputConfig.encode(message.inputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.features != null && message.features.length) + for (var i = 0; i < message.features.length; ++i) + $root.google.cloud.vision.v1p3beta1.Feature.encode(message.features[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.imageContext != null && message.hasOwnProperty("imageContext")) + $root.google.cloud.vision.v1p3beta1.ImageContext.encode(message.imageContext, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + $root.google.cloud.vision.v1p3beta1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); return writer; }; /** - * Encodes the specified OutputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.OutputConfig.verify|verify} messages. + * Encodes the specified AsyncAnnotateFileRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.OutputConfig + * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest * @static - * @param {google.cloud.vision.v1p3beta1.IOutputConfig} message OutputConfig message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IAsyncAnnotateFileRequest} message AsyncAnnotateFileRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OutputConfig.encodeDelimited = function encodeDelimited(message, writer) { + AsyncAnnotateFileRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an OutputConfig message from the specified reader or buffer. + * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.OutputConfig + * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.OutputConfig} OutputConfig + * @returns {google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OutputConfig.decode = function decode(reader, length) { + AsyncAnnotateFileRequest.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.vision.v1p3beta1.OutputConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.gcsDestination = $root.google.cloud.vision.v1p3beta1.GcsDestination.decode(reader, reader.uint32()); + message.inputConfig = $root.google.cloud.vision.v1p3beta1.InputConfig.decode(reader, reader.uint32()); break; case 2: - message.batchSize = reader.int32(); + if (!(message.features && message.features.length)) + message.features = []; + message.features.push($root.google.cloud.vision.v1p3beta1.Feature.decode(reader, reader.uint32())); + break; + case 3: + message.imageContext = $root.google.cloud.vision.v1p3beta1.ImageContext.decode(reader, reader.uint32()); + break; + case 4: + message.outputConfig = $root.google.cloud.vision.v1p3beta1.OutputConfig.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -58638,121 +58668,165 @@ }; /** - * Decodes an OutputConfig message from the specified reader or buffer, length delimited. + * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.OutputConfig + * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.OutputConfig} OutputConfig + * @returns {google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OutputConfig.decodeDelimited = function decodeDelimited(reader) { + AsyncAnnotateFileRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an OutputConfig message. + * Verifies an AsyncAnnotateFileRequest message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.OutputConfig + * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - OutputConfig.verify = function verify(message) { + AsyncAnnotateFileRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { - var error = $root.google.cloud.vision.v1p3beta1.GcsDestination.verify(message.gcsDestination); + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.vision.v1p3beta1.InputConfig.verify(message.inputConfig); if (error) - return "gcsDestination." + error; + return "inputConfig." + error; + } + if (message.features != null && message.hasOwnProperty("features")) { + if (!Array.isArray(message.features)) + return "features: array expected"; + for (var i = 0; i < message.features.length; ++i) { + var error = $root.google.cloud.vision.v1p3beta1.Feature.verify(message.features[i]); + if (error) + return "features." + error; + } + } + if (message.imageContext != null && message.hasOwnProperty("imageContext")) { + var error = $root.google.cloud.vision.v1p3beta1.ImageContext.verify(message.imageContext); + if (error) + return "imageContext." + error; + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + var error = $root.google.cloud.vision.v1p3beta1.OutputConfig.verify(message.outputConfig); + if (error) + return "outputConfig." + error; } - if (message.batchSize != null && message.hasOwnProperty("batchSize")) - if (!$util.isInteger(message.batchSize)) - return "batchSize: integer expected"; return null; }; /** - * Creates an OutputConfig message from a plain object. Also converts values to their respective internal types. + * Creates an AsyncAnnotateFileRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.OutputConfig + * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.OutputConfig} OutputConfig + * @returns {google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest */ - OutputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.OutputConfig) + AsyncAnnotateFileRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest) return object; - var message = new $root.google.cloud.vision.v1p3beta1.OutputConfig(); - if (object.gcsDestination != null) { - if (typeof object.gcsDestination !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.OutputConfig.gcsDestination: object expected"); - message.gcsDestination = $root.google.cloud.vision.v1p3beta1.GcsDestination.fromObject(object.gcsDestination); + var message = new $root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest(); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.vision.v1p3beta1.InputConfig.fromObject(object.inputConfig); + } + if (object.features) { + if (!Array.isArray(object.features)) + throw TypeError(".google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest.features: array expected"); + message.features = []; + for (var i = 0; i < object.features.length; ++i) { + if (typeof object.features[i] !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest.features: object expected"); + message.features[i] = $root.google.cloud.vision.v1p3beta1.Feature.fromObject(object.features[i]); + } + } + if (object.imageContext != null) { + if (typeof object.imageContext !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest.imageContext: object expected"); + message.imageContext = $root.google.cloud.vision.v1p3beta1.ImageContext.fromObject(object.imageContext); + } + if (object.outputConfig != null) { + if (typeof object.outputConfig !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest.outputConfig: object expected"); + message.outputConfig = $root.google.cloud.vision.v1p3beta1.OutputConfig.fromObject(object.outputConfig); } - if (object.batchSize != null) - message.batchSize = object.batchSize | 0; return message; }; /** - * Creates a plain object from an OutputConfig message. Also converts values to other types if specified. + * Creates a plain object from an AsyncAnnotateFileRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.OutputConfig + * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest * @static - * @param {google.cloud.vision.v1p3beta1.OutputConfig} message OutputConfig + * @param {google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest} message AsyncAnnotateFileRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - OutputConfig.toObject = function toObject(message, options) { + AsyncAnnotateFileRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.features = []; if (options.defaults) { - object.gcsDestination = null; - object.batchSize = 0; + object.inputConfig = null; + object.imageContext = null; + object.outputConfig = null; } - if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) - object.gcsDestination = $root.google.cloud.vision.v1p3beta1.GcsDestination.toObject(message.gcsDestination, options); - if (message.batchSize != null && message.hasOwnProperty("batchSize")) - object.batchSize = message.batchSize; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.vision.v1p3beta1.InputConfig.toObject(message.inputConfig, options); + if (message.features && message.features.length) { + object.features = []; + for (var j = 0; j < message.features.length; ++j) + object.features[j] = $root.google.cloud.vision.v1p3beta1.Feature.toObject(message.features[j], options); + } + if (message.imageContext != null && message.hasOwnProperty("imageContext")) + object.imageContext = $root.google.cloud.vision.v1p3beta1.ImageContext.toObject(message.imageContext, options); + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + object.outputConfig = $root.google.cloud.vision.v1p3beta1.OutputConfig.toObject(message.outputConfig, options); return object; }; /** - * Converts this OutputConfig to JSON. + * Converts this AsyncAnnotateFileRequest to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.OutputConfig + * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest * @instance * @returns {Object.} JSON object */ - OutputConfig.prototype.toJSON = function toJSON() { + AsyncAnnotateFileRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return OutputConfig; + return AsyncAnnotateFileRequest; })(); - v1p3beta1.GcsSource = (function() { + v1p3beta1.AsyncAnnotateFileResponse = (function() { /** - * Properties of a GcsSource. + * Properties of an AsyncAnnotateFileResponse. * @memberof google.cloud.vision.v1p3beta1 - * @interface IGcsSource - * @property {string|null} [uri] GcsSource uri + * @interface IAsyncAnnotateFileResponse + * @property {google.cloud.vision.v1p3beta1.IOutputConfig|null} [outputConfig] AsyncAnnotateFileResponse outputConfig */ /** - * Constructs a new GcsSource. + * Constructs a new AsyncAnnotateFileResponse. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a GcsSource. - * @implements IGcsSource + * @classdesc Represents an AsyncAnnotateFileResponse. + * @implements IAsyncAnnotateFileResponse * @constructor - * @param {google.cloud.vision.v1p3beta1.IGcsSource=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.IAsyncAnnotateFileResponse=} [properties] Properties to set */ - function GcsSource(properties) { + function AsyncAnnotateFileResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -58760,75 +58834,75 @@ } /** - * GcsSource uri. - * @member {string} uri - * @memberof google.cloud.vision.v1p3beta1.GcsSource + * AsyncAnnotateFileResponse outputConfig. + * @member {google.cloud.vision.v1p3beta1.IOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse * @instance */ - GcsSource.prototype.uri = ""; + AsyncAnnotateFileResponse.prototype.outputConfig = null; /** - * Creates a new GcsSource instance using the specified properties. + * Creates a new AsyncAnnotateFileResponse instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.GcsSource + * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse * @static - * @param {google.cloud.vision.v1p3beta1.IGcsSource=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.GcsSource} GcsSource instance + * @param {google.cloud.vision.v1p3beta1.IAsyncAnnotateFileResponse=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse instance */ - GcsSource.create = function create(properties) { - return new GcsSource(properties); + AsyncAnnotateFileResponse.create = function create(properties) { + return new AsyncAnnotateFileResponse(properties); }; /** - * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.vision.v1p3beta1.GcsSource.verify|verify} messages. + * Encodes the specified AsyncAnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.GcsSource + * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse * @static - * @param {google.cloud.vision.v1p3beta1.IGcsSource} message GcsSource message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IAsyncAnnotateFileResponse} message AsyncAnnotateFileResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsSource.encode = function encode(message, writer) { + AsyncAnnotateFileResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.uri != null && message.hasOwnProperty("uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + $root.google.cloud.vision.v1p3beta1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.GcsSource.verify|verify} messages. + * Encodes the specified AsyncAnnotateFileResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.GcsSource + * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse * @static - * @param {google.cloud.vision.v1p3beta1.IGcsSource} message GcsSource message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IAsyncAnnotateFileResponse} message AsyncAnnotateFileResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsSource.encodeDelimited = function encodeDelimited(message, writer) { + AsyncAnnotateFileResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GcsSource message from the specified reader or buffer. + * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.GcsSource + * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.GcsSource} GcsSource + * @returns {google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsSource.decode = function decode(reader, length) { + AsyncAnnotateFileResponse.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.vision.v1p3beta1.GcsSource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.uri = reader.string(); + message.outputConfig = $root.google.cloud.vision.v1p3beta1.OutputConfig.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -58839,107 +58913,113 @@ }; /** - * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.GcsSource + * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.GcsSource} GcsSource + * @returns {google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsSource.decodeDelimited = function decodeDelimited(reader) { + AsyncAnnotateFileResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GcsSource message. + * Verifies an AsyncAnnotateFileResponse message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.GcsSource + * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GcsSource.verify = function verify(message) { + AsyncAnnotateFileResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + var error = $root.google.cloud.vision.v1p3beta1.OutputConfig.verify(message.outputConfig); + if (error) + return "outputConfig." + error; + } return null; }; /** - * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * Creates an AsyncAnnotateFileResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.GcsSource + * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.GcsSource} GcsSource + * @returns {google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse */ - GcsSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.GcsSource) + AsyncAnnotateFileResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse) return object; - var message = new $root.google.cloud.vision.v1p3beta1.GcsSource(); - if (object.uri != null) - message.uri = String(object.uri); + var message = new $root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse(); + if (object.outputConfig != null) { + if (typeof object.outputConfig !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse.outputConfig: object expected"); + message.outputConfig = $root.google.cloud.vision.v1p3beta1.OutputConfig.fromObject(object.outputConfig); + } return message; }; /** - * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * Creates a plain object from an AsyncAnnotateFileResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.GcsSource + * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse * @static - * @param {google.cloud.vision.v1p3beta1.GcsSource} message GcsSource + * @param {google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse} message AsyncAnnotateFileResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GcsSource.toObject = function toObject(message, options) { + AsyncAnnotateFileResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) - object.uri = ""; - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; + object.outputConfig = null; + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + object.outputConfig = $root.google.cloud.vision.v1p3beta1.OutputConfig.toObject(message.outputConfig, options); return object; }; /** - * Converts this GcsSource to JSON. + * Converts this AsyncAnnotateFileResponse to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.GcsSource + * @memberof google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse * @instance * @returns {Object.} JSON object */ - GcsSource.prototype.toJSON = function toJSON() { + AsyncAnnotateFileResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GcsSource; + return AsyncAnnotateFileResponse; })(); - v1p3beta1.GcsDestination = (function() { + v1p3beta1.AsyncBatchAnnotateFilesRequest = (function() { /** - * Properties of a GcsDestination. + * Properties of an AsyncBatchAnnotateFilesRequest. * @memberof google.cloud.vision.v1p3beta1 - * @interface IGcsDestination - * @property {string|null} [uri] GcsDestination uri + * @interface IAsyncBatchAnnotateFilesRequest + * @property {Array.|null} [requests] AsyncBatchAnnotateFilesRequest requests */ /** - * Constructs a new GcsDestination. + * Constructs a new AsyncBatchAnnotateFilesRequest. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a GcsDestination. - * @implements IGcsDestination + * @classdesc Represents an AsyncBatchAnnotateFilesRequest. + * @implements IAsyncBatchAnnotateFilesRequest * @constructor - * @param {google.cloud.vision.v1p3beta1.IGcsDestination=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesRequest=} [properties] Properties to set */ - function GcsDestination(properties) { + function AsyncBatchAnnotateFilesRequest(properties) { + this.requests = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -58947,75 +59027,78 @@ } /** - * GcsDestination uri. - * @member {string} uri - * @memberof google.cloud.vision.v1p3beta1.GcsDestination + * AsyncBatchAnnotateFilesRequest requests. + * @member {Array.} requests + * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest * @instance */ - GcsDestination.prototype.uri = ""; + AsyncBatchAnnotateFilesRequest.prototype.requests = $util.emptyArray; /** - * Creates a new GcsDestination instance using the specified properties. + * Creates a new AsyncBatchAnnotateFilesRequest instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.GcsDestination + * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest * @static - * @param {google.cloud.vision.v1p3beta1.IGcsDestination=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.GcsDestination} GcsDestination instance + * @param {google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesRequest=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest instance */ - GcsDestination.create = function create(properties) { - return new GcsDestination(properties); + AsyncBatchAnnotateFilesRequest.create = function create(properties) { + return new AsyncBatchAnnotateFilesRequest(properties); }; /** - * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.vision.v1p3beta1.GcsDestination.verify|verify} messages. + * Encodes the specified AsyncBatchAnnotateFilesRequest message. Does not implicitly {@link google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.GcsDestination + * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest * @static - * @param {google.cloud.vision.v1p3beta1.IGcsDestination} message GcsDestination message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesRequest} message AsyncBatchAnnotateFilesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsDestination.encode = function encode(message, writer) { + AsyncBatchAnnotateFilesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.uri != null && message.hasOwnProperty("uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.requests != null && message.requests.length) + for (var i = 0; i < message.requests.length; ++i) + $root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.GcsDestination.verify|verify} messages. + * Encodes the specified AsyncBatchAnnotateFilesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.GcsDestination + * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest * @static - * @param {google.cloud.vision.v1p3beta1.IGcsDestination} message GcsDestination message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesRequest} message AsyncBatchAnnotateFilesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsDestination.encodeDelimited = function encodeDelimited(message, writer) { + AsyncBatchAnnotateFilesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GcsDestination message from the specified reader or buffer. + * Decodes an AsyncBatchAnnotateFilesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.GcsDestination + * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.GcsDestination} GcsDestination + * @returns {google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsDestination.decode = function decode(reader, length) { + AsyncBatchAnnotateFilesRequest.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.vision.v1p3beta1.GcsDestination(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.uri = reader.string(); + if (!(message.requests && message.requests.length)) + message.requests = []; + message.requests.push($root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -59026,131 +59109,125 @@ }; /** - * Decodes a GcsDestination message from the specified reader or buffer, length delimited. + * Decodes an AsyncBatchAnnotateFilesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.GcsDestination + * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.GcsDestination} GcsDestination + * @returns {google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsDestination.decodeDelimited = function decodeDelimited(reader) { + AsyncBatchAnnotateFilesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GcsDestination message. + * Verifies an AsyncBatchAnnotateFilesRequest message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.GcsDestination + * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GcsDestination.verify = function verify(message) { + AsyncBatchAnnotateFilesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; + if (message.requests != null && message.hasOwnProperty("requests")) { + if (!Array.isArray(message.requests)) + return "requests: array expected"; + for (var i = 0; i < message.requests.length; ++i) { + var error = $root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest.verify(message.requests[i]); + if (error) + return "requests." + error; + } + } return null; }; /** - * Creates a GcsDestination message from a plain object. Also converts values to their respective internal types. + * Creates an AsyncBatchAnnotateFilesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.GcsDestination + * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.GcsDestination} GcsDestination + * @returns {google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest */ - GcsDestination.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.GcsDestination) + AsyncBatchAnnotateFilesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest) return object; - var message = new $root.google.cloud.vision.v1p3beta1.GcsDestination(); - if (object.uri != null) - message.uri = String(object.uri); + var message = new $root.google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest(); + if (object.requests) { + if (!Array.isArray(object.requests)) + throw TypeError(".google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest.requests: array expected"); + message.requests = []; + for (var i = 0; i < object.requests.length; ++i) { + if (typeof object.requests[i] !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest.requests: object expected"); + message.requests[i] = $root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest.fromObject(object.requests[i]); + } + } return message; }; /** - * Creates a plain object from a GcsDestination message. Also converts values to other types if specified. + * Creates a plain object from an AsyncBatchAnnotateFilesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.GcsDestination + * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest * @static - * @param {google.cloud.vision.v1p3beta1.GcsDestination} message GcsDestination + * @param {google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest} message AsyncBatchAnnotateFilesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GcsDestination.toObject = function toObject(message, options) { + AsyncBatchAnnotateFilesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.uri = ""; - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; + if (options.arrays || options.defaults) + object.requests = []; + if (message.requests && message.requests.length) { + object.requests = []; + for (var j = 0; j < message.requests.length; ++j) + object.requests[j] = $root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest.toObject(message.requests[j], options); + } return object; }; /** - * Converts this GcsDestination to JSON. + * Converts this AsyncBatchAnnotateFilesRequest to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.GcsDestination + * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest * @instance * @returns {Object.} JSON object */ - GcsDestination.prototype.toJSON = function toJSON() { + AsyncBatchAnnotateFilesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GcsDestination; - })(); - - /** - * Likelihood enum. - * @name google.cloud.vision.v1p3beta1.Likelihood - * @enum {string} - * @property {number} UNKNOWN=0 UNKNOWN value - * @property {number} VERY_UNLIKELY=1 VERY_UNLIKELY value - * @property {number} UNLIKELY=2 UNLIKELY value - * @property {number} POSSIBLE=3 POSSIBLE value - * @property {number} LIKELY=4 LIKELY value - * @property {number} VERY_LIKELY=5 VERY_LIKELY value - */ - v1p3beta1.Likelihood = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "UNKNOWN"] = 0; - values[valuesById[1] = "VERY_UNLIKELY"] = 1; - values[valuesById[2] = "UNLIKELY"] = 2; - values[valuesById[3] = "POSSIBLE"] = 3; - values[valuesById[4] = "LIKELY"] = 4; - values[valuesById[5] = "VERY_LIKELY"] = 5; - return values; + return AsyncBatchAnnotateFilesRequest; })(); - v1p3beta1.OperationMetadata = (function() { + v1p3beta1.AsyncBatchAnnotateFilesResponse = (function() { /** - * Properties of an OperationMetadata. + * Properties of an AsyncBatchAnnotateFilesResponse. * @memberof google.cloud.vision.v1p3beta1 - * @interface IOperationMetadata - * @property {google.cloud.vision.v1p3beta1.OperationMetadata.State|null} [state] OperationMetadata state - * @property {google.protobuf.ITimestamp|null} [createTime] OperationMetadata createTime - * @property {google.protobuf.ITimestamp|null} [updateTime] OperationMetadata updateTime + * @interface IAsyncBatchAnnotateFilesResponse + * @property {Array.|null} [responses] AsyncBatchAnnotateFilesResponse responses */ /** - * Constructs a new OperationMetadata. + * Constructs a new AsyncBatchAnnotateFilesResponse. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents an OperationMetadata. - * @implements IOperationMetadata + * @classdesc Represents an AsyncBatchAnnotateFilesResponse. + * @implements IAsyncBatchAnnotateFilesResponse * @constructor - * @param {google.cloud.vision.v1p3beta1.IOperationMetadata=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesResponse=} [properties] Properties to set */ - function OperationMetadata(properties) { + function AsyncBatchAnnotateFilesResponse(properties) { + this.responses = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -59158,101 +59235,78 @@ } /** - * OperationMetadata state. - * @member {google.cloud.vision.v1p3beta1.OperationMetadata.State} state - * @memberof google.cloud.vision.v1p3beta1.OperationMetadata - * @instance - */ - OperationMetadata.prototype.state = 0; - - /** - * OperationMetadata createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.vision.v1p3beta1.OperationMetadata - * @instance - */ - OperationMetadata.prototype.createTime = null; - - /** - * OperationMetadata updateTime. - * @member {google.protobuf.ITimestamp|null|undefined} updateTime - * @memberof google.cloud.vision.v1p3beta1.OperationMetadata + * AsyncBatchAnnotateFilesResponse responses. + * @member {Array.} responses + * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse * @instance */ - OperationMetadata.prototype.updateTime = null; + AsyncBatchAnnotateFilesResponse.prototype.responses = $util.emptyArray; /** - * Creates a new OperationMetadata instance using the specified properties. + * Creates a new AsyncBatchAnnotateFilesResponse instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.OperationMetadata + * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse * @static - * @param {google.cloud.vision.v1p3beta1.IOperationMetadata=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.OperationMetadata} OperationMetadata instance + * @param {google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesResponse=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse instance */ - OperationMetadata.create = function create(properties) { - return new OperationMetadata(properties); + AsyncBatchAnnotateFilesResponse.create = function create(properties) { + return new AsyncBatchAnnotateFilesResponse(properties); }; /** - * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.vision.v1p3beta1.OperationMetadata.verify|verify} messages. + * Encodes the specified AsyncBatchAnnotateFilesResponse message. Does not implicitly {@link google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.OperationMetadata + * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse * @static - * @param {google.cloud.vision.v1p3beta1.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesResponse} message AsyncBatchAnnotateFilesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OperationMetadata.encode = function encode(message, writer) { + AsyncBatchAnnotateFilesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.state != null && message.hasOwnProperty("state")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); - if (message.createTime != null && message.hasOwnProperty("createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.updateTime != null && message.hasOwnProperty("updateTime")) - $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.responses != null && message.responses.length) + for (var i = 0; i < message.responses.length; ++i) + $root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse.encode(message.responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.OperationMetadata.verify|verify} messages. + * Encodes the specified AsyncBatchAnnotateFilesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.OperationMetadata + * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse * @static - * @param {google.cloud.vision.v1p3beta1.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesResponse} message AsyncBatchAnnotateFilesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + AsyncBatchAnnotateFilesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an OperationMetadata message from the specified reader or buffer. + * Decodes an AsyncBatchAnnotateFilesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.OperationMetadata + * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.OperationMetadata} OperationMetadata + * @returns {google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OperationMetadata.decode = function decode(reader, length) { + AsyncBatchAnnotateFilesResponse.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.vision.v1p3beta1.OperationMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.state = reader.int32(); - break; - case 5: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 6: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + if (!(message.responses && message.responses.length)) + message.responses = []; + message.responses.push($root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -59263,183 +59317,125 @@ }; /** - * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. + * Decodes an AsyncBatchAnnotateFilesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.OperationMetadata + * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.OperationMetadata} OperationMetadata + * @returns {google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OperationMetadata.decodeDelimited = function decodeDelimited(reader) { + AsyncBatchAnnotateFilesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an OperationMetadata message. + * Verifies an AsyncBatchAnnotateFilesResponse message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.OperationMetadata + * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - OperationMetadata.verify = function verify(message) { + AsyncBatchAnnotateFilesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.state != null && message.hasOwnProperty("state")) - switch (message.state) { - default: - return "state: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; + if (message.responses != null && message.hasOwnProperty("responses")) { + if (!Array.isArray(message.responses)) + return "responses: array expected"; + for (var i = 0; i < message.responses.length; ++i) { + var error = $root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse.verify(message.responses[i]); + if (error) + return "responses." + error; } - if (message.createTime != null && message.hasOwnProperty("createTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.createTime); - if (error) - return "createTime." + error; - } - if (message.updateTime != null && message.hasOwnProperty("updateTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.updateTime); - if (error) - return "updateTime." + error; } return null; }; /** - * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. + * Creates an AsyncBatchAnnotateFilesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.OperationMetadata + * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.OperationMetadata} OperationMetadata + * @returns {google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse */ - OperationMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.OperationMetadata) + AsyncBatchAnnotateFilesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse) return object; - var message = new $root.google.cloud.vision.v1p3beta1.OperationMetadata(); - switch (object.state) { - case "STATE_UNSPECIFIED": - case 0: - message.state = 0; - break; - case "CREATED": - case 1: - message.state = 1; - break; - case "RUNNING": - case 2: - message.state = 2; - break; - case "DONE": - case 3: - message.state = 3; - break; - case "CANCELLED": - case 4: - message.state = 4; - break; - } - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.OperationMetadata.createTime: object expected"); - message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); - } - if (object.updateTime != null) { - if (typeof object.updateTime !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.OperationMetadata.updateTime: object expected"); - message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + var message = new $root.google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse(); + if (object.responses) { + if (!Array.isArray(object.responses)) + throw TypeError(".google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse.responses: array expected"); + message.responses = []; + for (var i = 0; i < object.responses.length; ++i) { + if (typeof object.responses[i] !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse.responses: object expected"); + message.responses[i] = $root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse.fromObject(object.responses[i]); + } } return message; }; /** - * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. + * Creates a plain object from an AsyncBatchAnnotateFilesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.OperationMetadata + * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse * @static - * @param {google.cloud.vision.v1p3beta1.OperationMetadata} message OperationMetadata + * @param {google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse} message AsyncBatchAnnotateFilesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - OperationMetadata.toObject = function toObject(message, options) { + AsyncBatchAnnotateFilesResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; - object.createTime = null; - object.updateTime = null; + if (options.arrays || options.defaults) + object.responses = []; + if (message.responses && message.responses.length) { + object.responses = []; + for (var j = 0; j < message.responses.length; ++j) + object.responses[j] = $root.google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse.toObject(message.responses[j], options); } - if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.vision.v1p3beta1.OperationMetadata.State[message.state] : message.state; - if (message.createTime != null && message.hasOwnProperty("createTime")) - object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); - if (message.updateTime != null && message.hasOwnProperty("updateTime")) - object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); return object; }; /** - * Converts this OperationMetadata to JSON. + * Converts this AsyncBatchAnnotateFilesResponse to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.OperationMetadata + * @memberof google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse * @instance * @returns {Object.} JSON object */ - OperationMetadata.prototype.toJSON = function toJSON() { + AsyncBatchAnnotateFilesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * State enum. - * @name google.cloud.vision.v1p3beta1.OperationMetadata.State - * @enum {string} - * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value - * @property {number} CREATED=1 CREATED value - * @property {number} RUNNING=2 RUNNING value - * @property {number} DONE=3 DONE value - * @property {number} CANCELLED=4 CANCELLED value - */ - OperationMetadata.State = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; - values[valuesById[1] = "CREATED"] = 1; - values[valuesById[2] = "RUNNING"] = 2; - values[valuesById[3] = "DONE"] = 3; - values[valuesById[4] = "CANCELLED"] = 4; - return values; - })(); - - return OperationMetadata; + return AsyncBatchAnnotateFilesResponse; })(); - v1p3beta1.Vertex = (function() { + v1p3beta1.InputConfig = (function() { /** - * Properties of a Vertex. + * Properties of an InputConfig. * @memberof google.cloud.vision.v1p3beta1 - * @interface IVertex - * @property {number|null} [x] Vertex x - * @property {number|null} [y] Vertex y + * @interface IInputConfig + * @property {google.cloud.vision.v1p3beta1.IGcsSource|null} [gcsSource] InputConfig gcsSource + * @property {string|null} [mimeType] InputConfig mimeType */ /** - * Constructs a new Vertex. + * Constructs a new InputConfig. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a Vertex. - * @implements IVertex + * @classdesc Represents an InputConfig. + * @implements IInputConfig * @constructor - * @param {google.cloud.vision.v1p3beta1.IVertex=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.IInputConfig=} [properties] Properties to set */ - function Vertex(properties) { + function InputConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -59447,88 +59443,88 @@ } /** - * Vertex x. - * @member {number} x - * @memberof google.cloud.vision.v1p3beta1.Vertex + * InputConfig gcsSource. + * @member {google.cloud.vision.v1p3beta1.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.vision.v1p3beta1.InputConfig * @instance */ - Vertex.prototype.x = 0; + InputConfig.prototype.gcsSource = null; /** - * Vertex y. - * @member {number} y - * @memberof google.cloud.vision.v1p3beta1.Vertex + * InputConfig mimeType. + * @member {string} mimeType + * @memberof google.cloud.vision.v1p3beta1.InputConfig * @instance */ - Vertex.prototype.y = 0; + InputConfig.prototype.mimeType = ""; /** - * Creates a new Vertex instance using the specified properties. + * Creates a new InputConfig instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.Vertex + * @memberof google.cloud.vision.v1p3beta1.InputConfig * @static - * @param {google.cloud.vision.v1p3beta1.IVertex=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.Vertex} Vertex instance + * @param {google.cloud.vision.v1p3beta1.IInputConfig=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.InputConfig} InputConfig instance */ - Vertex.create = function create(properties) { - return new Vertex(properties); + InputConfig.create = function create(properties) { + return new InputConfig(properties); }; /** - * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Vertex.verify|verify} messages. + * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.vision.v1p3beta1.InputConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.Vertex + * @memberof google.cloud.vision.v1p3beta1.InputConfig * @static - * @param {google.cloud.vision.v1p3beta1.IVertex} message Vertex message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IInputConfig} message InputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Vertex.encode = function encode(message, writer) { + InputConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.x != null && message.hasOwnProperty("x")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.x); - if (message.y != null && message.hasOwnProperty("y")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.y); + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) + $root.google.cloud.vision.v1p3beta1.GcsSource.encode(message.gcsSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimeType); return writer; }; /** - * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.Vertex.verify|verify} messages. + * Encodes the specified InputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.InputConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.Vertex + * @memberof google.cloud.vision.v1p3beta1.InputConfig * @static - * @param {google.cloud.vision.v1p3beta1.IVertex} message Vertex message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IInputConfig} message InputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Vertex.encodeDelimited = function encodeDelimited(message, writer) { + InputConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Vertex message from the specified reader or buffer. + * Decodes an InputConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.Vertex + * @memberof google.cloud.vision.v1p3beta1.InputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.Vertex} Vertex + * @returns {google.cloud.vision.v1p3beta1.InputConfig} InputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Vertex.decode = function decode(reader, length) { + InputConfig.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.vision.v1p3beta1.Vertex(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.InputConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.x = reader.int32(); + message.gcsSource = $root.google.cloud.vision.v1p3beta1.GcsSource.decode(reader, reader.uint32()); break; case 2: - message.y = reader.int32(); + message.mimeType = reader.string(); break; default: reader.skipType(tag & 7); @@ -59539,117 +59535,122 @@ }; /** - * Decodes a Vertex message from the specified reader or buffer, length delimited. + * Decodes an InputConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.Vertex + * @memberof google.cloud.vision.v1p3beta1.InputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.Vertex} Vertex + * @returns {google.cloud.vision.v1p3beta1.InputConfig} InputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Vertex.decodeDelimited = function decodeDelimited(reader) { + InputConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Vertex message. + * Verifies an InputConfig message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.Vertex + * @memberof google.cloud.vision.v1p3beta1.InputConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Vertex.verify = function verify(message) { + InputConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.x != null && message.hasOwnProperty("x")) - if (!$util.isInteger(message.x)) - return "x: integer expected"; - if (message.y != null && message.hasOwnProperty("y")) - if (!$util.isInteger(message.y)) - return "y: integer expected"; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + var error = $root.google.cloud.vision.v1p3beta1.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; return null; }; /** - * Creates a Vertex message from a plain object. Also converts values to their respective internal types. + * Creates an InputConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.Vertex + * @memberof google.cloud.vision.v1p3beta1.InputConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.Vertex} Vertex + * @returns {google.cloud.vision.v1p3beta1.InputConfig} InputConfig */ - Vertex.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.Vertex) + InputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.InputConfig) return object; - var message = new $root.google.cloud.vision.v1p3beta1.Vertex(); - if (object.x != null) - message.x = object.x | 0; - if (object.y != null) - message.y = object.y | 0; + var message = new $root.google.cloud.vision.v1p3beta1.InputConfig(); + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.InputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.vision.v1p3beta1.GcsSource.fromObject(object.gcsSource); + } + if (object.mimeType != null) + message.mimeType = String(object.mimeType); return message; }; /** - * Creates a plain object from a Vertex message. Also converts values to other types if specified. + * Creates a plain object from an InputConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.Vertex + * @memberof google.cloud.vision.v1p3beta1.InputConfig * @static - * @param {google.cloud.vision.v1p3beta1.Vertex} message Vertex + * @param {google.cloud.vision.v1p3beta1.InputConfig} message InputConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Vertex.toObject = function toObject(message, options) { + InputConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.x = 0; - object.y = 0; + object.gcsSource = null; + object.mimeType = ""; } - if (message.x != null && message.hasOwnProperty("x")) - object.x = message.x; - if (message.y != null && message.hasOwnProperty("y")) - object.y = message.y; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) + object.gcsSource = $root.google.cloud.vision.v1p3beta1.GcsSource.toObject(message.gcsSource, options); + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; return object; }; /** - * Converts this Vertex to JSON. + * Converts this InputConfig to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.Vertex + * @memberof google.cloud.vision.v1p3beta1.InputConfig * @instance * @returns {Object.} JSON object */ - Vertex.prototype.toJSON = function toJSON() { + InputConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Vertex; + return InputConfig; })(); - v1p3beta1.NormalizedVertex = (function() { + v1p3beta1.OutputConfig = (function() { /** - * Properties of a NormalizedVertex. + * Properties of an OutputConfig. * @memberof google.cloud.vision.v1p3beta1 - * @interface INormalizedVertex - * @property {number|null} [x] NormalizedVertex x - * @property {number|null} [y] NormalizedVertex y + * @interface IOutputConfig + * @property {google.cloud.vision.v1p3beta1.IGcsDestination|null} [gcsDestination] OutputConfig gcsDestination + * @property {number|null} [batchSize] OutputConfig batchSize */ /** - * Constructs a new NormalizedVertex. + * Constructs a new OutputConfig. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a NormalizedVertex. - * @implements INormalizedVertex + * @classdesc Represents an OutputConfig. + * @implements IOutputConfig * @constructor - * @param {google.cloud.vision.v1p3beta1.INormalizedVertex=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.IOutputConfig=} [properties] Properties to set */ - function NormalizedVertex(properties) { + function OutputConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -59657,88 +59658,88 @@ } /** - * NormalizedVertex x. - * @member {number} x - * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex + * OutputConfig gcsDestination. + * @member {google.cloud.vision.v1p3beta1.IGcsDestination|null|undefined} gcsDestination + * @memberof google.cloud.vision.v1p3beta1.OutputConfig * @instance */ - NormalizedVertex.prototype.x = 0; + OutputConfig.prototype.gcsDestination = null; /** - * NormalizedVertex y. - * @member {number} y - * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex + * OutputConfig batchSize. + * @member {number} batchSize + * @memberof google.cloud.vision.v1p3beta1.OutputConfig * @instance */ - NormalizedVertex.prototype.y = 0; + OutputConfig.prototype.batchSize = 0; /** - * Creates a new NormalizedVertex instance using the specified properties. + * Creates a new OutputConfig instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex + * @memberof google.cloud.vision.v1p3beta1.OutputConfig * @static - * @param {google.cloud.vision.v1p3beta1.INormalizedVertex=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.NormalizedVertex} NormalizedVertex instance + * @param {google.cloud.vision.v1p3beta1.IOutputConfig=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.OutputConfig} OutputConfig instance */ - NormalizedVertex.create = function create(properties) { - return new NormalizedVertex(properties); + OutputConfig.create = function create(properties) { + return new OutputConfig(properties); }; /** - * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.vision.v1p3beta1.NormalizedVertex.verify|verify} messages. + * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.vision.v1p3beta1.OutputConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex + * @memberof google.cloud.vision.v1p3beta1.OutputConfig * @static - * @param {google.cloud.vision.v1p3beta1.INormalizedVertex} message NormalizedVertex message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IOutputConfig} message OutputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - NormalizedVertex.encode = function encode(message, writer) { + OutputConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.x != null && message.hasOwnProperty("x")) - writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); - if (message.y != null && message.hasOwnProperty("y")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) + $root.google.cloud.vision.v1p3beta1.GcsDestination.encode(message.gcsDestination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.batchSize != null && message.hasOwnProperty("batchSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.batchSize); return writer; }; /** - * Encodes the specified NormalizedVertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.NormalizedVertex.verify|verify} messages. + * Encodes the specified OutputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.OutputConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex + * @memberof google.cloud.vision.v1p3beta1.OutputConfig * @static - * @param {google.cloud.vision.v1p3beta1.INormalizedVertex} message NormalizedVertex message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IOutputConfig} message OutputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - NormalizedVertex.encodeDelimited = function encodeDelimited(message, writer) { + OutputConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a NormalizedVertex message from the specified reader or buffer. + * Decodes an OutputConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex + * @memberof google.cloud.vision.v1p3beta1.OutputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.NormalizedVertex} NormalizedVertex + * @returns {google.cloud.vision.v1p3beta1.OutputConfig} OutputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - NormalizedVertex.decode = function decode(reader, length) { + OutputConfig.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.vision.v1p3beta1.NormalizedVertex(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.OutputConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.x = reader.float(); + message.gcsDestination = $root.google.cloud.vision.v1p3beta1.GcsDestination.decode(reader, reader.uint32()); break; case 2: - message.y = reader.float(); + message.batchSize = reader.int32(); break; default: reader.skipType(tag & 7); @@ -59749,119 +59750,121 @@ }; /** - * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. + * Decodes an OutputConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex + * @memberof google.cloud.vision.v1p3beta1.OutputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.NormalizedVertex} NormalizedVertex + * @returns {google.cloud.vision.v1p3beta1.OutputConfig} OutputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - NormalizedVertex.decodeDelimited = function decodeDelimited(reader) { + OutputConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a NormalizedVertex message. + * Verifies an OutputConfig message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex + * @memberof google.cloud.vision.v1p3beta1.OutputConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - NormalizedVertex.verify = function verify(message) { + OutputConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.x != null && message.hasOwnProperty("x")) - if (typeof message.x !== "number") - return "x: number expected"; - if (message.y != null && message.hasOwnProperty("y")) - if (typeof message.y !== "number") - return "y: number expected"; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { + var error = $root.google.cloud.vision.v1p3beta1.GcsDestination.verify(message.gcsDestination); + if (error) + return "gcsDestination." + error; + } + if (message.batchSize != null && message.hasOwnProperty("batchSize")) + if (!$util.isInteger(message.batchSize)) + return "batchSize: integer expected"; return null; }; /** - * Creates a NormalizedVertex message from a plain object. Also converts values to their respective internal types. + * Creates an OutputConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex + * @memberof google.cloud.vision.v1p3beta1.OutputConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.NormalizedVertex} NormalizedVertex + * @returns {google.cloud.vision.v1p3beta1.OutputConfig} OutputConfig */ - NormalizedVertex.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.NormalizedVertex) + OutputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.OutputConfig) return object; - var message = new $root.google.cloud.vision.v1p3beta1.NormalizedVertex(); - if (object.x != null) - message.x = Number(object.x); - if (object.y != null) - message.y = Number(object.y); + var message = new $root.google.cloud.vision.v1p3beta1.OutputConfig(); + if (object.gcsDestination != null) { + if (typeof object.gcsDestination !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.OutputConfig.gcsDestination: object expected"); + message.gcsDestination = $root.google.cloud.vision.v1p3beta1.GcsDestination.fromObject(object.gcsDestination); + } + if (object.batchSize != null) + message.batchSize = object.batchSize | 0; return message; }; /** - * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. + * Creates a plain object from an OutputConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex + * @memberof google.cloud.vision.v1p3beta1.OutputConfig * @static - * @param {google.cloud.vision.v1p3beta1.NormalizedVertex} message NormalizedVertex + * @param {google.cloud.vision.v1p3beta1.OutputConfig} message OutputConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - NormalizedVertex.toObject = function toObject(message, options) { + OutputConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.x = 0; - object.y = 0; + object.gcsDestination = null; + object.batchSize = 0; } - if (message.x != null && message.hasOwnProperty("x")) - object.x = options.json && !isFinite(message.x) ? String(message.x) : message.x; - if (message.y != null && message.hasOwnProperty("y")) - object.y = options.json && !isFinite(message.y) ? String(message.y) : message.y; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) + object.gcsDestination = $root.google.cloud.vision.v1p3beta1.GcsDestination.toObject(message.gcsDestination, options); + if (message.batchSize != null && message.hasOwnProperty("batchSize")) + object.batchSize = message.batchSize; return object; }; /** - * Converts this NormalizedVertex to JSON. + * Converts this OutputConfig to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.NormalizedVertex + * @memberof google.cloud.vision.v1p3beta1.OutputConfig * @instance * @returns {Object.} JSON object */ - NormalizedVertex.prototype.toJSON = function toJSON() { + OutputConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return NormalizedVertex; + return OutputConfig; })(); - v1p3beta1.BoundingPoly = (function() { + v1p3beta1.GcsSource = (function() { /** - * Properties of a BoundingPoly. + * Properties of a GcsSource. * @memberof google.cloud.vision.v1p3beta1 - * @interface IBoundingPoly - * @property {Array.|null} [vertices] BoundingPoly vertices - * @property {Array.|null} [normalizedVertices] BoundingPoly normalizedVertices + * @interface IGcsSource + * @property {string|null} [uri] GcsSource uri */ /** - * Constructs a new BoundingPoly. + * Constructs a new GcsSource. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a BoundingPoly. - * @implements IBoundingPoly + * @classdesc Represents a GcsSource. + * @implements IGcsSource * @constructor - * @param {google.cloud.vision.v1p3beta1.IBoundingPoly=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.IGcsSource=} [properties] Properties to set */ - function BoundingPoly(properties) { - this.vertices = []; - this.normalizedVertices = []; + function GcsSource(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -59869,94 +59872,75 @@ } /** - * BoundingPoly vertices. - * @member {Array.} vertices - * @memberof google.cloud.vision.v1p3beta1.BoundingPoly - * @instance - */ - BoundingPoly.prototype.vertices = $util.emptyArray; - - /** - * BoundingPoly normalizedVertices. - * @member {Array.} normalizedVertices - * @memberof google.cloud.vision.v1p3beta1.BoundingPoly + * GcsSource uri. + * @member {string} uri + * @memberof google.cloud.vision.v1p3beta1.GcsSource * @instance */ - BoundingPoly.prototype.normalizedVertices = $util.emptyArray; + GcsSource.prototype.uri = ""; /** - * Creates a new BoundingPoly instance using the specified properties. + * Creates a new GcsSource instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.BoundingPoly + * @memberof google.cloud.vision.v1p3beta1.GcsSource * @static - * @param {google.cloud.vision.v1p3beta1.IBoundingPoly=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.BoundingPoly} BoundingPoly instance + * @param {google.cloud.vision.v1p3beta1.IGcsSource=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.GcsSource} GcsSource instance */ - BoundingPoly.create = function create(properties) { - return new BoundingPoly(properties); + GcsSource.create = function create(properties) { + return new GcsSource(properties); }; /** - * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.vision.v1p3beta1.BoundingPoly.verify|verify} messages. + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.vision.v1p3beta1.GcsSource.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.BoundingPoly + * @memberof google.cloud.vision.v1p3beta1.GcsSource * @static - * @param {google.cloud.vision.v1p3beta1.IBoundingPoly} message BoundingPoly message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IGcsSource} message GcsSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BoundingPoly.encode = function encode(message, writer) { + GcsSource.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.vertices != null && message.vertices.length) - for (var i = 0; i < message.vertices.length; ++i) - $root.google.cloud.vision.v1p3beta1.Vertex.encode(message.vertices[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.normalizedVertices != null && message.normalizedVertices.length) - for (var i = 0; i < message.normalizedVertices.length; ++i) - $root.google.cloud.vision.v1p3beta1.NormalizedVertex.encode(message.normalizedVertices[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.uri != null && message.hasOwnProperty("uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); return writer; }; /** - * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.BoundingPoly.verify|verify} messages. + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.GcsSource.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.BoundingPoly + * @memberof google.cloud.vision.v1p3beta1.GcsSource * @static - * @param {google.cloud.vision.v1p3beta1.IBoundingPoly} message BoundingPoly message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IGcsSource} message GcsSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BoundingPoly.encodeDelimited = function encodeDelimited(message, writer) { + GcsSource.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BoundingPoly message from the specified reader or buffer. + * Decodes a GcsSource message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.BoundingPoly + * @memberof google.cloud.vision.v1p3beta1.GcsSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.BoundingPoly} BoundingPoly + * @returns {google.cloud.vision.v1p3beta1.GcsSource} GcsSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BoundingPoly.decode = function decode(reader, length) { + GcsSource.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.vision.v1p3beta1.BoundingPoly(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.GcsSource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.vertices && message.vertices.length)) - message.vertices = []; - message.vertices.push($root.google.cloud.vision.v1p3beta1.Vertex.decode(reader, reader.uint32())); - break; - case 2: - if (!(message.normalizedVertices && message.normalizedVertices.length)) - message.normalizedVertices = []; - message.normalizedVertices.push($root.google.cloud.vision.v1p3beta1.NormalizedVertex.decode(reader, reader.uint32())); + message.uri = reader.string(); break; default: reader.skipType(tag & 7); @@ -59967,151 +59951,107 @@ }; /** - * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. + * Decodes a GcsSource message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.BoundingPoly + * @memberof google.cloud.vision.v1p3beta1.GcsSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.BoundingPoly} BoundingPoly + * @returns {google.cloud.vision.v1p3beta1.GcsSource} GcsSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BoundingPoly.decodeDelimited = function decodeDelimited(reader) { + GcsSource.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BoundingPoly message. + * Verifies a GcsSource message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.BoundingPoly + * @memberof google.cloud.vision.v1p3beta1.GcsSource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BoundingPoly.verify = function verify(message) { + GcsSource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.vertices != null && message.hasOwnProperty("vertices")) { - if (!Array.isArray(message.vertices)) - return "vertices: array expected"; - for (var i = 0; i < message.vertices.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.Vertex.verify(message.vertices[i]); - if (error) - return "vertices." + error; - } - } - if (message.normalizedVertices != null && message.hasOwnProperty("normalizedVertices")) { - if (!Array.isArray(message.normalizedVertices)) - return "normalizedVertices: array expected"; - for (var i = 0; i < message.normalizedVertices.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.NormalizedVertex.verify(message.normalizedVertices[i]); - if (error) - return "normalizedVertices." + error; - } - } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; return null; }; /** - * Creates a BoundingPoly message from a plain object. Also converts values to their respective internal types. + * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.BoundingPoly + * @memberof google.cloud.vision.v1p3beta1.GcsSource * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.BoundingPoly} BoundingPoly + * @returns {google.cloud.vision.v1p3beta1.GcsSource} GcsSource */ - BoundingPoly.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.BoundingPoly) + GcsSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.GcsSource) return object; - var message = new $root.google.cloud.vision.v1p3beta1.BoundingPoly(); - if (object.vertices) { - if (!Array.isArray(object.vertices)) - throw TypeError(".google.cloud.vision.v1p3beta1.BoundingPoly.vertices: array expected"); - message.vertices = []; - for (var i = 0; i < object.vertices.length; ++i) { - if (typeof object.vertices[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.BoundingPoly.vertices: object expected"); - message.vertices[i] = $root.google.cloud.vision.v1p3beta1.Vertex.fromObject(object.vertices[i]); - } - } - if (object.normalizedVertices) { - if (!Array.isArray(object.normalizedVertices)) - throw TypeError(".google.cloud.vision.v1p3beta1.BoundingPoly.normalizedVertices: array expected"); - message.normalizedVertices = []; - for (var i = 0; i < object.normalizedVertices.length; ++i) { - if (typeof object.normalizedVertices[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.BoundingPoly.normalizedVertices: object expected"); - message.normalizedVertices[i] = $root.google.cloud.vision.v1p3beta1.NormalizedVertex.fromObject(object.normalizedVertices[i]); - } - } + var message = new $root.google.cloud.vision.v1p3beta1.GcsSource(); + if (object.uri != null) + message.uri = String(object.uri); return message; }; /** - * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. + * Creates a plain object from a GcsSource message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.BoundingPoly + * @memberof google.cloud.vision.v1p3beta1.GcsSource * @static - * @param {google.cloud.vision.v1p3beta1.BoundingPoly} message BoundingPoly + * @param {google.cloud.vision.v1p3beta1.GcsSource} message GcsSource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BoundingPoly.toObject = function toObject(message, options) { + GcsSource.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.vertices = []; - object.normalizedVertices = []; - } - if (message.vertices && message.vertices.length) { - object.vertices = []; - for (var j = 0; j < message.vertices.length; ++j) - object.vertices[j] = $root.google.cloud.vision.v1p3beta1.Vertex.toObject(message.vertices[j], options); - } - if (message.normalizedVertices && message.normalizedVertices.length) { - object.normalizedVertices = []; - for (var j = 0; j < message.normalizedVertices.length; ++j) - object.normalizedVertices[j] = $root.google.cloud.vision.v1p3beta1.NormalizedVertex.toObject(message.normalizedVertices[j], options); - } + if (options.defaults) + object.uri = ""; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; return object; }; /** - * Converts this BoundingPoly to JSON. + * Converts this GcsSource to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.BoundingPoly + * @memberof google.cloud.vision.v1p3beta1.GcsSource * @instance * @returns {Object.} JSON object */ - BoundingPoly.prototype.toJSON = function toJSON() { + GcsSource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BoundingPoly; + return GcsSource; })(); - v1p3beta1.NormalizedBoundingPoly = (function() { + v1p3beta1.GcsDestination = (function() { /** - * Properties of a NormalizedBoundingPoly. + * Properties of a GcsDestination. * @memberof google.cloud.vision.v1p3beta1 - * @interface INormalizedBoundingPoly - * @property {Array.|null} [vertices] NormalizedBoundingPoly vertices + * @interface IGcsDestination + * @property {string|null} [uri] GcsDestination uri */ /** - * Constructs a new NormalizedBoundingPoly. + * Constructs a new GcsDestination. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a NormalizedBoundingPoly. - * @implements INormalizedBoundingPoly + * @classdesc Represents a GcsDestination. + * @implements IGcsDestination * @constructor - * @param {google.cloud.vision.v1p3beta1.INormalizedBoundingPoly=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.IGcsDestination=} [properties] Properties to set */ - function NormalizedBoundingPoly(properties) { - this.vertices = []; + function GcsDestination(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -60119,78 +60059,75 @@ } /** - * NormalizedBoundingPoly vertices. - * @member {Array.} vertices - * @memberof google.cloud.vision.v1p3beta1.NormalizedBoundingPoly + * GcsDestination uri. + * @member {string} uri + * @memberof google.cloud.vision.v1p3beta1.GcsDestination * @instance */ - NormalizedBoundingPoly.prototype.vertices = $util.emptyArray; + GcsDestination.prototype.uri = ""; /** - * Creates a new NormalizedBoundingPoly instance using the specified properties. + * Creates a new GcsDestination instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.NormalizedBoundingPoly + * @memberof google.cloud.vision.v1p3beta1.GcsDestination * @static - * @param {google.cloud.vision.v1p3beta1.INormalizedBoundingPoly=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.NormalizedBoundingPoly} NormalizedBoundingPoly instance + * @param {google.cloud.vision.v1p3beta1.IGcsDestination=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.GcsDestination} GcsDestination instance */ - NormalizedBoundingPoly.create = function create(properties) { - return new NormalizedBoundingPoly(properties); + GcsDestination.create = function create(properties) { + return new GcsDestination(properties); }; /** - * Encodes the specified NormalizedBoundingPoly message. Does not implicitly {@link google.cloud.vision.v1p3beta1.NormalizedBoundingPoly.verify|verify} messages. + * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.vision.v1p3beta1.GcsDestination.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.NormalizedBoundingPoly + * @memberof google.cloud.vision.v1p3beta1.GcsDestination * @static - * @param {google.cloud.vision.v1p3beta1.INormalizedBoundingPoly} message NormalizedBoundingPoly message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IGcsDestination} message GcsDestination message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - NormalizedBoundingPoly.encode = function encode(message, writer) { + GcsDestination.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.vertices != null && message.vertices.length) - for (var i = 0; i < message.vertices.length; ++i) - $root.google.cloud.vision.v1p3beta1.NormalizedVertex.encode(message.vertices[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.uri != null && message.hasOwnProperty("uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); return writer; }; /** - * Encodes the specified NormalizedBoundingPoly message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.NormalizedBoundingPoly.verify|verify} messages. + * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.GcsDestination.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.NormalizedBoundingPoly + * @memberof google.cloud.vision.v1p3beta1.GcsDestination * @static - * @param {google.cloud.vision.v1p3beta1.INormalizedBoundingPoly} message NormalizedBoundingPoly message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IGcsDestination} message GcsDestination message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - NormalizedBoundingPoly.encodeDelimited = function encodeDelimited(message, writer) { + GcsDestination.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a NormalizedBoundingPoly message from the specified reader or buffer. + * Decodes a GcsDestination message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.NormalizedBoundingPoly + * @memberof google.cloud.vision.v1p3beta1.GcsDestination * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.NormalizedBoundingPoly} NormalizedBoundingPoly + * @returns {google.cloud.vision.v1p3beta1.GcsDestination} GcsDestination * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - NormalizedBoundingPoly.decode = function decode(reader, length) { + GcsDestination.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.vision.v1p3beta1.NormalizedBoundingPoly(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.GcsDestination(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.vertices && message.vertices.length)) - message.vertices = []; - message.vertices.push($root.google.cloud.vision.v1p3beta1.NormalizedVertex.decode(reader, reader.uint32())); + message.uri = reader.string(); break; default: reader.skipType(tag & 7); @@ -60201,126 +60138,131 @@ }; /** - * Decodes a NormalizedBoundingPoly message from the specified reader or buffer, length delimited. + * Decodes a GcsDestination message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.NormalizedBoundingPoly + * @memberof google.cloud.vision.v1p3beta1.GcsDestination * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.NormalizedBoundingPoly} NormalizedBoundingPoly + * @returns {google.cloud.vision.v1p3beta1.GcsDestination} GcsDestination * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - NormalizedBoundingPoly.decodeDelimited = function decodeDelimited(reader) { + GcsDestination.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a NormalizedBoundingPoly message. + * Verifies a GcsDestination message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.NormalizedBoundingPoly + * @memberof google.cloud.vision.v1p3beta1.GcsDestination * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - NormalizedBoundingPoly.verify = function verify(message) { + GcsDestination.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.vertices != null && message.hasOwnProperty("vertices")) { - if (!Array.isArray(message.vertices)) - return "vertices: array expected"; - for (var i = 0; i < message.vertices.length; ++i) { - var error = $root.google.cloud.vision.v1p3beta1.NormalizedVertex.verify(message.vertices[i]); - if (error) - return "vertices." + error; - } - } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; return null; }; /** - * Creates a NormalizedBoundingPoly message from a plain object. Also converts values to their respective internal types. + * Creates a GcsDestination message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.NormalizedBoundingPoly + * @memberof google.cloud.vision.v1p3beta1.GcsDestination * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.NormalizedBoundingPoly} NormalizedBoundingPoly + * @returns {google.cloud.vision.v1p3beta1.GcsDestination} GcsDestination */ - NormalizedBoundingPoly.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.NormalizedBoundingPoly) + GcsDestination.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.GcsDestination) return object; - var message = new $root.google.cloud.vision.v1p3beta1.NormalizedBoundingPoly(); - if (object.vertices) { - if (!Array.isArray(object.vertices)) - throw TypeError(".google.cloud.vision.v1p3beta1.NormalizedBoundingPoly.vertices: array expected"); - message.vertices = []; - for (var i = 0; i < object.vertices.length; ++i) { - if (typeof object.vertices[i] !== "object") - throw TypeError(".google.cloud.vision.v1p3beta1.NormalizedBoundingPoly.vertices: object expected"); - message.vertices[i] = $root.google.cloud.vision.v1p3beta1.NormalizedVertex.fromObject(object.vertices[i]); - } - } + var message = new $root.google.cloud.vision.v1p3beta1.GcsDestination(); + if (object.uri != null) + message.uri = String(object.uri); return message; }; /** - * Creates a plain object from a NormalizedBoundingPoly message. Also converts values to other types if specified. + * Creates a plain object from a GcsDestination message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.NormalizedBoundingPoly + * @memberof google.cloud.vision.v1p3beta1.GcsDestination * @static - * @param {google.cloud.vision.v1p3beta1.NormalizedBoundingPoly} message NormalizedBoundingPoly + * @param {google.cloud.vision.v1p3beta1.GcsDestination} message GcsDestination * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - NormalizedBoundingPoly.toObject = function toObject(message, options) { + GcsDestination.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.vertices = []; - if (message.vertices && message.vertices.length) { - object.vertices = []; - for (var j = 0; j < message.vertices.length; ++j) - object.vertices[j] = $root.google.cloud.vision.v1p3beta1.NormalizedVertex.toObject(message.vertices[j], options); - } + if (options.defaults) + object.uri = ""; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; return object; }; /** - * Converts this NormalizedBoundingPoly to JSON. + * Converts this GcsDestination to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.NormalizedBoundingPoly + * @memberof google.cloud.vision.v1p3beta1.GcsDestination * @instance * @returns {Object.} JSON object */ - NormalizedBoundingPoly.prototype.toJSON = function toJSON() { + GcsDestination.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return NormalizedBoundingPoly; + return GcsDestination; })(); - v1p3beta1.Position = (function() { + /** + * Likelihood enum. + * @name google.cloud.vision.v1p3beta1.Likelihood + * @enum {string} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} VERY_UNLIKELY=1 VERY_UNLIKELY value + * @property {number} UNLIKELY=2 UNLIKELY value + * @property {number} POSSIBLE=3 POSSIBLE value + * @property {number} LIKELY=4 LIKELY value + * @property {number} VERY_LIKELY=5 VERY_LIKELY value + */ + v1p3beta1.Likelihood = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "VERY_UNLIKELY"] = 1; + values[valuesById[2] = "UNLIKELY"] = 2; + values[valuesById[3] = "POSSIBLE"] = 3; + values[valuesById[4] = "LIKELY"] = 4; + values[valuesById[5] = "VERY_LIKELY"] = 5; + return values; + })(); + + v1p3beta1.OperationMetadata = (function() { /** - * Properties of a Position. + * Properties of an OperationMetadata. * @memberof google.cloud.vision.v1p3beta1 - * @interface IPosition - * @property {number|null} [x] Position x - * @property {number|null} [y] Position y - * @property {number|null} [z] Position z + * @interface IOperationMetadata + * @property {google.cloud.vision.v1p3beta1.OperationMetadata.State|null} [state] OperationMetadata state + * @property {google.protobuf.ITimestamp|null} [createTime] OperationMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] OperationMetadata updateTime */ /** - * Constructs a new Position. + * Constructs a new OperationMetadata. * @memberof google.cloud.vision.v1p3beta1 - * @classdesc Represents a Position. - * @implements IPosition + * @classdesc Represents an OperationMetadata. + * @implements IOperationMetadata * @constructor - * @param {google.cloud.vision.v1p3beta1.IPosition=} [properties] Properties to set + * @param {google.cloud.vision.v1p3beta1.IOperationMetadata=} [properties] Properties to set */ - function Position(properties) { + function OperationMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -60328,101 +60270,101 @@ } /** - * Position x. - * @member {number} x - * @memberof google.cloud.vision.v1p3beta1.Position + * OperationMetadata state. + * @member {google.cloud.vision.v1p3beta1.OperationMetadata.State} state + * @memberof google.cloud.vision.v1p3beta1.OperationMetadata * @instance */ - Position.prototype.x = 0; + OperationMetadata.prototype.state = 0; /** - * Position y. - * @member {number} y - * @memberof google.cloud.vision.v1p3beta1.Position + * OperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.vision.v1p3beta1.OperationMetadata * @instance */ - Position.prototype.y = 0; + OperationMetadata.prototype.createTime = null; /** - * Position z. - * @member {number} z - * @memberof google.cloud.vision.v1p3beta1.Position + * OperationMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.vision.v1p3beta1.OperationMetadata * @instance */ - Position.prototype.z = 0; + OperationMetadata.prototype.updateTime = null; /** - * Creates a new Position instance using the specified properties. + * Creates a new OperationMetadata instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p3beta1.Position + * @memberof google.cloud.vision.v1p3beta1.OperationMetadata * @static - * @param {google.cloud.vision.v1p3beta1.IPosition=} [properties] Properties to set - * @returns {google.cloud.vision.v1p3beta1.Position} Position instance + * @param {google.cloud.vision.v1p3beta1.IOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.vision.v1p3beta1.OperationMetadata} OperationMetadata instance */ - Position.create = function create(properties) { - return new Position(properties); + OperationMetadata.create = function create(properties) { + return new OperationMetadata(properties); }; /** - * Encodes the specified Position message. Does not implicitly {@link google.cloud.vision.v1p3beta1.Position.verify|verify} messages. + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.vision.v1p3beta1.OperationMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p3beta1.Position + * @memberof google.cloud.vision.v1p3beta1.OperationMetadata * @static - * @param {google.cloud.vision.v1p3beta1.IPosition} message Position message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IOperationMetadata} message OperationMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Position.encode = function encode(message, writer) { + OperationMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.x != null && message.hasOwnProperty("x")) - writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); - if (message.y != null && message.hasOwnProperty("y")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); - if (message.z != null && message.hasOwnProperty("z")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.z); + if (message.state != null && message.hasOwnProperty("state")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); + if (message.createTime != null && message.hasOwnProperty("createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); return writer; }; /** - * Encodes the specified Position message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.Position.verify|verify} messages. + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.vision.v1p3beta1.OperationMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p3beta1.Position + * @memberof google.cloud.vision.v1p3beta1.OperationMetadata * @static - * @param {google.cloud.vision.v1p3beta1.IPosition} message Position message or plain object to encode + * @param {google.cloud.vision.v1p3beta1.IOperationMetadata} message OperationMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Position.encodeDelimited = function encodeDelimited(message, writer) { + OperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Position message from the specified reader or buffer. + * Decodes an OperationMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p3beta1.Position + * @memberof google.cloud.vision.v1p3beta1.OperationMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p3beta1.Position} Position + * @returns {google.cloud.vision.v1p3beta1.OperationMetadata} OperationMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Position.decode = function decode(reader, length) { + OperationMetadata.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.vision.v1p3beta1.Position(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p3beta1.OperationMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.x = reader.float(); + message.state = reader.int32(); break; - case 2: - message.y = reader.float(); + case 5: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; - case 3: - message.z = reader.float(); + case 6: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -60433,104 +60375,162 @@ }; /** - * Decodes a Position message from the specified reader or buffer, length delimited. + * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p3beta1.Position + * @memberof google.cloud.vision.v1p3beta1.OperationMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p3beta1.Position} Position + * @returns {google.cloud.vision.v1p3beta1.OperationMetadata} OperationMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Position.decodeDelimited = function decodeDelimited(reader) { + OperationMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Position message. + * Verifies an OperationMetadata message. * @function verify - * @memberof google.cloud.vision.v1p3beta1.Position + * @memberof google.cloud.vision.v1p3beta1.OperationMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Position.verify = function verify(message) { + OperationMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.x != null && message.hasOwnProperty("x")) - if (typeof message.x !== "number") - return "x: number expected"; - if (message.y != null && message.hasOwnProperty("y")) - if (typeof message.y !== "number") - return "y: number expected"; - if (message.z != null && message.hasOwnProperty("z")) - if (typeof message.z !== "number") - return "z: number expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } return null; }; /** - * Creates a Position message from a plain object. Also converts values to their respective internal types. + * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p3beta1.Position + * @memberof google.cloud.vision.v1p3beta1.OperationMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p3beta1.Position} Position + * @returns {google.cloud.vision.v1p3beta1.OperationMetadata} OperationMetadata */ - Position.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p3beta1.Position) + OperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p3beta1.OperationMetadata) return object; - var message = new $root.google.cloud.vision.v1p3beta1.Position(); - if (object.x != null) - message.x = Number(object.x); - if (object.y != null) - message.y = Number(object.y); - if (object.z != null) - message.z = Number(object.z); + var message = new $root.google.cloud.vision.v1p3beta1.OperationMetadata(); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "CREATED": + case 1: + message.state = 1; + break; + case "RUNNING": + case 2: + message.state = 2; + break; + case "DONE": + case 3: + message.state = 3; + break; + case "CANCELLED": + case 4: + message.state = 4; + break; + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.OperationMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.vision.v1p3beta1.OperationMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } return message; }; /** - * Creates a plain object from a Position message. Also converts values to other types if specified. + * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p3beta1.Position + * @memberof google.cloud.vision.v1p3beta1.OperationMetadata * @static - * @param {google.cloud.vision.v1p3beta1.Position} message Position + * @param {google.cloud.vision.v1p3beta1.OperationMetadata} message OperationMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Position.toObject = function toObject(message, options) { + OperationMetadata.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.x = 0; - object.y = 0; - object.z = 0; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.createTime = null; + object.updateTime = null; } - if (message.x != null && message.hasOwnProperty("x")) - object.x = options.json && !isFinite(message.x) ? String(message.x) : message.x; - if (message.y != null && message.hasOwnProperty("y")) - object.y = options.json && !isFinite(message.y) ? String(message.y) : message.y; - if (message.z != null && message.hasOwnProperty("z")) - object.z = options.json && !isFinite(message.z) ? String(message.z) : message.z; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.vision.v1p3beta1.OperationMetadata.State[message.state] : message.state; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); return object; }; /** - * Converts this Position to JSON. + * Converts this OperationMetadata to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.Position + * @memberof google.cloud.vision.v1p3beta1.OperationMetadata * @instance * @returns {Object.} JSON object */ - Position.prototype.toJSON = function toJSON() { + OperationMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Position; + /** + * State enum. + * @name google.cloud.vision.v1p3beta1.OperationMetadata.State + * @enum {string} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} CREATED=1 CREATED value + * @property {number} RUNNING=2 RUNNING value + * @property {number} DONE=3 DONE value + * @property {number} CANCELLED=4 CANCELLED value + */ + OperationMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "CREATED"] = 1; + values[valuesById[2] = "RUNNING"] = 2; + values[valuesById[3] = "DONE"] = 3; + values[valuesById[4] = "CANCELLED"] = 4; + return values; + })(); + + return OperationMetadata; })(); v1p3beta1.ProductSearchParams = (function() { @@ -72991,229 +72991,496 @@ object.label = ""; object.languageCode = ""; } - if (message.label != null && message.hasOwnProperty("label")) - object.label = message.label; - if (message.languageCode != null && message.hasOwnProperty("languageCode")) - object.languageCode = message.languageCode; - return object; - }; + if (message.label != null && message.hasOwnProperty("label")) + object.label = message.label; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this WebLabel to JSON. + * @function toJSON + * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebLabel + * @instance + * @returns {Object.} JSON object + */ + WebLabel.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return WebLabel; + })(); + + return WebDetection; + })(); + + return v1p3beta1; + })(); + + vision.v1p4beta1 = (function() { + + /** + * Namespace v1p4beta1. + * @memberof google.cloud.vision + * @namespace + */ + var v1p4beta1 = {}; + + v1p4beta1.FaceRecognitionParams = (function() { + + /** + * Properties of a FaceRecognitionParams. + * @memberof google.cloud.vision.v1p4beta1 + * @interface IFaceRecognitionParams + * @property {Array.|null} [celebritySet] FaceRecognitionParams celebritySet + */ + + /** + * Constructs a new FaceRecognitionParams. + * @memberof google.cloud.vision.v1p4beta1 + * @classdesc Represents a FaceRecognitionParams. + * @implements IFaceRecognitionParams + * @constructor + * @param {google.cloud.vision.v1p4beta1.IFaceRecognitionParams=} [properties] Properties to set + */ + function FaceRecognitionParams(properties) { + this.celebritySet = []; + 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]]; + } + + /** + * FaceRecognitionParams celebritySet. + * @member {Array.} celebritySet + * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionParams + * @instance + */ + FaceRecognitionParams.prototype.celebritySet = $util.emptyArray; + + /** + * Creates a new FaceRecognitionParams instance using the specified properties. + * @function create + * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionParams + * @static + * @param {google.cloud.vision.v1p4beta1.IFaceRecognitionParams=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.FaceRecognitionParams} FaceRecognitionParams instance + */ + FaceRecognitionParams.create = function create(properties) { + return new FaceRecognitionParams(properties); + }; + + /** + * Encodes the specified FaceRecognitionParams message. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceRecognitionParams.verify|verify} messages. + * @function encode + * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionParams + * @static + * @param {google.cloud.vision.v1p4beta1.IFaceRecognitionParams} message FaceRecognitionParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FaceRecognitionParams.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.celebritySet != null && message.celebritySet.length) + for (var i = 0; i < message.celebritySet.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.celebritySet[i]); + return writer; + }; + + /** + * Encodes the specified FaceRecognitionParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceRecognitionParams.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionParams + * @static + * @param {google.cloud.vision.v1p4beta1.IFaceRecognitionParams} message FaceRecognitionParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FaceRecognitionParams.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FaceRecognitionParams message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.vision.v1p4beta1.FaceRecognitionParams} FaceRecognitionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FaceRecognitionParams.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.vision.v1p4beta1.FaceRecognitionParams(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.celebritySet && message.celebritySet.length)) + message.celebritySet = []; + message.celebritySet.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Converts this WebLabel to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p3beta1.WebDetection.WebLabel - * @instance - * @returns {Object.} JSON object - */ - WebLabel.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Decodes a FaceRecognitionParams message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.vision.v1p4beta1.FaceRecognitionParams} FaceRecognitionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FaceRecognitionParams.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - return WebLabel; - })(); + /** + * Verifies a FaceRecognitionParams message. + * @function verify + * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionParams + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FaceRecognitionParams.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.celebritySet != null && message.hasOwnProperty("celebritySet")) { + if (!Array.isArray(message.celebritySet)) + return "celebritySet: array expected"; + for (var i = 0; i < message.celebritySet.length; ++i) + if (!$util.isString(message.celebritySet[i])) + return "celebritySet: string[] expected"; + } + return null; + }; - return WebDetection; - })(); + /** + * Creates a FaceRecognitionParams message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionParams + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.vision.v1p4beta1.FaceRecognitionParams} FaceRecognitionParams + */ + FaceRecognitionParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.FaceRecognitionParams) + return object; + var message = new $root.google.cloud.vision.v1p4beta1.FaceRecognitionParams(); + if (object.celebritySet) { + if (!Array.isArray(object.celebritySet)) + throw TypeError(".google.cloud.vision.v1p4beta1.FaceRecognitionParams.celebritySet: array expected"); + message.celebritySet = []; + for (var i = 0; i < object.celebritySet.length; ++i) + message.celebritySet[i] = String(object.celebritySet[i]); + } + return message; + }; - return v1p3beta1; - })(); + /** + * Creates a plain object from a FaceRecognitionParams message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionParams + * @static + * @param {google.cloud.vision.v1p4beta1.FaceRecognitionParams} message FaceRecognitionParams + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FaceRecognitionParams.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.celebritySet = []; + if (message.celebritySet && message.celebritySet.length) { + object.celebritySet = []; + for (var j = 0; j < message.celebritySet.length; ++j) + object.celebritySet[j] = message.celebritySet[j]; + } + return object; + }; - vision.v1p4beta1 = (function() { + /** + * Converts this FaceRecognitionParams to JSON. + * @function toJSON + * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionParams + * @instance + * @returns {Object.} JSON object + */ + FaceRecognitionParams.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Namespace v1p4beta1. - * @memberof google.cloud.vision - * @namespace - */ - var v1p4beta1 = {}; + return FaceRecognitionParams; + })(); - v1p4beta1.ImageAnnotator = (function() { + v1p4beta1.Celebrity = (function() { /** - * Constructs a new ImageAnnotator service. + * Properties of a Celebrity. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an ImageAnnotator - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @interface ICelebrity + * @property {string|null} [name] Celebrity name + * @property {string|null} [displayName] Celebrity displayName + * @property {string|null} [description] Celebrity description */ - function ImageAnnotator(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (ImageAnnotator.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ImageAnnotator; /** - * Creates new ImageAnnotator service using the specified rpc implementation. - * @function create - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotator - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {ImageAnnotator} RPC service. Useful where requests and/or responses are streamed. + * Constructs a new Celebrity. + * @memberof google.cloud.vision.v1p4beta1 + * @classdesc Represents a Celebrity. + * @implements ICelebrity + * @constructor + * @param {google.cloud.vision.v1p4beta1.ICelebrity=} [properties] Properties to set */ - ImageAnnotator.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; + function Celebrity(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]]; + } /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ImageAnnotator#batchAnnotateImages}. - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotator - * @typedef BatchAnnotateImagesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse} [response] BatchAnnotateImagesResponse + * Celebrity name. + * @member {string} name + * @memberof google.cloud.vision.v1p4beta1.Celebrity + * @instance */ + Celebrity.prototype.name = ""; /** - * Calls BatchAnnotateImages. - * @function batchAnnotateImages - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotator + * Celebrity displayName. + * @member {string} displayName + * @memberof google.cloud.vision.v1p4beta1.Celebrity * @instance - * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest} request BatchAnnotateImagesRequest message or plain object - * @param {google.cloud.vision.v1p4beta1.ImageAnnotator.BatchAnnotateImagesCallback} callback Node-style callback called with the error, if any, and BatchAnnotateImagesResponse - * @returns {undefined} - * @variation 1 */ - Object.defineProperty(ImageAnnotator.prototype.batchAnnotateImages = function batchAnnotateImages(request, callback) { - return this.rpcCall(batchAnnotateImages, $root.google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest, $root.google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse, request, callback); - }, "name", { value: "BatchAnnotateImages" }); + Celebrity.prototype.displayName = ""; /** - * Calls BatchAnnotateImages. - * @function batchAnnotateImages - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotator + * Celebrity description. + * @member {string} description + * @memberof google.cloud.vision.v1p4beta1.Celebrity * @instance - * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest} request BatchAnnotateImagesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 */ + Celebrity.prototype.description = ""; /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ImageAnnotator#batchAnnotateFiles}. - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotator - * @typedef BatchAnnotateFilesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse} [response] BatchAnnotateFilesResponse + * Creates a new Celebrity instance using the specified properties. + * @function create + * @memberof google.cloud.vision.v1p4beta1.Celebrity + * @static + * @param {google.cloud.vision.v1p4beta1.ICelebrity=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.Celebrity} Celebrity instance */ + Celebrity.create = function create(properties) { + return new Celebrity(properties); + }; /** - * Calls BatchAnnotateFiles. - * @function batchAnnotateFiles - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotator - * @instance - * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest} request BatchAnnotateFilesRequest message or plain object - * @param {google.cloud.vision.v1p4beta1.ImageAnnotator.BatchAnnotateFilesCallback} callback Node-style callback called with the error, if any, and BatchAnnotateFilesResponse - * @returns {undefined} - * @variation 1 + * Encodes the specified Celebrity message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Celebrity.verify|verify} messages. + * @function encode + * @memberof google.cloud.vision.v1p4beta1.Celebrity + * @static + * @param {google.cloud.vision.v1p4beta1.ICelebrity} message Celebrity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ - Object.defineProperty(ImageAnnotator.prototype.batchAnnotateFiles = function batchAnnotateFiles(request, callback) { - return this.rpcCall(batchAnnotateFiles, $root.google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest, $root.google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse, request, callback); - }, "name", { value: "BatchAnnotateFiles" }); + Celebrity.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.displayName != null && message.hasOwnProperty("displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.description != null && message.hasOwnProperty("description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + return writer; + }; /** - * Calls BatchAnnotateFiles. - * @function batchAnnotateFiles - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotator - * @instance - * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest} request BatchAnnotateFilesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Encodes the specified Celebrity message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Celebrity.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.vision.v1p4beta1.Celebrity + * @static + * @param {google.cloud.vision.v1p4beta1.ICelebrity} message Celebrity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer */ + Celebrity.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ImageAnnotator#asyncBatchAnnotateImages}. - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotator - * @typedef AsyncBatchAnnotateImagesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation + * Decodes a Celebrity message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.vision.v1p4beta1.Celebrity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.vision.v1p4beta1.Celebrity} Celebrity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ + Celebrity.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.vision.v1p4beta1.Celebrity(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.displayName = reader.string(); + break; + case 3: + message.description = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; /** - * Calls AsyncBatchAnnotateImages. - * @function asyncBatchAnnotateImages - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotator - * @instance - * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest} request AsyncBatchAnnotateImagesRequest message or plain object - * @param {google.cloud.vision.v1p4beta1.ImageAnnotator.AsyncBatchAnnotateImagesCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 + * Decodes a Celebrity message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.vision.v1p4beta1.Celebrity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.vision.v1p4beta1.Celebrity} Celebrity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Object.defineProperty(ImageAnnotator.prototype.asyncBatchAnnotateImages = function asyncBatchAnnotateImages(request, callback) { - return this.rpcCall(asyncBatchAnnotateImages, $root.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "AsyncBatchAnnotateImages" }); + Celebrity.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; /** - * Calls AsyncBatchAnnotateImages. - * @function asyncBatchAnnotateImages - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotator - * @instance - * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest} request AsyncBatchAnnotateImagesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * Verifies a Celebrity message. + * @function verify + * @memberof google.cloud.vision.v1p4beta1.Celebrity + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not */ + Celebrity.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + return null; + }; /** - * Callback as used by {@link google.cloud.vision.v1p4beta1.ImageAnnotator#asyncBatchAnnotateFiles}. - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotator - * @typedef AsyncBatchAnnotateFilesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.longrunning.Operation} [response] Operation + * Creates a Celebrity message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.vision.v1p4beta1.Celebrity + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.vision.v1p4beta1.Celebrity} Celebrity */ + Celebrity.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.Celebrity) + return object; + var message = new $root.google.cloud.vision.v1p4beta1.Celebrity(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.description != null) + message.description = String(object.description); + return message; + }; /** - * Calls AsyncBatchAnnotateFiles. - * @function asyncBatchAnnotateFiles - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotator - * @instance - * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest} request AsyncBatchAnnotateFilesRequest message or plain object - * @param {google.cloud.vision.v1p4beta1.ImageAnnotator.AsyncBatchAnnotateFilesCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 + * Creates a plain object from a Celebrity message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.vision.v1p4beta1.Celebrity + * @static + * @param {google.cloud.vision.v1p4beta1.Celebrity} message Celebrity + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object */ - Object.defineProperty(ImageAnnotator.prototype.asyncBatchAnnotateFiles = function asyncBatchAnnotateFiles(request, callback) { - return this.rpcCall(asyncBatchAnnotateFiles, $root.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest, $root.google.longrunning.Operation, request, callback); - }, "name", { value: "AsyncBatchAnnotateFiles" }); + Celebrity.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.description = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + return object; + }; /** - * Calls AsyncBatchAnnotateFiles. - * @function asyncBatchAnnotateFiles - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotator + * Converts this Celebrity to JSON. + * @function toJSON + * @memberof google.cloud.vision.v1p4beta1.Celebrity * @instance - * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest} request AsyncBatchAnnotateFilesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 + * @returns {Object.} JSON object */ + Celebrity.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - return ImageAnnotator; + return Celebrity; })(); - v1p4beta1.Feature = (function() { + v1p4beta1.FaceRecognitionResult = (function() { /** - * Properties of a Feature. + * Properties of a FaceRecognitionResult. * @memberof google.cloud.vision.v1p4beta1 - * @interface IFeature - * @property {google.cloud.vision.v1p4beta1.Feature.Type|null} [type] Feature type - * @property {number|null} [maxResults] Feature maxResults - * @property {string|null} [model] Feature model + * @interface IFaceRecognitionResult + * @property {google.cloud.vision.v1p4beta1.ICelebrity|null} [celebrity] FaceRecognitionResult celebrity + * @property {number|null} [confidence] FaceRecognitionResult confidence */ /** - * Constructs a new Feature. + * Constructs a new FaceRecognitionResult. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a Feature. - * @implements IFeature + * @classdesc Represents a FaceRecognitionResult. + * @implements IFaceRecognitionResult * @constructor - * @param {google.cloud.vision.v1p4beta1.IFeature=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IFaceRecognitionResult=} [properties] Properties to set */ - function Feature(properties) { + function FaceRecognitionResult(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -73221,101 +73488,88 @@ } /** - * Feature type. - * @member {google.cloud.vision.v1p4beta1.Feature.Type} type - * @memberof google.cloud.vision.v1p4beta1.Feature - * @instance - */ - Feature.prototype.type = 0; - - /** - * Feature maxResults. - * @member {number} maxResults - * @memberof google.cloud.vision.v1p4beta1.Feature + * FaceRecognitionResult celebrity. + * @member {google.cloud.vision.v1p4beta1.ICelebrity|null|undefined} celebrity + * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult * @instance */ - Feature.prototype.maxResults = 0; + FaceRecognitionResult.prototype.celebrity = null; /** - * Feature model. - * @member {string} model - * @memberof google.cloud.vision.v1p4beta1.Feature + * FaceRecognitionResult confidence. + * @member {number} confidence + * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult * @instance */ - Feature.prototype.model = ""; + FaceRecognitionResult.prototype.confidence = 0; /** - * Creates a new Feature instance using the specified properties. + * Creates a new FaceRecognitionResult instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.Feature + * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult * @static - * @param {google.cloud.vision.v1p4beta1.IFeature=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.Feature} Feature instance + * @param {google.cloud.vision.v1p4beta1.IFaceRecognitionResult=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.FaceRecognitionResult} FaceRecognitionResult instance */ - Feature.create = function create(properties) { - return new Feature(properties); + FaceRecognitionResult.create = function create(properties) { + return new FaceRecognitionResult(properties); }; /** - * Encodes the specified Feature message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Feature.verify|verify} messages. + * Encodes the specified FaceRecognitionResult message. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceRecognitionResult.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.Feature + * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult * @static - * @param {google.cloud.vision.v1p4beta1.IFeature} message Feature message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IFaceRecognitionResult} message FaceRecognitionResult message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Feature.encode = function encode(message, writer) { + FaceRecognitionResult.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.type != null && message.hasOwnProperty("type")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); - if (message.maxResults != null && message.hasOwnProperty("maxResults")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.maxResults); - if (message.model != null && message.hasOwnProperty("model")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.model); + if (message.celebrity != null && message.hasOwnProperty("celebrity")) + $root.google.cloud.vision.v1p4beta1.Celebrity.encode(message.celebrity, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.confidence != null && message.hasOwnProperty("confidence")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); return writer; }; /** - * Encodes the specified Feature message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Feature.verify|verify} messages. + * Encodes the specified FaceRecognitionResult message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceRecognitionResult.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.Feature + * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult * @static - * @param {google.cloud.vision.v1p4beta1.IFeature} message Feature message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IFaceRecognitionResult} message FaceRecognitionResult message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Feature.encodeDelimited = function encodeDelimited(message, writer) { + FaceRecognitionResult.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Feature message from the specified reader or buffer. + * Decodes a FaceRecognitionResult message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.Feature + * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.Feature} Feature + * @returns {google.cloud.vision.v1p4beta1.FaceRecognitionResult} FaceRecognitionResult * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Feature.decode = function decode(reader, length) { + FaceRecognitionResult.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.vision.v1p4beta1.Feature(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.FaceRecognitionResult(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.type = reader.int32(); + message.celebrity = $root.google.cloud.vision.v1p4beta1.Celebrity.decode(reader, reader.uint32()); break; case 2: - message.maxResults = reader.int32(); - break; - case 3: - message.model = reader.string(); + message.confidence = reader.float(); break; default: reader.skipType(tag & 7); @@ -73326,229 +73580,122 @@ }; /** - * Decodes a Feature message from the specified reader or buffer, length delimited. + * Decodes a FaceRecognitionResult message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.Feature + * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.Feature} Feature + * @returns {google.cloud.vision.v1p4beta1.FaceRecognitionResult} FaceRecognitionResult * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Feature.decodeDelimited = function decodeDelimited(reader) { + FaceRecognitionResult.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Feature message. + * Verifies a FaceRecognitionResult message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.Feature + * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Feature.verify = function verify(message) { + FaceRecognitionResult.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 11: - case 6: - case 7: - case 9: - case 10: - case 12: - case 19: - break; - } - if (message.maxResults != null && message.hasOwnProperty("maxResults")) - if (!$util.isInteger(message.maxResults)) - return "maxResults: integer expected"; - if (message.model != null && message.hasOwnProperty("model")) - if (!$util.isString(message.model)) - return "model: string expected"; + if (message.celebrity != null && message.hasOwnProperty("celebrity")) { + var error = $root.google.cloud.vision.v1p4beta1.Celebrity.verify(message.celebrity); + if (error) + return "celebrity." + error; + } + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; return null; }; /** - * Creates a Feature message from a plain object. Also converts values to their respective internal types. + * Creates a FaceRecognitionResult message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.Feature + * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.Feature} Feature + * @returns {google.cloud.vision.v1p4beta1.FaceRecognitionResult} FaceRecognitionResult */ - Feature.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.Feature) + FaceRecognitionResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.FaceRecognitionResult) return object; - var message = new $root.google.cloud.vision.v1p4beta1.Feature(); - switch (object.type) { - case "TYPE_UNSPECIFIED": - case 0: - message.type = 0; - break; - case "FACE_DETECTION": - case 1: - message.type = 1; - break; - case "LANDMARK_DETECTION": - case 2: - message.type = 2; - break; - case "LOGO_DETECTION": - case 3: - message.type = 3; - break; - case "LABEL_DETECTION": - case 4: - message.type = 4; - break; - case "TEXT_DETECTION": - case 5: - message.type = 5; - break; - case "DOCUMENT_TEXT_DETECTION": - case 11: - message.type = 11; - break; - case "SAFE_SEARCH_DETECTION": - case 6: - message.type = 6; - break; - case "IMAGE_PROPERTIES": - case 7: - message.type = 7; - break; - case "CROP_HINTS": - case 9: - message.type = 9; - break; - case "WEB_DETECTION": - case 10: - message.type = 10; - break; - case "PRODUCT_SEARCH": - case 12: - message.type = 12; - break; - case "OBJECT_LOCALIZATION": - case 19: - message.type = 19; - break; + var message = new $root.google.cloud.vision.v1p4beta1.FaceRecognitionResult(); + if (object.celebrity != null) { + if (typeof object.celebrity !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.FaceRecognitionResult.celebrity: object expected"); + message.celebrity = $root.google.cloud.vision.v1p4beta1.Celebrity.fromObject(object.celebrity); } - if (object.maxResults != null) - message.maxResults = object.maxResults | 0; - if (object.model != null) - message.model = String(object.model); + if (object.confidence != null) + message.confidence = Number(object.confidence); return message; }; /** - * Creates a plain object from a Feature message. Also converts values to other types if specified. + * Creates a plain object from a FaceRecognitionResult message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.Feature + * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult * @static - * @param {google.cloud.vision.v1p4beta1.Feature} message Feature + * @param {google.cloud.vision.v1p4beta1.FaceRecognitionResult} message FaceRecognitionResult * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Feature.toObject = function toObject(message, options) { + FaceRecognitionResult.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; - object.maxResults = 0; - object.model = ""; + object.celebrity = null; + object.confidence = 0; } - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.vision.v1p4beta1.Feature.Type[message.type] : message.type; - if (message.maxResults != null && message.hasOwnProperty("maxResults")) - object.maxResults = message.maxResults; - if (message.model != null && message.hasOwnProperty("model")) - object.model = message.model; + if (message.celebrity != null && message.hasOwnProperty("celebrity")) + object.celebrity = $root.google.cloud.vision.v1p4beta1.Celebrity.toObject(message.celebrity, options); + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; return object; }; /** - * Converts this Feature to JSON. + * Converts this FaceRecognitionResult to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.Feature + * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult * @instance * @returns {Object.} JSON object */ - Feature.prototype.toJSON = function toJSON() { + FaceRecognitionResult.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * Type enum. - * @name google.cloud.vision.v1p4beta1.Feature.Type - * @enum {string} - * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value - * @property {number} FACE_DETECTION=1 FACE_DETECTION value - * @property {number} LANDMARK_DETECTION=2 LANDMARK_DETECTION value - * @property {number} LOGO_DETECTION=3 LOGO_DETECTION value - * @property {number} LABEL_DETECTION=4 LABEL_DETECTION value - * @property {number} TEXT_DETECTION=5 TEXT_DETECTION value - * @property {number} DOCUMENT_TEXT_DETECTION=11 DOCUMENT_TEXT_DETECTION value - * @property {number} SAFE_SEARCH_DETECTION=6 SAFE_SEARCH_DETECTION value - * @property {number} IMAGE_PROPERTIES=7 IMAGE_PROPERTIES value - * @property {number} CROP_HINTS=9 CROP_HINTS value - * @property {number} WEB_DETECTION=10 WEB_DETECTION value - * @property {number} PRODUCT_SEARCH=12 PRODUCT_SEARCH value - * @property {number} OBJECT_LOCALIZATION=19 OBJECT_LOCALIZATION value - */ - Feature.Type = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "FACE_DETECTION"] = 1; - values[valuesById[2] = "LANDMARK_DETECTION"] = 2; - values[valuesById[3] = "LOGO_DETECTION"] = 3; - values[valuesById[4] = "LABEL_DETECTION"] = 4; - values[valuesById[5] = "TEXT_DETECTION"] = 5; - values[valuesById[11] = "DOCUMENT_TEXT_DETECTION"] = 11; - values[valuesById[6] = "SAFE_SEARCH_DETECTION"] = 6; - values[valuesById[7] = "IMAGE_PROPERTIES"] = 7; - values[valuesById[9] = "CROP_HINTS"] = 9; - values[valuesById[10] = "WEB_DETECTION"] = 10; - values[valuesById[12] = "PRODUCT_SEARCH"] = 12; - values[valuesById[19] = "OBJECT_LOCALIZATION"] = 19; - return values; - })(); - - return Feature; + return FaceRecognitionResult; })(); - v1p4beta1.ImageSource = (function() { + v1p4beta1.Vertex = (function() { /** - * Properties of an ImageSource. + * Properties of a Vertex. * @memberof google.cloud.vision.v1p4beta1 - * @interface IImageSource - * @property {string|null} [gcsImageUri] ImageSource gcsImageUri - * @property {string|null} [imageUri] ImageSource imageUri + * @interface IVertex + * @property {number|null} [x] Vertex x + * @property {number|null} [y] Vertex y */ /** - * Constructs a new ImageSource. + * Constructs a new Vertex. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an ImageSource. - * @implements IImageSource + * @classdesc Represents a Vertex. + * @implements IVertex * @constructor - * @param {google.cloud.vision.v1p4beta1.IImageSource=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IVertex=} [properties] Properties to set */ - function ImageSource(properties) { + function Vertex(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -73556,88 +73703,88 @@ } /** - * ImageSource gcsImageUri. - * @member {string} gcsImageUri - * @memberof google.cloud.vision.v1p4beta1.ImageSource + * Vertex x. + * @member {number} x + * @memberof google.cloud.vision.v1p4beta1.Vertex * @instance */ - ImageSource.prototype.gcsImageUri = ""; + Vertex.prototype.x = 0; /** - * ImageSource imageUri. - * @member {string} imageUri - * @memberof google.cloud.vision.v1p4beta1.ImageSource + * Vertex y. + * @member {number} y + * @memberof google.cloud.vision.v1p4beta1.Vertex * @instance */ - ImageSource.prototype.imageUri = ""; + Vertex.prototype.y = 0; /** - * Creates a new ImageSource instance using the specified properties. + * Creates a new Vertex instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.ImageSource + * @memberof google.cloud.vision.v1p4beta1.Vertex * @static - * @param {google.cloud.vision.v1p4beta1.IImageSource=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.ImageSource} ImageSource instance + * @param {google.cloud.vision.v1p4beta1.IVertex=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.Vertex} Vertex instance */ - ImageSource.create = function create(properties) { - return new ImageSource(properties); + Vertex.create = function create(properties) { + return new Vertex(properties); }; /** - * Encodes the specified ImageSource message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageSource.verify|verify} messages. + * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Vertex.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.ImageSource + * @memberof google.cloud.vision.v1p4beta1.Vertex * @static - * @param {google.cloud.vision.v1p4beta1.IImageSource} message ImageSource message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IVertex} message Vertex message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageSource.encode = function encode(message, writer) { + Vertex.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.gcsImageUri != null && message.hasOwnProperty("gcsImageUri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsImageUri); - if (message.imageUri != null && message.hasOwnProperty("imageUri")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.imageUri); + if (message.x != null && message.hasOwnProperty("x")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.x); + if (message.y != null && message.hasOwnProperty("y")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.y); return writer; }; /** - * Encodes the specified ImageSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageSource.verify|verify} messages. + * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Vertex.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ImageSource + * @memberof google.cloud.vision.v1p4beta1.Vertex * @static - * @param {google.cloud.vision.v1p4beta1.IImageSource} message ImageSource message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IVertex} message Vertex message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageSource.encodeDelimited = function encodeDelimited(message, writer) { + Vertex.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImageSource message from the specified reader or buffer. + * Decodes a Vertex message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.ImageSource + * @memberof google.cloud.vision.v1p4beta1.Vertex * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.ImageSource} ImageSource + * @returns {google.cloud.vision.v1p4beta1.Vertex} Vertex * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageSource.decode = function decode(reader, length) { + Vertex.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.vision.v1p4beta1.ImageSource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.Vertex(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.gcsImageUri = reader.string(); + message.x = reader.int32(); break; case 2: - message.imageUri = reader.string(); + message.y = reader.int32(); break; default: reader.skipType(tag & 7); @@ -73648,117 +73795,117 @@ }; /** - * Decodes an ImageSource message from the specified reader or buffer, length delimited. + * Decodes a Vertex message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ImageSource + * @memberof google.cloud.vision.v1p4beta1.Vertex * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.ImageSource} ImageSource + * @returns {google.cloud.vision.v1p4beta1.Vertex} Vertex * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageSource.decodeDelimited = function decodeDelimited(reader) { + Vertex.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImageSource message. + * Verifies a Vertex message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.ImageSource + * @memberof google.cloud.vision.v1p4beta1.Vertex * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImageSource.verify = function verify(message) { + Vertex.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.gcsImageUri != null && message.hasOwnProperty("gcsImageUri")) - if (!$util.isString(message.gcsImageUri)) - return "gcsImageUri: string expected"; - if (message.imageUri != null && message.hasOwnProperty("imageUri")) - if (!$util.isString(message.imageUri)) - return "imageUri: string expected"; + if (message.x != null && message.hasOwnProperty("x")) + if (!$util.isInteger(message.x)) + return "x: integer expected"; + if (message.y != null && message.hasOwnProperty("y")) + if (!$util.isInteger(message.y)) + return "y: integer expected"; return null; }; /** - * Creates an ImageSource message from a plain object. Also converts values to their respective internal types. + * Creates a Vertex message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.ImageSource + * @memberof google.cloud.vision.v1p4beta1.Vertex * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.ImageSource} ImageSource + * @returns {google.cloud.vision.v1p4beta1.Vertex} Vertex */ - ImageSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.ImageSource) + Vertex.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.Vertex) return object; - var message = new $root.google.cloud.vision.v1p4beta1.ImageSource(); - if (object.gcsImageUri != null) - message.gcsImageUri = String(object.gcsImageUri); - if (object.imageUri != null) - message.imageUri = String(object.imageUri); + var message = new $root.google.cloud.vision.v1p4beta1.Vertex(); + if (object.x != null) + message.x = object.x | 0; + if (object.y != null) + message.y = object.y | 0; return message; }; /** - * Creates a plain object from an ImageSource message. Also converts values to other types if specified. + * Creates a plain object from a Vertex message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.ImageSource + * @memberof google.cloud.vision.v1p4beta1.Vertex * @static - * @param {google.cloud.vision.v1p4beta1.ImageSource} message ImageSource + * @param {google.cloud.vision.v1p4beta1.Vertex} message Vertex * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImageSource.toObject = function toObject(message, options) { + Vertex.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.gcsImageUri = ""; - object.imageUri = ""; + object.x = 0; + object.y = 0; } - if (message.gcsImageUri != null && message.hasOwnProperty("gcsImageUri")) - object.gcsImageUri = message.gcsImageUri; - if (message.imageUri != null && message.hasOwnProperty("imageUri")) - object.imageUri = message.imageUri; + if (message.x != null && message.hasOwnProperty("x")) + object.x = message.x; + if (message.y != null && message.hasOwnProperty("y")) + object.y = message.y; return object; }; /** - * Converts this ImageSource to JSON. + * Converts this Vertex to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.ImageSource + * @memberof google.cloud.vision.v1p4beta1.Vertex * @instance * @returns {Object.} JSON object */ - ImageSource.prototype.toJSON = function toJSON() { + Vertex.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImageSource; + return Vertex; })(); - v1p4beta1.Image = (function() { + v1p4beta1.NormalizedVertex = (function() { /** - * Properties of an Image. + * Properties of a NormalizedVertex. * @memberof google.cloud.vision.v1p4beta1 - * @interface IImage - * @property {Uint8Array|null} [content] Image content - * @property {google.cloud.vision.v1p4beta1.IImageSource|null} [source] Image source + * @interface INormalizedVertex + * @property {number|null} [x] NormalizedVertex x + * @property {number|null} [y] NormalizedVertex y */ /** - * Constructs a new Image. + * Constructs a new NormalizedVertex. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an Image. - * @implements IImage + * @classdesc Represents a NormalizedVertex. + * @implements INormalizedVertex * @constructor - * @param {google.cloud.vision.v1p4beta1.IImage=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.INormalizedVertex=} [properties] Properties to set */ - function Image(properties) { + function NormalizedVertex(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -73766,88 +73913,88 @@ } /** - * Image content. - * @member {Uint8Array} content - * @memberof google.cloud.vision.v1p4beta1.Image + * NormalizedVertex x. + * @member {number} x + * @memberof google.cloud.vision.v1p4beta1.NormalizedVertex * @instance */ - Image.prototype.content = $util.newBuffer([]); + NormalizedVertex.prototype.x = 0; /** - * Image source. - * @member {google.cloud.vision.v1p4beta1.IImageSource|null|undefined} source - * @memberof google.cloud.vision.v1p4beta1.Image + * NormalizedVertex y. + * @member {number} y + * @memberof google.cloud.vision.v1p4beta1.NormalizedVertex * @instance */ - Image.prototype.source = null; + NormalizedVertex.prototype.y = 0; /** - * Creates a new Image instance using the specified properties. + * Creates a new NormalizedVertex instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.Image + * @memberof google.cloud.vision.v1p4beta1.NormalizedVertex * @static - * @param {google.cloud.vision.v1p4beta1.IImage=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.Image} Image instance + * @param {google.cloud.vision.v1p4beta1.INormalizedVertex=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.NormalizedVertex} NormalizedVertex instance */ - Image.create = function create(properties) { - return new Image(properties); + NormalizedVertex.create = function create(properties) { + return new NormalizedVertex(properties); }; /** - * Encodes the specified Image message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Image.verify|verify} messages. + * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.vision.v1p4beta1.NormalizedVertex.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.Image + * @memberof google.cloud.vision.v1p4beta1.NormalizedVertex * @static - * @param {google.cloud.vision.v1p4beta1.IImage} message Image message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.INormalizedVertex} message NormalizedVertex message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Image.encode = function encode(message, writer) { + NormalizedVertex.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.content != null && message.hasOwnProperty("content")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.content); - if (message.source != null && message.hasOwnProperty("source")) - $root.google.cloud.vision.v1p4beta1.ImageSource.encode(message.source, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.x != null && message.hasOwnProperty("x")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); + if (message.y != null && message.hasOwnProperty("y")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); return writer; }; /** - * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Image.verify|verify} messages. + * Encodes the specified NormalizedVertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.NormalizedVertex.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.Image + * @memberof google.cloud.vision.v1p4beta1.NormalizedVertex * @static - * @param {google.cloud.vision.v1p4beta1.IImage} message Image message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.INormalizedVertex} message NormalizedVertex message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Image.encodeDelimited = function encodeDelimited(message, writer) { + NormalizedVertex.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an Image message from the specified reader or buffer. + * Decodes a NormalizedVertex message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.Image + * @memberof google.cloud.vision.v1p4beta1.NormalizedVertex * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.Image} Image + * @returns {google.cloud.vision.v1p4beta1.NormalizedVertex} NormalizedVertex * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Image.decode = function decode(reader, length) { + NormalizedVertex.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.vision.v1p4beta1.Image(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.NormalizedVertex(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.content = reader.bytes(); + message.x = reader.float(); break; case 2: - message.source = $root.google.cloud.vision.v1p4beta1.ImageSource.decode(reader, reader.uint32()); + message.y = reader.float(); break; default: reader.skipType(tag & 7); @@ -73858,169 +74005,119 @@ }; /** - * Decodes an Image message from the specified reader or buffer, length delimited. + * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.Image + * @memberof google.cloud.vision.v1p4beta1.NormalizedVertex * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.Image} Image + * @returns {google.cloud.vision.v1p4beta1.NormalizedVertex} NormalizedVertex * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Image.decodeDelimited = function decodeDelimited(reader) { + NormalizedVertex.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an Image message. + * Verifies a NormalizedVertex message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.Image + * @memberof google.cloud.vision.v1p4beta1.NormalizedVertex * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Image.verify = function verify(message) { + NormalizedVertex.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.content != null && message.hasOwnProperty("content")) - if (!(message.content && typeof message.content.length === "number" || $util.isString(message.content))) - return "content: buffer expected"; - if (message.source != null && message.hasOwnProperty("source")) { - var error = $root.google.cloud.vision.v1p4beta1.ImageSource.verify(message.source); - if (error) - return "source." + error; - } + if (message.x != null && message.hasOwnProperty("x")) + if (typeof message.x !== "number") + return "x: number expected"; + if (message.y != null && message.hasOwnProperty("y")) + if (typeof message.y !== "number") + return "y: number expected"; return null; }; /** - * Creates an Image message from a plain object. Also converts values to their respective internal types. + * Creates a NormalizedVertex message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.Image + * @memberof google.cloud.vision.v1p4beta1.NormalizedVertex * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.Image} Image + * @returns {google.cloud.vision.v1p4beta1.NormalizedVertex} NormalizedVertex */ - Image.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.Image) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.Image(); - if (object.content != null) - if (typeof object.content === "string") - $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); - else if (object.content.length) - message.content = object.content; - if (object.source != null) { - if (typeof object.source !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.Image.source: object expected"); - message.source = $root.google.cloud.vision.v1p4beta1.ImageSource.fromObject(object.source); - } + NormalizedVertex.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.NormalizedVertex) + return object; + var message = new $root.google.cloud.vision.v1p4beta1.NormalizedVertex(); + if (object.x != null) + message.x = Number(object.x); + if (object.y != null) + message.y = Number(object.y); return message; }; /** - * Creates a plain object from an Image message. Also converts values to other types if specified. + * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.Image + * @memberof google.cloud.vision.v1p4beta1.NormalizedVertex * @static - * @param {google.cloud.vision.v1p4beta1.Image} message Image + * @param {google.cloud.vision.v1p4beta1.NormalizedVertex} message NormalizedVertex * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Image.toObject = function toObject(message, options) { + NormalizedVertex.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - if (options.bytes === String) - object.content = ""; - else { - object.content = []; - if (options.bytes !== Array) - object.content = $util.newBuffer(object.content); - } - object.source = null; + object.x = 0; + object.y = 0; } - if (message.content != null && message.hasOwnProperty("content")) - object.content = options.bytes === String ? $util.base64.encode(message.content, 0, message.content.length) : options.bytes === Array ? Array.prototype.slice.call(message.content) : message.content; - if (message.source != null && message.hasOwnProperty("source")) - object.source = $root.google.cloud.vision.v1p4beta1.ImageSource.toObject(message.source, options); + if (message.x != null && message.hasOwnProperty("x")) + object.x = options.json && !isFinite(message.x) ? String(message.x) : message.x; + if (message.y != null && message.hasOwnProperty("y")) + object.y = options.json && !isFinite(message.y) ? String(message.y) : message.y; return object; }; /** - * Converts this Image to JSON. + * Converts this NormalizedVertex to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.Image + * @memberof google.cloud.vision.v1p4beta1.NormalizedVertex * @instance * @returns {Object.} JSON object */ - Image.prototype.toJSON = function toJSON() { + NormalizedVertex.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Image; - })(); - - /** - * Likelihood enum. - * @name google.cloud.vision.v1p4beta1.Likelihood - * @enum {string} - * @property {number} UNKNOWN=0 UNKNOWN value - * @property {number} VERY_UNLIKELY=1 VERY_UNLIKELY value - * @property {number} UNLIKELY=2 UNLIKELY value - * @property {number} POSSIBLE=3 POSSIBLE value - * @property {number} LIKELY=4 LIKELY value - * @property {number} VERY_LIKELY=5 VERY_LIKELY value - */ - v1p4beta1.Likelihood = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "UNKNOWN"] = 0; - values[valuesById[1] = "VERY_UNLIKELY"] = 1; - values[valuesById[2] = "UNLIKELY"] = 2; - values[valuesById[3] = "POSSIBLE"] = 3; - values[valuesById[4] = "LIKELY"] = 4; - values[valuesById[5] = "VERY_LIKELY"] = 5; - return values; + return NormalizedVertex; })(); - v1p4beta1.FaceAnnotation = (function() { + v1p4beta1.BoundingPoly = (function() { /** - * Properties of a FaceAnnotation. + * Properties of a BoundingPoly. * @memberof google.cloud.vision.v1p4beta1 - * @interface IFaceAnnotation - * @property {google.cloud.vision.v1p4beta1.IBoundingPoly|null} [boundingPoly] FaceAnnotation boundingPoly - * @property {google.cloud.vision.v1p4beta1.IBoundingPoly|null} [fdBoundingPoly] FaceAnnotation fdBoundingPoly - * @property {Array.|null} [landmarks] FaceAnnotation landmarks - * @property {number|null} [rollAngle] FaceAnnotation rollAngle - * @property {number|null} [panAngle] FaceAnnotation panAngle - * @property {number|null} [tiltAngle] FaceAnnotation tiltAngle - * @property {number|null} [detectionConfidence] FaceAnnotation detectionConfidence - * @property {number|null} [landmarkingConfidence] FaceAnnotation landmarkingConfidence - * @property {google.cloud.vision.v1p4beta1.Likelihood|null} [joyLikelihood] FaceAnnotation joyLikelihood - * @property {google.cloud.vision.v1p4beta1.Likelihood|null} [sorrowLikelihood] FaceAnnotation sorrowLikelihood - * @property {google.cloud.vision.v1p4beta1.Likelihood|null} [angerLikelihood] FaceAnnotation angerLikelihood - * @property {google.cloud.vision.v1p4beta1.Likelihood|null} [surpriseLikelihood] FaceAnnotation surpriseLikelihood - * @property {google.cloud.vision.v1p4beta1.Likelihood|null} [underExposedLikelihood] FaceAnnotation underExposedLikelihood - * @property {google.cloud.vision.v1p4beta1.Likelihood|null} [blurredLikelihood] FaceAnnotation blurredLikelihood - * @property {google.cloud.vision.v1p4beta1.Likelihood|null} [headwearLikelihood] FaceAnnotation headwearLikelihood - * @property {Array.|null} [recognitionResult] FaceAnnotation recognitionResult + * @interface IBoundingPoly + * @property {Array.|null} [vertices] BoundingPoly vertices + * @property {Array.|null} [normalizedVertices] BoundingPoly normalizedVertices */ /** - * Constructs a new FaceAnnotation. + * Constructs a new BoundingPoly. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a FaceAnnotation. - * @implements IFaceAnnotation + * @classdesc Represents a BoundingPoly. + * @implements IBoundingPoly * @constructor - * @param {google.cloud.vision.v1p4beta1.IFaceAnnotation=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IBoundingPoly=} [properties] Properties to set */ - function FaceAnnotation(properties) { - this.landmarks = []; - this.recognitionResult = []; + function BoundingPoly(properties) { + this.vertices = []; + this.normalizedVertices = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -74028,276 +74125,94 @@ } /** - * FaceAnnotation boundingPoly. - * @member {google.cloud.vision.v1p4beta1.IBoundingPoly|null|undefined} boundingPoly - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.boundingPoly = null; - - /** - * FaceAnnotation fdBoundingPoly. - * @member {google.cloud.vision.v1p4beta1.IBoundingPoly|null|undefined} fdBoundingPoly - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.fdBoundingPoly = null; - - /** - * FaceAnnotation landmarks. - * @member {Array.} landmarks - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.landmarks = $util.emptyArray; - - /** - * FaceAnnotation rollAngle. - * @member {number} rollAngle - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.rollAngle = 0; - - /** - * FaceAnnotation panAngle. - * @member {number} panAngle - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.panAngle = 0; - - /** - * FaceAnnotation tiltAngle. - * @member {number} tiltAngle - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.tiltAngle = 0; - - /** - * FaceAnnotation detectionConfidence. - * @member {number} detectionConfidence - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.detectionConfidence = 0; - - /** - * FaceAnnotation landmarkingConfidence. - * @member {number} landmarkingConfidence - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.landmarkingConfidence = 0; - - /** - * FaceAnnotation joyLikelihood. - * @member {google.cloud.vision.v1p4beta1.Likelihood} joyLikelihood - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.joyLikelihood = 0; - - /** - * FaceAnnotation sorrowLikelihood. - * @member {google.cloud.vision.v1p4beta1.Likelihood} sorrowLikelihood - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.sorrowLikelihood = 0; - - /** - * FaceAnnotation angerLikelihood. - * @member {google.cloud.vision.v1p4beta1.Likelihood} angerLikelihood - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.angerLikelihood = 0; - - /** - * FaceAnnotation surpriseLikelihood. - * @member {google.cloud.vision.v1p4beta1.Likelihood} surpriseLikelihood - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.surpriseLikelihood = 0; - - /** - * FaceAnnotation underExposedLikelihood. - * @member {google.cloud.vision.v1p4beta1.Likelihood} underExposedLikelihood - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.underExposedLikelihood = 0; - - /** - * FaceAnnotation blurredLikelihood. - * @member {google.cloud.vision.v1p4beta1.Likelihood} blurredLikelihood - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation - * @instance - */ - FaceAnnotation.prototype.blurredLikelihood = 0; - - /** - * FaceAnnotation headwearLikelihood. - * @member {google.cloud.vision.v1p4beta1.Likelihood} headwearLikelihood - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation + * BoundingPoly vertices. + * @member {Array.} vertices + * @memberof google.cloud.vision.v1p4beta1.BoundingPoly * @instance */ - FaceAnnotation.prototype.headwearLikelihood = 0; + BoundingPoly.prototype.vertices = $util.emptyArray; /** - * FaceAnnotation recognitionResult. - * @member {Array.} recognitionResult - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation + * BoundingPoly normalizedVertices. + * @member {Array.} normalizedVertices + * @memberof google.cloud.vision.v1p4beta1.BoundingPoly * @instance */ - FaceAnnotation.prototype.recognitionResult = $util.emptyArray; + BoundingPoly.prototype.normalizedVertices = $util.emptyArray; /** - * Creates a new FaceAnnotation instance using the specified properties. + * Creates a new BoundingPoly instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p4beta1.BoundingPoly * @static - * @param {google.cloud.vision.v1p4beta1.IFaceAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.FaceAnnotation} FaceAnnotation instance + * @param {google.cloud.vision.v1p4beta1.IBoundingPoly=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.BoundingPoly} BoundingPoly instance */ - FaceAnnotation.create = function create(properties) { - return new FaceAnnotation(properties); + BoundingPoly.create = function create(properties) { + return new BoundingPoly(properties); }; /** - * Encodes the specified FaceAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceAnnotation.verify|verify} messages. + * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.vision.v1p4beta1.BoundingPoly.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p4beta1.BoundingPoly * @static - * @param {google.cloud.vision.v1p4beta1.IFaceAnnotation} message FaceAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IBoundingPoly} message BoundingPoly message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FaceAnnotation.encode = function encode(message, writer) { + BoundingPoly.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - $root.google.cloud.vision.v1p4beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.fdBoundingPoly != null && message.hasOwnProperty("fdBoundingPoly")) - $root.google.cloud.vision.v1p4beta1.BoundingPoly.encode(message.fdBoundingPoly, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.landmarks != null && message.landmarks.length) - for (var i = 0; i < message.landmarks.length; ++i) - $root.google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.encode(message.landmarks[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.rollAngle != null && message.hasOwnProperty("rollAngle")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.rollAngle); - if (message.panAngle != null && message.hasOwnProperty("panAngle")) - writer.uint32(/* id 5, wireType 5 =*/45).float(message.panAngle); - if (message.tiltAngle != null && message.hasOwnProperty("tiltAngle")) - writer.uint32(/* id 6, wireType 5 =*/53).float(message.tiltAngle); - if (message.detectionConfidence != null && message.hasOwnProperty("detectionConfidence")) - writer.uint32(/* id 7, wireType 5 =*/61).float(message.detectionConfidence); - if (message.landmarkingConfidence != null && message.hasOwnProperty("landmarkingConfidence")) - writer.uint32(/* id 8, wireType 5 =*/69).float(message.landmarkingConfidence); - if (message.joyLikelihood != null && message.hasOwnProperty("joyLikelihood")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.joyLikelihood); - if (message.sorrowLikelihood != null && message.hasOwnProperty("sorrowLikelihood")) - writer.uint32(/* id 10, wireType 0 =*/80).int32(message.sorrowLikelihood); - if (message.angerLikelihood != null && message.hasOwnProperty("angerLikelihood")) - writer.uint32(/* id 11, wireType 0 =*/88).int32(message.angerLikelihood); - if (message.surpriseLikelihood != null && message.hasOwnProperty("surpriseLikelihood")) - writer.uint32(/* id 12, wireType 0 =*/96).int32(message.surpriseLikelihood); - if (message.underExposedLikelihood != null && message.hasOwnProperty("underExposedLikelihood")) - writer.uint32(/* id 13, wireType 0 =*/104).int32(message.underExposedLikelihood); - if (message.blurredLikelihood != null && message.hasOwnProperty("blurredLikelihood")) - writer.uint32(/* id 14, wireType 0 =*/112).int32(message.blurredLikelihood); - if (message.headwearLikelihood != null && message.hasOwnProperty("headwearLikelihood")) - writer.uint32(/* id 15, wireType 0 =*/120).int32(message.headwearLikelihood); - if (message.recognitionResult != null && message.recognitionResult.length) - for (var i = 0; i < message.recognitionResult.length; ++i) - $root.google.cloud.vision.v1p4beta1.FaceRecognitionResult.encode(message.recognitionResult[i], writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); + if (message.vertices != null && message.vertices.length) + for (var i = 0; i < message.vertices.length; ++i) + $root.google.cloud.vision.v1p4beta1.Vertex.encode(message.vertices[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.normalizedVertices != null && message.normalizedVertices.length) + for (var i = 0; i < message.normalizedVertices.length; ++i) + $root.google.cloud.vision.v1p4beta1.NormalizedVertex.encode(message.normalizedVertices[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified FaceAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceAnnotation.verify|verify} messages. + * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.BoundingPoly.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p4beta1.BoundingPoly * @static - * @param {google.cloud.vision.v1p4beta1.IFaceAnnotation} message FaceAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IBoundingPoly} message BoundingPoly message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FaceAnnotation.encodeDelimited = function encodeDelimited(message, writer) { + BoundingPoly.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FaceAnnotation message from the specified reader or buffer. + * Decodes a BoundingPoly message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p4beta1.BoundingPoly * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.FaceAnnotation} FaceAnnotation + * @returns {google.cloud.vision.v1p4beta1.BoundingPoly} BoundingPoly * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FaceAnnotation.decode = function decode(reader, length) { + BoundingPoly.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.vision.v1p4beta1.FaceAnnotation(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.BoundingPoly(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.boundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.decode(reader, reader.uint32()); + if (!(message.vertices && message.vertices.length)) + message.vertices = []; + message.vertices.push($root.google.cloud.vision.v1p4beta1.Vertex.decode(reader, reader.uint32())); break; case 2: - message.fdBoundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.decode(reader, reader.uint32()); - break; - case 3: - if (!(message.landmarks && message.landmarks.length)) - message.landmarks = []; - message.landmarks.push($root.google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.decode(reader, reader.uint32())); - break; - case 4: - message.rollAngle = reader.float(); - break; - case 5: - message.panAngle = reader.float(); - break; - case 6: - message.tiltAngle = reader.float(); - break; - case 7: - message.detectionConfidence = reader.float(); - break; - case 8: - message.landmarkingConfidence = reader.float(); - break; - case 9: - message.joyLikelihood = reader.int32(); - break; - case 10: - message.sorrowLikelihood = reader.int32(); - break; - case 11: - message.angerLikelihood = reader.int32(); - break; - case 12: - message.surpriseLikelihood = reader.int32(); - break; - case 13: - message.underExposedLikelihood = reader.int32(); - break; - case 14: - message.blurredLikelihood = reader.int32(); - break; - case 15: - message.headwearLikelihood = reader.int32(); - break; - case 16: - if (!(message.recognitionResult && message.recognitionResult.length)) - message.recognitionResult = []; - message.recognitionResult.push($root.google.cloud.vision.v1p4beta1.FaceRecognitionResult.decode(reader, reader.uint32())); + if (!(message.normalizedVertices && message.normalizedVertices.length)) + message.normalizedVertices = []; + message.normalizedVertices.push($root.google.cloud.vision.v1p4beta1.NormalizedVertex.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -74308,1172 +74223,551 @@ }; /** - * Decodes a FaceAnnotation message from the specified reader or buffer, length delimited. + * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p4beta1.BoundingPoly * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.FaceAnnotation} FaceAnnotation + * @returns {google.cloud.vision.v1p4beta1.BoundingPoly} BoundingPoly * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FaceAnnotation.decodeDelimited = function decodeDelimited(reader) { + BoundingPoly.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FaceAnnotation message. + * Verifies a BoundingPoly message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p4beta1.BoundingPoly * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FaceAnnotation.verify = function verify(message) { + BoundingPoly.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { - var error = $root.google.cloud.vision.v1p4beta1.BoundingPoly.verify(message.boundingPoly); - if (error) - return "boundingPoly." + error; - } - if (message.fdBoundingPoly != null && message.hasOwnProperty("fdBoundingPoly")) { - var error = $root.google.cloud.vision.v1p4beta1.BoundingPoly.verify(message.fdBoundingPoly); - if (error) - return "fdBoundingPoly." + error; - } - if (message.landmarks != null && message.hasOwnProperty("landmarks")) { - if (!Array.isArray(message.landmarks)) - return "landmarks: array expected"; - for (var i = 0; i < message.landmarks.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.verify(message.landmarks[i]); + if (message.vertices != null && message.hasOwnProperty("vertices")) { + if (!Array.isArray(message.vertices)) + return "vertices: array expected"; + for (var i = 0; i < message.vertices.length; ++i) { + var error = $root.google.cloud.vision.v1p4beta1.Vertex.verify(message.vertices[i]); if (error) - return "landmarks." + error; + return "vertices." + error; } } - if (message.rollAngle != null && message.hasOwnProperty("rollAngle")) - if (typeof message.rollAngle !== "number") - return "rollAngle: number expected"; - if (message.panAngle != null && message.hasOwnProperty("panAngle")) - if (typeof message.panAngle !== "number") - return "panAngle: number expected"; - if (message.tiltAngle != null && message.hasOwnProperty("tiltAngle")) - if (typeof message.tiltAngle !== "number") - return "tiltAngle: number expected"; - if (message.detectionConfidence != null && message.hasOwnProperty("detectionConfidence")) - if (typeof message.detectionConfidence !== "number") - return "detectionConfidence: number expected"; - if (message.landmarkingConfidence != null && message.hasOwnProperty("landmarkingConfidence")) - if (typeof message.landmarkingConfidence !== "number") - return "landmarkingConfidence: number expected"; - if (message.joyLikelihood != null && message.hasOwnProperty("joyLikelihood")) - switch (message.joyLikelihood) { - default: - return "joyLikelihood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.sorrowLikelihood != null && message.hasOwnProperty("sorrowLikelihood")) - switch (message.sorrowLikelihood) { - default: - return "sorrowLikelihood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.angerLikelihood != null && message.hasOwnProperty("angerLikelihood")) - switch (message.angerLikelihood) { - default: - return "angerLikelihood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.surpriseLikelihood != null && message.hasOwnProperty("surpriseLikelihood")) - switch (message.surpriseLikelihood) { - default: - return "surpriseLikelihood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.underExposedLikelihood != null && message.hasOwnProperty("underExposedLikelihood")) - switch (message.underExposedLikelihood) { - default: - return "underExposedLikelihood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.blurredLikelihood != null && message.hasOwnProperty("blurredLikelihood")) - switch (message.blurredLikelihood) { - default: - return "blurredLikelihood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.headwearLikelihood != null && message.hasOwnProperty("headwearLikelihood")) - switch (message.headwearLikelihood) { - default: - return "headwearLikelihood: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.recognitionResult != null && message.hasOwnProperty("recognitionResult")) { - if (!Array.isArray(message.recognitionResult)) - return "recognitionResult: array expected"; - for (var i = 0; i < message.recognitionResult.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.FaceRecognitionResult.verify(message.recognitionResult[i]); + if (message.normalizedVertices != null && message.hasOwnProperty("normalizedVertices")) { + if (!Array.isArray(message.normalizedVertices)) + return "normalizedVertices: array expected"; + for (var i = 0; i < message.normalizedVertices.length; ++i) { + var error = $root.google.cloud.vision.v1p4beta1.NormalizedVertex.verify(message.normalizedVertices[i]); if (error) - return "recognitionResult." + error; + return "normalizedVertices." + error; } } return null; }; /** - * Creates a FaceAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates a BoundingPoly message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p4beta1.BoundingPoly * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.FaceAnnotation} FaceAnnotation + * @returns {google.cloud.vision.v1p4beta1.BoundingPoly} BoundingPoly */ - FaceAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.FaceAnnotation) + BoundingPoly.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.BoundingPoly) return object; - var message = new $root.google.cloud.vision.v1p4beta1.FaceAnnotation(); - if (object.boundingPoly != null) { - if (typeof object.boundingPoly !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.FaceAnnotation.boundingPoly: object expected"); - message.boundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.fromObject(object.boundingPoly); - } - if (object.fdBoundingPoly != null) { - if (typeof object.fdBoundingPoly !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.FaceAnnotation.fdBoundingPoly: object expected"); - message.fdBoundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.fromObject(object.fdBoundingPoly); - } - if (object.landmarks) { - if (!Array.isArray(object.landmarks)) - throw TypeError(".google.cloud.vision.v1p4beta1.FaceAnnotation.landmarks: array expected"); - message.landmarks = []; - for (var i = 0; i < object.landmarks.length; ++i) { - if (typeof object.landmarks[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.FaceAnnotation.landmarks: object expected"); - message.landmarks[i] = $root.google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.fromObject(object.landmarks[i]); + var message = new $root.google.cloud.vision.v1p4beta1.BoundingPoly(); + if (object.vertices) { + if (!Array.isArray(object.vertices)) + throw TypeError(".google.cloud.vision.v1p4beta1.BoundingPoly.vertices: array expected"); + message.vertices = []; + for (var i = 0; i < object.vertices.length; ++i) { + if (typeof object.vertices[i] !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.BoundingPoly.vertices: object expected"); + message.vertices[i] = $root.google.cloud.vision.v1p4beta1.Vertex.fromObject(object.vertices[i]); } } - if (object.rollAngle != null) - message.rollAngle = Number(object.rollAngle); - if (object.panAngle != null) - message.panAngle = Number(object.panAngle); - if (object.tiltAngle != null) - message.tiltAngle = Number(object.tiltAngle); - if (object.detectionConfidence != null) - message.detectionConfidence = Number(object.detectionConfidence); - if (object.landmarkingConfidence != null) - message.landmarkingConfidence = Number(object.landmarkingConfidence); - switch (object.joyLikelihood) { - case "UNKNOWN": - case 0: - message.joyLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.joyLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.joyLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.joyLikelihood = 3; - break; - case "LIKELY": - case 4: - message.joyLikelihood = 4; - break; - case "VERY_LIKELY": - case 5: - message.joyLikelihood = 5; - break; - } - switch (object.sorrowLikelihood) { - case "UNKNOWN": - case 0: - message.sorrowLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.sorrowLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.sorrowLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.sorrowLikelihood = 3; - break; - case "LIKELY": - case 4: - message.sorrowLikelihood = 4; - break; - case "VERY_LIKELY": - case 5: - message.sorrowLikelihood = 5; - break; - } - switch (object.angerLikelihood) { - case "UNKNOWN": - case 0: - message.angerLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.angerLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.angerLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.angerLikelihood = 3; - break; - case "LIKELY": - case 4: - message.angerLikelihood = 4; - break; - case "VERY_LIKELY": - case 5: - message.angerLikelihood = 5; - break; - } - switch (object.surpriseLikelihood) { - case "UNKNOWN": - case 0: - message.surpriseLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.surpriseLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.surpriseLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.surpriseLikelihood = 3; - break; - case "LIKELY": - case 4: - message.surpriseLikelihood = 4; - break; - case "VERY_LIKELY": - case 5: - message.surpriseLikelihood = 5; - break; - } - switch (object.underExposedLikelihood) { - case "UNKNOWN": - case 0: - message.underExposedLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.underExposedLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.underExposedLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.underExposedLikelihood = 3; - break; - case "LIKELY": - case 4: - message.underExposedLikelihood = 4; - break; - case "VERY_LIKELY": - case 5: - message.underExposedLikelihood = 5; - break; - } - switch (object.blurredLikelihood) { - case "UNKNOWN": - case 0: - message.blurredLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.blurredLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.blurredLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.blurredLikelihood = 3; - break; - case "LIKELY": - case 4: - message.blurredLikelihood = 4; - break; - case "VERY_LIKELY": - case 5: - message.blurredLikelihood = 5; - break; - } - switch (object.headwearLikelihood) { - case "UNKNOWN": - case 0: - message.headwearLikelihood = 0; - break; - case "VERY_UNLIKELY": - case 1: - message.headwearLikelihood = 1; - break; - case "UNLIKELY": - case 2: - message.headwearLikelihood = 2; - break; - case "POSSIBLE": - case 3: - message.headwearLikelihood = 3; - break; - case "LIKELY": - case 4: - message.headwearLikelihood = 4; - break; - case "VERY_LIKELY": - case 5: - message.headwearLikelihood = 5; - break; - } - if (object.recognitionResult) { - if (!Array.isArray(object.recognitionResult)) - throw TypeError(".google.cloud.vision.v1p4beta1.FaceAnnotation.recognitionResult: array expected"); - message.recognitionResult = []; - for (var i = 0; i < object.recognitionResult.length; ++i) { - if (typeof object.recognitionResult[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.FaceAnnotation.recognitionResult: object expected"); - message.recognitionResult[i] = $root.google.cloud.vision.v1p4beta1.FaceRecognitionResult.fromObject(object.recognitionResult[i]); + if (object.normalizedVertices) { + if (!Array.isArray(object.normalizedVertices)) + throw TypeError(".google.cloud.vision.v1p4beta1.BoundingPoly.normalizedVertices: array expected"); + message.normalizedVertices = []; + for (var i = 0; i < object.normalizedVertices.length; ++i) { + if (typeof object.normalizedVertices[i] !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.BoundingPoly.normalizedVertices: object expected"); + message.normalizedVertices[i] = $root.google.cloud.vision.v1p4beta1.NormalizedVertex.fromObject(object.normalizedVertices[i]); } } return message; }; /** - * Creates a plain object from a FaceAnnotation message. Also converts values to other types if specified. + * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p4beta1.BoundingPoly * @static - * @param {google.cloud.vision.v1p4beta1.FaceAnnotation} message FaceAnnotation + * @param {google.cloud.vision.v1p4beta1.BoundingPoly} message BoundingPoly * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FaceAnnotation.toObject = function toObject(message, options) { + BoundingPoly.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) { - object.landmarks = []; - object.recognitionResult = []; - } - if (options.defaults) { - object.boundingPoly = null; - object.fdBoundingPoly = null; - object.rollAngle = 0; - object.panAngle = 0; - object.tiltAngle = 0; - object.detectionConfidence = 0; - object.landmarkingConfidence = 0; - object.joyLikelihood = options.enums === String ? "UNKNOWN" : 0; - object.sorrowLikelihood = options.enums === String ? "UNKNOWN" : 0; - object.angerLikelihood = options.enums === String ? "UNKNOWN" : 0; - object.surpriseLikelihood = options.enums === String ? "UNKNOWN" : 0; - object.underExposedLikelihood = options.enums === String ? "UNKNOWN" : 0; - object.blurredLikelihood = options.enums === String ? "UNKNOWN" : 0; - object.headwearLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.vertices = []; + object.normalizedVertices = []; } - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - object.boundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.toObject(message.boundingPoly, options); - if (message.fdBoundingPoly != null && message.hasOwnProperty("fdBoundingPoly")) - object.fdBoundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.toObject(message.fdBoundingPoly, options); - if (message.landmarks && message.landmarks.length) { - object.landmarks = []; - for (var j = 0; j < message.landmarks.length; ++j) - object.landmarks[j] = $root.google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.toObject(message.landmarks[j], options); + if (message.vertices && message.vertices.length) { + object.vertices = []; + for (var j = 0; j < message.vertices.length; ++j) + object.vertices[j] = $root.google.cloud.vision.v1p4beta1.Vertex.toObject(message.vertices[j], options); } - if (message.rollAngle != null && message.hasOwnProperty("rollAngle")) - object.rollAngle = options.json && !isFinite(message.rollAngle) ? String(message.rollAngle) : message.rollAngle; - if (message.panAngle != null && message.hasOwnProperty("panAngle")) - object.panAngle = options.json && !isFinite(message.panAngle) ? String(message.panAngle) : message.panAngle; - if (message.tiltAngle != null && message.hasOwnProperty("tiltAngle")) - object.tiltAngle = options.json && !isFinite(message.tiltAngle) ? String(message.tiltAngle) : message.tiltAngle; - if (message.detectionConfidence != null && message.hasOwnProperty("detectionConfidence")) - object.detectionConfidence = options.json && !isFinite(message.detectionConfidence) ? String(message.detectionConfidence) : message.detectionConfidence; - if (message.landmarkingConfidence != null && message.hasOwnProperty("landmarkingConfidence")) - object.landmarkingConfidence = options.json && !isFinite(message.landmarkingConfidence) ? String(message.landmarkingConfidence) : message.landmarkingConfidence; - if (message.joyLikelihood != null && message.hasOwnProperty("joyLikelihood")) - object.joyLikelihood = options.enums === String ? $root.google.cloud.vision.v1p4beta1.Likelihood[message.joyLikelihood] : message.joyLikelihood; - if (message.sorrowLikelihood != null && message.hasOwnProperty("sorrowLikelihood")) - object.sorrowLikelihood = options.enums === String ? $root.google.cloud.vision.v1p4beta1.Likelihood[message.sorrowLikelihood] : message.sorrowLikelihood; - if (message.angerLikelihood != null && message.hasOwnProperty("angerLikelihood")) - object.angerLikelihood = options.enums === String ? $root.google.cloud.vision.v1p4beta1.Likelihood[message.angerLikelihood] : message.angerLikelihood; - if (message.surpriseLikelihood != null && message.hasOwnProperty("surpriseLikelihood")) - object.surpriseLikelihood = options.enums === String ? $root.google.cloud.vision.v1p4beta1.Likelihood[message.surpriseLikelihood] : message.surpriseLikelihood; - if (message.underExposedLikelihood != null && message.hasOwnProperty("underExposedLikelihood")) - object.underExposedLikelihood = options.enums === String ? $root.google.cloud.vision.v1p4beta1.Likelihood[message.underExposedLikelihood] : message.underExposedLikelihood; - if (message.blurredLikelihood != null && message.hasOwnProperty("blurredLikelihood")) - object.blurredLikelihood = options.enums === String ? $root.google.cloud.vision.v1p4beta1.Likelihood[message.blurredLikelihood] : message.blurredLikelihood; - if (message.headwearLikelihood != null && message.hasOwnProperty("headwearLikelihood")) - object.headwearLikelihood = options.enums === String ? $root.google.cloud.vision.v1p4beta1.Likelihood[message.headwearLikelihood] : message.headwearLikelihood; - if (message.recognitionResult && message.recognitionResult.length) { - object.recognitionResult = []; - for (var j = 0; j < message.recognitionResult.length; ++j) - object.recognitionResult[j] = $root.google.cloud.vision.v1p4beta1.FaceRecognitionResult.toObject(message.recognitionResult[j], options); + if (message.normalizedVertices && message.normalizedVertices.length) { + object.normalizedVertices = []; + for (var j = 0; j < message.normalizedVertices.length; ++j) + object.normalizedVertices[j] = $root.google.cloud.vision.v1p4beta1.NormalizedVertex.toObject(message.normalizedVertices[j], options); } return object; }; /** - * Converts this FaceAnnotation to JSON. + * Converts this BoundingPoly to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation + * @memberof google.cloud.vision.v1p4beta1.BoundingPoly * @instance * @returns {Object.} JSON object */ - FaceAnnotation.prototype.toJSON = function toJSON() { + BoundingPoly.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - FaceAnnotation.Landmark = (function() { - - /** - * Properties of a Landmark. - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation - * @interface ILandmark - * @property {google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.Type|null} [type] Landmark type - * @property {google.cloud.vision.v1p4beta1.IPosition|null} [position] Landmark position - */ + return BoundingPoly; + })(); - /** - * Constructs a new Landmark. - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation - * @classdesc Represents a Landmark. - * @implements ILandmark - * @constructor - * @param {google.cloud.vision.v1p4beta1.FaceAnnotation.ILandmark=} [properties] Properties to set - */ - function Landmark(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]]; - } + v1p4beta1.Position = (function() { - /** - * Landmark type. - * @member {google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.Type} type - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark - * @instance - */ - Landmark.prototype.type = 0; + /** + * Properties of a Position. + * @memberof google.cloud.vision.v1p4beta1 + * @interface IPosition + * @property {number|null} [x] Position x + * @property {number|null} [y] Position y + * @property {number|null} [z] Position z + */ - /** - * Landmark position. - * @member {google.cloud.vision.v1p4beta1.IPosition|null|undefined} position - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark - * @instance - */ - Landmark.prototype.position = null; + /** + * Constructs a new Position. + * @memberof google.cloud.vision.v1p4beta1 + * @classdesc Represents a Position. + * @implements IPosition + * @constructor + * @param {google.cloud.vision.v1p4beta1.IPosition=} [properties] Properties to set + */ + function Position(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } - /** - * Creates a new Landmark instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark - * @static - * @param {google.cloud.vision.v1p4beta1.FaceAnnotation.ILandmark=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark} Landmark instance - */ - Landmark.create = function create(properties) { - return new Landmark(properties); - }; + /** + * Position x. + * @member {number} x + * @memberof google.cloud.vision.v1p4beta1.Position + * @instance + */ + Position.prototype.x = 0; - /** - * Encodes the specified Landmark message. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark - * @static - * @param {google.cloud.vision.v1p4beta1.FaceAnnotation.ILandmark} message Landmark message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Landmark.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.type != null && message.hasOwnProperty("type")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); - if (message.position != null && message.hasOwnProperty("position")) - $root.google.cloud.vision.v1p4beta1.Position.encode(message.position, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; + /** + * Position y. + * @member {number} y + * @memberof google.cloud.vision.v1p4beta1.Position + * @instance + */ + Position.prototype.y = 0; - /** - * Encodes the specified Landmark message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark - * @static - * @param {google.cloud.vision.v1p4beta1.FaceAnnotation.ILandmark} message Landmark message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Landmark.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Position z. + * @member {number} z + * @memberof google.cloud.vision.v1p4beta1.Position + * @instance + */ + Position.prototype.z = 0; - /** - * Decodes a Landmark message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark} Landmark - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Landmark.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.vision.v1p4beta1.FaceAnnotation.Landmark(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 3: - message.type = reader.int32(); - break; - case 4: - message.position = $root.google.cloud.vision.v1p4beta1.Position.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; + /** + * Creates a new Position instance using the specified properties. + * @function create + * @memberof google.cloud.vision.v1p4beta1.Position + * @static + * @param {google.cloud.vision.v1p4beta1.IPosition=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.Position} Position instance + */ + Position.create = function create(properties) { + return new Position(properties); + }; - /** - * Decodes a Landmark message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark} Landmark - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Landmark.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; + /** + * Encodes the specified Position message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Position.verify|verify} messages. + * @function encode + * @memberof google.cloud.vision.v1p4beta1.Position + * @static + * @param {google.cloud.vision.v1p4beta1.IPosition} message Position message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Position.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.x != null && message.hasOwnProperty("x")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); + if (message.y != null && message.hasOwnProperty("y")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); + if (message.z != null && message.hasOwnProperty("z")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.z); + return writer; + }; - /** - * Verifies a Landmark message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Landmark.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - case 30: - case 31: - case 32: - case 33: - case 34: - break; - } - if (message.position != null && message.hasOwnProperty("position")) { - var error = $root.google.cloud.vision.v1p4beta1.Position.verify(message.position); - if (error) - return "position." + error; - } - return null; - }; + /** + * Encodes the specified Position message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Position.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.vision.v1p4beta1.Position + * @static + * @param {google.cloud.vision.v1p4beta1.IPosition} message Position message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Position.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; - /** - * Creates a Landmark message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark} Landmark - */ - Landmark.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark(); - switch (object.type) { - case "UNKNOWN_LANDMARK": - case 0: - message.type = 0; - break; - case "LEFT_EYE": + /** + * Decodes a Position message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.vision.v1p4beta1.Position + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.vision.v1p4beta1.Position} Position + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Position.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.vision.v1p4beta1.Position(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { case 1: - message.type = 1; + message.x = reader.float(); break; - case "RIGHT_EYE": case 2: - message.type = 2; + message.y = reader.float(); break; - case "LEFT_OF_LEFT_EYEBROW": case 3: - message.type = 3; - break; - case "RIGHT_OF_LEFT_EYEBROW": - case 4: - message.type = 4; - break; - case "LEFT_OF_RIGHT_EYEBROW": - case 5: - message.type = 5; - break; - case "RIGHT_OF_RIGHT_EYEBROW": - case 6: - message.type = 6; - break; - case "MIDPOINT_BETWEEN_EYES": - case 7: - message.type = 7; - break; - case "NOSE_TIP": - case 8: - message.type = 8; - break; - case "UPPER_LIP": - case 9: - message.type = 9; - break; - case "LOWER_LIP": - case 10: - message.type = 10; - break; - case "MOUTH_LEFT": - case 11: - message.type = 11; - break; - case "MOUTH_RIGHT": - case 12: - message.type = 12; - break; - case "MOUTH_CENTER": - case 13: - message.type = 13; - break; - case "NOSE_BOTTOM_RIGHT": - case 14: - message.type = 14; - break; - case "NOSE_BOTTOM_LEFT": - case 15: - message.type = 15; - break; - case "NOSE_BOTTOM_CENTER": - case 16: - message.type = 16; - break; - case "LEFT_EYE_TOP_BOUNDARY": - case 17: - message.type = 17; - break; - case "LEFT_EYE_RIGHT_CORNER": - case 18: - message.type = 18; - break; - case "LEFT_EYE_BOTTOM_BOUNDARY": - case 19: - message.type = 19; - break; - case "LEFT_EYE_LEFT_CORNER": - case 20: - message.type = 20; - break; - case "RIGHT_EYE_TOP_BOUNDARY": - case 21: - message.type = 21; - break; - case "RIGHT_EYE_RIGHT_CORNER": - case 22: - message.type = 22; - break; - case "RIGHT_EYE_BOTTOM_BOUNDARY": - case 23: - message.type = 23; - break; - case "RIGHT_EYE_LEFT_CORNER": - case 24: - message.type = 24; - break; - case "LEFT_EYEBROW_UPPER_MIDPOINT": - case 25: - message.type = 25; - break; - case "RIGHT_EYEBROW_UPPER_MIDPOINT": - case 26: - message.type = 26; - break; - case "LEFT_EAR_TRAGION": - case 27: - message.type = 27; - break; - case "RIGHT_EAR_TRAGION": - case 28: - message.type = 28; - break; - case "LEFT_EYE_PUPIL": - case 29: - message.type = 29; - break; - case "RIGHT_EYE_PUPIL": - case 30: - message.type = 30; - break; - case "FOREHEAD_GLABELLA": - case 31: - message.type = 31; - break; - case "CHIN_GNATHION": - case 32: - message.type = 32; - break; - case "CHIN_LEFT_GONION": - case 33: - message.type = 33; + message.z = reader.float(); break; - case "CHIN_RIGHT_GONION": - case 34: - message.type = 34; + default: + reader.skipType(tag & 7); break; } - if (object.position != null) { - if (typeof object.position !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.position: object expected"); - message.position = $root.google.cloud.vision.v1p4beta1.Position.fromObject(object.position); - } - return message; - }; + } + return message; + }; - /** - * Creates a plain object from a Landmark message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark - * @static - * @param {google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark} message Landmark - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Landmark.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.type = options.enums === String ? "UNKNOWN_LANDMARK" : 0; - object.position = null; - } - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.Type[message.type] : message.type; - if (message.position != null && message.hasOwnProperty("position")) - object.position = $root.google.cloud.vision.v1p4beta1.Position.toObject(message.position, options); - return object; - }; + /** + * Decodes a Position message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.vision.v1p4beta1.Position + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.vision.v1p4beta1.Position} Position + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Position.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Converts this Landmark to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark - * @instance - * @returns {Object.} JSON object - */ - Landmark.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Verifies a Position message. + * @function verify + * @memberof google.cloud.vision.v1p4beta1.Position + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Position.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.x != null && message.hasOwnProperty("x")) + if (typeof message.x !== "number") + return "x: number expected"; + if (message.y != null && message.hasOwnProperty("y")) + if (typeof message.y !== "number") + return "y: number expected"; + if (message.z != null && message.hasOwnProperty("z")) + if (typeof message.z !== "number") + return "z: number expected"; + return null; + }; - /** - * Type enum. - * @name google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.Type - * @enum {string} - * @property {number} UNKNOWN_LANDMARK=0 UNKNOWN_LANDMARK value - * @property {number} LEFT_EYE=1 LEFT_EYE value - * @property {number} RIGHT_EYE=2 RIGHT_EYE value - * @property {number} LEFT_OF_LEFT_EYEBROW=3 LEFT_OF_LEFT_EYEBROW value - * @property {number} RIGHT_OF_LEFT_EYEBROW=4 RIGHT_OF_LEFT_EYEBROW value - * @property {number} LEFT_OF_RIGHT_EYEBROW=5 LEFT_OF_RIGHT_EYEBROW value - * @property {number} RIGHT_OF_RIGHT_EYEBROW=6 RIGHT_OF_RIGHT_EYEBROW value - * @property {number} MIDPOINT_BETWEEN_EYES=7 MIDPOINT_BETWEEN_EYES value - * @property {number} NOSE_TIP=8 NOSE_TIP value - * @property {number} UPPER_LIP=9 UPPER_LIP value - * @property {number} LOWER_LIP=10 LOWER_LIP value - * @property {number} MOUTH_LEFT=11 MOUTH_LEFT value - * @property {number} MOUTH_RIGHT=12 MOUTH_RIGHT value - * @property {number} MOUTH_CENTER=13 MOUTH_CENTER value - * @property {number} NOSE_BOTTOM_RIGHT=14 NOSE_BOTTOM_RIGHT value - * @property {number} NOSE_BOTTOM_LEFT=15 NOSE_BOTTOM_LEFT value - * @property {number} NOSE_BOTTOM_CENTER=16 NOSE_BOTTOM_CENTER value - * @property {number} LEFT_EYE_TOP_BOUNDARY=17 LEFT_EYE_TOP_BOUNDARY value - * @property {number} LEFT_EYE_RIGHT_CORNER=18 LEFT_EYE_RIGHT_CORNER value - * @property {number} LEFT_EYE_BOTTOM_BOUNDARY=19 LEFT_EYE_BOTTOM_BOUNDARY value - * @property {number} LEFT_EYE_LEFT_CORNER=20 LEFT_EYE_LEFT_CORNER value - * @property {number} RIGHT_EYE_TOP_BOUNDARY=21 RIGHT_EYE_TOP_BOUNDARY value - * @property {number} RIGHT_EYE_RIGHT_CORNER=22 RIGHT_EYE_RIGHT_CORNER value - * @property {number} RIGHT_EYE_BOTTOM_BOUNDARY=23 RIGHT_EYE_BOTTOM_BOUNDARY value - * @property {number} RIGHT_EYE_LEFT_CORNER=24 RIGHT_EYE_LEFT_CORNER value - * @property {number} LEFT_EYEBROW_UPPER_MIDPOINT=25 LEFT_EYEBROW_UPPER_MIDPOINT value - * @property {number} RIGHT_EYEBROW_UPPER_MIDPOINT=26 RIGHT_EYEBROW_UPPER_MIDPOINT value - * @property {number} LEFT_EAR_TRAGION=27 LEFT_EAR_TRAGION value - * @property {number} RIGHT_EAR_TRAGION=28 RIGHT_EAR_TRAGION value - * @property {number} LEFT_EYE_PUPIL=29 LEFT_EYE_PUPIL value - * @property {number} RIGHT_EYE_PUPIL=30 RIGHT_EYE_PUPIL value - * @property {number} FOREHEAD_GLABELLA=31 FOREHEAD_GLABELLA value - * @property {number} CHIN_GNATHION=32 CHIN_GNATHION value - * @property {number} CHIN_LEFT_GONION=33 CHIN_LEFT_GONION value - * @property {number} CHIN_RIGHT_GONION=34 CHIN_RIGHT_GONION value - */ - Landmark.Type = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "UNKNOWN_LANDMARK"] = 0; - values[valuesById[1] = "LEFT_EYE"] = 1; - values[valuesById[2] = "RIGHT_EYE"] = 2; - values[valuesById[3] = "LEFT_OF_LEFT_EYEBROW"] = 3; - values[valuesById[4] = "RIGHT_OF_LEFT_EYEBROW"] = 4; - values[valuesById[5] = "LEFT_OF_RIGHT_EYEBROW"] = 5; - values[valuesById[6] = "RIGHT_OF_RIGHT_EYEBROW"] = 6; - values[valuesById[7] = "MIDPOINT_BETWEEN_EYES"] = 7; - values[valuesById[8] = "NOSE_TIP"] = 8; - values[valuesById[9] = "UPPER_LIP"] = 9; - values[valuesById[10] = "LOWER_LIP"] = 10; - values[valuesById[11] = "MOUTH_LEFT"] = 11; - values[valuesById[12] = "MOUTH_RIGHT"] = 12; - values[valuesById[13] = "MOUTH_CENTER"] = 13; - values[valuesById[14] = "NOSE_BOTTOM_RIGHT"] = 14; - values[valuesById[15] = "NOSE_BOTTOM_LEFT"] = 15; - values[valuesById[16] = "NOSE_BOTTOM_CENTER"] = 16; - values[valuesById[17] = "LEFT_EYE_TOP_BOUNDARY"] = 17; - values[valuesById[18] = "LEFT_EYE_RIGHT_CORNER"] = 18; - values[valuesById[19] = "LEFT_EYE_BOTTOM_BOUNDARY"] = 19; - values[valuesById[20] = "LEFT_EYE_LEFT_CORNER"] = 20; - values[valuesById[21] = "RIGHT_EYE_TOP_BOUNDARY"] = 21; - values[valuesById[22] = "RIGHT_EYE_RIGHT_CORNER"] = 22; - values[valuesById[23] = "RIGHT_EYE_BOTTOM_BOUNDARY"] = 23; - values[valuesById[24] = "RIGHT_EYE_LEFT_CORNER"] = 24; - values[valuesById[25] = "LEFT_EYEBROW_UPPER_MIDPOINT"] = 25; - values[valuesById[26] = "RIGHT_EYEBROW_UPPER_MIDPOINT"] = 26; - values[valuesById[27] = "LEFT_EAR_TRAGION"] = 27; - values[valuesById[28] = "RIGHT_EAR_TRAGION"] = 28; - values[valuesById[29] = "LEFT_EYE_PUPIL"] = 29; - values[valuesById[30] = "RIGHT_EYE_PUPIL"] = 30; - values[valuesById[31] = "FOREHEAD_GLABELLA"] = 31; - values[valuesById[32] = "CHIN_GNATHION"] = 32; - values[valuesById[33] = "CHIN_LEFT_GONION"] = 33; - values[valuesById[34] = "CHIN_RIGHT_GONION"] = 34; - return values; - })(); + /** + * Creates a Position message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.vision.v1p4beta1.Position + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.vision.v1p4beta1.Position} Position + */ + Position.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.Position) + return object; + var message = new $root.google.cloud.vision.v1p4beta1.Position(); + if (object.x != null) + message.x = Number(object.x); + if (object.y != null) + message.y = Number(object.y); + if (object.z != null) + message.z = Number(object.z); + return message; + }; - return Landmark; - })(); + /** + * Creates a plain object from a Position message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.vision.v1p4beta1.Position + * @static + * @param {google.cloud.vision.v1p4beta1.Position} message Position + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Position.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.x = 0; + object.y = 0; + object.z = 0; + } + if (message.x != null && message.hasOwnProperty("x")) + object.x = options.json && !isFinite(message.x) ? String(message.x) : message.x; + if (message.y != null && message.hasOwnProperty("y")) + object.y = options.json && !isFinite(message.y) ? String(message.y) : message.y; + if (message.z != null && message.hasOwnProperty("z")) + object.z = options.json && !isFinite(message.z) ? String(message.z) : message.z; + return object; + }; - return FaceAnnotation; + /** + * Converts this Position to JSON. + * @function toJSON + * @memberof google.cloud.vision.v1p4beta1.Position + * @instance + * @returns {Object.} JSON object + */ + Position.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + return Position; })(); - v1p4beta1.LocationInfo = (function() { + v1p4beta1.ImageAnnotator = (function() { /** - * Properties of a LocationInfo. + * Constructs a new ImageAnnotator service. * @memberof google.cloud.vision.v1p4beta1 - * @interface ILocationInfo - * @property {google.type.ILatLng|null} [latLng] LocationInfo latLng + * @classdesc Represents an ImageAnnotator + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited */ + function ImageAnnotator(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (ImageAnnotator.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ImageAnnotator; /** - * Constructs a new LocationInfo. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a LocationInfo. - * @implements ILocationInfo - * @constructor - * @param {google.cloud.vision.v1p4beta1.ILocationInfo=} [properties] Properties to set + * Creates new ImageAnnotator service using the specified rpc implementation. + * @function create + * @memberof google.cloud.vision.v1p4beta1.ImageAnnotator + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {ImageAnnotator} RPC service. Useful where requests and/or responses are streamed. + */ + ImageAnnotator.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.vision.v1p4beta1.ImageAnnotator#batchAnnotateImages}. + * @memberof google.cloud.vision.v1p4beta1.ImageAnnotator + * @typedef BatchAnnotateImagesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse} [response] BatchAnnotateImagesResponse */ - function LocationInfo(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } /** - * LocationInfo latLng. - * @member {google.type.ILatLng|null|undefined} latLng - * @memberof google.cloud.vision.v1p4beta1.LocationInfo + * Calls BatchAnnotateImages. + * @function batchAnnotateImages + * @memberof google.cloud.vision.v1p4beta1.ImageAnnotator * @instance + * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest} request BatchAnnotateImagesRequest message or plain object + * @param {google.cloud.vision.v1p4beta1.ImageAnnotator.BatchAnnotateImagesCallback} callback Node-style callback called with the error, if any, and BatchAnnotateImagesResponse + * @returns {undefined} + * @variation 1 */ - LocationInfo.prototype.latLng = null; + Object.defineProperty(ImageAnnotator.prototype.batchAnnotateImages = function batchAnnotateImages(request, callback) { + return this.rpcCall(batchAnnotateImages, $root.google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest, $root.google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse, request, callback); + }, "name", { value: "BatchAnnotateImages" }); /** - * Creates a new LocationInfo instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.LocationInfo - * @static - * @param {google.cloud.vision.v1p4beta1.ILocationInfo=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.LocationInfo} LocationInfo instance + * Calls BatchAnnotateImages. + * @function batchAnnotateImages + * @memberof google.cloud.vision.v1p4beta1.ImageAnnotator + * @instance + * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest} request BatchAnnotateImagesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - LocationInfo.create = function create(properties) { - return new LocationInfo(properties); - }; /** - * Encodes the specified LocationInfo message. Does not implicitly {@link google.cloud.vision.v1p4beta1.LocationInfo.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.LocationInfo - * @static - * @param {google.cloud.vision.v1p4beta1.ILocationInfo} message LocationInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * Callback as used by {@link google.cloud.vision.v1p4beta1.ImageAnnotator#batchAnnotateFiles}. + * @memberof google.cloud.vision.v1p4beta1.ImageAnnotator + * @typedef BatchAnnotateFilesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse} [response] BatchAnnotateFilesResponse */ - LocationInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.latLng != null && message.hasOwnProperty("latLng")) - $root.google.type.LatLng.encode(message.latLng, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; /** - * Encodes the specified LocationInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.LocationInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.LocationInfo - * @static - * @param {google.cloud.vision.v1p4beta1.ILocationInfo} message LocationInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer + * Calls BatchAnnotateFiles. + * @function batchAnnotateFiles + * @memberof google.cloud.vision.v1p4beta1.ImageAnnotator + * @instance + * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest} request BatchAnnotateFilesRequest message or plain object + * @param {google.cloud.vision.v1p4beta1.ImageAnnotator.BatchAnnotateFilesCallback} callback Node-style callback called with the error, if any, and BatchAnnotateFilesResponse + * @returns {undefined} + * @variation 1 */ - LocationInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + Object.defineProperty(ImageAnnotator.prototype.batchAnnotateFiles = function batchAnnotateFiles(request, callback) { + return this.rpcCall(batchAnnotateFiles, $root.google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest, $root.google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse, request, callback); + }, "name", { value: "BatchAnnotateFiles" }); /** - * Decodes a LocationInfo message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.LocationInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.LocationInfo} LocationInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Calls BatchAnnotateFiles. + * @function batchAnnotateFiles + * @memberof google.cloud.vision.v1p4beta1.ImageAnnotator + * @instance + * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest} request BatchAnnotateFilesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - LocationInfo.decode = function decode(reader, length) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.LocationInfo(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.latLng = $root.google.type.LatLng.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; /** - * Decodes a LocationInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.LocationInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.LocationInfo} LocationInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing + * Callback as used by {@link google.cloud.vision.v1p4beta1.ImageAnnotator#asyncBatchAnnotateImages}. + * @memberof google.cloud.vision.v1p4beta1.ImageAnnotator + * @typedef AsyncBatchAnnotateImagesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation */ - LocationInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; /** - * Verifies a LocationInfo message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.LocationInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not + * Calls AsyncBatchAnnotateImages. + * @function asyncBatchAnnotateImages + * @memberof google.cloud.vision.v1p4beta1.ImageAnnotator + * @instance + * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest} request AsyncBatchAnnotateImagesRequest message or plain object + * @param {google.cloud.vision.v1p4beta1.ImageAnnotator.AsyncBatchAnnotateImagesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 */ - LocationInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.latLng != null && message.hasOwnProperty("latLng")) { - var error = $root.google.type.LatLng.verify(message.latLng); - if (error) - return "latLng." + error; - } - return null; - }; + Object.defineProperty(ImageAnnotator.prototype.asyncBatchAnnotateImages = function asyncBatchAnnotateImages(request, callback) { + return this.rpcCall(asyncBatchAnnotateImages, $root.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "AsyncBatchAnnotateImages" }); /** - * Creates a LocationInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.LocationInfo - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.LocationInfo} LocationInfo + * Calls AsyncBatchAnnotateImages. + * @function asyncBatchAnnotateImages + * @memberof google.cloud.vision.v1p4beta1.ImageAnnotator + * @instance + * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest} request AsyncBatchAnnotateImagesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 */ - LocationInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.LocationInfo) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.LocationInfo(); - if (object.latLng != null) { - if (typeof object.latLng !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.LocationInfo.latLng: object expected"); - message.latLng = $root.google.type.LatLng.fromObject(object.latLng); - } - return message; - }; /** - * Creates a plain object from a LocationInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.LocationInfo - * @static - * @param {google.cloud.vision.v1p4beta1.LocationInfo} message LocationInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object + * Callback as used by {@link google.cloud.vision.v1p4beta1.ImageAnnotator#asyncBatchAnnotateFiles}. + * @memberof google.cloud.vision.v1p4beta1.ImageAnnotator + * @typedef AsyncBatchAnnotateFilesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation */ - LocationInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.latLng = null; - if (message.latLng != null && message.hasOwnProperty("latLng")) - object.latLng = $root.google.type.LatLng.toObject(message.latLng, options); - return object; - }; /** - * Converts this LocationInfo to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.LocationInfo + * Calls AsyncBatchAnnotateFiles. + * @function asyncBatchAnnotateFiles + * @memberof google.cloud.vision.v1p4beta1.ImageAnnotator * @instance - * @returns {Object.} JSON object + * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest} request AsyncBatchAnnotateFilesRequest message or plain object + * @param {google.cloud.vision.v1p4beta1.ImageAnnotator.AsyncBatchAnnotateFilesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 */ - LocationInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + Object.defineProperty(ImageAnnotator.prototype.asyncBatchAnnotateFiles = function asyncBatchAnnotateFiles(request, callback) { + return this.rpcCall(asyncBatchAnnotateFiles, $root.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "AsyncBatchAnnotateFiles" }); - return LocationInfo; + /** + * Calls AsyncBatchAnnotateFiles. + * @function asyncBatchAnnotateFiles + * @memberof google.cloud.vision.v1p4beta1.ImageAnnotator + * @instance + * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest} request AsyncBatchAnnotateFilesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return ImageAnnotator; })(); - v1p4beta1.Property = (function() { + v1p4beta1.Feature = (function() { /** - * Properties of a Property. + * Properties of a Feature. * @memberof google.cloud.vision.v1p4beta1 - * @interface IProperty - * @property {string|null} [name] Property name - * @property {string|null} [value] Property value - * @property {number|Long|null} [uint64Value] Property uint64Value + * @interface IFeature + * @property {google.cloud.vision.v1p4beta1.Feature.Type|null} [type] Feature type + * @property {number|null} [maxResults] Feature maxResults + * @property {string|null} [model] Feature model */ /** - * Constructs a new Property. + * Constructs a new Feature. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a Property. - * @implements IProperty + * @classdesc Represents a Feature. + * @implements IFeature * @constructor - * @param {google.cloud.vision.v1p4beta1.IProperty=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IFeature=} [properties] Properties to set */ - function Property(properties) { + function Feature(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -75481,101 +74775,101 @@ } /** - * Property name. - * @member {string} name - * @memberof google.cloud.vision.v1p4beta1.Property + * Feature type. + * @member {google.cloud.vision.v1p4beta1.Feature.Type} type + * @memberof google.cloud.vision.v1p4beta1.Feature * @instance */ - Property.prototype.name = ""; + Feature.prototype.type = 0; /** - * Property value. - * @member {string} value - * @memberof google.cloud.vision.v1p4beta1.Property + * Feature maxResults. + * @member {number} maxResults + * @memberof google.cloud.vision.v1p4beta1.Feature * @instance */ - Property.prototype.value = ""; + Feature.prototype.maxResults = 0; /** - * Property uint64Value. - * @member {number|Long} uint64Value - * @memberof google.cloud.vision.v1p4beta1.Property + * Feature model. + * @member {string} model + * @memberof google.cloud.vision.v1p4beta1.Feature * @instance */ - Property.prototype.uint64Value = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + Feature.prototype.model = ""; /** - * Creates a new Property instance using the specified properties. + * Creates a new Feature instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.Property + * @memberof google.cloud.vision.v1p4beta1.Feature * @static - * @param {google.cloud.vision.v1p4beta1.IProperty=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.Property} Property instance + * @param {google.cloud.vision.v1p4beta1.IFeature=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.Feature} Feature instance */ - Property.create = function create(properties) { - return new Property(properties); + Feature.create = function create(properties) { + return new Feature(properties); }; /** - * Encodes the specified Property message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Property.verify|verify} messages. + * Encodes the specified Feature message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Feature.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.Property + * @memberof google.cloud.vision.v1p4beta1.Feature * @static - * @param {google.cloud.vision.v1p4beta1.IProperty} message Property message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IFeature} message Feature message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Property.encode = function encode(message, writer) { + Feature.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.value != null && message.hasOwnProperty("value")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); - if (message.uint64Value != null && message.hasOwnProperty("uint64Value")) - writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.uint64Value); + if (message.type != null && message.hasOwnProperty("type")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.maxResults); + if (message.model != null && message.hasOwnProperty("model")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.model); return writer; }; /** - * Encodes the specified Property message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Property.verify|verify} messages. + * Encodes the specified Feature message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Feature.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.Property + * @memberof google.cloud.vision.v1p4beta1.Feature * @static - * @param {google.cloud.vision.v1p4beta1.IProperty} message Property message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IFeature} message Feature message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Property.encodeDelimited = function encodeDelimited(message, writer) { + Feature.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Property message from the specified reader or buffer. + * Decodes a Feature message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.Property + * @memberof google.cloud.vision.v1p4beta1.Feature * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.Property} Property + * @returns {google.cloud.vision.v1p4beta1.Feature} Feature * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Property.decode = function decode(reader, length) { + Feature.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.vision.v1p4beta1.Property(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.Feature(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.name = reader.string(); + message.type = reader.int32(); break; case 2: - message.value = reader.string(); + message.maxResults = reader.int32(); break; case 3: - message.uint64Value = reader.uint64(); + message.model = reader.string(); break; default: reader.skipType(tag & 7); @@ -75586,148 +74880,229 @@ }; /** - * Decodes a Property message from the specified reader or buffer, length delimited. + * Decodes a Feature message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.Property + * @memberof google.cloud.vision.v1p4beta1.Feature * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.Property} Property + * @returns {google.cloud.vision.v1p4beta1.Feature} Feature * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Property.decodeDelimited = function decodeDelimited(reader) { + Feature.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Property message. + * Verifies a Feature message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.Property + * @memberof google.cloud.vision.v1p4beta1.Feature * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Property.verify = function verify(message) { + Feature.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isString(message.value)) - return "value: string expected"; - if (message.uint64Value != null && message.hasOwnProperty("uint64Value")) - if (!$util.isInteger(message.uint64Value) && !(message.uint64Value && $util.isInteger(message.uint64Value.low) && $util.isInteger(message.uint64Value.high))) - return "uint64Value: integer|Long expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 11: + case 6: + case 7: + case 9: + case 10: + case 12: + case 19: + break; + } + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + if (!$util.isInteger(message.maxResults)) + return "maxResults: integer expected"; + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; return null; }; /** - * Creates a Property message from a plain object. Also converts values to their respective internal types. + * Creates a Feature message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.Property + * @memberof google.cloud.vision.v1p4beta1.Feature * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.Property} Property + * @returns {google.cloud.vision.v1p4beta1.Feature} Feature */ - Property.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.Property) + Feature.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.Feature) return object; - var message = new $root.google.cloud.vision.v1p4beta1.Property(); - if (object.name != null) - message.name = String(object.name); - if (object.value != null) - message.value = String(object.value); - if (object.uint64Value != null) - if ($util.Long) - (message.uint64Value = $util.Long.fromValue(object.uint64Value)).unsigned = true; - else if (typeof object.uint64Value === "string") - message.uint64Value = parseInt(object.uint64Value, 10); - else if (typeof object.uint64Value === "number") - message.uint64Value = object.uint64Value; - else if (typeof object.uint64Value === "object") - message.uint64Value = new $util.LongBits(object.uint64Value.low >>> 0, object.uint64Value.high >>> 0).toNumber(true); + var message = new $root.google.cloud.vision.v1p4beta1.Feature(); + switch (object.type) { + case "TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "FACE_DETECTION": + case 1: + message.type = 1; + break; + case "LANDMARK_DETECTION": + case 2: + message.type = 2; + break; + case "LOGO_DETECTION": + case 3: + message.type = 3; + break; + case "LABEL_DETECTION": + case 4: + message.type = 4; + break; + case "TEXT_DETECTION": + case 5: + message.type = 5; + break; + case "DOCUMENT_TEXT_DETECTION": + case 11: + message.type = 11; + break; + case "SAFE_SEARCH_DETECTION": + case 6: + message.type = 6; + break; + case "IMAGE_PROPERTIES": + case 7: + message.type = 7; + break; + case "CROP_HINTS": + case 9: + message.type = 9; + break; + case "WEB_DETECTION": + case 10: + message.type = 10; + break; + case "PRODUCT_SEARCH": + case 12: + message.type = 12; + break; + case "OBJECT_LOCALIZATION": + case 19: + message.type = 19; + break; + } + if (object.maxResults != null) + message.maxResults = object.maxResults | 0; + if (object.model != null) + message.model = String(object.model); return message; }; /** - * Creates a plain object from a Property message. Also converts values to other types if specified. + * Creates a plain object from a Feature message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.Property + * @memberof google.cloud.vision.v1p4beta1.Feature * @static - * @param {google.cloud.vision.v1p4beta1.Property} message Property + * @param {google.cloud.vision.v1p4beta1.Feature} message Feature * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Property.toObject = function toObject(message, options) { + Feature.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.name = ""; - object.value = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, true); - object.uint64Value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.uint64Value = options.longs === String ? "0" : 0; + object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + object.maxResults = 0; + object.model = ""; } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - if (message.uint64Value != null && message.hasOwnProperty("uint64Value")) - if (typeof message.uint64Value === "number") - object.uint64Value = options.longs === String ? String(message.uint64Value) : message.uint64Value; - else - object.uint64Value = options.longs === String ? $util.Long.prototype.toString.call(message.uint64Value) : options.longs === Number ? new $util.LongBits(message.uint64Value.low >>> 0, message.uint64Value.high >>> 0).toNumber(true) : message.uint64Value; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.vision.v1p4beta1.Feature.Type[message.type] : message.type; + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + object.maxResults = message.maxResults; + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; return object; }; /** - * Converts this Property to JSON. + * Converts this Feature to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.Property + * @memberof google.cloud.vision.v1p4beta1.Feature * @instance * @returns {Object.} JSON object */ - Property.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + Feature.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Type enum. + * @name google.cloud.vision.v1p4beta1.Feature.Type + * @enum {string} + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} FACE_DETECTION=1 FACE_DETECTION value + * @property {number} LANDMARK_DETECTION=2 LANDMARK_DETECTION value + * @property {number} LOGO_DETECTION=3 LOGO_DETECTION value + * @property {number} LABEL_DETECTION=4 LABEL_DETECTION value + * @property {number} TEXT_DETECTION=5 TEXT_DETECTION value + * @property {number} DOCUMENT_TEXT_DETECTION=11 DOCUMENT_TEXT_DETECTION value + * @property {number} SAFE_SEARCH_DETECTION=6 SAFE_SEARCH_DETECTION value + * @property {number} IMAGE_PROPERTIES=7 IMAGE_PROPERTIES value + * @property {number} CROP_HINTS=9 CROP_HINTS value + * @property {number} WEB_DETECTION=10 WEB_DETECTION value + * @property {number} PRODUCT_SEARCH=12 PRODUCT_SEARCH value + * @property {number} OBJECT_LOCALIZATION=19 OBJECT_LOCALIZATION value + */ + Feature.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "FACE_DETECTION"] = 1; + values[valuesById[2] = "LANDMARK_DETECTION"] = 2; + values[valuesById[3] = "LOGO_DETECTION"] = 3; + values[valuesById[4] = "LABEL_DETECTION"] = 4; + values[valuesById[5] = "TEXT_DETECTION"] = 5; + values[valuesById[11] = "DOCUMENT_TEXT_DETECTION"] = 11; + values[valuesById[6] = "SAFE_SEARCH_DETECTION"] = 6; + values[valuesById[7] = "IMAGE_PROPERTIES"] = 7; + values[valuesById[9] = "CROP_HINTS"] = 9; + values[valuesById[10] = "WEB_DETECTION"] = 10; + values[valuesById[12] = "PRODUCT_SEARCH"] = 12; + values[valuesById[19] = "OBJECT_LOCALIZATION"] = 19; + return values; + })(); - return Property; + return Feature; })(); - v1p4beta1.EntityAnnotation = (function() { + v1p4beta1.ImageSource = (function() { /** - * Properties of an EntityAnnotation. + * Properties of an ImageSource. * @memberof google.cloud.vision.v1p4beta1 - * @interface IEntityAnnotation - * @property {string|null} [mid] EntityAnnotation mid - * @property {string|null} [locale] EntityAnnotation locale - * @property {string|null} [description] EntityAnnotation description - * @property {number|null} [score] EntityAnnotation score - * @property {number|null} [confidence] EntityAnnotation confidence - * @property {number|null} [topicality] EntityAnnotation topicality - * @property {google.cloud.vision.v1p4beta1.IBoundingPoly|null} [boundingPoly] EntityAnnotation boundingPoly - * @property {Array.|null} [locations] EntityAnnotation locations - * @property {Array.|null} [properties] EntityAnnotation properties + * @interface IImageSource + * @property {string|null} [gcsImageUri] ImageSource gcsImageUri + * @property {string|null} [imageUri] ImageSource imageUri */ /** - * Constructs a new EntityAnnotation. + * Constructs a new ImageSource. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an EntityAnnotation. - * @implements IEntityAnnotation + * @classdesc Represents an ImageSource. + * @implements IImageSource * @constructor - * @param {google.cloud.vision.v1p4beta1.IEntityAnnotation=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IImageSource=} [properties] Properties to set */ - function EntityAnnotation(properties) { - this.locations = []; - this.properties = []; + function ImageSource(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -75735,185 +75110,88 @@ } /** - * EntityAnnotation mid. - * @member {string} mid - * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation - * @instance - */ - EntityAnnotation.prototype.mid = ""; - - /** - * EntityAnnotation locale. - * @member {string} locale - * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation - * @instance - */ - EntityAnnotation.prototype.locale = ""; - - /** - * EntityAnnotation description. - * @member {string} description - * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation - * @instance - */ - EntityAnnotation.prototype.description = ""; - - /** - * EntityAnnotation score. - * @member {number} score - * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation - * @instance - */ - EntityAnnotation.prototype.score = 0; - - /** - * EntityAnnotation confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation - * @instance - */ - EntityAnnotation.prototype.confidence = 0; - - /** - * EntityAnnotation topicality. - * @member {number} topicality - * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation - * @instance - */ - EntityAnnotation.prototype.topicality = 0; - - /** - * EntityAnnotation boundingPoly. - * @member {google.cloud.vision.v1p4beta1.IBoundingPoly|null|undefined} boundingPoly - * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation - * @instance - */ - EntityAnnotation.prototype.boundingPoly = null; - - /** - * EntityAnnotation locations. - * @member {Array.} locations - * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation + * ImageSource gcsImageUri. + * @member {string} gcsImageUri + * @memberof google.cloud.vision.v1p4beta1.ImageSource * @instance */ - EntityAnnotation.prototype.locations = $util.emptyArray; + ImageSource.prototype.gcsImageUri = ""; /** - * EntityAnnotation properties. - * @member {Array.} properties - * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation + * ImageSource imageUri. + * @member {string} imageUri + * @memberof google.cloud.vision.v1p4beta1.ImageSource * @instance */ - EntityAnnotation.prototype.properties = $util.emptyArray; + ImageSource.prototype.imageUri = ""; /** - * Creates a new EntityAnnotation instance using the specified properties. + * Creates a new ImageSource instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation + * @memberof google.cloud.vision.v1p4beta1.ImageSource * @static - * @param {google.cloud.vision.v1p4beta1.IEntityAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.EntityAnnotation} EntityAnnotation instance + * @param {google.cloud.vision.v1p4beta1.IImageSource=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.ImageSource} ImageSource instance */ - EntityAnnotation.create = function create(properties) { - return new EntityAnnotation(properties); + ImageSource.create = function create(properties) { + return new ImageSource(properties); }; /** - * Encodes the specified EntityAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.EntityAnnotation.verify|verify} messages. + * Encodes the specified ImageSource message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageSource.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation + * @memberof google.cloud.vision.v1p4beta1.ImageSource * @static - * @param {google.cloud.vision.v1p4beta1.IEntityAnnotation} message EntityAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IImageSource} message ImageSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EntityAnnotation.encode = function encode(message, writer) { + ImageSource.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.mid != null && message.hasOwnProperty("mid")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.mid); - if (message.locale != null && message.hasOwnProperty("locale")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.locale); - if (message.description != null && message.hasOwnProperty("description")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); - if (message.score != null && message.hasOwnProperty("score")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.score); - if (message.confidence != null && message.hasOwnProperty("confidence")) - writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); - if (message.topicality != null && message.hasOwnProperty("topicality")) - writer.uint32(/* id 6, wireType 5 =*/53).float(message.topicality); - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - $root.google.cloud.vision.v1p4beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.locations != null && message.locations.length) - for (var i = 0; i < message.locations.length; ++i) - $root.google.cloud.vision.v1p4beta1.LocationInfo.encode(message.locations[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.properties != null && message.properties.length) - for (var i = 0; i < message.properties.length; ++i) - $root.google.cloud.vision.v1p4beta1.Property.encode(message.properties[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.gcsImageUri != null && message.hasOwnProperty("gcsImageUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.gcsImageUri); + if (message.imageUri != null && message.hasOwnProperty("imageUri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.imageUri); return writer; }; /** - * Encodes the specified EntityAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.EntityAnnotation.verify|verify} messages. + * Encodes the specified ImageSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageSource.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation + * @memberof google.cloud.vision.v1p4beta1.ImageSource * @static - * @param {google.cloud.vision.v1p4beta1.IEntityAnnotation} message EntityAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IImageSource} message ImageSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EntityAnnotation.encodeDelimited = function encodeDelimited(message, writer) { + ImageSource.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an EntityAnnotation message from the specified reader or buffer. + * Decodes an ImageSource message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation + * @memberof google.cloud.vision.v1p4beta1.ImageSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.EntityAnnotation} EntityAnnotation + * @returns {google.cloud.vision.v1p4beta1.ImageSource} ImageSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EntityAnnotation.decode = function decode(reader, length) { + ImageSource.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.vision.v1p4beta1.EntityAnnotation(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.ImageSource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.mid = reader.string(); + message.gcsImageUri = reader.string(); break; case 2: - message.locale = reader.string(); - break; - case 3: - message.description = reader.string(); - break; - case 4: - message.score = reader.float(); - break; - case 5: - message.confidence = reader.float(); - break; - case 6: - message.topicality = reader.float(); - break; - case 7: - message.boundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.decode(reader, reader.uint32()); - break; - case 8: - if (!(message.locations && message.locations.length)) - message.locations = []; - message.locations.push($root.google.cloud.vision.v1p4beta1.LocationInfo.decode(reader, reader.uint32())); - break; - case 9: - if (!(message.properties && message.properties.length)) - message.properties = []; - message.properties.push($root.google.cloud.vision.v1p4beta1.Property.decode(reader, reader.uint32())); + message.imageUri = reader.string(); break; default: reader.skipType(tag & 7); @@ -75924,217 +75202,117 @@ }; /** - * Decodes an EntityAnnotation message from the specified reader or buffer, length delimited. + * Decodes an ImageSource message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation + * @memberof google.cloud.vision.v1p4beta1.ImageSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.EntityAnnotation} EntityAnnotation + * @returns {google.cloud.vision.v1p4beta1.ImageSource} ImageSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EntityAnnotation.decodeDelimited = function decodeDelimited(reader) { + ImageSource.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an EntityAnnotation message. + * Verifies an ImageSource message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation + * @memberof google.cloud.vision.v1p4beta1.ImageSource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - EntityAnnotation.verify = function verify(message) { + ImageSource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.mid != null && message.hasOwnProperty("mid")) - if (!$util.isString(message.mid)) - return "mid: string expected"; - if (message.locale != null && message.hasOwnProperty("locale")) - if (!$util.isString(message.locale)) - return "locale: string expected"; - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; - if (message.confidence != null && message.hasOwnProperty("confidence")) - if (typeof message.confidence !== "number") - return "confidence: number expected"; - if (message.topicality != null && message.hasOwnProperty("topicality")) - if (typeof message.topicality !== "number") - return "topicality: number expected"; - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { - var error = $root.google.cloud.vision.v1p4beta1.BoundingPoly.verify(message.boundingPoly); - if (error) - return "boundingPoly." + error; - } - if (message.locations != null && message.hasOwnProperty("locations")) { - if (!Array.isArray(message.locations)) - return "locations: array expected"; - for (var i = 0; i < message.locations.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.LocationInfo.verify(message.locations[i]); - if (error) - return "locations." + error; - } - } - if (message.properties != null && message.hasOwnProperty("properties")) { - if (!Array.isArray(message.properties)) - return "properties: array expected"; - for (var i = 0; i < message.properties.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.Property.verify(message.properties[i]); - if (error) - return "properties." + error; - } - } + if (message.gcsImageUri != null && message.hasOwnProperty("gcsImageUri")) + if (!$util.isString(message.gcsImageUri)) + return "gcsImageUri: string expected"; + if (message.imageUri != null && message.hasOwnProperty("imageUri")) + if (!$util.isString(message.imageUri)) + return "imageUri: string expected"; return null; }; /** - * Creates an EntityAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates an ImageSource message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation + * @memberof google.cloud.vision.v1p4beta1.ImageSource * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.EntityAnnotation} EntityAnnotation + * @returns {google.cloud.vision.v1p4beta1.ImageSource} ImageSource */ - EntityAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.EntityAnnotation) + ImageSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.ImageSource) return object; - var message = new $root.google.cloud.vision.v1p4beta1.EntityAnnotation(); - if (object.mid != null) - message.mid = String(object.mid); - if (object.locale != null) - message.locale = String(object.locale); - if (object.description != null) - message.description = String(object.description); - if (object.score != null) - message.score = Number(object.score); - if (object.confidence != null) - message.confidence = Number(object.confidence); - if (object.topicality != null) - message.topicality = Number(object.topicality); - if (object.boundingPoly != null) { - if (typeof object.boundingPoly !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.EntityAnnotation.boundingPoly: object expected"); - message.boundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.fromObject(object.boundingPoly); - } - if (object.locations) { - if (!Array.isArray(object.locations)) - throw TypeError(".google.cloud.vision.v1p4beta1.EntityAnnotation.locations: array expected"); - message.locations = []; - for (var i = 0; i < object.locations.length; ++i) { - if (typeof object.locations[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.EntityAnnotation.locations: object expected"); - message.locations[i] = $root.google.cloud.vision.v1p4beta1.LocationInfo.fromObject(object.locations[i]); - } - } - if (object.properties) { - if (!Array.isArray(object.properties)) - throw TypeError(".google.cloud.vision.v1p4beta1.EntityAnnotation.properties: array expected"); - message.properties = []; - for (var i = 0; i < object.properties.length; ++i) { - if (typeof object.properties[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.EntityAnnotation.properties: object expected"); - message.properties[i] = $root.google.cloud.vision.v1p4beta1.Property.fromObject(object.properties[i]); - } - } + var message = new $root.google.cloud.vision.v1p4beta1.ImageSource(); + if (object.gcsImageUri != null) + message.gcsImageUri = String(object.gcsImageUri); + if (object.imageUri != null) + message.imageUri = String(object.imageUri); return message; }; /** - * Creates a plain object from an EntityAnnotation message. Also converts values to other types if specified. + * Creates a plain object from an ImageSource message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation + * @memberof google.cloud.vision.v1p4beta1.ImageSource * @static - * @param {google.cloud.vision.v1p4beta1.EntityAnnotation} message EntityAnnotation + * @param {google.cloud.vision.v1p4beta1.ImageSource} message ImageSource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EntityAnnotation.toObject = function toObject(message, options) { + ImageSource.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.locations = []; - object.properties = []; - } if (options.defaults) { - object.mid = ""; - object.locale = ""; - object.description = ""; - object.score = 0; - object.confidence = 0; - object.topicality = 0; - object.boundingPoly = null; - } - if (message.mid != null && message.hasOwnProperty("mid")) - object.mid = message.mid; - if (message.locale != null && message.hasOwnProperty("locale")) - object.locale = message.locale; - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - if (message.confidence != null && message.hasOwnProperty("confidence")) - object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; - if (message.topicality != null && message.hasOwnProperty("topicality")) - object.topicality = options.json && !isFinite(message.topicality) ? String(message.topicality) : message.topicality; - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - object.boundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.toObject(message.boundingPoly, options); - if (message.locations && message.locations.length) { - object.locations = []; - for (var j = 0; j < message.locations.length; ++j) - object.locations[j] = $root.google.cloud.vision.v1p4beta1.LocationInfo.toObject(message.locations[j], options); - } - if (message.properties && message.properties.length) { - object.properties = []; - for (var j = 0; j < message.properties.length; ++j) - object.properties[j] = $root.google.cloud.vision.v1p4beta1.Property.toObject(message.properties[j], options); + object.gcsImageUri = ""; + object.imageUri = ""; } + if (message.gcsImageUri != null && message.hasOwnProperty("gcsImageUri")) + object.gcsImageUri = message.gcsImageUri; + if (message.imageUri != null && message.hasOwnProperty("imageUri")) + object.imageUri = message.imageUri; return object; }; /** - * Converts this EntityAnnotation to JSON. + * Converts this ImageSource to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation + * @memberof google.cloud.vision.v1p4beta1.ImageSource * @instance * @returns {Object.} JSON object */ - EntityAnnotation.prototype.toJSON = function toJSON() { + ImageSource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return EntityAnnotation; + return ImageSource; })(); - v1p4beta1.LocalizedObjectAnnotation = (function() { + v1p4beta1.Image = (function() { /** - * Properties of a LocalizedObjectAnnotation. + * Properties of an Image. * @memberof google.cloud.vision.v1p4beta1 - * @interface ILocalizedObjectAnnotation - * @property {string|null} [mid] LocalizedObjectAnnotation mid - * @property {string|null} [languageCode] LocalizedObjectAnnotation languageCode - * @property {string|null} [name] LocalizedObjectAnnotation name - * @property {number|null} [score] LocalizedObjectAnnotation score - * @property {google.cloud.vision.v1p4beta1.IBoundingPoly|null} [boundingPoly] LocalizedObjectAnnotation boundingPoly + * @interface IImage + * @property {Uint8Array|null} [content] Image content + * @property {google.cloud.vision.v1p4beta1.IImageSource|null} [source] Image source */ /** - * Constructs a new LocalizedObjectAnnotation. + * Constructs a new Image. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a LocalizedObjectAnnotation. - * @implements ILocalizedObjectAnnotation + * @classdesc Represents an Image. + * @implements IImage * @constructor - * @param {google.cloud.vision.v1p4beta1.ILocalizedObjectAnnotation=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IImage=} [properties] Properties to set */ - function LocalizedObjectAnnotation(properties) { + function Image(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -76142,127 +75320,88 @@ } /** - * LocalizedObjectAnnotation mid. - * @member {string} mid - * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation - * @instance - */ - LocalizedObjectAnnotation.prototype.mid = ""; - - /** - * LocalizedObjectAnnotation languageCode. - * @member {string} languageCode - * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation - * @instance - */ - LocalizedObjectAnnotation.prototype.languageCode = ""; - - /** - * LocalizedObjectAnnotation name. - * @member {string} name - * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation - * @instance - */ - LocalizedObjectAnnotation.prototype.name = ""; - - /** - * LocalizedObjectAnnotation score. - * @member {number} score - * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation + * Image content. + * @member {Uint8Array} content + * @memberof google.cloud.vision.v1p4beta1.Image * @instance */ - LocalizedObjectAnnotation.prototype.score = 0; + Image.prototype.content = $util.newBuffer([]); /** - * LocalizedObjectAnnotation boundingPoly. - * @member {google.cloud.vision.v1p4beta1.IBoundingPoly|null|undefined} boundingPoly - * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation + * Image source. + * @member {google.cloud.vision.v1p4beta1.IImageSource|null|undefined} source + * @memberof google.cloud.vision.v1p4beta1.Image * @instance */ - LocalizedObjectAnnotation.prototype.boundingPoly = null; + Image.prototype.source = null; /** - * Creates a new LocalizedObjectAnnotation instance using the specified properties. + * Creates a new Image instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation + * @memberof google.cloud.vision.v1p4beta1.Image * @static - * @param {google.cloud.vision.v1p4beta1.ILocalizedObjectAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation} LocalizedObjectAnnotation instance + * @param {google.cloud.vision.v1p4beta1.IImage=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.Image} Image instance */ - LocalizedObjectAnnotation.create = function create(properties) { - return new LocalizedObjectAnnotation(properties); + Image.create = function create(properties) { + return new Image(properties); }; /** - * Encodes the specified LocalizedObjectAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation.verify|verify} messages. + * Encodes the specified Image message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Image.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation + * @memberof google.cloud.vision.v1p4beta1.Image * @static - * @param {google.cloud.vision.v1p4beta1.ILocalizedObjectAnnotation} message LocalizedObjectAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IImage} message Image message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - LocalizedObjectAnnotation.encode = function encode(message, writer) { + Image.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.mid != null && message.hasOwnProperty("mid")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.mid); - if (message.languageCode != null && message.hasOwnProperty("languageCode")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); - if (message.name != null && message.hasOwnProperty("name")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); - if (message.score != null && message.hasOwnProperty("score")) - writer.uint32(/* id 4, wireType 5 =*/37).float(message.score); - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - $root.google.cloud.vision.v1p4beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.content != null && message.hasOwnProperty("content")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.content); + if (message.source != null && message.hasOwnProperty("source")) + $root.google.cloud.vision.v1p4beta1.ImageSource.encode(message.source, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified LocalizedObjectAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation.verify|verify} messages. + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Image.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation + * @memberof google.cloud.vision.v1p4beta1.Image * @static - * @param {google.cloud.vision.v1p4beta1.ILocalizedObjectAnnotation} message LocalizedObjectAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IImage} message Image message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - LocalizedObjectAnnotation.encodeDelimited = function encodeDelimited(message, writer) { + Image.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a LocalizedObjectAnnotation message from the specified reader or buffer. + * Decodes an Image message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation + * @memberof google.cloud.vision.v1p4beta1.Image * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation} LocalizedObjectAnnotation + * @returns {google.cloud.vision.v1p4beta1.Image} Image * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - LocalizedObjectAnnotation.decode = function decode(reader, length) { + Image.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.vision.v1p4beta1.LocalizedObjectAnnotation(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.Image(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.mid = reader.string(); + message.content = reader.bytes(); break; case 2: - message.languageCode = reader.string(); - break; - case 3: - message.name = reader.string(); - break; - case 4: - message.score = reader.float(); - break; - case 5: - message.boundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.decode(reader, reader.uint32()); + message.source = $root.google.cloud.vision.v1p4beta1.ImageSource.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -76273,149 +75412,169 @@ }; /** - * Decodes a LocalizedObjectAnnotation message from the specified reader or buffer, length delimited. + * Decodes an Image message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation + * @memberof google.cloud.vision.v1p4beta1.Image * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation} LocalizedObjectAnnotation + * @returns {google.cloud.vision.v1p4beta1.Image} Image * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - LocalizedObjectAnnotation.decodeDelimited = function decodeDelimited(reader) { + Image.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a LocalizedObjectAnnotation message. + * Verifies an Image message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation + * @memberof google.cloud.vision.v1p4beta1.Image * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - LocalizedObjectAnnotation.verify = function verify(message) { + Image.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.mid != null && message.hasOwnProperty("mid")) - if (!$util.isString(message.mid)) - return "mid: string expected"; - if (message.languageCode != null && message.hasOwnProperty("languageCode")) - if (!$util.isString(message.languageCode)) - return "languageCode: string expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { - var error = $root.google.cloud.vision.v1p4beta1.BoundingPoly.verify(message.boundingPoly); + if (message.content != null && message.hasOwnProperty("content")) + if (!(message.content && typeof message.content.length === "number" || $util.isString(message.content))) + return "content: buffer expected"; + if (message.source != null && message.hasOwnProperty("source")) { + var error = $root.google.cloud.vision.v1p4beta1.ImageSource.verify(message.source); if (error) - return "boundingPoly." + error; + return "source." + error; } return null; }; /** - * Creates a LocalizedObjectAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates an Image message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation + * @memberof google.cloud.vision.v1p4beta1.Image * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation} LocalizedObjectAnnotation + * @returns {google.cloud.vision.v1p4beta1.Image} Image */ - LocalizedObjectAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation) + Image.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.Image) return object; - var message = new $root.google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation(); - if (object.mid != null) - message.mid = String(object.mid); - if (object.languageCode != null) - message.languageCode = String(object.languageCode); - if (object.name != null) - message.name = String(object.name); - if (object.score != null) - message.score = Number(object.score); - if (object.boundingPoly != null) { - if (typeof object.boundingPoly !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation.boundingPoly: object expected"); - message.boundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.fromObject(object.boundingPoly); + var message = new $root.google.cloud.vision.v1p4beta1.Image(); + if (object.content != null) + if (typeof object.content === "string") + $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); + else if (object.content.length) + message.content = object.content; + if (object.source != null) { + if (typeof object.source !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.Image.source: object expected"); + message.source = $root.google.cloud.vision.v1p4beta1.ImageSource.fromObject(object.source); } return message; }; /** - * Creates a plain object from a LocalizedObjectAnnotation message. Also converts values to other types if specified. + * Creates a plain object from an Image message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation + * @memberof google.cloud.vision.v1p4beta1.Image * @static - * @param {google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation} message LocalizedObjectAnnotation + * @param {google.cloud.vision.v1p4beta1.Image} message Image * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - LocalizedObjectAnnotation.toObject = function toObject(message, options) { + Image.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.mid = ""; - object.languageCode = ""; - object.name = ""; - object.score = 0; - object.boundingPoly = null; + if (options.bytes === String) + object.content = ""; + else { + object.content = []; + if (options.bytes !== Array) + object.content = $util.newBuffer(object.content); + } + object.source = null; } - if (message.mid != null && message.hasOwnProperty("mid")) - object.mid = message.mid; - if (message.languageCode != null && message.hasOwnProperty("languageCode")) - object.languageCode = message.languageCode; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - object.boundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.toObject(message.boundingPoly, options); + if (message.content != null && message.hasOwnProperty("content")) + object.content = options.bytes === String ? $util.base64.encode(message.content, 0, message.content.length) : options.bytes === Array ? Array.prototype.slice.call(message.content) : message.content; + if (message.source != null && message.hasOwnProperty("source")) + object.source = $root.google.cloud.vision.v1p4beta1.ImageSource.toObject(message.source, options); return object; }; /** - * Converts this LocalizedObjectAnnotation to JSON. + * Converts this Image to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation + * @memberof google.cloud.vision.v1p4beta1.Image * @instance * @returns {Object.} JSON object */ - LocalizedObjectAnnotation.prototype.toJSON = function toJSON() { + Image.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return LocalizedObjectAnnotation; + return Image; })(); - v1p4beta1.SafeSearchAnnotation = (function() { + /** + * Likelihood enum. + * @name google.cloud.vision.v1p4beta1.Likelihood + * @enum {string} + * @property {number} UNKNOWN=0 UNKNOWN value + * @property {number} VERY_UNLIKELY=1 VERY_UNLIKELY value + * @property {number} UNLIKELY=2 UNLIKELY value + * @property {number} POSSIBLE=3 POSSIBLE value + * @property {number} LIKELY=4 LIKELY value + * @property {number} VERY_LIKELY=5 VERY_LIKELY value + */ + v1p4beta1.Likelihood = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN"] = 0; + values[valuesById[1] = "VERY_UNLIKELY"] = 1; + values[valuesById[2] = "UNLIKELY"] = 2; + values[valuesById[3] = "POSSIBLE"] = 3; + values[valuesById[4] = "LIKELY"] = 4; + values[valuesById[5] = "VERY_LIKELY"] = 5; + return values; + })(); + + v1p4beta1.FaceAnnotation = (function() { /** - * Properties of a SafeSearchAnnotation. + * Properties of a FaceAnnotation. * @memberof google.cloud.vision.v1p4beta1 - * @interface ISafeSearchAnnotation - * @property {google.cloud.vision.v1p4beta1.Likelihood|null} [adult] SafeSearchAnnotation adult - * @property {google.cloud.vision.v1p4beta1.Likelihood|null} [spoof] SafeSearchAnnotation spoof - * @property {google.cloud.vision.v1p4beta1.Likelihood|null} [medical] SafeSearchAnnotation medical - * @property {google.cloud.vision.v1p4beta1.Likelihood|null} [violence] SafeSearchAnnotation violence - * @property {google.cloud.vision.v1p4beta1.Likelihood|null} [racy] SafeSearchAnnotation racy + * @interface IFaceAnnotation + * @property {google.cloud.vision.v1p4beta1.IBoundingPoly|null} [boundingPoly] FaceAnnotation boundingPoly + * @property {google.cloud.vision.v1p4beta1.IBoundingPoly|null} [fdBoundingPoly] FaceAnnotation fdBoundingPoly + * @property {Array.|null} [landmarks] FaceAnnotation landmarks + * @property {number|null} [rollAngle] FaceAnnotation rollAngle + * @property {number|null} [panAngle] FaceAnnotation panAngle + * @property {number|null} [tiltAngle] FaceAnnotation tiltAngle + * @property {number|null} [detectionConfidence] FaceAnnotation detectionConfidence + * @property {number|null} [landmarkingConfidence] FaceAnnotation landmarkingConfidence + * @property {google.cloud.vision.v1p4beta1.Likelihood|null} [joyLikelihood] FaceAnnotation joyLikelihood + * @property {google.cloud.vision.v1p4beta1.Likelihood|null} [sorrowLikelihood] FaceAnnotation sorrowLikelihood + * @property {google.cloud.vision.v1p4beta1.Likelihood|null} [angerLikelihood] FaceAnnotation angerLikelihood + * @property {google.cloud.vision.v1p4beta1.Likelihood|null} [surpriseLikelihood] FaceAnnotation surpriseLikelihood + * @property {google.cloud.vision.v1p4beta1.Likelihood|null} [underExposedLikelihood] FaceAnnotation underExposedLikelihood + * @property {google.cloud.vision.v1p4beta1.Likelihood|null} [blurredLikelihood] FaceAnnotation blurredLikelihood + * @property {google.cloud.vision.v1p4beta1.Likelihood|null} [headwearLikelihood] FaceAnnotation headwearLikelihood + * @property {Array.|null} [recognitionResult] FaceAnnotation recognitionResult */ /** - * Constructs a new SafeSearchAnnotation. + * Constructs a new FaceAnnotation. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a SafeSearchAnnotation. - * @implements ISafeSearchAnnotation + * @classdesc Represents a FaceAnnotation. + * @implements IFaceAnnotation * @constructor - * @param {google.cloud.vision.v1p4beta1.ISafeSearchAnnotation=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IFaceAnnotation=} [properties] Properties to set */ - function SafeSearchAnnotation(properties) { + function FaceAnnotation(properties) { + this.landmarks = []; + this.recognitionResult = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -76423,167 +75582,374 @@ } /** - * SafeSearchAnnotation adult. - * @member {google.cloud.vision.v1p4beta1.Likelihood} adult - * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation + * FaceAnnotation boundingPoly. + * @member {google.cloud.vision.v1p4beta1.IBoundingPoly|null|undefined} boundingPoly + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation * @instance */ - SafeSearchAnnotation.prototype.adult = 0; + FaceAnnotation.prototype.boundingPoly = null; /** - * SafeSearchAnnotation spoof. - * @member {google.cloud.vision.v1p4beta1.Likelihood} spoof - * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation + * FaceAnnotation fdBoundingPoly. + * @member {google.cloud.vision.v1p4beta1.IBoundingPoly|null|undefined} fdBoundingPoly + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation * @instance */ - SafeSearchAnnotation.prototype.spoof = 0; + FaceAnnotation.prototype.fdBoundingPoly = null; /** - * SafeSearchAnnotation medical. - * @member {google.cloud.vision.v1p4beta1.Likelihood} medical - * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation + * FaceAnnotation landmarks. + * @member {Array.} landmarks + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation * @instance */ - SafeSearchAnnotation.prototype.medical = 0; + FaceAnnotation.prototype.landmarks = $util.emptyArray; /** - * SafeSearchAnnotation violence. - * @member {google.cloud.vision.v1p4beta1.Likelihood} violence - * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation + * FaceAnnotation rollAngle. + * @member {number} rollAngle + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation * @instance */ - SafeSearchAnnotation.prototype.violence = 0; + FaceAnnotation.prototype.rollAngle = 0; /** - * SafeSearchAnnotation racy. - * @member {google.cloud.vision.v1p4beta1.Likelihood} racy - * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation + * FaceAnnotation panAngle. + * @member {number} panAngle + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation * @instance */ - SafeSearchAnnotation.prototype.racy = 0; + FaceAnnotation.prototype.panAngle = 0; /** - * Creates a new SafeSearchAnnotation instance using the specified properties. + * FaceAnnotation tiltAngle. + * @member {number} tiltAngle + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.tiltAngle = 0; + + /** + * FaceAnnotation detectionConfidence. + * @member {number} detectionConfidence + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.detectionConfidence = 0; + + /** + * FaceAnnotation landmarkingConfidence. + * @member {number} landmarkingConfidence + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.landmarkingConfidence = 0; + + /** + * FaceAnnotation joyLikelihood. + * @member {google.cloud.vision.v1p4beta1.Likelihood} joyLikelihood + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.joyLikelihood = 0; + + /** + * FaceAnnotation sorrowLikelihood. + * @member {google.cloud.vision.v1p4beta1.Likelihood} sorrowLikelihood + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.sorrowLikelihood = 0; + + /** + * FaceAnnotation angerLikelihood. + * @member {google.cloud.vision.v1p4beta1.Likelihood} angerLikelihood + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.angerLikelihood = 0; + + /** + * FaceAnnotation surpriseLikelihood. + * @member {google.cloud.vision.v1p4beta1.Likelihood} surpriseLikelihood + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.surpriseLikelihood = 0; + + /** + * FaceAnnotation underExposedLikelihood. + * @member {google.cloud.vision.v1p4beta1.Likelihood} underExposedLikelihood + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.underExposedLikelihood = 0; + + /** + * FaceAnnotation blurredLikelihood. + * @member {google.cloud.vision.v1p4beta1.Likelihood} blurredLikelihood + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.blurredLikelihood = 0; + + /** + * FaceAnnotation headwearLikelihood. + * @member {google.cloud.vision.v1p4beta1.Likelihood} headwearLikelihood + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.headwearLikelihood = 0; + + /** + * FaceAnnotation recognitionResult. + * @member {Array.} recognitionResult + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation + * @instance + */ + FaceAnnotation.prototype.recognitionResult = $util.emptyArray; + + /** + * Creates a new FaceAnnotation instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation * @static - * @param {google.cloud.vision.v1p4beta1.ISafeSearchAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.SafeSearchAnnotation} SafeSearchAnnotation instance + * @param {google.cloud.vision.v1p4beta1.IFaceAnnotation=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.FaceAnnotation} FaceAnnotation instance */ - SafeSearchAnnotation.create = function create(properties) { - return new SafeSearchAnnotation(properties); + FaceAnnotation.create = function create(properties) { + return new FaceAnnotation(properties); }; /** - * Encodes the specified SafeSearchAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.SafeSearchAnnotation.verify|verify} messages. + * Encodes the specified FaceAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceAnnotation.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation * @static - * @param {google.cloud.vision.v1p4beta1.ISafeSearchAnnotation} message SafeSearchAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IFaceAnnotation} message FaceAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SafeSearchAnnotation.encode = function encode(message, writer) { + FaceAnnotation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.adult != null && message.hasOwnProperty("adult")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.adult); - if (message.spoof != null && message.hasOwnProperty("spoof")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.spoof); - if (message.medical != null && message.hasOwnProperty("medical")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.medical); - if (message.violence != null && message.hasOwnProperty("violence")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.violence); - if (message.racy != null && message.hasOwnProperty("racy")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.racy); + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + $root.google.cloud.vision.v1p4beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.fdBoundingPoly != null && message.hasOwnProperty("fdBoundingPoly")) + $root.google.cloud.vision.v1p4beta1.BoundingPoly.encode(message.fdBoundingPoly, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.landmarks != null && message.landmarks.length) + for (var i = 0; i < message.landmarks.length; ++i) + $root.google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.encode(message.landmarks[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.rollAngle != null && message.hasOwnProperty("rollAngle")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.rollAngle); + if (message.panAngle != null && message.hasOwnProperty("panAngle")) + writer.uint32(/* id 5, wireType 5 =*/45).float(message.panAngle); + if (message.tiltAngle != null && message.hasOwnProperty("tiltAngle")) + writer.uint32(/* id 6, wireType 5 =*/53).float(message.tiltAngle); + if (message.detectionConfidence != null && message.hasOwnProperty("detectionConfidence")) + writer.uint32(/* id 7, wireType 5 =*/61).float(message.detectionConfidence); + if (message.landmarkingConfidence != null && message.hasOwnProperty("landmarkingConfidence")) + writer.uint32(/* id 8, wireType 5 =*/69).float(message.landmarkingConfidence); + if (message.joyLikelihood != null && message.hasOwnProperty("joyLikelihood")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.joyLikelihood); + if (message.sorrowLikelihood != null && message.hasOwnProperty("sorrowLikelihood")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.sorrowLikelihood); + if (message.angerLikelihood != null && message.hasOwnProperty("angerLikelihood")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.angerLikelihood); + if (message.surpriseLikelihood != null && message.hasOwnProperty("surpriseLikelihood")) + writer.uint32(/* id 12, wireType 0 =*/96).int32(message.surpriseLikelihood); + if (message.underExposedLikelihood != null && message.hasOwnProperty("underExposedLikelihood")) + writer.uint32(/* id 13, wireType 0 =*/104).int32(message.underExposedLikelihood); + if (message.blurredLikelihood != null && message.hasOwnProperty("blurredLikelihood")) + writer.uint32(/* id 14, wireType 0 =*/112).int32(message.blurredLikelihood); + if (message.headwearLikelihood != null && message.hasOwnProperty("headwearLikelihood")) + writer.uint32(/* id 15, wireType 0 =*/120).int32(message.headwearLikelihood); + if (message.recognitionResult != null && message.recognitionResult.length) + for (var i = 0; i < message.recognitionResult.length; ++i) + $root.google.cloud.vision.v1p4beta1.FaceRecognitionResult.encode(message.recognitionResult[i], writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); return writer; }; /** - * Encodes the specified SafeSearchAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.SafeSearchAnnotation.verify|verify} messages. + * Encodes the specified FaceAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceAnnotation.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation * @static - * @param {google.cloud.vision.v1p4beta1.ISafeSearchAnnotation} message SafeSearchAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IFaceAnnotation} message FaceAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - SafeSearchAnnotation.encodeDelimited = function encodeDelimited(message, writer) { + FaceAnnotation.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a SafeSearchAnnotation message from the specified reader or buffer. + * Decodes a FaceAnnotation message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.SafeSearchAnnotation} SafeSearchAnnotation + * @returns {google.cloud.vision.v1p4beta1.FaceAnnotation} FaceAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - SafeSearchAnnotation.decode = function decode(reader, length) { + FaceAnnotation.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.vision.v1p4beta1.SafeSearchAnnotation(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.FaceAnnotation(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.adult = reader.int32(); - break; + message.boundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.decode(reader, reader.uint32()); + break; + case 2: + message.fdBoundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.decode(reader, reader.uint32()); + break; + case 3: + if (!(message.landmarks && message.landmarks.length)) + message.landmarks = []; + message.landmarks.push($root.google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.decode(reader, reader.uint32())); + break; + case 4: + message.rollAngle = reader.float(); + break; + case 5: + message.panAngle = reader.float(); + break; + case 6: + message.tiltAngle = reader.float(); + break; + case 7: + message.detectionConfidence = reader.float(); + break; + case 8: + message.landmarkingConfidence = reader.float(); + break; + case 9: + message.joyLikelihood = reader.int32(); + break; + case 10: + message.sorrowLikelihood = reader.int32(); + break; + case 11: + message.angerLikelihood = reader.int32(); + break; + case 12: + message.surpriseLikelihood = reader.int32(); + break; + case 13: + message.underExposedLikelihood = reader.int32(); + break; + case 14: + message.blurredLikelihood = reader.int32(); + break; + case 15: + message.headwearLikelihood = reader.int32(); + break; + case 16: + if (!(message.recognitionResult && message.recognitionResult.length)) + message.recognitionResult = []; + message.recognitionResult.push($root.google.cloud.vision.v1p4beta1.FaceRecognitionResult.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FaceAnnotation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.vision.v1p4beta1.FaceAnnotation} FaceAnnotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FaceAnnotation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FaceAnnotation message. + * @function verify + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FaceAnnotation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { + var error = $root.google.cloud.vision.v1p4beta1.BoundingPoly.verify(message.boundingPoly); + if (error) + return "boundingPoly." + error; + } + if (message.fdBoundingPoly != null && message.hasOwnProperty("fdBoundingPoly")) { + var error = $root.google.cloud.vision.v1p4beta1.BoundingPoly.verify(message.fdBoundingPoly); + if (error) + return "fdBoundingPoly." + error; + } + if (message.landmarks != null && message.hasOwnProperty("landmarks")) { + if (!Array.isArray(message.landmarks)) + return "landmarks: array expected"; + for (var i = 0; i < message.landmarks.length; ++i) { + var error = $root.google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.verify(message.landmarks[i]); + if (error) + return "landmarks." + error; + } + } + if (message.rollAngle != null && message.hasOwnProperty("rollAngle")) + if (typeof message.rollAngle !== "number") + return "rollAngle: number expected"; + if (message.panAngle != null && message.hasOwnProperty("panAngle")) + if (typeof message.panAngle !== "number") + return "panAngle: number expected"; + if (message.tiltAngle != null && message.hasOwnProperty("tiltAngle")) + if (typeof message.tiltAngle !== "number") + return "tiltAngle: number expected"; + if (message.detectionConfidence != null && message.hasOwnProperty("detectionConfidence")) + if (typeof message.detectionConfidence !== "number") + return "detectionConfidence: number expected"; + if (message.landmarkingConfidence != null && message.hasOwnProperty("landmarkingConfidence")) + if (typeof message.landmarkingConfidence !== "number") + return "landmarkingConfidence: number expected"; + if (message.joyLikelihood != null && message.hasOwnProperty("joyLikelihood")) + switch (message.joyLikelihood) { + default: + return "joyLikelihood: enum value expected"; + case 0: + case 1: case 2: - message.spoof = reader.int32(); - break; case 3: - message.medical = reader.int32(); - break; case 4: - message.violence = reader.int32(); - break; - case 9: - message.racy = reader.int32(); + case 5: break; + } + if (message.sorrowLikelihood != null && message.hasOwnProperty("sorrowLikelihood")) + switch (message.sorrowLikelihood) { default: - reader.skipType(tag & 7); + return "sorrowLikelihood: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: break; } - } - return message; - }; - - /** - * Decodes a SafeSearchAnnotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.SafeSearchAnnotation} SafeSearchAnnotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SafeSearchAnnotation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SafeSearchAnnotation message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SafeSearchAnnotation.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.adult != null && message.hasOwnProperty("adult")) - switch (message.adult) { + if (message.angerLikelihood != null && message.hasOwnProperty("angerLikelihood")) + switch (message.angerLikelihood) { default: - return "adult: enum value expected"; + return "angerLikelihood: enum value expected"; case 0: case 1: case 2: @@ -76592,10 +75958,10 @@ case 5: break; } - if (message.spoof != null && message.hasOwnProperty("spoof")) - switch (message.spoof) { + if (message.surpriseLikelihood != null && message.hasOwnProperty("surpriseLikelihood")) + switch (message.surpriseLikelihood) { default: - return "spoof: enum value expected"; + return "surpriseLikelihood: enum value expected"; case 0: case 1: case 2: @@ -76604,10 +75970,10 @@ case 5: break; } - if (message.medical != null && message.hasOwnProperty("medical")) - switch (message.medical) { + if (message.underExposedLikelihood != null && message.hasOwnProperty("underExposedLikelihood")) + switch (message.underExposedLikelihood) { default: - return "medical: enum value expected"; + return "underExposedLikelihood: enum value expected"; case 0: case 1: case 2: @@ -76616,10 +75982,10 @@ case 5: break; } - if (message.violence != null && message.hasOwnProperty("violence")) - switch (message.violence) { + if (message.blurredLikelihood != null && message.hasOwnProperty("blurredLikelihood")) + switch (message.blurredLikelihood) { default: - return "violence: enum value expected"; + return "blurredLikelihood: enum value expected"; case 0: case 1: case 2: @@ -76628,10 +75994,10 @@ case 5: break; } - if (message.racy != null && message.hasOwnProperty("racy")) - switch (message.racy) { + if (message.headwearLikelihood != null && message.hasOwnProperty("headwearLikelihood")) + switch (message.headwearLikelihood) { default: - return "racy: enum value expected"; + return "headwearLikelihood: enum value expected"; case 0: case 1: case 2: @@ -76640,441 +76006,834 @@ case 5: break; } + if (message.recognitionResult != null && message.hasOwnProperty("recognitionResult")) { + if (!Array.isArray(message.recognitionResult)) + return "recognitionResult: array expected"; + for (var i = 0; i < message.recognitionResult.length; ++i) { + var error = $root.google.cloud.vision.v1p4beta1.FaceRecognitionResult.verify(message.recognitionResult[i]); + if (error) + return "recognitionResult." + error; + } + } return null; }; /** - * Creates a SafeSearchAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates a FaceAnnotation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.SafeSearchAnnotation} SafeSearchAnnotation + * @returns {google.cloud.vision.v1p4beta1.FaceAnnotation} FaceAnnotation */ - SafeSearchAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.SafeSearchAnnotation) + FaceAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.FaceAnnotation) return object; - var message = new $root.google.cloud.vision.v1p4beta1.SafeSearchAnnotation(); - switch (object.adult) { + var message = new $root.google.cloud.vision.v1p4beta1.FaceAnnotation(); + if (object.boundingPoly != null) { + if (typeof object.boundingPoly !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.FaceAnnotation.boundingPoly: object expected"); + message.boundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.fromObject(object.boundingPoly); + } + if (object.fdBoundingPoly != null) { + if (typeof object.fdBoundingPoly !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.FaceAnnotation.fdBoundingPoly: object expected"); + message.fdBoundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.fromObject(object.fdBoundingPoly); + } + if (object.landmarks) { + if (!Array.isArray(object.landmarks)) + throw TypeError(".google.cloud.vision.v1p4beta1.FaceAnnotation.landmarks: array expected"); + message.landmarks = []; + for (var i = 0; i < object.landmarks.length; ++i) { + if (typeof object.landmarks[i] !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.FaceAnnotation.landmarks: object expected"); + message.landmarks[i] = $root.google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.fromObject(object.landmarks[i]); + } + } + if (object.rollAngle != null) + message.rollAngle = Number(object.rollAngle); + if (object.panAngle != null) + message.panAngle = Number(object.panAngle); + if (object.tiltAngle != null) + message.tiltAngle = Number(object.tiltAngle); + if (object.detectionConfidence != null) + message.detectionConfidence = Number(object.detectionConfidence); + if (object.landmarkingConfidence != null) + message.landmarkingConfidence = Number(object.landmarkingConfidence); + switch (object.joyLikelihood) { case "UNKNOWN": case 0: - message.adult = 0; + message.joyLikelihood = 0; break; case "VERY_UNLIKELY": case 1: - message.adult = 1; + message.joyLikelihood = 1; break; case "UNLIKELY": case 2: - message.adult = 2; + message.joyLikelihood = 2; break; case "POSSIBLE": case 3: - message.adult = 3; + message.joyLikelihood = 3; break; case "LIKELY": case 4: - message.adult = 4; + message.joyLikelihood = 4; break; case "VERY_LIKELY": case 5: - message.adult = 5; + message.joyLikelihood = 5; break; } - switch (object.spoof) { + switch (object.sorrowLikelihood) { case "UNKNOWN": case 0: - message.spoof = 0; + message.sorrowLikelihood = 0; break; case "VERY_UNLIKELY": case 1: - message.spoof = 1; + message.sorrowLikelihood = 1; break; case "UNLIKELY": case 2: - message.spoof = 2; + message.sorrowLikelihood = 2; break; case "POSSIBLE": case 3: - message.spoof = 3; + message.sorrowLikelihood = 3; break; case "LIKELY": case 4: - message.spoof = 4; + message.sorrowLikelihood = 4; break; case "VERY_LIKELY": case 5: - message.spoof = 5; + message.sorrowLikelihood = 5; break; } - switch (object.medical) { + switch (object.angerLikelihood) { case "UNKNOWN": case 0: - message.medical = 0; + message.angerLikelihood = 0; break; case "VERY_UNLIKELY": case 1: - message.medical = 1; + message.angerLikelihood = 1; break; case "UNLIKELY": case 2: - message.medical = 2; + message.angerLikelihood = 2; break; case "POSSIBLE": case 3: - message.medical = 3; + message.angerLikelihood = 3; break; case "LIKELY": case 4: - message.medical = 4; + message.angerLikelihood = 4; break; case "VERY_LIKELY": case 5: - message.medical = 5; + message.angerLikelihood = 5; break; } - switch (object.violence) { + switch (object.surpriseLikelihood) { case "UNKNOWN": case 0: - message.violence = 0; + message.surpriseLikelihood = 0; break; case "VERY_UNLIKELY": case 1: - message.violence = 1; + message.surpriseLikelihood = 1; break; case "UNLIKELY": case 2: - message.violence = 2; + message.surpriseLikelihood = 2; break; case "POSSIBLE": case 3: - message.violence = 3; + message.surpriseLikelihood = 3; break; case "LIKELY": case 4: - message.violence = 4; + message.surpriseLikelihood = 4; break; case "VERY_LIKELY": case 5: - message.violence = 5; + message.surpriseLikelihood = 5; break; } - switch (object.racy) { + switch (object.underExposedLikelihood) { case "UNKNOWN": case 0: - message.racy = 0; + message.underExposedLikelihood = 0; break; case "VERY_UNLIKELY": case 1: - message.racy = 1; + message.underExposedLikelihood = 1; break; case "UNLIKELY": case 2: - message.racy = 2; + message.underExposedLikelihood = 2; break; case "POSSIBLE": case 3: - message.racy = 3; + message.underExposedLikelihood = 3; break; case "LIKELY": case 4: - message.racy = 4; + message.underExposedLikelihood = 4; break; case "VERY_LIKELY": case 5: - message.racy = 5; + message.underExposedLikelihood = 5; + break; + } + switch (object.blurredLikelihood) { + case "UNKNOWN": + case 0: + message.blurredLikelihood = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.blurredLikelihood = 1; + break; + case "UNLIKELY": + case 2: + message.blurredLikelihood = 2; + break; + case "POSSIBLE": + case 3: + message.blurredLikelihood = 3; + break; + case "LIKELY": + case 4: + message.blurredLikelihood = 4; + break; + case "VERY_LIKELY": + case 5: + message.blurredLikelihood = 5; + break; + } + switch (object.headwearLikelihood) { + case "UNKNOWN": + case 0: + message.headwearLikelihood = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.headwearLikelihood = 1; + break; + case "UNLIKELY": + case 2: + message.headwearLikelihood = 2; + break; + case "POSSIBLE": + case 3: + message.headwearLikelihood = 3; + break; + case "LIKELY": + case 4: + message.headwearLikelihood = 4; + break; + case "VERY_LIKELY": + case 5: + message.headwearLikelihood = 5; break; } + if (object.recognitionResult) { + if (!Array.isArray(object.recognitionResult)) + throw TypeError(".google.cloud.vision.v1p4beta1.FaceAnnotation.recognitionResult: array expected"); + message.recognitionResult = []; + for (var i = 0; i < object.recognitionResult.length; ++i) { + if (typeof object.recognitionResult[i] !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.FaceAnnotation.recognitionResult: object expected"); + message.recognitionResult[i] = $root.google.cloud.vision.v1p4beta1.FaceRecognitionResult.fromObject(object.recognitionResult[i]); + } + } return message; }; /** - * Creates a plain object from a SafeSearchAnnotation message. Also converts values to other types if specified. + * Creates a plain object from a FaceAnnotation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation * @static - * @param {google.cloud.vision.v1p4beta1.SafeSearchAnnotation} message SafeSearchAnnotation + * @param {google.cloud.vision.v1p4beta1.FaceAnnotation} message FaceAnnotation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - SafeSearchAnnotation.toObject = function toObject(message, options) { + FaceAnnotation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) { + object.landmarks = []; + object.recognitionResult = []; + } if (options.defaults) { - object.adult = options.enums === String ? "UNKNOWN" : 0; - object.spoof = options.enums === String ? "UNKNOWN" : 0; - object.medical = options.enums === String ? "UNKNOWN" : 0; - object.violence = options.enums === String ? "UNKNOWN" : 0; - object.racy = options.enums === String ? "UNKNOWN" : 0; + object.boundingPoly = null; + object.fdBoundingPoly = null; + object.rollAngle = 0; + object.panAngle = 0; + object.tiltAngle = 0; + object.detectionConfidence = 0; + object.landmarkingConfidence = 0; + object.joyLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.sorrowLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.angerLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.surpriseLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.underExposedLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.blurredLikelihood = options.enums === String ? "UNKNOWN" : 0; + object.headwearLikelihood = options.enums === String ? "UNKNOWN" : 0; + } + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + object.boundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.toObject(message.boundingPoly, options); + if (message.fdBoundingPoly != null && message.hasOwnProperty("fdBoundingPoly")) + object.fdBoundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.toObject(message.fdBoundingPoly, options); + if (message.landmarks && message.landmarks.length) { + object.landmarks = []; + for (var j = 0; j < message.landmarks.length; ++j) + object.landmarks[j] = $root.google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.toObject(message.landmarks[j], options); + } + if (message.rollAngle != null && message.hasOwnProperty("rollAngle")) + object.rollAngle = options.json && !isFinite(message.rollAngle) ? String(message.rollAngle) : message.rollAngle; + if (message.panAngle != null && message.hasOwnProperty("panAngle")) + object.panAngle = options.json && !isFinite(message.panAngle) ? String(message.panAngle) : message.panAngle; + if (message.tiltAngle != null && message.hasOwnProperty("tiltAngle")) + object.tiltAngle = options.json && !isFinite(message.tiltAngle) ? String(message.tiltAngle) : message.tiltAngle; + if (message.detectionConfidence != null && message.hasOwnProperty("detectionConfidence")) + object.detectionConfidence = options.json && !isFinite(message.detectionConfidence) ? String(message.detectionConfidence) : message.detectionConfidence; + if (message.landmarkingConfidence != null && message.hasOwnProperty("landmarkingConfidence")) + object.landmarkingConfidence = options.json && !isFinite(message.landmarkingConfidence) ? String(message.landmarkingConfidence) : message.landmarkingConfidence; + if (message.joyLikelihood != null && message.hasOwnProperty("joyLikelihood")) + object.joyLikelihood = options.enums === String ? $root.google.cloud.vision.v1p4beta1.Likelihood[message.joyLikelihood] : message.joyLikelihood; + if (message.sorrowLikelihood != null && message.hasOwnProperty("sorrowLikelihood")) + object.sorrowLikelihood = options.enums === String ? $root.google.cloud.vision.v1p4beta1.Likelihood[message.sorrowLikelihood] : message.sorrowLikelihood; + if (message.angerLikelihood != null && message.hasOwnProperty("angerLikelihood")) + object.angerLikelihood = options.enums === String ? $root.google.cloud.vision.v1p4beta1.Likelihood[message.angerLikelihood] : message.angerLikelihood; + if (message.surpriseLikelihood != null && message.hasOwnProperty("surpriseLikelihood")) + object.surpriseLikelihood = options.enums === String ? $root.google.cloud.vision.v1p4beta1.Likelihood[message.surpriseLikelihood] : message.surpriseLikelihood; + if (message.underExposedLikelihood != null && message.hasOwnProperty("underExposedLikelihood")) + object.underExposedLikelihood = options.enums === String ? $root.google.cloud.vision.v1p4beta1.Likelihood[message.underExposedLikelihood] : message.underExposedLikelihood; + if (message.blurredLikelihood != null && message.hasOwnProperty("blurredLikelihood")) + object.blurredLikelihood = options.enums === String ? $root.google.cloud.vision.v1p4beta1.Likelihood[message.blurredLikelihood] : message.blurredLikelihood; + if (message.headwearLikelihood != null && message.hasOwnProperty("headwearLikelihood")) + object.headwearLikelihood = options.enums === String ? $root.google.cloud.vision.v1p4beta1.Likelihood[message.headwearLikelihood] : message.headwearLikelihood; + if (message.recognitionResult && message.recognitionResult.length) { + object.recognitionResult = []; + for (var j = 0; j < message.recognitionResult.length; ++j) + object.recognitionResult[j] = $root.google.cloud.vision.v1p4beta1.FaceRecognitionResult.toObject(message.recognitionResult[j], options); } - if (message.adult != null && message.hasOwnProperty("adult")) - object.adult = options.enums === String ? $root.google.cloud.vision.v1p4beta1.Likelihood[message.adult] : message.adult; - if (message.spoof != null && message.hasOwnProperty("spoof")) - object.spoof = options.enums === String ? $root.google.cloud.vision.v1p4beta1.Likelihood[message.spoof] : message.spoof; - if (message.medical != null && message.hasOwnProperty("medical")) - object.medical = options.enums === String ? $root.google.cloud.vision.v1p4beta1.Likelihood[message.medical] : message.medical; - if (message.violence != null && message.hasOwnProperty("violence")) - object.violence = options.enums === String ? $root.google.cloud.vision.v1p4beta1.Likelihood[message.violence] : message.violence; - if (message.racy != null && message.hasOwnProperty("racy")) - object.racy = options.enums === String ? $root.google.cloud.vision.v1p4beta1.Likelihood[message.racy] : message.racy; return object; }; /** - * Converts this SafeSearchAnnotation to JSON. + * Converts this FaceAnnotation to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation * @instance * @returns {Object.} JSON object */ - SafeSearchAnnotation.prototype.toJSON = function toJSON() { + FaceAnnotation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return SafeSearchAnnotation; - })(); + FaceAnnotation.Landmark = (function() { - v1p4beta1.LatLongRect = (function() { + /** + * Properties of a Landmark. + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation + * @interface ILandmark + * @property {google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.Type|null} [type] Landmark type + * @property {google.cloud.vision.v1p4beta1.IPosition|null} [position] Landmark position + */ - /** - * Properties of a LatLongRect. - * @memberof google.cloud.vision.v1p4beta1 - * @interface ILatLongRect - * @property {google.type.ILatLng|null} [minLatLng] LatLongRect minLatLng - * @property {google.type.ILatLng|null} [maxLatLng] LatLongRect maxLatLng - */ + /** + * Constructs a new Landmark. + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation + * @classdesc Represents a Landmark. + * @implements ILandmark + * @constructor + * @param {google.cloud.vision.v1p4beta1.FaceAnnotation.ILandmark=} [properties] Properties to set + */ + function Landmark(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]]; + } - /** - * Constructs a new LatLongRect. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a LatLongRect. - * @implements ILatLongRect - * @constructor - * @param {google.cloud.vision.v1p4beta1.ILatLongRect=} [properties] Properties to set - */ - function LatLongRect(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]]; - } + /** + * Landmark type. + * @member {google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.Type} type + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark + * @instance + */ + Landmark.prototype.type = 0; - /** - * LatLongRect minLatLng. - * @member {google.type.ILatLng|null|undefined} minLatLng - * @memberof google.cloud.vision.v1p4beta1.LatLongRect - * @instance - */ - LatLongRect.prototype.minLatLng = null; + /** + * Landmark position. + * @member {google.cloud.vision.v1p4beta1.IPosition|null|undefined} position + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark + * @instance + */ + Landmark.prototype.position = null; - /** - * LatLongRect maxLatLng. - * @member {google.type.ILatLng|null|undefined} maxLatLng - * @memberof google.cloud.vision.v1p4beta1.LatLongRect - * @instance - */ - LatLongRect.prototype.maxLatLng = null; + /** + * Creates a new Landmark instance using the specified properties. + * @function create + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark + * @static + * @param {google.cloud.vision.v1p4beta1.FaceAnnotation.ILandmark=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark} Landmark instance + */ + Landmark.create = function create(properties) { + return new Landmark(properties); + }; - /** - * Creates a new LatLongRect instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.LatLongRect - * @static - * @param {google.cloud.vision.v1p4beta1.ILatLongRect=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.LatLongRect} LatLongRect instance - */ - LatLongRect.create = function create(properties) { - return new LatLongRect(properties); - }; + /** + * Encodes the specified Landmark message. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.verify|verify} messages. + * @function encode + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark + * @static + * @param {google.cloud.vision.v1p4beta1.FaceAnnotation.ILandmark} message Landmark message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Landmark.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && message.hasOwnProperty("type")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.type); + if (message.position != null && message.hasOwnProperty("position")) + $root.google.cloud.vision.v1p4beta1.Position.encode(message.position, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Landmark message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark + * @static + * @param {google.cloud.vision.v1p4beta1.FaceAnnotation.ILandmark} message Landmark message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Landmark.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Landmark message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark} Landmark + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Landmark.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.vision.v1p4beta1.FaceAnnotation.Landmark(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + message.type = reader.int32(); + break; + case 4: + message.position = $root.google.cloud.vision.v1p4beta1.Position.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; - /** - * Encodes the specified LatLongRect message. Does not implicitly {@link google.cloud.vision.v1p4beta1.LatLongRect.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.LatLongRect - * @static - * @param {google.cloud.vision.v1p4beta1.ILatLongRect} message LatLongRect message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LatLongRect.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.minLatLng != null && message.hasOwnProperty("minLatLng")) - $root.google.type.LatLng.encode(message.minLatLng, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.maxLatLng != null && message.hasOwnProperty("maxLatLng")) - $root.google.type.LatLng.encode(message.maxLatLng, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; + /** + * Decodes a Landmark message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark} Landmark + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Landmark.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; - /** - * Encodes the specified LatLongRect message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.LatLongRect.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.LatLongRect - * @static - * @param {google.cloud.vision.v1p4beta1.ILatLongRect} message LatLongRect message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LatLongRect.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; + /** + * Verifies a Landmark message. + * @function verify + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Landmark.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + case 24: + case 25: + case 26: + case 27: + case 28: + case 29: + case 30: + case 31: + case 32: + case 33: + case 34: + break; + } + if (message.position != null && message.hasOwnProperty("position")) { + var error = $root.google.cloud.vision.v1p4beta1.Position.verify(message.position); + if (error) + return "position." + error; + } + return null; + }; - /** - * Decodes a LatLongRect message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.LatLongRect - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.LatLongRect} LatLongRect - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LatLongRect.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.vision.v1p4beta1.LatLongRect(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { + /** + * Creates a Landmark message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark} Landmark + */ + Landmark.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark) + return object; + var message = new $root.google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark(); + switch (object.type) { + case "UNKNOWN_LANDMARK": + case 0: + message.type = 0; + break; + case "LEFT_EYE": case 1: - message.minLatLng = $root.google.type.LatLng.decode(reader, reader.uint32()); + message.type = 1; break; + case "RIGHT_EYE": case 2: - message.maxLatLng = $root.google.type.LatLng.decode(reader, reader.uint32()); + message.type = 2; break; - default: - reader.skipType(tag & 7); + case "LEFT_OF_LEFT_EYEBROW": + case 3: + message.type = 3; + break; + case "RIGHT_OF_LEFT_EYEBROW": + case 4: + message.type = 4; + break; + case "LEFT_OF_RIGHT_EYEBROW": + case 5: + message.type = 5; + break; + case "RIGHT_OF_RIGHT_EYEBROW": + case 6: + message.type = 6; + break; + case "MIDPOINT_BETWEEN_EYES": + case 7: + message.type = 7; + break; + case "NOSE_TIP": + case 8: + message.type = 8; + break; + case "UPPER_LIP": + case 9: + message.type = 9; + break; + case "LOWER_LIP": + case 10: + message.type = 10; + break; + case "MOUTH_LEFT": + case 11: + message.type = 11; + break; + case "MOUTH_RIGHT": + case 12: + message.type = 12; + break; + case "MOUTH_CENTER": + case 13: + message.type = 13; + break; + case "NOSE_BOTTOM_RIGHT": + case 14: + message.type = 14; + break; + case "NOSE_BOTTOM_LEFT": + case 15: + message.type = 15; + break; + case "NOSE_BOTTOM_CENTER": + case 16: + message.type = 16; + break; + case "LEFT_EYE_TOP_BOUNDARY": + case 17: + message.type = 17; + break; + case "LEFT_EYE_RIGHT_CORNER": + case 18: + message.type = 18; + break; + case "LEFT_EYE_BOTTOM_BOUNDARY": + case 19: + message.type = 19; + break; + case "LEFT_EYE_LEFT_CORNER": + case 20: + message.type = 20; + break; + case "RIGHT_EYE_TOP_BOUNDARY": + case 21: + message.type = 21; + break; + case "RIGHT_EYE_RIGHT_CORNER": + case 22: + message.type = 22; + break; + case "RIGHT_EYE_BOTTOM_BOUNDARY": + case 23: + message.type = 23; + break; + case "RIGHT_EYE_LEFT_CORNER": + case 24: + message.type = 24; + break; + case "LEFT_EYEBROW_UPPER_MIDPOINT": + case 25: + message.type = 25; + break; + case "RIGHT_EYEBROW_UPPER_MIDPOINT": + case 26: + message.type = 26; + break; + case "LEFT_EAR_TRAGION": + case 27: + message.type = 27; + break; + case "RIGHT_EAR_TRAGION": + case 28: + message.type = 28; + break; + case "LEFT_EYE_PUPIL": + case 29: + message.type = 29; + break; + case "RIGHT_EYE_PUPIL": + case 30: + message.type = 30; + break; + case "FOREHEAD_GLABELLA": + case 31: + message.type = 31; + break; + case "CHIN_GNATHION": + case 32: + message.type = 32; + break; + case "CHIN_LEFT_GONION": + case 33: + message.type = 33; + break; + case "CHIN_RIGHT_GONION": + case 34: + message.type = 34; break; } - } - return message; - }; - - /** - * Decodes a LatLongRect message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.LatLongRect - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.LatLongRect} LatLongRect - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LatLongRect.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a LatLongRect message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.LatLongRect - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - LatLongRect.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.minLatLng != null && message.hasOwnProperty("minLatLng")) { - var error = $root.google.type.LatLng.verify(message.minLatLng); - if (error) - return "minLatLng." + error; - } - if (message.maxLatLng != null && message.hasOwnProperty("maxLatLng")) { - var error = $root.google.type.LatLng.verify(message.maxLatLng); - if (error) - return "maxLatLng." + error; - } - return null; - }; + if (object.position != null) { + if (typeof object.position !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.position: object expected"); + message.position = $root.google.cloud.vision.v1p4beta1.Position.fromObject(object.position); + } + return message; + }; - /** - * Creates a LatLongRect message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.LatLongRect - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.LatLongRect} LatLongRect - */ - LatLongRect.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.LatLongRect) + /** + * Creates a plain object from a Landmark message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark + * @static + * @param {google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark} message Landmark + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Landmark.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.type = options.enums === String ? "UNKNOWN_LANDMARK" : 0; + object.position = null; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.Type[message.type] : message.type; + if (message.position != null && message.hasOwnProperty("position")) + object.position = $root.google.cloud.vision.v1p4beta1.Position.toObject(message.position, options); return object; - var message = new $root.google.cloud.vision.v1p4beta1.LatLongRect(); - if (object.minLatLng != null) { - if (typeof object.minLatLng !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.LatLongRect.minLatLng: object expected"); - message.minLatLng = $root.google.type.LatLng.fromObject(object.minLatLng); - } - if (object.maxLatLng != null) { - if (typeof object.maxLatLng !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.LatLongRect.maxLatLng: object expected"); - message.maxLatLng = $root.google.type.LatLng.fromObject(object.maxLatLng); - } - return message; - }; + }; - /** - * Creates a plain object from a LatLongRect message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.LatLongRect - * @static - * @param {google.cloud.vision.v1p4beta1.LatLongRect} message LatLongRect - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - LatLongRect.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.minLatLng = null; - object.maxLatLng = null; - } - if (message.minLatLng != null && message.hasOwnProperty("minLatLng")) - object.minLatLng = $root.google.type.LatLng.toObject(message.minLatLng, options); - if (message.maxLatLng != null && message.hasOwnProperty("maxLatLng")) - object.maxLatLng = $root.google.type.LatLng.toObject(message.maxLatLng, options); - return object; - }; + /** + * Converts this Landmark to JSON. + * @function toJSON + * @memberof google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark + * @instance + * @returns {Object.} JSON object + */ + Landmark.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; - /** - * Converts this LatLongRect to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.LatLongRect - * @instance - * @returns {Object.} JSON object - */ - LatLongRect.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; + /** + * Type enum. + * @name google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark.Type + * @enum {string} + * @property {number} UNKNOWN_LANDMARK=0 UNKNOWN_LANDMARK value + * @property {number} LEFT_EYE=1 LEFT_EYE value + * @property {number} RIGHT_EYE=2 RIGHT_EYE value + * @property {number} LEFT_OF_LEFT_EYEBROW=3 LEFT_OF_LEFT_EYEBROW value + * @property {number} RIGHT_OF_LEFT_EYEBROW=4 RIGHT_OF_LEFT_EYEBROW value + * @property {number} LEFT_OF_RIGHT_EYEBROW=5 LEFT_OF_RIGHT_EYEBROW value + * @property {number} RIGHT_OF_RIGHT_EYEBROW=6 RIGHT_OF_RIGHT_EYEBROW value + * @property {number} MIDPOINT_BETWEEN_EYES=7 MIDPOINT_BETWEEN_EYES value + * @property {number} NOSE_TIP=8 NOSE_TIP value + * @property {number} UPPER_LIP=9 UPPER_LIP value + * @property {number} LOWER_LIP=10 LOWER_LIP value + * @property {number} MOUTH_LEFT=11 MOUTH_LEFT value + * @property {number} MOUTH_RIGHT=12 MOUTH_RIGHT value + * @property {number} MOUTH_CENTER=13 MOUTH_CENTER value + * @property {number} NOSE_BOTTOM_RIGHT=14 NOSE_BOTTOM_RIGHT value + * @property {number} NOSE_BOTTOM_LEFT=15 NOSE_BOTTOM_LEFT value + * @property {number} NOSE_BOTTOM_CENTER=16 NOSE_BOTTOM_CENTER value + * @property {number} LEFT_EYE_TOP_BOUNDARY=17 LEFT_EYE_TOP_BOUNDARY value + * @property {number} LEFT_EYE_RIGHT_CORNER=18 LEFT_EYE_RIGHT_CORNER value + * @property {number} LEFT_EYE_BOTTOM_BOUNDARY=19 LEFT_EYE_BOTTOM_BOUNDARY value + * @property {number} LEFT_EYE_LEFT_CORNER=20 LEFT_EYE_LEFT_CORNER value + * @property {number} RIGHT_EYE_TOP_BOUNDARY=21 RIGHT_EYE_TOP_BOUNDARY value + * @property {number} RIGHT_EYE_RIGHT_CORNER=22 RIGHT_EYE_RIGHT_CORNER value + * @property {number} RIGHT_EYE_BOTTOM_BOUNDARY=23 RIGHT_EYE_BOTTOM_BOUNDARY value + * @property {number} RIGHT_EYE_LEFT_CORNER=24 RIGHT_EYE_LEFT_CORNER value + * @property {number} LEFT_EYEBROW_UPPER_MIDPOINT=25 LEFT_EYEBROW_UPPER_MIDPOINT value + * @property {number} RIGHT_EYEBROW_UPPER_MIDPOINT=26 RIGHT_EYEBROW_UPPER_MIDPOINT value + * @property {number} LEFT_EAR_TRAGION=27 LEFT_EAR_TRAGION value + * @property {number} RIGHT_EAR_TRAGION=28 RIGHT_EAR_TRAGION value + * @property {number} LEFT_EYE_PUPIL=29 LEFT_EYE_PUPIL value + * @property {number} RIGHT_EYE_PUPIL=30 RIGHT_EYE_PUPIL value + * @property {number} FOREHEAD_GLABELLA=31 FOREHEAD_GLABELLA value + * @property {number} CHIN_GNATHION=32 CHIN_GNATHION value + * @property {number} CHIN_LEFT_GONION=33 CHIN_LEFT_GONION value + * @property {number} CHIN_RIGHT_GONION=34 CHIN_RIGHT_GONION value + */ + Landmark.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UNKNOWN_LANDMARK"] = 0; + values[valuesById[1] = "LEFT_EYE"] = 1; + values[valuesById[2] = "RIGHT_EYE"] = 2; + values[valuesById[3] = "LEFT_OF_LEFT_EYEBROW"] = 3; + values[valuesById[4] = "RIGHT_OF_LEFT_EYEBROW"] = 4; + values[valuesById[5] = "LEFT_OF_RIGHT_EYEBROW"] = 5; + values[valuesById[6] = "RIGHT_OF_RIGHT_EYEBROW"] = 6; + values[valuesById[7] = "MIDPOINT_BETWEEN_EYES"] = 7; + values[valuesById[8] = "NOSE_TIP"] = 8; + values[valuesById[9] = "UPPER_LIP"] = 9; + values[valuesById[10] = "LOWER_LIP"] = 10; + values[valuesById[11] = "MOUTH_LEFT"] = 11; + values[valuesById[12] = "MOUTH_RIGHT"] = 12; + values[valuesById[13] = "MOUTH_CENTER"] = 13; + values[valuesById[14] = "NOSE_BOTTOM_RIGHT"] = 14; + values[valuesById[15] = "NOSE_BOTTOM_LEFT"] = 15; + values[valuesById[16] = "NOSE_BOTTOM_CENTER"] = 16; + values[valuesById[17] = "LEFT_EYE_TOP_BOUNDARY"] = 17; + values[valuesById[18] = "LEFT_EYE_RIGHT_CORNER"] = 18; + values[valuesById[19] = "LEFT_EYE_BOTTOM_BOUNDARY"] = 19; + values[valuesById[20] = "LEFT_EYE_LEFT_CORNER"] = 20; + values[valuesById[21] = "RIGHT_EYE_TOP_BOUNDARY"] = 21; + values[valuesById[22] = "RIGHT_EYE_RIGHT_CORNER"] = 22; + values[valuesById[23] = "RIGHT_EYE_BOTTOM_BOUNDARY"] = 23; + values[valuesById[24] = "RIGHT_EYE_LEFT_CORNER"] = 24; + values[valuesById[25] = "LEFT_EYEBROW_UPPER_MIDPOINT"] = 25; + values[valuesById[26] = "RIGHT_EYEBROW_UPPER_MIDPOINT"] = 26; + values[valuesById[27] = "LEFT_EAR_TRAGION"] = 27; + values[valuesById[28] = "RIGHT_EAR_TRAGION"] = 28; + values[valuesById[29] = "LEFT_EYE_PUPIL"] = 29; + values[valuesById[30] = "RIGHT_EYE_PUPIL"] = 30; + values[valuesById[31] = "FOREHEAD_GLABELLA"] = 31; + values[valuesById[32] = "CHIN_GNATHION"] = 32; + values[valuesById[33] = "CHIN_LEFT_GONION"] = 33; + values[valuesById[34] = "CHIN_RIGHT_GONION"] = 34; + return values; + })(); - return LatLongRect; + return Landmark; + })(); + + return FaceAnnotation; })(); - v1p4beta1.ColorInfo = (function() { + v1p4beta1.LocationInfo = (function() { /** - * Properties of a ColorInfo. + * Properties of a LocationInfo. * @memberof google.cloud.vision.v1p4beta1 - * @interface IColorInfo - * @property {google.type.IColor|null} [color] ColorInfo color - * @property {number|null} [score] ColorInfo score - * @property {number|null} [pixelFraction] ColorInfo pixelFraction + * @interface ILocationInfo + * @property {google.type.ILatLng|null} [latLng] LocationInfo latLng */ /** - * Constructs a new ColorInfo. + * Constructs a new LocationInfo. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a ColorInfo. - * @implements IColorInfo + * @classdesc Represents a LocationInfo. + * @implements ILocationInfo * @constructor - * @param {google.cloud.vision.v1p4beta1.IColorInfo=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.ILocationInfo=} [properties] Properties to set */ - function ColorInfo(properties) { + function LocationInfo(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -77082,101 +76841,75 @@ } /** - * ColorInfo color. - * @member {google.type.IColor|null|undefined} color - * @memberof google.cloud.vision.v1p4beta1.ColorInfo - * @instance - */ - ColorInfo.prototype.color = null; - - /** - * ColorInfo score. - * @member {number} score - * @memberof google.cloud.vision.v1p4beta1.ColorInfo - * @instance - */ - ColorInfo.prototype.score = 0; - - /** - * ColorInfo pixelFraction. - * @member {number} pixelFraction - * @memberof google.cloud.vision.v1p4beta1.ColorInfo + * LocationInfo latLng. + * @member {google.type.ILatLng|null|undefined} latLng + * @memberof google.cloud.vision.v1p4beta1.LocationInfo * @instance */ - ColorInfo.prototype.pixelFraction = 0; + LocationInfo.prototype.latLng = null; /** - * Creates a new ColorInfo instance using the specified properties. + * Creates a new LocationInfo instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.ColorInfo + * @memberof google.cloud.vision.v1p4beta1.LocationInfo * @static - * @param {google.cloud.vision.v1p4beta1.IColorInfo=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.ColorInfo} ColorInfo instance + * @param {google.cloud.vision.v1p4beta1.ILocationInfo=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.LocationInfo} LocationInfo instance */ - ColorInfo.create = function create(properties) { - return new ColorInfo(properties); + LocationInfo.create = function create(properties) { + return new LocationInfo(properties); }; /** - * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ColorInfo.verify|verify} messages. + * Encodes the specified LocationInfo message. Does not implicitly {@link google.cloud.vision.v1p4beta1.LocationInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.ColorInfo + * @memberof google.cloud.vision.v1p4beta1.LocationInfo * @static - * @param {google.cloud.vision.v1p4beta1.IColorInfo} message ColorInfo message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.ILocationInfo} message LocationInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ColorInfo.encode = function encode(message, writer) { + LocationInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.color != null && message.hasOwnProperty("color")) - $root.google.type.Color.encode(message.color, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.score != null && message.hasOwnProperty("score")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); - if (message.pixelFraction != null && message.hasOwnProperty("pixelFraction")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.pixelFraction); + if (message.latLng != null && message.hasOwnProperty("latLng")) + $root.google.type.LatLng.encode(message.latLng, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ColorInfo.verify|verify} messages. + * Encodes the specified LocationInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.LocationInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ColorInfo + * @memberof google.cloud.vision.v1p4beta1.LocationInfo * @static - * @param {google.cloud.vision.v1p4beta1.IColorInfo} message ColorInfo message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.ILocationInfo} message LocationInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ColorInfo.encodeDelimited = function encodeDelimited(message, writer) { + LocationInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a ColorInfo message from the specified reader or buffer. + * Decodes a LocationInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.ColorInfo + * @memberof google.cloud.vision.v1p4beta1.LocationInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.ColorInfo} ColorInfo + * @returns {google.cloud.vision.v1p4beta1.LocationInfo} LocationInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ColorInfo.decode = function decode(reader, length) { + LocationInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.ColorInfo(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.LocationInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.color = $root.google.type.Color.decode(reader, reader.uint32()); - break; - case 2: - message.score = reader.float(); - break; - case 3: - message.pixelFraction = reader.float(); + message.latLng = $root.google.type.LatLng.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -77187,130 +76920,114 @@ }; /** - * Decodes a ColorInfo message from the specified reader or buffer, length delimited. + * Decodes a LocationInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ColorInfo + * @memberof google.cloud.vision.v1p4beta1.LocationInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.ColorInfo} ColorInfo + * @returns {google.cloud.vision.v1p4beta1.LocationInfo} LocationInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ColorInfo.decodeDelimited = function decodeDelimited(reader) { + LocationInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a ColorInfo message. + * Verifies a LocationInfo message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.ColorInfo + * @memberof google.cloud.vision.v1p4beta1.LocationInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ColorInfo.verify = function verify(message) { + LocationInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.color != null && message.hasOwnProperty("color")) { - var error = $root.google.type.Color.verify(message.color); + if (message.latLng != null && message.hasOwnProperty("latLng")) { + var error = $root.google.type.LatLng.verify(message.latLng); if (error) - return "color." + error; + return "latLng." + error; } - if (message.score != null && message.hasOwnProperty("score")) - if (typeof message.score !== "number") - return "score: number expected"; - if (message.pixelFraction != null && message.hasOwnProperty("pixelFraction")) - if (typeof message.pixelFraction !== "number") - return "pixelFraction: number expected"; return null; }; /** - * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. + * Creates a LocationInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.ColorInfo + * @memberof google.cloud.vision.v1p4beta1.LocationInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.ColorInfo} ColorInfo + * @returns {google.cloud.vision.v1p4beta1.LocationInfo} LocationInfo */ - ColorInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.ColorInfo) + LocationInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.LocationInfo) return object; - var message = new $root.google.cloud.vision.v1p4beta1.ColorInfo(); - if (object.color != null) { - if (typeof object.color !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.ColorInfo.color: object expected"); - message.color = $root.google.type.Color.fromObject(object.color); + var message = new $root.google.cloud.vision.v1p4beta1.LocationInfo(); + if (object.latLng != null) { + if (typeof object.latLng !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.LocationInfo.latLng: object expected"); + message.latLng = $root.google.type.LatLng.fromObject(object.latLng); } - if (object.score != null) - message.score = Number(object.score); - if (object.pixelFraction != null) - message.pixelFraction = Number(object.pixelFraction); return message; }; /** - * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. + * Creates a plain object from a LocationInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.ColorInfo + * @memberof google.cloud.vision.v1p4beta1.LocationInfo * @static - * @param {google.cloud.vision.v1p4beta1.ColorInfo} message ColorInfo + * @param {google.cloud.vision.v1p4beta1.LocationInfo} message LocationInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ColorInfo.toObject = function toObject(message, options) { + LocationInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.color = null; - object.score = 0; - object.pixelFraction = 0; - } - if (message.color != null && message.hasOwnProperty("color")) - object.color = $root.google.type.Color.toObject(message.color, options); - if (message.score != null && message.hasOwnProperty("score")) - object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; - if (message.pixelFraction != null && message.hasOwnProperty("pixelFraction")) - object.pixelFraction = options.json && !isFinite(message.pixelFraction) ? String(message.pixelFraction) : message.pixelFraction; + if (options.defaults) + object.latLng = null; + if (message.latLng != null && message.hasOwnProperty("latLng")) + object.latLng = $root.google.type.LatLng.toObject(message.latLng, options); return object; }; /** - * Converts this ColorInfo to JSON. + * Converts this LocationInfo to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.ColorInfo + * @memberof google.cloud.vision.v1p4beta1.LocationInfo * @instance * @returns {Object.} JSON object */ - ColorInfo.prototype.toJSON = function toJSON() { + LocationInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ColorInfo; + return LocationInfo; })(); - v1p4beta1.DominantColorsAnnotation = (function() { + v1p4beta1.Property = (function() { /** - * Properties of a DominantColorsAnnotation. + * Properties of a Property. * @memberof google.cloud.vision.v1p4beta1 - * @interface IDominantColorsAnnotation - * @property {Array.|null} [colors] DominantColorsAnnotation colors + * @interface IProperty + * @property {string|null} [name] Property name + * @property {string|null} [value] Property value + * @property {number|Long|null} [uint64Value] Property uint64Value */ /** - * Constructs a new DominantColorsAnnotation. + * Constructs a new Property. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a DominantColorsAnnotation. - * @implements IDominantColorsAnnotation + * @classdesc Represents a Property. + * @implements IProperty * @constructor - * @param {google.cloud.vision.v1p4beta1.IDominantColorsAnnotation=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IProperty=} [properties] Properties to set */ - function DominantColorsAnnotation(properties) { - this.colors = []; + function Property(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -77318,78 +77035,101 @@ } /** - * DominantColorsAnnotation colors. - * @member {Array.} colors - * @memberof google.cloud.vision.v1p4beta1.DominantColorsAnnotation + * Property name. + * @member {string} name + * @memberof google.cloud.vision.v1p4beta1.Property * @instance */ - DominantColorsAnnotation.prototype.colors = $util.emptyArray; + Property.prototype.name = ""; /** - * Creates a new DominantColorsAnnotation instance using the specified properties. + * Property value. + * @member {string} value + * @memberof google.cloud.vision.v1p4beta1.Property + * @instance + */ + Property.prototype.value = ""; + + /** + * Property uint64Value. + * @member {number|Long} uint64Value + * @memberof google.cloud.vision.v1p4beta1.Property + * @instance + */ + Property.prototype.uint64Value = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Creates a new Property instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p4beta1.Property * @static - * @param {google.cloud.vision.v1p4beta1.IDominantColorsAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.DominantColorsAnnotation} DominantColorsAnnotation instance + * @param {google.cloud.vision.v1p4beta1.IProperty=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.Property} Property instance */ - DominantColorsAnnotation.create = function create(properties) { - return new DominantColorsAnnotation(properties); + Property.create = function create(properties) { + return new Property(properties); }; /** - * Encodes the specified DominantColorsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.DominantColorsAnnotation.verify|verify} messages. + * Encodes the specified Property message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Property.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p4beta1.Property * @static - * @param {google.cloud.vision.v1p4beta1.IDominantColorsAnnotation} message DominantColorsAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IProperty} message Property message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DominantColorsAnnotation.encode = function encode(message, writer) { + Property.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.colors != null && message.colors.length) - for (var i = 0; i < message.colors.length; ++i) - $root.google.cloud.vision.v1p4beta1.ColorInfo.encode(message.colors[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.value != null && message.hasOwnProperty("value")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); + if (message.uint64Value != null && message.hasOwnProperty("uint64Value")) + writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.uint64Value); return writer; }; /** - * Encodes the specified DominantColorsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.DominantColorsAnnotation.verify|verify} messages. + * Encodes the specified Property message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Property.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p4beta1.Property * @static - * @param {google.cloud.vision.v1p4beta1.IDominantColorsAnnotation} message DominantColorsAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IProperty} message Property message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - DominantColorsAnnotation.encodeDelimited = function encodeDelimited(message, writer) { + Property.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a DominantColorsAnnotation message from the specified reader or buffer. + * Decodes a Property message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p4beta1.Property * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.DominantColorsAnnotation} DominantColorsAnnotation + * @returns {google.cloud.vision.v1p4beta1.Property} Property * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DominantColorsAnnotation.decode = function decode(reader, length) { + Property.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.DominantColorsAnnotation(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.Property(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.colors && message.colors.length)) - message.colors = []; - message.colors.push($root.google.cloud.vision.v1p4beta1.ColorInfo.decode(reader, reader.uint32())); + message.name = reader.string(); + break; + case 2: + message.value = reader.string(); + break; + case 3: + message.uint64Value = reader.uint64(); break; default: reader.skipType(tag & 7); @@ -77400,124 +77140,148 @@ }; /** - * Decodes a DominantColorsAnnotation message from the specified reader or buffer, length delimited. + * Decodes a Property message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p4beta1.Property * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.DominantColorsAnnotation} DominantColorsAnnotation + * @returns {google.cloud.vision.v1p4beta1.Property} Property * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - DominantColorsAnnotation.decodeDelimited = function decodeDelimited(reader) { + Property.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a DominantColorsAnnotation message. + * Verifies a Property message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p4beta1.Property * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - DominantColorsAnnotation.verify = function verify(message) { + Property.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.colors != null && message.hasOwnProperty("colors")) { - if (!Array.isArray(message.colors)) - return "colors: array expected"; - for (var i = 0; i < message.colors.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.ColorInfo.verify(message.colors[i]); - if (error) - return "colors." + error; - } - } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + if (message.uint64Value != null && message.hasOwnProperty("uint64Value")) + if (!$util.isInteger(message.uint64Value) && !(message.uint64Value && $util.isInteger(message.uint64Value.low) && $util.isInteger(message.uint64Value.high))) + return "uint64Value: integer|Long expected"; return null; }; /** - * Creates a DominantColorsAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates a Property message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p4beta1.Property * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.DominantColorsAnnotation} DominantColorsAnnotation + * @returns {google.cloud.vision.v1p4beta1.Property} Property */ - DominantColorsAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.DominantColorsAnnotation) + Property.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.Property) return object; - var message = new $root.google.cloud.vision.v1p4beta1.DominantColorsAnnotation(); - if (object.colors) { - if (!Array.isArray(object.colors)) - throw TypeError(".google.cloud.vision.v1p4beta1.DominantColorsAnnotation.colors: array expected"); - message.colors = []; - for (var i = 0; i < object.colors.length; ++i) { - if (typeof object.colors[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.DominantColorsAnnotation.colors: object expected"); - message.colors[i] = $root.google.cloud.vision.v1p4beta1.ColorInfo.fromObject(object.colors[i]); - } - } + var message = new $root.google.cloud.vision.v1p4beta1.Property(); + if (object.name != null) + message.name = String(object.name); + if (object.value != null) + message.value = String(object.value); + if (object.uint64Value != null) + if ($util.Long) + (message.uint64Value = $util.Long.fromValue(object.uint64Value)).unsigned = true; + else if (typeof object.uint64Value === "string") + message.uint64Value = parseInt(object.uint64Value, 10); + else if (typeof object.uint64Value === "number") + message.uint64Value = object.uint64Value; + else if (typeof object.uint64Value === "object") + message.uint64Value = new $util.LongBits(object.uint64Value.low >>> 0, object.uint64Value.high >>> 0).toNumber(true); return message; }; /** - * Creates a plain object from a DominantColorsAnnotation message. Also converts values to other types if specified. + * Creates a plain object from a Property message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p4beta1.Property * @static - * @param {google.cloud.vision.v1p4beta1.DominantColorsAnnotation} message DominantColorsAnnotation + * @param {google.cloud.vision.v1p4beta1.Property} message Property * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - DominantColorsAnnotation.toObject = function toObject(message, options) { + Property.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.colors = []; - if (message.colors && message.colors.length) { - object.colors = []; - for (var j = 0; j < message.colors.length; ++j) - object.colors[j] = $root.google.cloud.vision.v1p4beta1.ColorInfo.toObject(message.colors[j], options); + if (options.defaults) { + object.name = ""; + object.value = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.uint64Value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.uint64Value = options.longs === String ? "0" : 0; } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.uint64Value != null && message.hasOwnProperty("uint64Value")) + if (typeof message.uint64Value === "number") + object.uint64Value = options.longs === String ? String(message.uint64Value) : message.uint64Value; + else + object.uint64Value = options.longs === String ? $util.Long.prototype.toString.call(message.uint64Value) : options.longs === Number ? new $util.LongBits(message.uint64Value.low >>> 0, message.uint64Value.high >>> 0).toNumber(true) : message.uint64Value; return object; }; /** - * Converts this DominantColorsAnnotation to JSON. + * Converts this Property to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.DominantColorsAnnotation + * @memberof google.cloud.vision.v1p4beta1.Property * @instance * @returns {Object.} JSON object */ - DominantColorsAnnotation.prototype.toJSON = function toJSON() { + Property.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return DominantColorsAnnotation; + return Property; })(); - v1p4beta1.ImageProperties = (function() { + v1p4beta1.EntityAnnotation = (function() { /** - * Properties of an ImageProperties. + * Properties of an EntityAnnotation. * @memberof google.cloud.vision.v1p4beta1 - * @interface IImageProperties - * @property {google.cloud.vision.v1p4beta1.IDominantColorsAnnotation|null} [dominantColors] ImageProperties dominantColors + * @interface IEntityAnnotation + * @property {string|null} [mid] EntityAnnotation mid + * @property {string|null} [locale] EntityAnnotation locale + * @property {string|null} [description] EntityAnnotation description + * @property {number|null} [score] EntityAnnotation score + * @property {number|null} [confidence] EntityAnnotation confidence + * @property {number|null} [topicality] EntityAnnotation topicality + * @property {google.cloud.vision.v1p4beta1.IBoundingPoly|null} [boundingPoly] EntityAnnotation boundingPoly + * @property {Array.|null} [locations] EntityAnnotation locations + * @property {Array.|null} [properties] EntityAnnotation properties */ /** - * Constructs a new ImageProperties. + * Constructs a new EntityAnnotation. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an ImageProperties. - * @implements IImageProperties + * @classdesc Represents an EntityAnnotation. + * @implements IEntityAnnotation * @constructor - * @param {google.cloud.vision.v1p4beta1.IImageProperties=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IEntityAnnotation=} [properties] Properties to set */ - function ImageProperties(properties) { + function EntityAnnotation(properties) { + this.locations = []; + this.properties = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -77525,75 +77289,185 @@ } /** - * ImageProperties dominantColors. - * @member {google.cloud.vision.v1p4beta1.IDominantColorsAnnotation|null|undefined} dominantColors - * @memberof google.cloud.vision.v1p4beta1.ImageProperties + * EntityAnnotation mid. + * @member {string} mid + * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation * @instance */ - ImageProperties.prototype.dominantColors = null; + EntityAnnotation.prototype.mid = ""; /** - * Creates a new ImageProperties instance using the specified properties. + * EntityAnnotation locale. + * @member {string} locale + * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.locale = ""; + + /** + * EntityAnnotation description. + * @member {string} description + * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.description = ""; + + /** + * EntityAnnotation score. + * @member {number} score + * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.score = 0; + + /** + * EntityAnnotation confidence. + * @member {number} confidence + * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.confidence = 0; + + /** + * EntityAnnotation topicality. + * @member {number} topicality + * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.topicality = 0; + + /** + * EntityAnnotation boundingPoly. + * @member {google.cloud.vision.v1p4beta1.IBoundingPoly|null|undefined} boundingPoly + * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.boundingPoly = null; + + /** + * EntityAnnotation locations. + * @member {Array.} locations + * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.locations = $util.emptyArray; + + /** + * EntityAnnotation properties. + * @member {Array.} properties + * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation + * @instance + */ + EntityAnnotation.prototype.properties = $util.emptyArray; + + /** + * Creates a new EntityAnnotation instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.ImageProperties + * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation * @static - * @param {google.cloud.vision.v1p4beta1.IImageProperties=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.ImageProperties} ImageProperties instance + * @param {google.cloud.vision.v1p4beta1.IEntityAnnotation=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.EntityAnnotation} EntityAnnotation instance */ - ImageProperties.create = function create(properties) { - return new ImageProperties(properties); + EntityAnnotation.create = function create(properties) { + return new EntityAnnotation(properties); }; /** - * Encodes the specified ImageProperties message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageProperties.verify|verify} messages. + * Encodes the specified EntityAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.EntityAnnotation.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.ImageProperties + * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation * @static - * @param {google.cloud.vision.v1p4beta1.IImageProperties} message ImageProperties message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IEntityAnnotation} message EntityAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageProperties.encode = function encode(message, writer) { + EntityAnnotation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.dominantColors != null && message.hasOwnProperty("dominantColors")) - $root.google.cloud.vision.v1p4beta1.DominantColorsAnnotation.encode(message.dominantColors, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.mid != null && message.hasOwnProperty("mid")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.mid); + if (message.locale != null && message.hasOwnProperty("locale")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.locale); + if (message.description != null && message.hasOwnProperty("description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + if (message.score != null && message.hasOwnProperty("score")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.score); + if (message.confidence != null && message.hasOwnProperty("confidence")) + writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidence); + if (message.topicality != null && message.hasOwnProperty("topicality")) + writer.uint32(/* id 6, wireType 5 =*/53).float(message.topicality); + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + $root.google.cloud.vision.v1p4beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.locations != null && message.locations.length) + for (var i = 0; i < message.locations.length; ++i) + $root.google.cloud.vision.v1p4beta1.LocationInfo.encode(message.locations[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.properties != null && message.properties.length) + for (var i = 0; i < message.properties.length; ++i) + $root.google.cloud.vision.v1p4beta1.Property.encode(message.properties[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); return writer; }; /** - * Encodes the specified ImageProperties message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageProperties.verify|verify} messages. + * Encodes the specified EntityAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.EntityAnnotation.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ImageProperties + * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation * @static - * @param {google.cloud.vision.v1p4beta1.IImageProperties} message ImageProperties message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IEntityAnnotation} message EntityAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageProperties.encodeDelimited = function encodeDelimited(message, writer) { + EntityAnnotation.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImageProperties message from the specified reader or buffer. + * Decodes an EntityAnnotation message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.ImageProperties + * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.ImageProperties} ImageProperties + * @returns {google.cloud.vision.v1p4beta1.EntityAnnotation} EntityAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageProperties.decode = function decode(reader, length) { + EntityAnnotation.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.vision.v1p4beta1.ImageProperties(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.EntityAnnotation(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.dominantColors = $root.google.cloud.vision.v1p4beta1.DominantColorsAnnotation.decode(reader, reader.uint32()); + message.mid = reader.string(); + break; + case 2: + message.locale = reader.string(); + break; + case 3: + message.description = reader.string(); + break; + case 4: + message.score = reader.float(); + break; + case 5: + message.confidence = reader.float(); + break; + case 6: + message.topicality = reader.float(); + break; + case 7: + message.boundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.decode(reader, reader.uint32()); + break; + case 8: + if (!(message.locations && message.locations.length)) + message.locations = []; + message.locations.push($root.google.cloud.vision.v1p4beta1.LocationInfo.decode(reader, reader.uint32())); + break; + case 9: + if (!(message.properties && message.properties.length)) + message.properties = []; + message.properties.push($root.google.cloud.vision.v1p4beta1.Property.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -77604,114 +77478,217 @@ }; /** - * Decodes an ImageProperties message from the specified reader or buffer, length delimited. + * Decodes an EntityAnnotation message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ImageProperties + * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.ImageProperties} ImageProperties + * @returns {google.cloud.vision.v1p4beta1.EntityAnnotation} EntityAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageProperties.decodeDelimited = function decodeDelimited(reader) { + EntityAnnotation.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImageProperties message. + * Verifies an EntityAnnotation message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.ImageProperties + * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImageProperties.verify = function verify(message) { + EntityAnnotation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.dominantColors != null && message.hasOwnProperty("dominantColors")) { - var error = $root.google.cloud.vision.v1p4beta1.DominantColorsAnnotation.verify(message.dominantColors); + if (message.mid != null && message.hasOwnProperty("mid")) + if (!$util.isString(message.mid)) + return "mid: string expected"; + if (message.locale != null && message.hasOwnProperty("locale")) + if (!$util.isString(message.locale)) + return "locale: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.score != null && message.hasOwnProperty("score")) + if (typeof message.score !== "number") + return "score: number expected"; + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + if (message.topicality != null && message.hasOwnProperty("topicality")) + if (typeof message.topicality !== "number") + return "topicality: number expected"; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { + var error = $root.google.cloud.vision.v1p4beta1.BoundingPoly.verify(message.boundingPoly); if (error) - return "dominantColors." + error; + return "boundingPoly." + error; + } + if (message.locations != null && message.hasOwnProperty("locations")) { + if (!Array.isArray(message.locations)) + return "locations: array expected"; + for (var i = 0; i < message.locations.length; ++i) { + var error = $root.google.cloud.vision.v1p4beta1.LocationInfo.verify(message.locations[i]); + if (error) + return "locations." + error; + } + } + if (message.properties != null && message.hasOwnProperty("properties")) { + if (!Array.isArray(message.properties)) + return "properties: array expected"; + for (var i = 0; i < message.properties.length; ++i) { + var error = $root.google.cloud.vision.v1p4beta1.Property.verify(message.properties[i]); + if (error) + return "properties." + error; + } } return null; }; /** - * Creates an ImageProperties message from a plain object. Also converts values to their respective internal types. + * Creates an EntityAnnotation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.ImageProperties + * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.ImageProperties} ImageProperties + * @returns {google.cloud.vision.v1p4beta1.EntityAnnotation} EntityAnnotation */ - ImageProperties.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.ImageProperties) + EntityAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.EntityAnnotation) return object; - var message = new $root.google.cloud.vision.v1p4beta1.ImageProperties(); - if (object.dominantColors != null) { - if (typeof object.dominantColors !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.ImageProperties.dominantColors: object expected"); - message.dominantColors = $root.google.cloud.vision.v1p4beta1.DominantColorsAnnotation.fromObject(object.dominantColors); + var message = new $root.google.cloud.vision.v1p4beta1.EntityAnnotation(); + if (object.mid != null) + message.mid = String(object.mid); + if (object.locale != null) + message.locale = String(object.locale); + if (object.description != null) + message.description = String(object.description); + if (object.score != null) + message.score = Number(object.score); + if (object.confidence != null) + message.confidence = Number(object.confidence); + if (object.topicality != null) + message.topicality = Number(object.topicality); + if (object.boundingPoly != null) { + if (typeof object.boundingPoly !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.EntityAnnotation.boundingPoly: object expected"); + message.boundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.fromObject(object.boundingPoly); + } + if (object.locations) { + if (!Array.isArray(object.locations)) + throw TypeError(".google.cloud.vision.v1p4beta1.EntityAnnotation.locations: array expected"); + message.locations = []; + for (var i = 0; i < object.locations.length; ++i) { + if (typeof object.locations[i] !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.EntityAnnotation.locations: object expected"); + message.locations[i] = $root.google.cloud.vision.v1p4beta1.LocationInfo.fromObject(object.locations[i]); + } + } + if (object.properties) { + if (!Array.isArray(object.properties)) + throw TypeError(".google.cloud.vision.v1p4beta1.EntityAnnotation.properties: array expected"); + message.properties = []; + for (var i = 0; i < object.properties.length; ++i) { + if (typeof object.properties[i] !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.EntityAnnotation.properties: object expected"); + message.properties[i] = $root.google.cloud.vision.v1p4beta1.Property.fromObject(object.properties[i]); + } } return message; }; /** - * Creates a plain object from an ImageProperties message. Also converts values to other types if specified. + * Creates a plain object from an EntityAnnotation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.ImageProperties + * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation * @static - * @param {google.cloud.vision.v1p4beta1.ImageProperties} message ImageProperties + * @param {google.cloud.vision.v1p4beta1.EntityAnnotation} message EntityAnnotation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImageProperties.toObject = function toObject(message, options) { + EntityAnnotation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.dominantColors = null; - if (message.dominantColors != null && message.hasOwnProperty("dominantColors")) - object.dominantColors = $root.google.cloud.vision.v1p4beta1.DominantColorsAnnotation.toObject(message.dominantColors, options); + if (options.arrays || options.defaults) { + object.locations = []; + object.properties = []; + } + if (options.defaults) { + object.mid = ""; + object.locale = ""; + object.description = ""; + object.score = 0; + object.confidence = 0; + object.topicality = 0; + object.boundingPoly = null; + } + if (message.mid != null && message.hasOwnProperty("mid")) + object.mid = message.mid; + if (message.locale != null && message.hasOwnProperty("locale")) + object.locale = message.locale; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.score != null && message.hasOwnProperty("score")) + object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + if (message.topicality != null && message.hasOwnProperty("topicality")) + object.topicality = options.json && !isFinite(message.topicality) ? String(message.topicality) : message.topicality; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + object.boundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.toObject(message.boundingPoly, options); + if (message.locations && message.locations.length) { + object.locations = []; + for (var j = 0; j < message.locations.length; ++j) + object.locations[j] = $root.google.cloud.vision.v1p4beta1.LocationInfo.toObject(message.locations[j], options); + } + if (message.properties && message.properties.length) { + object.properties = []; + for (var j = 0; j < message.properties.length; ++j) + object.properties[j] = $root.google.cloud.vision.v1p4beta1.Property.toObject(message.properties[j], options); + } return object; }; /** - * Converts this ImageProperties to JSON. + * Converts this EntityAnnotation to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.ImageProperties + * @memberof google.cloud.vision.v1p4beta1.EntityAnnotation * @instance * @returns {Object.} JSON object */ - ImageProperties.prototype.toJSON = function toJSON() { + EntityAnnotation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImageProperties; + return EntityAnnotation; })(); - v1p4beta1.CropHint = (function() { + v1p4beta1.LocalizedObjectAnnotation = (function() { /** - * Properties of a CropHint. + * Properties of a LocalizedObjectAnnotation. * @memberof google.cloud.vision.v1p4beta1 - * @interface ICropHint - * @property {google.cloud.vision.v1p4beta1.IBoundingPoly|null} [boundingPoly] CropHint boundingPoly - * @property {number|null} [confidence] CropHint confidence - * @property {number|null} [importanceFraction] CropHint importanceFraction + * @interface ILocalizedObjectAnnotation + * @property {string|null} [mid] LocalizedObjectAnnotation mid + * @property {string|null} [languageCode] LocalizedObjectAnnotation languageCode + * @property {string|null} [name] LocalizedObjectAnnotation name + * @property {number|null} [score] LocalizedObjectAnnotation score + * @property {google.cloud.vision.v1p4beta1.IBoundingPoly|null} [boundingPoly] LocalizedObjectAnnotation boundingPoly */ /** - * Constructs a new CropHint. + * Constructs a new LocalizedObjectAnnotation. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a CropHint. - * @implements ICropHint + * @classdesc Represents a LocalizedObjectAnnotation. + * @implements ILocalizedObjectAnnotation * @constructor - * @param {google.cloud.vision.v1p4beta1.ICropHint=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.ILocalizedObjectAnnotation=} [properties] Properties to set */ - function CropHint(properties) { + function LocalizedObjectAnnotation(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -77719,101 +77696,127 @@ } /** - * CropHint boundingPoly. - * @member {google.cloud.vision.v1p4beta1.IBoundingPoly|null|undefined} boundingPoly - * @memberof google.cloud.vision.v1p4beta1.CropHint + * LocalizedObjectAnnotation mid. + * @member {string} mid + * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation * @instance */ - CropHint.prototype.boundingPoly = null; + LocalizedObjectAnnotation.prototype.mid = ""; /** - * CropHint confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p4beta1.CropHint + * LocalizedObjectAnnotation languageCode. + * @member {string} languageCode + * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation * @instance */ - CropHint.prototype.confidence = 0; + LocalizedObjectAnnotation.prototype.languageCode = ""; /** - * CropHint importanceFraction. - * @member {number} importanceFraction - * @memberof google.cloud.vision.v1p4beta1.CropHint + * LocalizedObjectAnnotation name. + * @member {string} name + * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation * @instance */ - CropHint.prototype.importanceFraction = 0; + LocalizedObjectAnnotation.prototype.name = ""; /** - * Creates a new CropHint instance using the specified properties. + * LocalizedObjectAnnotation score. + * @member {number} score + * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation + * @instance + */ + LocalizedObjectAnnotation.prototype.score = 0; + + /** + * LocalizedObjectAnnotation boundingPoly. + * @member {google.cloud.vision.v1p4beta1.IBoundingPoly|null|undefined} boundingPoly + * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation + * @instance + */ + LocalizedObjectAnnotation.prototype.boundingPoly = null; + + /** + * Creates a new LocalizedObjectAnnotation instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.CropHint + * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation * @static - * @param {google.cloud.vision.v1p4beta1.ICropHint=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.CropHint} CropHint instance + * @param {google.cloud.vision.v1p4beta1.ILocalizedObjectAnnotation=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation} LocalizedObjectAnnotation instance */ - CropHint.create = function create(properties) { - return new CropHint(properties); + LocalizedObjectAnnotation.create = function create(properties) { + return new LocalizedObjectAnnotation(properties); }; /** - * Encodes the specified CropHint message. Does not implicitly {@link google.cloud.vision.v1p4beta1.CropHint.verify|verify} messages. + * Encodes the specified LocalizedObjectAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.CropHint + * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation * @static - * @param {google.cloud.vision.v1p4beta1.ICropHint} message CropHint message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.ILocalizedObjectAnnotation} message LocalizedObjectAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CropHint.encode = function encode(message, writer) { + LocalizedObjectAnnotation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); + if (message.mid != null && message.hasOwnProperty("mid")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.mid); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); + if (message.name != null && message.hasOwnProperty("name")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); + if (message.score != null && message.hasOwnProperty("score")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.score); if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) - $root.google.cloud.vision.v1p4beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.confidence != null && message.hasOwnProperty("confidence")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); - if (message.importanceFraction != null && message.hasOwnProperty("importanceFraction")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.importanceFraction); + $root.google.cloud.vision.v1p4beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; /** - * Encodes the specified CropHint message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.CropHint.verify|verify} messages. + * Encodes the specified LocalizedObjectAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.CropHint + * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation * @static - * @param {google.cloud.vision.v1p4beta1.ICropHint} message CropHint message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.ILocalizedObjectAnnotation} message LocalizedObjectAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CropHint.encodeDelimited = function encodeDelimited(message, writer) { + LocalizedObjectAnnotation.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CropHint message from the specified reader or buffer. + * Decodes a LocalizedObjectAnnotation message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.CropHint + * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.CropHint} CropHint + * @returns {google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation} LocalizedObjectAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CropHint.decode = function decode(reader, length) { + LocalizedObjectAnnotation.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.vision.v1p4beta1.CropHint(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.boundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.decode(reader, reader.uint32()); + message.mid = reader.string(); break; case 2: - message.confidence = reader.float(); + message.languageCode = reader.string(); break; case 3: - message.importanceFraction = reader.float(); + message.name = reader.string(); + break; + case 4: + message.score = reader.float(); + break; + case 5: + message.boundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -77824,130 +77827,149 @@ }; /** - * Decodes a CropHint message from the specified reader or buffer, length delimited. + * Decodes a LocalizedObjectAnnotation message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.CropHint + * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.CropHint} CropHint + * @returns {google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation} LocalizedObjectAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CropHint.decodeDelimited = function decodeDelimited(reader) { + LocalizedObjectAnnotation.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CropHint message. + * Verifies a LocalizedObjectAnnotation message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.CropHint + * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CropHint.verify = function verify(message) { + LocalizedObjectAnnotation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + if (message.mid != null && message.hasOwnProperty("mid")) + if (!$util.isString(message.mid)) + return "mid: string expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.score != null && message.hasOwnProperty("score")) + if (typeof message.score !== "number") + return "score: number expected"; if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { var error = $root.google.cloud.vision.v1p4beta1.BoundingPoly.verify(message.boundingPoly); if (error) return "boundingPoly." + error; } - if (message.confidence != null && message.hasOwnProperty("confidence")) - if (typeof message.confidence !== "number") - return "confidence: number expected"; - if (message.importanceFraction != null && message.hasOwnProperty("importanceFraction")) - if (typeof message.importanceFraction !== "number") - return "importanceFraction: number expected"; return null; }; /** - * Creates a CropHint message from a plain object. Also converts values to their respective internal types. + * Creates a LocalizedObjectAnnotation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.CropHint + * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.CropHint} CropHint + * @returns {google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation} LocalizedObjectAnnotation */ - CropHint.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.CropHint) + LocalizedObjectAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation) return object; - var message = new $root.google.cloud.vision.v1p4beta1.CropHint(); + var message = new $root.google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation(); + if (object.mid != null) + message.mid = String(object.mid); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.name != null) + message.name = String(object.name); + if (object.score != null) + message.score = Number(object.score); if (object.boundingPoly != null) { if (typeof object.boundingPoly !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.CropHint.boundingPoly: object expected"); + throw TypeError(".google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation.boundingPoly: object expected"); message.boundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.fromObject(object.boundingPoly); } - if (object.confidence != null) - message.confidence = Number(object.confidence); - if (object.importanceFraction != null) - message.importanceFraction = Number(object.importanceFraction); return message; }; /** - * Creates a plain object from a CropHint message. Also converts values to other types if specified. + * Creates a plain object from a LocalizedObjectAnnotation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.CropHint + * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation * @static - * @param {google.cloud.vision.v1p4beta1.CropHint} message CropHint + * @param {google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation} message LocalizedObjectAnnotation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CropHint.toObject = function toObject(message, options) { + LocalizedObjectAnnotation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { + object.mid = ""; + object.languageCode = ""; + object.name = ""; + object.score = 0; object.boundingPoly = null; - object.confidence = 0; - object.importanceFraction = 0; } + if (message.mid != null && message.hasOwnProperty("mid")) + object.mid = message.mid; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.score != null && message.hasOwnProperty("score")) + object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) object.boundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.toObject(message.boundingPoly, options); - if (message.confidence != null && message.hasOwnProperty("confidence")) - object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; - if (message.importanceFraction != null && message.hasOwnProperty("importanceFraction")) - object.importanceFraction = options.json && !isFinite(message.importanceFraction) ? String(message.importanceFraction) : message.importanceFraction; return object; }; /** - * Converts this CropHint to JSON. + * Converts this LocalizedObjectAnnotation to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.CropHint + * @memberof google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation * @instance * @returns {Object.} JSON object */ - CropHint.prototype.toJSON = function toJSON() { + LocalizedObjectAnnotation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CropHint; + return LocalizedObjectAnnotation; })(); - v1p4beta1.CropHintsAnnotation = (function() { + v1p4beta1.SafeSearchAnnotation = (function() { /** - * Properties of a CropHintsAnnotation. + * Properties of a SafeSearchAnnotation. * @memberof google.cloud.vision.v1p4beta1 - * @interface ICropHintsAnnotation - * @property {Array.|null} [cropHints] CropHintsAnnotation cropHints + * @interface ISafeSearchAnnotation + * @property {google.cloud.vision.v1p4beta1.Likelihood|null} [adult] SafeSearchAnnotation adult + * @property {google.cloud.vision.v1p4beta1.Likelihood|null} [spoof] SafeSearchAnnotation spoof + * @property {google.cloud.vision.v1p4beta1.Likelihood|null} [medical] SafeSearchAnnotation medical + * @property {google.cloud.vision.v1p4beta1.Likelihood|null} [violence] SafeSearchAnnotation violence + * @property {google.cloud.vision.v1p4beta1.Likelihood|null} [racy] SafeSearchAnnotation racy */ /** - * Constructs a new CropHintsAnnotation. + * Constructs a new SafeSearchAnnotation. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a CropHintsAnnotation. - * @implements ICropHintsAnnotation + * @classdesc Represents a SafeSearchAnnotation. + * @implements ISafeSearchAnnotation * @constructor - * @param {google.cloud.vision.v1p4beta1.ICropHintsAnnotation=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.ISafeSearchAnnotation=} [properties] Properties to set */ - function CropHintsAnnotation(properties) { - this.cropHints = []; + function SafeSearchAnnotation(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -77955,78 +77977,127 @@ } /** - * CropHintsAnnotation cropHints. - * @member {Array.} cropHints - * @memberof google.cloud.vision.v1p4beta1.CropHintsAnnotation + * SafeSearchAnnotation adult. + * @member {google.cloud.vision.v1p4beta1.Likelihood} adult + * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation * @instance */ - CropHintsAnnotation.prototype.cropHints = $util.emptyArray; + SafeSearchAnnotation.prototype.adult = 0; /** - * Creates a new CropHintsAnnotation instance using the specified properties. + * SafeSearchAnnotation spoof. + * @member {google.cloud.vision.v1p4beta1.Likelihood} spoof + * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation + * @instance + */ + SafeSearchAnnotation.prototype.spoof = 0; + + /** + * SafeSearchAnnotation medical. + * @member {google.cloud.vision.v1p4beta1.Likelihood} medical + * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation + * @instance + */ + SafeSearchAnnotation.prototype.medical = 0; + + /** + * SafeSearchAnnotation violence. + * @member {google.cloud.vision.v1p4beta1.Likelihood} violence + * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation + * @instance + */ + SafeSearchAnnotation.prototype.violence = 0; + + /** + * SafeSearchAnnotation racy. + * @member {google.cloud.vision.v1p4beta1.Likelihood} racy + * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation + * @instance + */ + SafeSearchAnnotation.prototype.racy = 0; + + /** + * Creates a new SafeSearchAnnotation instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation * @static - * @param {google.cloud.vision.v1p4beta1.ICropHintsAnnotation=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.CropHintsAnnotation} CropHintsAnnotation instance + * @param {google.cloud.vision.v1p4beta1.ISafeSearchAnnotation=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.SafeSearchAnnotation} SafeSearchAnnotation instance */ - CropHintsAnnotation.create = function create(properties) { - return new CropHintsAnnotation(properties); + SafeSearchAnnotation.create = function create(properties) { + return new SafeSearchAnnotation(properties); }; /** - * Encodes the specified CropHintsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.CropHintsAnnotation.verify|verify} messages. + * Encodes the specified SafeSearchAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.SafeSearchAnnotation.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation * @static - * @param {google.cloud.vision.v1p4beta1.ICropHintsAnnotation} message CropHintsAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.ISafeSearchAnnotation} message SafeSearchAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CropHintsAnnotation.encode = function encode(message, writer) { + SafeSearchAnnotation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.cropHints != null && message.cropHints.length) - for (var i = 0; i < message.cropHints.length; ++i) - $root.google.cloud.vision.v1p4beta1.CropHint.encode(message.cropHints[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.adult != null && message.hasOwnProperty("adult")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.adult); + if (message.spoof != null && message.hasOwnProperty("spoof")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.spoof); + if (message.medical != null && message.hasOwnProperty("medical")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.medical); + if (message.violence != null && message.hasOwnProperty("violence")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.violence); + if (message.racy != null && message.hasOwnProperty("racy")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.racy); return writer; }; /** - * Encodes the specified CropHintsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.CropHintsAnnotation.verify|verify} messages. + * Encodes the specified SafeSearchAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.SafeSearchAnnotation.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation * @static - * @param {google.cloud.vision.v1p4beta1.ICropHintsAnnotation} message CropHintsAnnotation message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.ISafeSearchAnnotation} message SafeSearchAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CropHintsAnnotation.encodeDelimited = function encodeDelimited(message, writer) { + SafeSearchAnnotation.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CropHintsAnnotation message from the specified reader or buffer. + * Decodes a SafeSearchAnnotation message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.CropHintsAnnotation} CropHintsAnnotation + * @returns {google.cloud.vision.v1p4beta1.SafeSearchAnnotation} SafeSearchAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CropHintsAnnotation.decode = function decode(reader, length) { + SafeSearchAnnotation.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.vision.v1p4beta1.CropHintsAnnotation(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.SafeSearchAnnotation(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.cropHints && message.cropHints.length)) - message.cropHints = []; - message.cropHints.push($root.google.cloud.vision.v1p4beta1.CropHint.decode(reader, reader.uint32())); + message.adult = reader.int32(); + break; + case 2: + message.spoof = reader.int32(); + break; + case 3: + message.medical = reader.int32(); + break; + case 4: + message.violence = reader.int32(); + break; + case 9: + message.racy = reader.int32(); break; default: reader.skipType(tag & 7); @@ -78037,125 +78108,306 @@ }; /** - * Decodes a CropHintsAnnotation message from the specified reader or buffer, length delimited. + * Decodes a SafeSearchAnnotation message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.CropHintsAnnotation} CropHintsAnnotation + * @returns {google.cloud.vision.v1p4beta1.SafeSearchAnnotation} SafeSearchAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CropHintsAnnotation.decodeDelimited = function decodeDelimited(reader) { + SafeSearchAnnotation.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CropHintsAnnotation message. + * Verifies a SafeSearchAnnotation message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CropHintsAnnotation.verify = function verify(message) { + SafeSearchAnnotation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.cropHints != null && message.hasOwnProperty("cropHints")) { - if (!Array.isArray(message.cropHints)) - return "cropHints: array expected"; - for (var i = 0; i < message.cropHints.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.CropHint.verify(message.cropHints[i]); - if (error) - return "cropHints." + error; + if (message.adult != null && message.hasOwnProperty("adult")) + switch (message.adult) { + default: + return "adult: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.spoof != null && message.hasOwnProperty("spoof")) + switch (message.spoof) { + default: + return "spoof: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.medical != null && message.hasOwnProperty("medical")) + switch (message.medical) { + default: + return "medical: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.violence != null && message.hasOwnProperty("violence")) + switch (message.violence) { + default: + return "violence: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.racy != null && message.hasOwnProperty("racy")) + switch (message.racy) { + default: + return "racy: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; } - } return null; }; /** - * Creates a CropHintsAnnotation message from a plain object. Also converts values to their respective internal types. + * Creates a SafeSearchAnnotation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.CropHintsAnnotation} CropHintsAnnotation + * @returns {google.cloud.vision.v1p4beta1.SafeSearchAnnotation} SafeSearchAnnotation */ - CropHintsAnnotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.CropHintsAnnotation) + SafeSearchAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.SafeSearchAnnotation) return object; - var message = new $root.google.cloud.vision.v1p4beta1.CropHintsAnnotation(); - if (object.cropHints) { - if (!Array.isArray(object.cropHints)) - throw TypeError(".google.cloud.vision.v1p4beta1.CropHintsAnnotation.cropHints: array expected"); - message.cropHints = []; - for (var i = 0; i < object.cropHints.length; ++i) { - if (typeof object.cropHints[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.CropHintsAnnotation.cropHints: object expected"); - message.cropHints[i] = $root.google.cloud.vision.v1p4beta1.CropHint.fromObject(object.cropHints[i]); - } + var message = new $root.google.cloud.vision.v1p4beta1.SafeSearchAnnotation(); + switch (object.adult) { + case "UNKNOWN": + case 0: + message.adult = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.adult = 1; + break; + case "UNLIKELY": + case 2: + message.adult = 2; + break; + case "POSSIBLE": + case 3: + message.adult = 3; + break; + case "LIKELY": + case 4: + message.adult = 4; + break; + case "VERY_LIKELY": + case 5: + message.adult = 5; + break; + } + switch (object.spoof) { + case "UNKNOWN": + case 0: + message.spoof = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.spoof = 1; + break; + case "UNLIKELY": + case 2: + message.spoof = 2; + break; + case "POSSIBLE": + case 3: + message.spoof = 3; + break; + case "LIKELY": + case 4: + message.spoof = 4; + break; + case "VERY_LIKELY": + case 5: + message.spoof = 5; + break; + } + switch (object.medical) { + case "UNKNOWN": + case 0: + message.medical = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.medical = 1; + break; + case "UNLIKELY": + case 2: + message.medical = 2; + break; + case "POSSIBLE": + case 3: + message.medical = 3; + break; + case "LIKELY": + case 4: + message.medical = 4; + break; + case "VERY_LIKELY": + case 5: + message.medical = 5; + break; + } + switch (object.violence) { + case "UNKNOWN": + case 0: + message.violence = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.violence = 1; + break; + case "UNLIKELY": + case 2: + message.violence = 2; + break; + case "POSSIBLE": + case 3: + message.violence = 3; + break; + case "LIKELY": + case 4: + message.violence = 4; + break; + case "VERY_LIKELY": + case 5: + message.violence = 5; + break; + } + switch (object.racy) { + case "UNKNOWN": + case 0: + message.racy = 0; + break; + case "VERY_UNLIKELY": + case 1: + message.racy = 1; + break; + case "UNLIKELY": + case 2: + message.racy = 2; + break; + case "POSSIBLE": + case 3: + message.racy = 3; + break; + case "LIKELY": + case 4: + message.racy = 4; + break; + case "VERY_LIKELY": + case 5: + message.racy = 5; + break; } return message; }; /** - * Creates a plain object from a CropHintsAnnotation message. Also converts values to other types if specified. + * Creates a plain object from a SafeSearchAnnotation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation * @static - * @param {google.cloud.vision.v1p4beta1.CropHintsAnnotation} message CropHintsAnnotation + * @param {google.cloud.vision.v1p4beta1.SafeSearchAnnotation} message SafeSearchAnnotation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CropHintsAnnotation.toObject = function toObject(message, options) { + SafeSearchAnnotation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.cropHints = []; - if (message.cropHints && message.cropHints.length) { - object.cropHints = []; - for (var j = 0; j < message.cropHints.length; ++j) - object.cropHints[j] = $root.google.cloud.vision.v1p4beta1.CropHint.toObject(message.cropHints[j], options); + if (options.defaults) { + object.adult = options.enums === String ? "UNKNOWN" : 0; + object.spoof = options.enums === String ? "UNKNOWN" : 0; + object.medical = options.enums === String ? "UNKNOWN" : 0; + object.violence = options.enums === String ? "UNKNOWN" : 0; + object.racy = options.enums === String ? "UNKNOWN" : 0; } + if (message.adult != null && message.hasOwnProperty("adult")) + object.adult = options.enums === String ? $root.google.cloud.vision.v1p4beta1.Likelihood[message.adult] : message.adult; + if (message.spoof != null && message.hasOwnProperty("spoof")) + object.spoof = options.enums === String ? $root.google.cloud.vision.v1p4beta1.Likelihood[message.spoof] : message.spoof; + if (message.medical != null && message.hasOwnProperty("medical")) + object.medical = options.enums === String ? $root.google.cloud.vision.v1p4beta1.Likelihood[message.medical] : message.medical; + if (message.violence != null && message.hasOwnProperty("violence")) + object.violence = options.enums === String ? $root.google.cloud.vision.v1p4beta1.Likelihood[message.violence] : message.violence; + if (message.racy != null && message.hasOwnProperty("racy")) + object.racy = options.enums === String ? $root.google.cloud.vision.v1p4beta1.Likelihood[message.racy] : message.racy; return object; }; /** - * Converts this CropHintsAnnotation to JSON. + * Converts this SafeSearchAnnotation to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.CropHintsAnnotation + * @memberof google.cloud.vision.v1p4beta1.SafeSearchAnnotation * @instance * @returns {Object.} JSON object */ - CropHintsAnnotation.prototype.toJSON = function toJSON() { + SafeSearchAnnotation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CropHintsAnnotation; + return SafeSearchAnnotation; })(); - v1p4beta1.CropHintsParams = (function() { + v1p4beta1.LatLongRect = (function() { /** - * Properties of a CropHintsParams. + * Properties of a LatLongRect. * @memberof google.cloud.vision.v1p4beta1 - * @interface ICropHintsParams - * @property {Array.|null} [aspectRatios] CropHintsParams aspectRatios + * @interface ILatLongRect + * @property {google.type.ILatLng|null} [minLatLng] LatLongRect minLatLng + * @property {google.type.ILatLng|null} [maxLatLng] LatLongRect maxLatLng */ /** - * Constructs a new CropHintsParams. + * Constructs a new LatLongRect. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a CropHintsParams. - * @implements ICropHintsParams + * @classdesc Represents a LatLongRect. + * @implements ILatLongRect * @constructor - * @param {google.cloud.vision.v1p4beta1.ICropHintsParams=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.ILatLongRect=} [properties] Properties to set */ - function CropHintsParams(properties) { - this.aspectRatios = []; + function LatLongRect(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -78163,86 +78415,88 @@ } /** - * CropHintsParams aspectRatios. - * @member {Array.} aspectRatios - * @memberof google.cloud.vision.v1p4beta1.CropHintsParams + * LatLongRect minLatLng. + * @member {google.type.ILatLng|null|undefined} minLatLng + * @memberof google.cloud.vision.v1p4beta1.LatLongRect * @instance */ - CropHintsParams.prototype.aspectRatios = $util.emptyArray; + LatLongRect.prototype.minLatLng = null; /** - * Creates a new CropHintsParams instance using the specified properties. + * LatLongRect maxLatLng. + * @member {google.type.ILatLng|null|undefined} maxLatLng + * @memberof google.cloud.vision.v1p4beta1.LatLongRect + * @instance + */ + LatLongRect.prototype.maxLatLng = null; + + /** + * Creates a new LatLongRect instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.CropHintsParams + * @memberof google.cloud.vision.v1p4beta1.LatLongRect * @static - * @param {google.cloud.vision.v1p4beta1.ICropHintsParams=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.CropHintsParams} CropHintsParams instance + * @param {google.cloud.vision.v1p4beta1.ILatLongRect=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.LatLongRect} LatLongRect instance */ - CropHintsParams.create = function create(properties) { - return new CropHintsParams(properties); + LatLongRect.create = function create(properties) { + return new LatLongRect(properties); }; /** - * Encodes the specified CropHintsParams message. Does not implicitly {@link google.cloud.vision.v1p4beta1.CropHintsParams.verify|verify} messages. + * Encodes the specified LatLongRect message. Does not implicitly {@link google.cloud.vision.v1p4beta1.LatLongRect.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.CropHintsParams + * @memberof google.cloud.vision.v1p4beta1.LatLongRect * @static - * @param {google.cloud.vision.v1p4beta1.ICropHintsParams} message CropHintsParams message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.ILatLongRect} message LatLongRect message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CropHintsParams.encode = function encode(message, writer) { + LatLongRect.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.aspectRatios != null && message.aspectRatios.length) { - writer.uint32(/* id 1, wireType 2 =*/10).fork(); - for (var i = 0; i < message.aspectRatios.length; ++i) - writer.float(message.aspectRatios[i]); - writer.ldelim(); - } + if (message.minLatLng != null && message.hasOwnProperty("minLatLng")) + $root.google.type.LatLng.encode(message.minLatLng, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.maxLatLng != null && message.hasOwnProperty("maxLatLng")) + $root.google.type.LatLng.encode(message.maxLatLng, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified CropHintsParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.CropHintsParams.verify|verify} messages. + * Encodes the specified LatLongRect message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.LatLongRect.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.CropHintsParams + * @memberof google.cloud.vision.v1p4beta1.LatLongRect * @static - * @param {google.cloud.vision.v1p4beta1.ICropHintsParams} message CropHintsParams message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.ILatLongRect} message LatLongRect message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - CropHintsParams.encodeDelimited = function encodeDelimited(message, writer) { + LatLongRect.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a CropHintsParams message from the specified reader or buffer. + * Decodes a LatLongRect message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.CropHintsParams + * @memberof google.cloud.vision.v1p4beta1.LatLongRect * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.CropHintsParams} CropHintsParams + * @returns {google.cloud.vision.v1p4beta1.LatLongRect} LatLongRect * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CropHintsParams.decode = function decode(reader, length) { + LatLongRect.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.vision.v1p4beta1.CropHintsParams(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.LatLongRect(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.aspectRatios && message.aspectRatios.length)) - message.aspectRatios = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.aspectRatios.push(reader.float()); - } else - message.aspectRatios.push(reader.float()); + message.minLatLng = $root.google.type.LatLng.decode(reader, reader.uint32()); + break; + case 2: + message.maxLatLng = $root.google.type.LatLng.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -78253,119 +78507,128 @@ }; /** - * Decodes a CropHintsParams message from the specified reader or buffer, length delimited. + * Decodes a LatLongRect message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.CropHintsParams + * @memberof google.cloud.vision.v1p4beta1.LatLongRect * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.CropHintsParams} CropHintsParams + * @returns {google.cloud.vision.v1p4beta1.LatLongRect} LatLongRect * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - CropHintsParams.decodeDelimited = function decodeDelimited(reader) { + LatLongRect.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a CropHintsParams message. + * Verifies a LatLongRect message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.CropHintsParams + * @memberof google.cloud.vision.v1p4beta1.LatLongRect * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - CropHintsParams.verify = function verify(message) { + LatLongRect.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.aspectRatios != null && message.hasOwnProperty("aspectRatios")) { - if (!Array.isArray(message.aspectRatios)) - return "aspectRatios: array expected"; - for (var i = 0; i < message.aspectRatios.length; ++i) - if (typeof message.aspectRatios[i] !== "number") - return "aspectRatios: number[] expected"; + if (message.minLatLng != null && message.hasOwnProperty("minLatLng")) { + var error = $root.google.type.LatLng.verify(message.minLatLng); + if (error) + return "minLatLng." + error; + } + if (message.maxLatLng != null && message.hasOwnProperty("maxLatLng")) { + var error = $root.google.type.LatLng.verify(message.maxLatLng); + if (error) + return "maxLatLng." + error; } return null; }; /** - * Creates a CropHintsParams message from a plain object. Also converts values to their respective internal types. + * Creates a LatLongRect message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.CropHintsParams + * @memberof google.cloud.vision.v1p4beta1.LatLongRect * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.CropHintsParams} CropHintsParams + * @returns {google.cloud.vision.v1p4beta1.LatLongRect} LatLongRect */ - CropHintsParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.CropHintsParams) + LatLongRect.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.LatLongRect) return object; - var message = new $root.google.cloud.vision.v1p4beta1.CropHintsParams(); - if (object.aspectRatios) { - if (!Array.isArray(object.aspectRatios)) - throw TypeError(".google.cloud.vision.v1p4beta1.CropHintsParams.aspectRatios: array expected"); - message.aspectRatios = []; - for (var i = 0; i < object.aspectRatios.length; ++i) - message.aspectRatios[i] = Number(object.aspectRatios[i]); + var message = new $root.google.cloud.vision.v1p4beta1.LatLongRect(); + if (object.minLatLng != null) { + if (typeof object.minLatLng !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.LatLongRect.minLatLng: object expected"); + message.minLatLng = $root.google.type.LatLng.fromObject(object.minLatLng); + } + if (object.maxLatLng != null) { + if (typeof object.maxLatLng !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.LatLongRect.maxLatLng: object expected"); + message.maxLatLng = $root.google.type.LatLng.fromObject(object.maxLatLng); } return message; }; /** - * Creates a plain object from a CropHintsParams message. Also converts values to other types if specified. + * Creates a plain object from a LatLongRect message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.CropHintsParams + * @memberof google.cloud.vision.v1p4beta1.LatLongRect * @static - * @param {google.cloud.vision.v1p4beta1.CropHintsParams} message CropHintsParams + * @param {google.cloud.vision.v1p4beta1.LatLongRect} message LatLongRect * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - CropHintsParams.toObject = function toObject(message, options) { + LatLongRect.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.aspectRatios = []; - if (message.aspectRatios && message.aspectRatios.length) { - object.aspectRatios = []; - for (var j = 0; j < message.aspectRatios.length; ++j) - object.aspectRatios[j] = options.json && !isFinite(message.aspectRatios[j]) ? String(message.aspectRatios[j]) : message.aspectRatios[j]; + if (options.defaults) { + object.minLatLng = null; + object.maxLatLng = null; } + if (message.minLatLng != null && message.hasOwnProperty("minLatLng")) + object.minLatLng = $root.google.type.LatLng.toObject(message.minLatLng, options); + if (message.maxLatLng != null && message.hasOwnProperty("maxLatLng")) + object.maxLatLng = $root.google.type.LatLng.toObject(message.maxLatLng, options); return object; }; /** - * Converts this CropHintsParams to JSON. + * Converts this LatLongRect to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.CropHintsParams + * @memberof google.cloud.vision.v1p4beta1.LatLongRect * @instance * @returns {Object.} JSON object */ - CropHintsParams.prototype.toJSON = function toJSON() { + LatLongRect.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return CropHintsParams; + return LatLongRect; })(); - v1p4beta1.WebDetectionParams = (function() { + v1p4beta1.ColorInfo = (function() { /** - * Properties of a WebDetectionParams. + * Properties of a ColorInfo. * @memberof google.cloud.vision.v1p4beta1 - * @interface IWebDetectionParams - * @property {boolean|null} [includeGeoResults] WebDetectionParams includeGeoResults + * @interface IColorInfo + * @property {google.type.IColor|null} [color] ColorInfo color + * @property {number|null} [score] ColorInfo score + * @property {number|null} [pixelFraction] ColorInfo pixelFraction */ /** - * Constructs a new WebDetectionParams. + * Constructs a new ColorInfo. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a WebDetectionParams. - * @implements IWebDetectionParams + * @classdesc Represents a ColorInfo. + * @implements IColorInfo * @constructor - * @param {google.cloud.vision.v1p4beta1.IWebDetectionParams=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IColorInfo=} [properties] Properties to set */ - function WebDetectionParams(properties) { + function ColorInfo(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -78373,75 +78636,101 @@ } /** - * WebDetectionParams includeGeoResults. - * @member {boolean} includeGeoResults - * @memberof google.cloud.vision.v1p4beta1.WebDetectionParams + * ColorInfo color. + * @member {google.type.IColor|null|undefined} color + * @memberof google.cloud.vision.v1p4beta1.ColorInfo * @instance */ - WebDetectionParams.prototype.includeGeoResults = false; + ColorInfo.prototype.color = null; /** - * Creates a new WebDetectionParams instance using the specified properties. + * ColorInfo score. + * @member {number} score + * @memberof google.cloud.vision.v1p4beta1.ColorInfo + * @instance + */ + ColorInfo.prototype.score = 0; + + /** + * ColorInfo pixelFraction. + * @member {number} pixelFraction + * @memberof google.cloud.vision.v1p4beta1.ColorInfo + * @instance + */ + ColorInfo.prototype.pixelFraction = 0; + + /** + * Creates a new ColorInfo instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p4beta1.ColorInfo * @static - * @param {google.cloud.vision.v1p4beta1.IWebDetectionParams=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.WebDetectionParams} WebDetectionParams instance + * @param {google.cloud.vision.v1p4beta1.IColorInfo=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.ColorInfo} ColorInfo instance */ - WebDetectionParams.create = function create(properties) { - return new WebDetectionParams(properties); + ColorInfo.create = function create(properties) { + return new ColorInfo(properties); }; /** - * Encodes the specified WebDetectionParams message. Does not implicitly {@link google.cloud.vision.v1p4beta1.WebDetectionParams.verify|verify} messages. + * Encodes the specified ColorInfo message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ColorInfo.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p4beta1.ColorInfo * @static - * @param {google.cloud.vision.v1p4beta1.IWebDetectionParams} message WebDetectionParams message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IColorInfo} message ColorInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WebDetectionParams.encode = function encode(message, writer) { + ColorInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.includeGeoResults != null && message.hasOwnProperty("includeGeoResults")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.includeGeoResults); + if (message.color != null && message.hasOwnProperty("color")) + $root.google.type.Color.encode(message.color, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.score != null && message.hasOwnProperty("score")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.score); + if (message.pixelFraction != null && message.hasOwnProperty("pixelFraction")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.pixelFraction); return writer; }; /** - * Encodes the specified WebDetectionParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.WebDetectionParams.verify|verify} messages. + * Encodes the specified ColorInfo message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ColorInfo.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p4beta1.ColorInfo * @static - * @param {google.cloud.vision.v1p4beta1.IWebDetectionParams} message WebDetectionParams message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IColorInfo} message ColorInfo message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - WebDetectionParams.encodeDelimited = function encodeDelimited(message, writer) { + ColorInfo.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a WebDetectionParams message from the specified reader or buffer. + * Decodes a ColorInfo message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p4beta1.ColorInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.WebDetectionParams} WebDetectionParams + * @returns {google.cloud.vision.v1p4beta1.ColorInfo} ColorInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WebDetectionParams.decode = function decode(reader, length) { + ColorInfo.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.vision.v1p4beta1.WebDetectionParams(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.ColorInfo(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { + case 1: + message.color = $root.google.type.Color.decode(reader, reader.uint32()); + break; case 2: - message.includeGeoResults = reader.bool(); + message.score = reader.float(); + break; + case 3: + message.pixelFraction = reader.float(); break; default: reader.skipType(tag & 7); @@ -78452,113 +78741,130 @@ }; /** - * Decodes a WebDetectionParams message from the specified reader or buffer, length delimited. + * Decodes a ColorInfo message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p4beta1.ColorInfo * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.WebDetectionParams} WebDetectionParams + * @returns {google.cloud.vision.v1p4beta1.ColorInfo} ColorInfo * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - WebDetectionParams.decodeDelimited = function decodeDelimited(reader) { + ColorInfo.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a WebDetectionParams message. + * Verifies a ColorInfo message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p4beta1.ColorInfo * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - WebDetectionParams.verify = function verify(message) { + ColorInfo.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.includeGeoResults != null && message.hasOwnProperty("includeGeoResults")) - if (typeof message.includeGeoResults !== "boolean") - return "includeGeoResults: boolean expected"; + if (message.color != null && message.hasOwnProperty("color")) { + var error = $root.google.type.Color.verify(message.color); + if (error) + return "color." + error; + } + if (message.score != null && message.hasOwnProperty("score")) + if (typeof message.score !== "number") + return "score: number expected"; + if (message.pixelFraction != null && message.hasOwnProperty("pixelFraction")) + if (typeof message.pixelFraction !== "number") + return "pixelFraction: number expected"; return null; }; /** - * Creates a WebDetectionParams message from a plain object. Also converts values to their respective internal types. + * Creates a ColorInfo message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p4beta1.ColorInfo * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.WebDetectionParams} WebDetectionParams + * @returns {google.cloud.vision.v1p4beta1.ColorInfo} ColorInfo */ - WebDetectionParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.WebDetectionParams) + ColorInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.ColorInfo) return object; - var message = new $root.google.cloud.vision.v1p4beta1.WebDetectionParams(); - if (object.includeGeoResults != null) - message.includeGeoResults = Boolean(object.includeGeoResults); + var message = new $root.google.cloud.vision.v1p4beta1.ColorInfo(); + if (object.color != null) { + if (typeof object.color !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.ColorInfo.color: object expected"); + message.color = $root.google.type.Color.fromObject(object.color); + } + if (object.score != null) + message.score = Number(object.score); + if (object.pixelFraction != null) + message.pixelFraction = Number(object.pixelFraction); return message; }; /** - * Creates a plain object from a WebDetectionParams message. Also converts values to other types if specified. + * Creates a plain object from a ColorInfo message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p4beta1.ColorInfo * @static - * @param {google.cloud.vision.v1p4beta1.WebDetectionParams} message WebDetectionParams + * @param {google.cloud.vision.v1p4beta1.ColorInfo} message ColorInfo * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - WebDetectionParams.toObject = function toObject(message, options) { + ColorInfo.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.includeGeoResults = false; - if (message.includeGeoResults != null && message.hasOwnProperty("includeGeoResults")) - object.includeGeoResults = message.includeGeoResults; + if (options.defaults) { + object.color = null; + object.score = 0; + object.pixelFraction = 0; + } + if (message.color != null && message.hasOwnProperty("color")) + object.color = $root.google.type.Color.toObject(message.color, options); + if (message.score != null && message.hasOwnProperty("score")) + object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; + if (message.pixelFraction != null && message.hasOwnProperty("pixelFraction")) + object.pixelFraction = options.json && !isFinite(message.pixelFraction) ? String(message.pixelFraction) : message.pixelFraction; return object; }; /** - * Converts this WebDetectionParams to JSON. + * Converts this ColorInfo to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.WebDetectionParams + * @memberof google.cloud.vision.v1p4beta1.ColorInfo * @instance * @returns {Object.} JSON object */ - WebDetectionParams.prototype.toJSON = function toJSON() { + ColorInfo.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return WebDetectionParams; + return ColorInfo; })(); - v1p4beta1.ImageContext = (function() { + v1p4beta1.DominantColorsAnnotation = (function() { /** - * Properties of an ImageContext. + * Properties of a DominantColorsAnnotation. * @memberof google.cloud.vision.v1p4beta1 - * @interface IImageContext - * @property {google.cloud.vision.v1p4beta1.ILatLongRect|null} [latLongRect] ImageContext latLongRect - * @property {Array.|null} [languageHints] ImageContext languageHints - * @property {google.cloud.vision.v1p4beta1.ICropHintsParams|null} [cropHintsParams] ImageContext cropHintsParams - * @property {google.cloud.vision.v1p4beta1.IFaceRecognitionParams|null} [faceRecognitionParams] ImageContext faceRecognitionParams - * @property {google.cloud.vision.v1p4beta1.IProductSearchParams|null} [productSearchParams] ImageContext productSearchParams - * @property {google.cloud.vision.v1p4beta1.IWebDetectionParams|null} [webDetectionParams] ImageContext webDetectionParams + * @interface IDominantColorsAnnotation + * @property {Array.|null} [colors] DominantColorsAnnotation colors */ /** - * Constructs a new ImageContext. + * Constructs a new DominantColorsAnnotation. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an ImageContext. - * @implements IImageContext + * @classdesc Represents a DominantColorsAnnotation. + * @implements IDominantColorsAnnotation * @constructor - * @param {google.cloud.vision.v1p4beta1.IImageContext=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IDominantColorsAnnotation=} [properties] Properties to set */ - function ImageContext(properties) { - this.languageHints = []; + function DominantColorsAnnotation(properties) { + this.colors = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -78566,143 +78872,78 @@ } /** - * ImageContext latLongRect. - * @member {google.cloud.vision.v1p4beta1.ILatLongRect|null|undefined} latLongRect - * @memberof google.cloud.vision.v1p4beta1.ImageContext - * @instance - */ - ImageContext.prototype.latLongRect = null; - - /** - * ImageContext languageHints. - * @member {Array.} languageHints - * @memberof google.cloud.vision.v1p4beta1.ImageContext - * @instance - */ - ImageContext.prototype.languageHints = $util.emptyArray; - - /** - * ImageContext cropHintsParams. - * @member {google.cloud.vision.v1p4beta1.ICropHintsParams|null|undefined} cropHintsParams - * @memberof google.cloud.vision.v1p4beta1.ImageContext - * @instance - */ - ImageContext.prototype.cropHintsParams = null; - - /** - * ImageContext faceRecognitionParams. - * @member {google.cloud.vision.v1p4beta1.IFaceRecognitionParams|null|undefined} faceRecognitionParams - * @memberof google.cloud.vision.v1p4beta1.ImageContext - * @instance - */ - ImageContext.prototype.faceRecognitionParams = null; - - /** - * ImageContext productSearchParams. - * @member {google.cloud.vision.v1p4beta1.IProductSearchParams|null|undefined} productSearchParams - * @memberof google.cloud.vision.v1p4beta1.ImageContext - * @instance - */ - ImageContext.prototype.productSearchParams = null; - - /** - * ImageContext webDetectionParams. - * @member {google.cloud.vision.v1p4beta1.IWebDetectionParams|null|undefined} webDetectionParams - * @memberof google.cloud.vision.v1p4beta1.ImageContext + * DominantColorsAnnotation colors. + * @member {Array.} colors + * @memberof google.cloud.vision.v1p4beta1.DominantColorsAnnotation * @instance */ - ImageContext.prototype.webDetectionParams = null; + DominantColorsAnnotation.prototype.colors = $util.emptyArray; /** - * Creates a new ImageContext instance using the specified properties. + * Creates a new DominantColorsAnnotation instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.ImageContext + * @memberof google.cloud.vision.v1p4beta1.DominantColorsAnnotation * @static - * @param {google.cloud.vision.v1p4beta1.IImageContext=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.ImageContext} ImageContext instance + * @param {google.cloud.vision.v1p4beta1.IDominantColorsAnnotation=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.DominantColorsAnnotation} DominantColorsAnnotation instance */ - ImageContext.create = function create(properties) { - return new ImageContext(properties); + DominantColorsAnnotation.create = function create(properties) { + return new DominantColorsAnnotation(properties); }; /** - * Encodes the specified ImageContext message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageContext.verify|verify} messages. + * Encodes the specified DominantColorsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.DominantColorsAnnotation.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.ImageContext + * @memberof google.cloud.vision.v1p4beta1.DominantColorsAnnotation * @static - * @param {google.cloud.vision.v1p4beta1.IImageContext} message ImageContext message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IDominantColorsAnnotation} message DominantColorsAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageContext.encode = function encode(message, writer) { + DominantColorsAnnotation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.latLongRect != null && message.hasOwnProperty("latLongRect")) - $root.google.cloud.vision.v1p4beta1.LatLongRect.encode(message.latLongRect, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.languageHints != null && message.languageHints.length) - for (var i = 0; i < message.languageHints.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageHints[i]); - if (message.cropHintsParams != null && message.hasOwnProperty("cropHintsParams")) - $root.google.cloud.vision.v1p4beta1.CropHintsParams.encode(message.cropHintsParams, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.productSearchParams != null && message.hasOwnProperty("productSearchParams")) - $root.google.cloud.vision.v1p4beta1.ProductSearchParams.encode(message.productSearchParams, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.webDetectionParams != null && message.hasOwnProperty("webDetectionParams")) - $root.google.cloud.vision.v1p4beta1.WebDetectionParams.encode(message.webDetectionParams, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.faceRecognitionParams != null && message.hasOwnProperty("faceRecognitionParams")) - $root.google.cloud.vision.v1p4beta1.FaceRecognitionParams.encode(message.faceRecognitionParams, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.colors != null && message.colors.length) + for (var i = 0; i < message.colors.length; ++i) + $root.google.cloud.vision.v1p4beta1.ColorInfo.encode(message.colors[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified ImageContext message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageContext.verify|verify} messages. + * Encodes the specified DominantColorsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.DominantColorsAnnotation.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ImageContext + * @memberof google.cloud.vision.v1p4beta1.DominantColorsAnnotation * @static - * @param {google.cloud.vision.v1p4beta1.IImageContext} message ImageContext message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IDominantColorsAnnotation} message DominantColorsAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageContext.encodeDelimited = function encodeDelimited(message, writer) { + DominantColorsAnnotation.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImageContext message from the specified reader or buffer. + * Decodes a DominantColorsAnnotation message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.ImageContext + * @memberof google.cloud.vision.v1p4beta1.DominantColorsAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.ImageContext} ImageContext + * @returns {google.cloud.vision.v1p4beta1.DominantColorsAnnotation} DominantColorsAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageContext.decode = function decode(reader, length) { + DominantColorsAnnotation.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.vision.v1p4beta1.ImageContext(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.DominantColorsAnnotation(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.latLongRect = $root.google.cloud.vision.v1p4beta1.LatLongRect.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.languageHints && message.languageHints.length)) - message.languageHints = []; - message.languageHints.push(reader.string()); - break; - case 4: - message.cropHintsParams = $root.google.cloud.vision.v1p4beta1.CropHintsParams.decode(reader, reader.uint32()); - break; - case 10: - message.faceRecognitionParams = $root.google.cloud.vision.v1p4beta1.FaceRecognitionParams.decode(reader, reader.uint32()); - break; - case 5: - message.productSearchParams = $root.google.cloud.vision.v1p4beta1.ProductSearchParams.decode(reader, reader.uint32()); - break; - case 6: - message.webDetectionParams = $root.google.cloud.vision.v1p4beta1.WebDetectionParams.decode(reader, reader.uint32()); + if (!(message.colors && message.colors.length)) + message.colors = []; + message.colors.push($root.google.cloud.vision.v1p4beta1.ColorInfo.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -78713,294 +78954,200 @@ }; /** - * Decodes an ImageContext message from the specified reader or buffer, length delimited. + * Decodes a DominantColorsAnnotation message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ImageContext + * @memberof google.cloud.vision.v1p4beta1.DominantColorsAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.ImageContext} ImageContext + * @returns {google.cloud.vision.v1p4beta1.DominantColorsAnnotation} DominantColorsAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageContext.decodeDelimited = function decodeDelimited(reader) { + DominantColorsAnnotation.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImageContext message. + * Verifies a DominantColorsAnnotation message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.ImageContext + * @memberof google.cloud.vision.v1p4beta1.DominantColorsAnnotation * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImageContext.verify = function verify(message) { + DominantColorsAnnotation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.latLongRect != null && message.hasOwnProperty("latLongRect")) { - var error = $root.google.cloud.vision.v1p4beta1.LatLongRect.verify(message.latLongRect); - if (error) - return "latLongRect." + error; - } - if (message.languageHints != null && message.hasOwnProperty("languageHints")) { - if (!Array.isArray(message.languageHints)) - return "languageHints: array expected"; - for (var i = 0; i < message.languageHints.length; ++i) - if (!$util.isString(message.languageHints[i])) - return "languageHints: string[] expected"; - } - if (message.cropHintsParams != null && message.hasOwnProperty("cropHintsParams")) { - var error = $root.google.cloud.vision.v1p4beta1.CropHintsParams.verify(message.cropHintsParams); - if (error) - return "cropHintsParams." + error; - } - if (message.faceRecognitionParams != null && message.hasOwnProperty("faceRecognitionParams")) { - var error = $root.google.cloud.vision.v1p4beta1.FaceRecognitionParams.verify(message.faceRecognitionParams); - if (error) - return "faceRecognitionParams." + error; - } - if (message.productSearchParams != null && message.hasOwnProperty("productSearchParams")) { - var error = $root.google.cloud.vision.v1p4beta1.ProductSearchParams.verify(message.productSearchParams); - if (error) - return "productSearchParams." + error; - } - if (message.webDetectionParams != null && message.hasOwnProperty("webDetectionParams")) { - var error = $root.google.cloud.vision.v1p4beta1.WebDetectionParams.verify(message.webDetectionParams); - if (error) - return "webDetectionParams." + error; + if (message.colors != null && message.hasOwnProperty("colors")) { + if (!Array.isArray(message.colors)) + return "colors: array expected"; + for (var i = 0; i < message.colors.length; ++i) { + var error = $root.google.cloud.vision.v1p4beta1.ColorInfo.verify(message.colors[i]); + if (error) + return "colors." + error; + } } return null; }; /** - * Creates an ImageContext message from a plain object. Also converts values to their respective internal types. + * Creates a DominantColorsAnnotation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.ImageContext + * @memberof google.cloud.vision.v1p4beta1.DominantColorsAnnotation * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.ImageContext} ImageContext + * @returns {google.cloud.vision.v1p4beta1.DominantColorsAnnotation} DominantColorsAnnotation */ - ImageContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.ImageContext) + DominantColorsAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.DominantColorsAnnotation) return object; - var message = new $root.google.cloud.vision.v1p4beta1.ImageContext(); - if (object.latLongRect != null) { - if (typeof object.latLongRect !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.ImageContext.latLongRect: object expected"); - message.latLongRect = $root.google.cloud.vision.v1p4beta1.LatLongRect.fromObject(object.latLongRect); - } - if (object.languageHints) { - if (!Array.isArray(object.languageHints)) - throw TypeError(".google.cloud.vision.v1p4beta1.ImageContext.languageHints: array expected"); - message.languageHints = []; - for (var i = 0; i < object.languageHints.length; ++i) - message.languageHints[i] = String(object.languageHints[i]); - } - if (object.cropHintsParams != null) { - if (typeof object.cropHintsParams !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.ImageContext.cropHintsParams: object expected"); - message.cropHintsParams = $root.google.cloud.vision.v1p4beta1.CropHintsParams.fromObject(object.cropHintsParams); - } - if (object.faceRecognitionParams != null) { - if (typeof object.faceRecognitionParams !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.ImageContext.faceRecognitionParams: object expected"); - message.faceRecognitionParams = $root.google.cloud.vision.v1p4beta1.FaceRecognitionParams.fromObject(object.faceRecognitionParams); - } - if (object.productSearchParams != null) { - if (typeof object.productSearchParams !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.ImageContext.productSearchParams: object expected"); - message.productSearchParams = $root.google.cloud.vision.v1p4beta1.ProductSearchParams.fromObject(object.productSearchParams); - } - if (object.webDetectionParams != null) { - if (typeof object.webDetectionParams !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.ImageContext.webDetectionParams: object expected"); - message.webDetectionParams = $root.google.cloud.vision.v1p4beta1.WebDetectionParams.fromObject(object.webDetectionParams); + var message = new $root.google.cloud.vision.v1p4beta1.DominantColorsAnnotation(); + if (object.colors) { + if (!Array.isArray(object.colors)) + throw TypeError(".google.cloud.vision.v1p4beta1.DominantColorsAnnotation.colors: array expected"); + message.colors = []; + for (var i = 0; i < object.colors.length; ++i) { + if (typeof object.colors[i] !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.DominantColorsAnnotation.colors: object expected"); + message.colors[i] = $root.google.cloud.vision.v1p4beta1.ColorInfo.fromObject(object.colors[i]); + } } return message; }; /** - * Creates a plain object from an ImageContext message. Also converts values to other types if specified. + * Creates a plain object from a DominantColorsAnnotation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.ImageContext + * @memberof google.cloud.vision.v1p4beta1.DominantColorsAnnotation * @static - * @param {google.cloud.vision.v1p4beta1.ImageContext} message ImageContext + * @param {google.cloud.vision.v1p4beta1.DominantColorsAnnotation} message DominantColorsAnnotation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImageContext.toObject = function toObject(message, options) { + DominantColorsAnnotation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.languageHints = []; - if (options.defaults) { - object.latLongRect = null; - object.cropHintsParams = null; - object.productSearchParams = null; - object.webDetectionParams = null; - object.faceRecognitionParams = null; - } - if (message.latLongRect != null && message.hasOwnProperty("latLongRect")) - object.latLongRect = $root.google.cloud.vision.v1p4beta1.LatLongRect.toObject(message.latLongRect, options); - if (message.languageHints && message.languageHints.length) { - object.languageHints = []; - for (var j = 0; j < message.languageHints.length; ++j) - object.languageHints[j] = message.languageHints[j]; + object.colors = []; + if (message.colors && message.colors.length) { + object.colors = []; + for (var j = 0; j < message.colors.length; ++j) + object.colors[j] = $root.google.cloud.vision.v1p4beta1.ColorInfo.toObject(message.colors[j], options); } - if (message.cropHintsParams != null && message.hasOwnProperty("cropHintsParams")) - object.cropHintsParams = $root.google.cloud.vision.v1p4beta1.CropHintsParams.toObject(message.cropHintsParams, options); - if (message.productSearchParams != null && message.hasOwnProperty("productSearchParams")) - object.productSearchParams = $root.google.cloud.vision.v1p4beta1.ProductSearchParams.toObject(message.productSearchParams, options); - if (message.webDetectionParams != null && message.hasOwnProperty("webDetectionParams")) - object.webDetectionParams = $root.google.cloud.vision.v1p4beta1.WebDetectionParams.toObject(message.webDetectionParams, options); - if (message.faceRecognitionParams != null && message.hasOwnProperty("faceRecognitionParams")) - object.faceRecognitionParams = $root.google.cloud.vision.v1p4beta1.FaceRecognitionParams.toObject(message.faceRecognitionParams, options); return object; }; /** - * Converts this ImageContext to JSON. + * Converts this DominantColorsAnnotation to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.ImageContext + * @memberof google.cloud.vision.v1p4beta1.DominantColorsAnnotation * @instance * @returns {Object.} JSON object */ - ImageContext.prototype.toJSON = function toJSON() { + DominantColorsAnnotation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImageContext; + return DominantColorsAnnotation; })(); - v1p4beta1.AnnotateImageRequest = (function() { + v1p4beta1.ImageProperties = (function() { /** - * Properties of an AnnotateImageRequest. + * Properties of an ImageProperties. * @memberof google.cloud.vision.v1p4beta1 - * @interface IAnnotateImageRequest - * @property {google.cloud.vision.v1p4beta1.IImage|null} [image] AnnotateImageRequest image - * @property {Array.|null} [features] AnnotateImageRequest features - * @property {google.cloud.vision.v1p4beta1.IImageContext|null} [imageContext] AnnotateImageRequest imageContext + * @interface IImageProperties + * @property {google.cloud.vision.v1p4beta1.IDominantColorsAnnotation|null} [dominantColors] ImageProperties dominantColors */ /** - * Constructs a new AnnotateImageRequest. + * Constructs a new ImageProperties. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an AnnotateImageRequest. - * @implements IAnnotateImageRequest - * @constructor - * @param {google.cloud.vision.v1p4beta1.IAnnotateImageRequest=} [properties] Properties to set - */ - function AnnotateImageRequest(properties) { - this.features = []; - 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]]; - } - - /** - * AnnotateImageRequest image. - * @member {google.cloud.vision.v1p4beta1.IImage|null|undefined} image - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest - * @instance - */ - AnnotateImageRequest.prototype.image = null; - - /** - * AnnotateImageRequest features. - * @member {Array.} features - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest - * @instance + * @classdesc Represents an ImageProperties. + * @implements IImageProperties + * @constructor + * @param {google.cloud.vision.v1p4beta1.IImageProperties=} [properties] Properties to set */ - AnnotateImageRequest.prototype.features = $util.emptyArray; + function ImageProperties(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]]; + } /** - * AnnotateImageRequest imageContext. - * @member {google.cloud.vision.v1p4beta1.IImageContext|null|undefined} imageContext - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest + * ImageProperties dominantColors. + * @member {google.cloud.vision.v1p4beta1.IDominantColorsAnnotation|null|undefined} dominantColors + * @memberof google.cloud.vision.v1p4beta1.ImageProperties * @instance */ - AnnotateImageRequest.prototype.imageContext = null; + ImageProperties.prototype.dominantColors = null; /** - * Creates a new AnnotateImageRequest instance using the specified properties. + * Creates a new ImageProperties instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p4beta1.ImageProperties * @static - * @param {google.cloud.vision.v1p4beta1.IAnnotateImageRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.AnnotateImageRequest} AnnotateImageRequest instance + * @param {google.cloud.vision.v1p4beta1.IImageProperties=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.ImageProperties} ImageProperties instance */ - AnnotateImageRequest.create = function create(properties) { - return new AnnotateImageRequest(properties); + ImageProperties.create = function create(properties) { + return new ImageProperties(properties); }; /** - * Encodes the specified AnnotateImageRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateImageRequest.verify|verify} messages. + * Encodes the specified ImageProperties message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageProperties.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p4beta1.ImageProperties * @static - * @param {google.cloud.vision.v1p4beta1.IAnnotateImageRequest} message AnnotateImageRequest message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IImageProperties} message ImageProperties message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateImageRequest.encode = function encode(message, writer) { + ImageProperties.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.image != null && message.hasOwnProperty("image")) - $root.google.cloud.vision.v1p4beta1.Image.encode(message.image, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.features != null && message.features.length) - for (var i = 0; i < message.features.length; ++i) - $root.google.cloud.vision.v1p4beta1.Feature.encode(message.features[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.imageContext != null && message.hasOwnProperty("imageContext")) - $root.google.cloud.vision.v1p4beta1.ImageContext.encode(message.imageContext, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.dominantColors != null && message.hasOwnProperty("dominantColors")) + $root.google.cloud.vision.v1p4beta1.DominantColorsAnnotation.encode(message.dominantColors, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified AnnotateImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateImageRequest.verify|verify} messages. + * Encodes the specified ImageProperties message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageProperties.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p4beta1.ImageProperties * @static - * @param {google.cloud.vision.v1p4beta1.IAnnotateImageRequest} message AnnotateImageRequest message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IImageProperties} message ImageProperties message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateImageRequest.encodeDelimited = function encodeDelimited(message, writer) { + ImageProperties.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AnnotateImageRequest message from the specified reader or buffer. + * Decodes an ImageProperties message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p4beta1.ImageProperties * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.AnnotateImageRequest} AnnotateImageRequest + * @returns {google.cloud.vision.v1p4beta1.ImageProperties} ImageProperties * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateImageRequest.decode = function decode(reader, length) { + ImageProperties.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.vision.v1p4beta1.AnnotateImageRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.ImageProperties(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.image = $root.google.cloud.vision.v1p4beta1.Image.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.features && message.features.length)) - message.features = []; - message.features.push($root.google.cloud.vision.v1p4beta1.Feature.decode(reader, reader.uint32())); - break; - case 3: - message.imageContext = $root.google.cloud.vision.v1p4beta1.ImageContext.decode(reader, reader.uint32()); + message.dominantColors = $root.google.cloud.vision.v1p4beta1.DominantColorsAnnotation.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -79011,153 +79158,114 @@ }; /** - * Decodes an AnnotateImageRequest message from the specified reader or buffer, length delimited. + * Decodes an ImageProperties message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p4beta1.ImageProperties * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.AnnotateImageRequest} AnnotateImageRequest + * @returns {google.cloud.vision.v1p4beta1.ImageProperties} ImageProperties * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateImageRequest.decodeDelimited = function decodeDelimited(reader) { + ImageProperties.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AnnotateImageRequest message. + * Verifies an ImageProperties message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p4beta1.ImageProperties * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AnnotateImageRequest.verify = function verify(message) { + ImageProperties.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.image != null && message.hasOwnProperty("image")) { - var error = $root.google.cloud.vision.v1p4beta1.Image.verify(message.image); - if (error) - return "image." + error; - } - if (message.features != null && message.hasOwnProperty("features")) { - if (!Array.isArray(message.features)) - return "features: array expected"; - for (var i = 0; i < message.features.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.Feature.verify(message.features[i]); - if (error) - return "features." + error; - } - } - if (message.imageContext != null && message.hasOwnProperty("imageContext")) { - var error = $root.google.cloud.vision.v1p4beta1.ImageContext.verify(message.imageContext); + if (message.dominantColors != null && message.hasOwnProperty("dominantColors")) { + var error = $root.google.cloud.vision.v1p4beta1.DominantColorsAnnotation.verify(message.dominantColors); if (error) - return "imageContext." + error; + return "dominantColors." + error; } return null; }; /** - * Creates an AnnotateImageRequest message from a plain object. Also converts values to their respective internal types. + * Creates an ImageProperties message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p4beta1.ImageProperties * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.AnnotateImageRequest} AnnotateImageRequest + * @returns {google.cloud.vision.v1p4beta1.ImageProperties} ImageProperties */ - AnnotateImageRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.AnnotateImageRequest) + ImageProperties.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.ImageProperties) return object; - var message = new $root.google.cloud.vision.v1p4beta1.AnnotateImageRequest(); - if (object.image != null) { - if (typeof object.image !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageRequest.image: object expected"); - message.image = $root.google.cloud.vision.v1p4beta1.Image.fromObject(object.image); - } - if (object.features) { - if (!Array.isArray(object.features)) - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageRequest.features: array expected"); - message.features = []; - for (var i = 0; i < object.features.length; ++i) { - if (typeof object.features[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageRequest.features: object expected"); - message.features[i] = $root.google.cloud.vision.v1p4beta1.Feature.fromObject(object.features[i]); - } - } - if (object.imageContext != null) { - if (typeof object.imageContext !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageRequest.imageContext: object expected"); - message.imageContext = $root.google.cloud.vision.v1p4beta1.ImageContext.fromObject(object.imageContext); + var message = new $root.google.cloud.vision.v1p4beta1.ImageProperties(); + if (object.dominantColors != null) { + if (typeof object.dominantColors !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.ImageProperties.dominantColors: object expected"); + message.dominantColors = $root.google.cloud.vision.v1p4beta1.DominantColorsAnnotation.fromObject(object.dominantColors); } return message; }; /** - * Creates a plain object from an AnnotateImageRequest message. Also converts values to other types if specified. + * Creates a plain object from an ImageProperties message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p4beta1.ImageProperties * @static - * @param {google.cloud.vision.v1p4beta1.AnnotateImageRequest} message AnnotateImageRequest + * @param {google.cloud.vision.v1p4beta1.ImageProperties} message ImageProperties * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AnnotateImageRequest.toObject = function toObject(message, options) { + ImageProperties.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.features = []; - if (options.defaults) { - object.image = null; - object.imageContext = null; - } - if (message.image != null && message.hasOwnProperty("image")) - object.image = $root.google.cloud.vision.v1p4beta1.Image.toObject(message.image, options); - if (message.features && message.features.length) { - object.features = []; - for (var j = 0; j < message.features.length; ++j) - object.features[j] = $root.google.cloud.vision.v1p4beta1.Feature.toObject(message.features[j], options); - } - if (message.imageContext != null && message.hasOwnProperty("imageContext")) - object.imageContext = $root.google.cloud.vision.v1p4beta1.ImageContext.toObject(message.imageContext, options); + if (options.defaults) + object.dominantColors = null; + if (message.dominantColors != null && message.hasOwnProperty("dominantColors")) + object.dominantColors = $root.google.cloud.vision.v1p4beta1.DominantColorsAnnotation.toObject(message.dominantColors, options); return object; }; /** - * Converts this AnnotateImageRequest to JSON. + * Converts this ImageProperties to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest + * @memberof google.cloud.vision.v1p4beta1.ImageProperties * @instance * @returns {Object.} JSON object */ - AnnotateImageRequest.prototype.toJSON = function toJSON() { + ImageProperties.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AnnotateImageRequest; + return ImageProperties; })(); - v1p4beta1.ImageAnnotationContext = (function() { + v1p4beta1.CropHint = (function() { /** - * Properties of an ImageAnnotationContext. + * Properties of a CropHint. * @memberof google.cloud.vision.v1p4beta1 - * @interface IImageAnnotationContext - * @property {string|null} [uri] ImageAnnotationContext uri - * @property {number|null} [pageNumber] ImageAnnotationContext pageNumber + * @interface ICropHint + * @property {google.cloud.vision.v1p4beta1.IBoundingPoly|null} [boundingPoly] CropHint boundingPoly + * @property {number|null} [confidence] CropHint confidence + * @property {number|null} [importanceFraction] CropHint importanceFraction */ /** - * Constructs a new ImageAnnotationContext. + * Constructs a new CropHint. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an ImageAnnotationContext. - * @implements IImageAnnotationContext + * @classdesc Represents a CropHint. + * @implements ICropHint * @constructor - * @param {google.cloud.vision.v1p4beta1.IImageAnnotationContext=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.ICropHint=} [properties] Properties to set */ - function ImageAnnotationContext(properties) { + function CropHint(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -79165,88 +79273,101 @@ } /** - * ImageAnnotationContext uri. - * @member {string} uri - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotationContext + * CropHint boundingPoly. + * @member {google.cloud.vision.v1p4beta1.IBoundingPoly|null|undefined} boundingPoly + * @memberof google.cloud.vision.v1p4beta1.CropHint * @instance */ - ImageAnnotationContext.prototype.uri = ""; + CropHint.prototype.boundingPoly = null; /** - * ImageAnnotationContext pageNumber. - * @member {number} pageNumber - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotationContext + * CropHint confidence. + * @member {number} confidence + * @memberof google.cloud.vision.v1p4beta1.CropHint * @instance */ - ImageAnnotationContext.prototype.pageNumber = 0; + CropHint.prototype.confidence = 0; /** - * Creates a new ImageAnnotationContext instance using the specified properties. + * CropHint importanceFraction. + * @member {number} importanceFraction + * @memberof google.cloud.vision.v1p4beta1.CropHint + * @instance + */ + CropHint.prototype.importanceFraction = 0; + + /** + * Creates a new CropHint instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotationContext + * @memberof google.cloud.vision.v1p4beta1.CropHint * @static - * @param {google.cloud.vision.v1p4beta1.IImageAnnotationContext=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.ImageAnnotationContext} ImageAnnotationContext instance + * @param {google.cloud.vision.v1p4beta1.ICropHint=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.CropHint} CropHint instance */ - ImageAnnotationContext.create = function create(properties) { - return new ImageAnnotationContext(properties); + CropHint.create = function create(properties) { + return new CropHint(properties); }; /** - * Encodes the specified ImageAnnotationContext message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageAnnotationContext.verify|verify} messages. + * Encodes the specified CropHint message. Does not implicitly {@link google.cloud.vision.v1p4beta1.CropHint.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotationContext + * @memberof google.cloud.vision.v1p4beta1.CropHint * @static - * @param {google.cloud.vision.v1p4beta1.IImageAnnotationContext} message ImageAnnotationContext message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.ICropHint} message CropHint message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageAnnotationContext.encode = function encode(message, writer) { + CropHint.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.uri != null && message.hasOwnProperty("uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); - if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageNumber); + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + $root.google.cloud.vision.v1p4beta1.BoundingPoly.encode(message.boundingPoly, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.confidence != null && message.hasOwnProperty("confidence")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); + if (message.importanceFraction != null && message.hasOwnProperty("importanceFraction")) + writer.uint32(/* id 3, wireType 5 =*/29).float(message.importanceFraction); return writer; }; /** - * Encodes the specified ImageAnnotationContext message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageAnnotationContext.verify|verify} messages. + * Encodes the specified CropHint message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.CropHint.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotationContext + * @memberof google.cloud.vision.v1p4beta1.CropHint * @static - * @param {google.cloud.vision.v1p4beta1.IImageAnnotationContext} message ImageAnnotationContext message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.ICropHint} message CropHint message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - ImageAnnotationContext.encodeDelimited = function encodeDelimited(message, writer) { + CropHint.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an ImageAnnotationContext message from the specified reader or buffer. + * Decodes a CropHint message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotationContext + * @memberof google.cloud.vision.v1p4beta1.CropHint * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.ImageAnnotationContext} ImageAnnotationContext + * @returns {google.cloud.vision.v1p4beta1.CropHint} CropHint * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageAnnotationContext.decode = function decode(reader, length) { + CropHint.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.vision.v1p4beta1.ImageAnnotationContext(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.CropHint(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.uri = reader.string(); + message.boundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.decode(reader, reader.uint32()); break; case 2: - message.pageNumber = reader.int32(); + message.confidence = reader.float(); + break; + case 3: + message.importanceFraction = reader.float(); break; default: reader.skipType(tag & 7); @@ -79257,398 +79378,209 @@ }; /** - * Decodes an ImageAnnotationContext message from the specified reader or buffer, length delimited. + * Decodes a CropHint message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotationContext + * @memberof google.cloud.vision.v1p4beta1.CropHint * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.ImageAnnotationContext} ImageAnnotationContext + * @returns {google.cloud.vision.v1p4beta1.CropHint} CropHint * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - ImageAnnotationContext.decodeDelimited = function decodeDelimited(reader) { + CropHint.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an ImageAnnotationContext message. + * Verifies a CropHint message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotationContext + * @memberof google.cloud.vision.v1p4beta1.CropHint * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - ImageAnnotationContext.verify = function verify(message) { + CropHint.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) - if (!$util.isInteger(message.pageNumber)) - return "pageNumber: integer expected"; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) { + var error = $root.google.cloud.vision.v1p4beta1.BoundingPoly.verify(message.boundingPoly); + if (error) + return "boundingPoly." + error; + } + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + if (message.importanceFraction != null && message.hasOwnProperty("importanceFraction")) + if (typeof message.importanceFraction !== "number") + return "importanceFraction: number expected"; return null; }; /** - * Creates an ImageAnnotationContext message from a plain object. Also converts values to their respective internal types. + * Creates a CropHint message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotationContext + * @memberof google.cloud.vision.v1p4beta1.CropHint * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.ImageAnnotationContext} ImageAnnotationContext + * @returns {google.cloud.vision.v1p4beta1.CropHint} CropHint */ - ImageAnnotationContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.ImageAnnotationContext) + CropHint.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.CropHint) return object; - var message = new $root.google.cloud.vision.v1p4beta1.ImageAnnotationContext(); - if (object.uri != null) - message.uri = String(object.uri); - if (object.pageNumber != null) - message.pageNumber = object.pageNumber | 0; + var message = new $root.google.cloud.vision.v1p4beta1.CropHint(); + if (object.boundingPoly != null) { + if (typeof object.boundingPoly !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.CropHint.boundingPoly: object expected"); + message.boundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.fromObject(object.boundingPoly); + } + if (object.confidence != null) + message.confidence = Number(object.confidence); + if (object.importanceFraction != null) + message.importanceFraction = Number(object.importanceFraction); return message; }; /** - * Creates a plain object from an ImageAnnotationContext message. Also converts values to other types if specified. + * Creates a plain object from a CropHint message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotationContext + * @memberof google.cloud.vision.v1p4beta1.CropHint * @static - * @param {google.cloud.vision.v1p4beta1.ImageAnnotationContext} message ImageAnnotationContext + * @param {google.cloud.vision.v1p4beta1.CropHint} message CropHint * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - ImageAnnotationContext.toObject = function toObject(message, options) { + CropHint.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.uri = ""; - object.pageNumber = 0; + object.boundingPoly = null; + object.confidence = 0; + object.importanceFraction = 0; } - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) - object.pageNumber = message.pageNumber; + if (message.boundingPoly != null && message.hasOwnProperty("boundingPoly")) + object.boundingPoly = $root.google.cloud.vision.v1p4beta1.BoundingPoly.toObject(message.boundingPoly, options); + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + if (message.importanceFraction != null && message.hasOwnProperty("importanceFraction")) + object.importanceFraction = options.json && !isFinite(message.importanceFraction) ? String(message.importanceFraction) : message.importanceFraction; return object; }; /** - * Converts this ImageAnnotationContext to JSON. + * Converts this CropHint to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.ImageAnnotationContext + * @memberof google.cloud.vision.v1p4beta1.CropHint * @instance * @returns {Object.} JSON object */ - ImageAnnotationContext.prototype.toJSON = function toJSON() { + CropHint.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return ImageAnnotationContext; + return CropHint; })(); - v1p4beta1.AnnotateImageResponse = (function() { + v1p4beta1.CropHintsAnnotation = (function() { /** - * Properties of an AnnotateImageResponse. + * Properties of a CropHintsAnnotation. * @memberof google.cloud.vision.v1p4beta1 - * @interface IAnnotateImageResponse - * @property {Array.|null} [faceAnnotations] AnnotateImageResponse faceAnnotations - * @property {Array.|null} [landmarkAnnotations] AnnotateImageResponse landmarkAnnotations - * @property {Array.|null} [logoAnnotations] AnnotateImageResponse logoAnnotations - * @property {Array.|null} [labelAnnotations] AnnotateImageResponse labelAnnotations - * @property {Array.|null} [localizedObjectAnnotations] AnnotateImageResponse localizedObjectAnnotations - * @property {Array.|null} [textAnnotations] AnnotateImageResponse textAnnotations - * @property {google.cloud.vision.v1p4beta1.ITextAnnotation|null} [fullTextAnnotation] AnnotateImageResponse fullTextAnnotation - * @property {google.cloud.vision.v1p4beta1.ISafeSearchAnnotation|null} [safeSearchAnnotation] AnnotateImageResponse safeSearchAnnotation - * @property {google.cloud.vision.v1p4beta1.IImageProperties|null} [imagePropertiesAnnotation] AnnotateImageResponse imagePropertiesAnnotation - * @property {google.cloud.vision.v1p4beta1.ICropHintsAnnotation|null} [cropHintsAnnotation] AnnotateImageResponse cropHintsAnnotation - * @property {google.cloud.vision.v1p4beta1.IWebDetection|null} [webDetection] AnnotateImageResponse webDetection - * @property {google.cloud.vision.v1p4beta1.IProductSearchResults|null} [productSearchResults] AnnotateImageResponse productSearchResults - * @property {google.rpc.IStatus|null} [error] AnnotateImageResponse error - * @property {google.cloud.vision.v1p4beta1.IImageAnnotationContext|null} [context] AnnotateImageResponse context + * @interface ICropHintsAnnotation + * @property {Array.|null} [cropHints] CropHintsAnnotation cropHints */ /** - * Constructs a new AnnotateImageResponse. + * Constructs a new CropHintsAnnotation. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an AnnotateImageResponse. - * @implements IAnnotateImageResponse + * @classdesc Represents a CropHintsAnnotation. + * @implements ICropHintsAnnotation * @constructor - * @param {google.cloud.vision.v1p4beta1.IAnnotateImageResponse=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.ICropHintsAnnotation=} [properties] Properties to set */ - function AnnotateImageResponse(properties) { - this.faceAnnotations = []; - this.landmarkAnnotations = []; - this.logoAnnotations = []; - this.labelAnnotations = []; - this.localizedObjectAnnotations = []; - this.textAnnotations = []; + function CropHintsAnnotation(properties) { + this.cropHints = []; 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]]; - } - - /** - * AnnotateImageResponse faceAnnotations. - * @member {Array.} faceAnnotations - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.faceAnnotations = $util.emptyArray; - - /** - * AnnotateImageResponse landmarkAnnotations. - * @member {Array.} landmarkAnnotations - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.landmarkAnnotations = $util.emptyArray; - - /** - * AnnotateImageResponse logoAnnotations. - * @member {Array.} logoAnnotations - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.logoAnnotations = $util.emptyArray; - - /** - * AnnotateImageResponse labelAnnotations. - * @member {Array.} labelAnnotations - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.labelAnnotations = $util.emptyArray; - - /** - * AnnotateImageResponse localizedObjectAnnotations. - * @member {Array.} localizedObjectAnnotations - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.localizedObjectAnnotations = $util.emptyArray; - - /** - * AnnotateImageResponse textAnnotations. - * @member {Array.} textAnnotations - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.textAnnotations = $util.emptyArray; - - /** - * AnnotateImageResponse fullTextAnnotation. - * @member {google.cloud.vision.v1p4beta1.ITextAnnotation|null|undefined} fullTextAnnotation - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.fullTextAnnotation = null; - - /** - * AnnotateImageResponse safeSearchAnnotation. - * @member {google.cloud.vision.v1p4beta1.ISafeSearchAnnotation|null|undefined} safeSearchAnnotation - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.safeSearchAnnotation = null; - - /** - * AnnotateImageResponse imagePropertiesAnnotation. - * @member {google.cloud.vision.v1p4beta1.IImageProperties|null|undefined} imagePropertiesAnnotation - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.imagePropertiesAnnotation = null; - - /** - * AnnotateImageResponse cropHintsAnnotation. - * @member {google.cloud.vision.v1p4beta1.ICropHintsAnnotation|null|undefined} cropHintsAnnotation - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.cropHintsAnnotation = null; - - /** - * AnnotateImageResponse webDetection. - * @member {google.cloud.vision.v1p4beta1.IWebDetection|null|undefined} webDetection - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.webDetection = null; - - /** - * AnnotateImageResponse productSearchResults. - * @member {google.cloud.vision.v1p4beta1.IProductSearchResults|null|undefined} productSearchResults - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.productSearchResults = null; - - /** - * AnnotateImageResponse error. - * @member {google.rpc.IStatus|null|undefined} error - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse - * @instance - */ - AnnotateImageResponse.prototype.error = null; + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } /** - * AnnotateImageResponse context. - * @member {google.cloud.vision.v1p4beta1.IImageAnnotationContext|null|undefined} context - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse + * CropHintsAnnotation cropHints. + * @member {Array.} cropHints + * @memberof google.cloud.vision.v1p4beta1.CropHintsAnnotation * @instance */ - AnnotateImageResponse.prototype.context = null; + CropHintsAnnotation.prototype.cropHints = $util.emptyArray; /** - * Creates a new AnnotateImageResponse instance using the specified properties. + * Creates a new CropHintsAnnotation instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p4beta1.CropHintsAnnotation * @static - * @param {google.cloud.vision.v1p4beta1.IAnnotateImageResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.AnnotateImageResponse} AnnotateImageResponse instance + * @param {google.cloud.vision.v1p4beta1.ICropHintsAnnotation=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.CropHintsAnnotation} CropHintsAnnotation instance */ - AnnotateImageResponse.create = function create(properties) { - return new AnnotateImageResponse(properties); + CropHintsAnnotation.create = function create(properties) { + return new CropHintsAnnotation(properties); }; /** - * Encodes the specified AnnotateImageResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateImageResponse.verify|verify} messages. + * Encodes the specified CropHintsAnnotation message. Does not implicitly {@link google.cloud.vision.v1p4beta1.CropHintsAnnotation.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p4beta1.CropHintsAnnotation * @static - * @param {google.cloud.vision.v1p4beta1.IAnnotateImageResponse} message AnnotateImageResponse message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.ICropHintsAnnotation} message CropHintsAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateImageResponse.encode = function encode(message, writer) { + CropHintsAnnotation.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.faceAnnotations != null && message.faceAnnotations.length) - for (var i = 0; i < message.faceAnnotations.length; ++i) - $root.google.cloud.vision.v1p4beta1.FaceAnnotation.encode(message.faceAnnotations[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.landmarkAnnotations != null && message.landmarkAnnotations.length) - for (var i = 0; i < message.landmarkAnnotations.length; ++i) - $root.google.cloud.vision.v1p4beta1.EntityAnnotation.encode(message.landmarkAnnotations[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.logoAnnotations != null && message.logoAnnotations.length) - for (var i = 0; i < message.logoAnnotations.length; ++i) - $root.google.cloud.vision.v1p4beta1.EntityAnnotation.encode(message.logoAnnotations[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.labelAnnotations != null && message.labelAnnotations.length) - for (var i = 0; i < message.labelAnnotations.length; ++i) - $root.google.cloud.vision.v1p4beta1.EntityAnnotation.encode(message.labelAnnotations[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.textAnnotations != null && message.textAnnotations.length) - for (var i = 0; i < message.textAnnotations.length; ++i) - $root.google.cloud.vision.v1p4beta1.EntityAnnotation.encode(message.textAnnotations[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.safeSearchAnnotation != null && message.hasOwnProperty("safeSearchAnnotation")) - $root.google.cloud.vision.v1p4beta1.SafeSearchAnnotation.encode(message.safeSearchAnnotation, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.imagePropertiesAnnotation != null && message.hasOwnProperty("imagePropertiesAnnotation")) - $root.google.cloud.vision.v1p4beta1.ImageProperties.encode(message.imagePropertiesAnnotation, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.error != null && message.hasOwnProperty("error")) - $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.cropHintsAnnotation != null && message.hasOwnProperty("cropHintsAnnotation")) - $root.google.cloud.vision.v1p4beta1.CropHintsAnnotation.encode(message.cropHintsAnnotation, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.fullTextAnnotation != null && message.hasOwnProperty("fullTextAnnotation")) - $root.google.cloud.vision.v1p4beta1.TextAnnotation.encode(message.fullTextAnnotation, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.webDetection != null && message.hasOwnProperty("webDetection")) - $root.google.cloud.vision.v1p4beta1.WebDetection.encode(message.webDetection, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); - if (message.productSearchResults != null && message.hasOwnProperty("productSearchResults")) - $root.google.cloud.vision.v1p4beta1.ProductSearchResults.encode(message.productSearchResults, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); - if (message.context != null && message.hasOwnProperty("context")) - $root.google.cloud.vision.v1p4beta1.ImageAnnotationContext.encode(message.context, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); - if (message.localizedObjectAnnotations != null && message.localizedObjectAnnotations.length) - for (var i = 0; i < message.localizedObjectAnnotations.length; ++i) - $root.google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation.encode(message.localizedObjectAnnotations[i], writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); + if (message.cropHints != null && message.cropHints.length) + for (var i = 0; i < message.cropHints.length; ++i) + $root.google.cloud.vision.v1p4beta1.CropHint.encode(message.cropHints[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified AnnotateImageResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateImageResponse.verify|verify} messages. + * Encodes the specified CropHintsAnnotation message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.CropHintsAnnotation.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p4beta1.CropHintsAnnotation * @static - * @param {google.cloud.vision.v1p4beta1.IAnnotateImageResponse} message AnnotateImageResponse message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.ICropHintsAnnotation} message CropHintsAnnotation message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateImageResponse.encodeDelimited = function encodeDelimited(message, writer) { + CropHintsAnnotation.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AnnotateImageResponse message from the specified reader or buffer. + * Decodes a CropHintsAnnotation message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p4beta1.CropHintsAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.AnnotateImageResponse} AnnotateImageResponse + * @returns {google.cloud.vision.v1p4beta1.CropHintsAnnotation} CropHintsAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateImageResponse.decode = function decode(reader, length) { + CropHintsAnnotation.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.vision.v1p4beta1.AnnotateImageResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.CropHintsAnnotation(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.faceAnnotations && message.faceAnnotations.length)) - message.faceAnnotations = []; - message.faceAnnotations.push($root.google.cloud.vision.v1p4beta1.FaceAnnotation.decode(reader, reader.uint32())); - break; - case 2: - if (!(message.landmarkAnnotations && message.landmarkAnnotations.length)) - message.landmarkAnnotations = []; - message.landmarkAnnotations.push($root.google.cloud.vision.v1p4beta1.EntityAnnotation.decode(reader, reader.uint32())); - break; - case 3: - if (!(message.logoAnnotations && message.logoAnnotations.length)) - message.logoAnnotations = []; - message.logoAnnotations.push($root.google.cloud.vision.v1p4beta1.EntityAnnotation.decode(reader, reader.uint32())); - break; - case 4: - if (!(message.labelAnnotations && message.labelAnnotations.length)) - message.labelAnnotations = []; - message.labelAnnotations.push($root.google.cloud.vision.v1p4beta1.EntityAnnotation.decode(reader, reader.uint32())); - break; - case 22: - if (!(message.localizedObjectAnnotations && message.localizedObjectAnnotations.length)) - message.localizedObjectAnnotations = []; - message.localizedObjectAnnotations.push($root.google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation.decode(reader, reader.uint32())); - break; - case 5: - if (!(message.textAnnotations && message.textAnnotations.length)) - message.textAnnotations = []; - message.textAnnotations.push($root.google.cloud.vision.v1p4beta1.EntityAnnotation.decode(reader, reader.uint32())); - break; - case 12: - message.fullTextAnnotation = $root.google.cloud.vision.v1p4beta1.TextAnnotation.decode(reader, reader.uint32()); - break; - case 6: - message.safeSearchAnnotation = $root.google.cloud.vision.v1p4beta1.SafeSearchAnnotation.decode(reader, reader.uint32()); - break; - case 8: - message.imagePropertiesAnnotation = $root.google.cloud.vision.v1p4beta1.ImageProperties.decode(reader, reader.uint32()); - break; - case 11: - message.cropHintsAnnotation = $root.google.cloud.vision.v1p4beta1.CropHintsAnnotation.decode(reader, reader.uint32()); - break; - case 13: - message.webDetection = $root.google.cloud.vision.v1p4beta1.WebDetection.decode(reader, reader.uint32()); - break; - case 14: - message.productSearchResults = $root.google.cloud.vision.v1p4beta1.ProductSearchResults.decode(reader, reader.uint32()); - break; - case 9: - message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); - break; - case 21: - message.context = $root.google.cloud.vision.v1p4beta1.ImageAnnotationContext.decode(reader, reader.uint32()); + if (!(message.cropHints && message.cropHints.length)) + message.cropHints = []; + message.cropHints.push($root.google.cloud.vision.v1p4beta1.CropHint.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -79659,357 +79591,125 @@ }; /** - * Decodes an AnnotateImageResponse message from the specified reader or buffer, length delimited. + * Decodes a CropHintsAnnotation message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p4beta1.CropHintsAnnotation * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.AnnotateImageResponse} AnnotateImageResponse + * @returns {google.cloud.vision.v1p4beta1.CropHintsAnnotation} CropHintsAnnotation * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateImageResponse.decodeDelimited = function decodeDelimited(reader) { + CropHintsAnnotation.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AnnotateImageResponse message. + * Verifies a CropHintsAnnotation message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p4beta1.CropHintsAnnotation * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AnnotateImageResponse.verify = function verify(message) { + CropHintsAnnotation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.faceAnnotations != null && message.hasOwnProperty("faceAnnotations")) { - if (!Array.isArray(message.faceAnnotations)) - return "faceAnnotations: array expected"; - for (var i = 0; i < message.faceAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.FaceAnnotation.verify(message.faceAnnotations[i]); - if (error) - return "faceAnnotations." + error; - } - } - if (message.landmarkAnnotations != null && message.hasOwnProperty("landmarkAnnotations")) { - if (!Array.isArray(message.landmarkAnnotations)) - return "landmarkAnnotations: array expected"; - for (var i = 0; i < message.landmarkAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.EntityAnnotation.verify(message.landmarkAnnotations[i]); - if (error) - return "landmarkAnnotations." + error; - } - } - if (message.logoAnnotations != null && message.hasOwnProperty("logoAnnotations")) { - if (!Array.isArray(message.logoAnnotations)) - return "logoAnnotations: array expected"; - for (var i = 0; i < message.logoAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.EntityAnnotation.verify(message.logoAnnotations[i]); - if (error) - return "logoAnnotations." + error; - } - } - if (message.labelAnnotations != null && message.hasOwnProperty("labelAnnotations")) { - if (!Array.isArray(message.labelAnnotations)) - return "labelAnnotations: array expected"; - for (var i = 0; i < message.labelAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.EntityAnnotation.verify(message.labelAnnotations[i]); - if (error) - return "labelAnnotations." + error; - } - } - if (message.localizedObjectAnnotations != null && message.hasOwnProperty("localizedObjectAnnotations")) { - if (!Array.isArray(message.localizedObjectAnnotations)) - return "localizedObjectAnnotations: array expected"; - for (var i = 0; i < message.localizedObjectAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation.verify(message.localizedObjectAnnotations[i]); - if (error) - return "localizedObjectAnnotations." + error; - } - } - if (message.textAnnotations != null && message.hasOwnProperty("textAnnotations")) { - if (!Array.isArray(message.textAnnotations)) - return "textAnnotations: array expected"; - for (var i = 0; i < message.textAnnotations.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.EntityAnnotation.verify(message.textAnnotations[i]); + if (message.cropHints != null && message.hasOwnProperty("cropHints")) { + if (!Array.isArray(message.cropHints)) + return "cropHints: array expected"; + for (var i = 0; i < message.cropHints.length; ++i) { + var error = $root.google.cloud.vision.v1p4beta1.CropHint.verify(message.cropHints[i]); if (error) - return "textAnnotations." + error; + return "cropHints." + error; } } - if (message.fullTextAnnotation != null && message.hasOwnProperty("fullTextAnnotation")) { - var error = $root.google.cloud.vision.v1p4beta1.TextAnnotation.verify(message.fullTextAnnotation); - if (error) - return "fullTextAnnotation." + error; - } - if (message.safeSearchAnnotation != null && message.hasOwnProperty("safeSearchAnnotation")) { - var error = $root.google.cloud.vision.v1p4beta1.SafeSearchAnnotation.verify(message.safeSearchAnnotation); - if (error) - return "safeSearchAnnotation." + error; - } - if (message.imagePropertiesAnnotation != null && message.hasOwnProperty("imagePropertiesAnnotation")) { - var error = $root.google.cloud.vision.v1p4beta1.ImageProperties.verify(message.imagePropertiesAnnotation); - if (error) - return "imagePropertiesAnnotation." + error; - } - if (message.cropHintsAnnotation != null && message.hasOwnProperty("cropHintsAnnotation")) { - var error = $root.google.cloud.vision.v1p4beta1.CropHintsAnnotation.verify(message.cropHintsAnnotation); - if (error) - return "cropHintsAnnotation." + error; - } - if (message.webDetection != null && message.hasOwnProperty("webDetection")) { - var error = $root.google.cloud.vision.v1p4beta1.WebDetection.verify(message.webDetection); - if (error) - return "webDetection." + error; - } - if (message.productSearchResults != null && message.hasOwnProperty("productSearchResults")) { - var error = $root.google.cloud.vision.v1p4beta1.ProductSearchResults.verify(message.productSearchResults); - if (error) - return "productSearchResults." + error; - } - if (message.error != null && message.hasOwnProperty("error")) { - var error = $root.google.rpc.Status.verify(message.error); - if (error) - return "error." + error; - } - if (message.context != null && message.hasOwnProperty("context")) { - var error = $root.google.cloud.vision.v1p4beta1.ImageAnnotationContext.verify(message.context); - if (error) - return "context." + error; - } return null; }; /** - * Creates an AnnotateImageResponse message from a plain object. Also converts values to their respective internal types. + * Creates a CropHintsAnnotation message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p4beta1.CropHintsAnnotation * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.AnnotateImageResponse} AnnotateImageResponse + * @returns {google.cloud.vision.v1p4beta1.CropHintsAnnotation} CropHintsAnnotation */ - AnnotateImageResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.AnnotateImageResponse) + CropHintsAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.CropHintsAnnotation) return object; - var message = new $root.google.cloud.vision.v1p4beta1.AnnotateImageResponse(); - if (object.faceAnnotations) { - if (!Array.isArray(object.faceAnnotations)) - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.faceAnnotations: array expected"); - message.faceAnnotations = []; - for (var i = 0; i < object.faceAnnotations.length; ++i) { - if (typeof object.faceAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.faceAnnotations: object expected"); - message.faceAnnotations[i] = $root.google.cloud.vision.v1p4beta1.FaceAnnotation.fromObject(object.faceAnnotations[i]); - } - } - if (object.landmarkAnnotations) { - if (!Array.isArray(object.landmarkAnnotations)) - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.landmarkAnnotations: array expected"); - message.landmarkAnnotations = []; - for (var i = 0; i < object.landmarkAnnotations.length; ++i) { - if (typeof object.landmarkAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.landmarkAnnotations: object expected"); - message.landmarkAnnotations[i] = $root.google.cloud.vision.v1p4beta1.EntityAnnotation.fromObject(object.landmarkAnnotations[i]); - } - } - if (object.logoAnnotations) { - if (!Array.isArray(object.logoAnnotations)) - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.logoAnnotations: array expected"); - message.logoAnnotations = []; - for (var i = 0; i < object.logoAnnotations.length; ++i) { - if (typeof object.logoAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.logoAnnotations: object expected"); - message.logoAnnotations[i] = $root.google.cloud.vision.v1p4beta1.EntityAnnotation.fromObject(object.logoAnnotations[i]); - } - } - if (object.labelAnnotations) { - if (!Array.isArray(object.labelAnnotations)) - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.labelAnnotations: array expected"); - message.labelAnnotations = []; - for (var i = 0; i < object.labelAnnotations.length; ++i) { - if (typeof object.labelAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.labelAnnotations: object expected"); - message.labelAnnotations[i] = $root.google.cloud.vision.v1p4beta1.EntityAnnotation.fromObject(object.labelAnnotations[i]); - } - } - if (object.localizedObjectAnnotations) { - if (!Array.isArray(object.localizedObjectAnnotations)) - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.localizedObjectAnnotations: array expected"); - message.localizedObjectAnnotations = []; - for (var i = 0; i < object.localizedObjectAnnotations.length; ++i) { - if (typeof object.localizedObjectAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.localizedObjectAnnotations: object expected"); - message.localizedObjectAnnotations[i] = $root.google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation.fromObject(object.localizedObjectAnnotations[i]); - } - } - if (object.textAnnotations) { - if (!Array.isArray(object.textAnnotations)) - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.textAnnotations: array expected"); - message.textAnnotations = []; - for (var i = 0; i < object.textAnnotations.length; ++i) { - if (typeof object.textAnnotations[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.textAnnotations: object expected"); - message.textAnnotations[i] = $root.google.cloud.vision.v1p4beta1.EntityAnnotation.fromObject(object.textAnnotations[i]); + var message = new $root.google.cloud.vision.v1p4beta1.CropHintsAnnotation(); + if (object.cropHints) { + if (!Array.isArray(object.cropHints)) + throw TypeError(".google.cloud.vision.v1p4beta1.CropHintsAnnotation.cropHints: array expected"); + message.cropHints = []; + for (var i = 0; i < object.cropHints.length; ++i) { + if (typeof object.cropHints[i] !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.CropHintsAnnotation.cropHints: object expected"); + message.cropHints[i] = $root.google.cloud.vision.v1p4beta1.CropHint.fromObject(object.cropHints[i]); } } - if (object.fullTextAnnotation != null) { - if (typeof object.fullTextAnnotation !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.fullTextAnnotation: object expected"); - message.fullTextAnnotation = $root.google.cloud.vision.v1p4beta1.TextAnnotation.fromObject(object.fullTextAnnotation); - } - if (object.safeSearchAnnotation != null) { - if (typeof object.safeSearchAnnotation !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.safeSearchAnnotation: object expected"); - message.safeSearchAnnotation = $root.google.cloud.vision.v1p4beta1.SafeSearchAnnotation.fromObject(object.safeSearchAnnotation); - } - if (object.imagePropertiesAnnotation != null) { - if (typeof object.imagePropertiesAnnotation !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.imagePropertiesAnnotation: object expected"); - message.imagePropertiesAnnotation = $root.google.cloud.vision.v1p4beta1.ImageProperties.fromObject(object.imagePropertiesAnnotation); - } - if (object.cropHintsAnnotation != null) { - if (typeof object.cropHintsAnnotation !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.cropHintsAnnotation: object expected"); - message.cropHintsAnnotation = $root.google.cloud.vision.v1p4beta1.CropHintsAnnotation.fromObject(object.cropHintsAnnotation); - } - if (object.webDetection != null) { - if (typeof object.webDetection !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.webDetection: object expected"); - message.webDetection = $root.google.cloud.vision.v1p4beta1.WebDetection.fromObject(object.webDetection); - } - if (object.productSearchResults != null) { - if (typeof object.productSearchResults !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.productSearchResults: object expected"); - message.productSearchResults = $root.google.cloud.vision.v1p4beta1.ProductSearchResults.fromObject(object.productSearchResults); - } - if (object.error != null) { - if (typeof object.error !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.error: object expected"); - message.error = $root.google.rpc.Status.fromObject(object.error); - } - if (object.context != null) { - if (typeof object.context !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.context: object expected"); - message.context = $root.google.cloud.vision.v1p4beta1.ImageAnnotationContext.fromObject(object.context); - } return message; }; /** - * Creates a plain object from an AnnotateImageResponse message. Also converts values to other types if specified. + * Creates a plain object from a CropHintsAnnotation message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p4beta1.CropHintsAnnotation * @static - * @param {google.cloud.vision.v1p4beta1.AnnotateImageResponse} message AnnotateImageResponse + * @param {google.cloud.vision.v1p4beta1.CropHintsAnnotation} message CropHintsAnnotation * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AnnotateImageResponse.toObject = function toObject(message, options) { + CropHintsAnnotation.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.faceAnnotations = []; - object.landmarkAnnotations = []; - object.logoAnnotations = []; - object.labelAnnotations = []; - object.textAnnotations = []; - object.localizedObjectAnnotations = []; - } - if (options.defaults) { - object.safeSearchAnnotation = null; - object.imagePropertiesAnnotation = null; - object.error = null; - object.cropHintsAnnotation = null; - object.fullTextAnnotation = null; - object.webDetection = null; - object.productSearchResults = null; - object.context = null; - } - if (message.faceAnnotations && message.faceAnnotations.length) { - object.faceAnnotations = []; - for (var j = 0; j < message.faceAnnotations.length; ++j) - object.faceAnnotations[j] = $root.google.cloud.vision.v1p4beta1.FaceAnnotation.toObject(message.faceAnnotations[j], options); - } - if (message.landmarkAnnotations && message.landmarkAnnotations.length) { - object.landmarkAnnotations = []; - for (var j = 0; j < message.landmarkAnnotations.length; ++j) - object.landmarkAnnotations[j] = $root.google.cloud.vision.v1p4beta1.EntityAnnotation.toObject(message.landmarkAnnotations[j], options); - } - if (message.logoAnnotations && message.logoAnnotations.length) { - object.logoAnnotations = []; - for (var j = 0; j < message.logoAnnotations.length; ++j) - object.logoAnnotations[j] = $root.google.cloud.vision.v1p4beta1.EntityAnnotation.toObject(message.logoAnnotations[j], options); - } - if (message.labelAnnotations && message.labelAnnotations.length) { - object.labelAnnotations = []; - for (var j = 0; j < message.labelAnnotations.length; ++j) - object.labelAnnotations[j] = $root.google.cloud.vision.v1p4beta1.EntityAnnotation.toObject(message.labelAnnotations[j], options); - } - if (message.textAnnotations && message.textAnnotations.length) { - object.textAnnotations = []; - for (var j = 0; j < message.textAnnotations.length; ++j) - object.textAnnotations[j] = $root.google.cloud.vision.v1p4beta1.EntityAnnotation.toObject(message.textAnnotations[j], options); - } - if (message.safeSearchAnnotation != null && message.hasOwnProperty("safeSearchAnnotation")) - object.safeSearchAnnotation = $root.google.cloud.vision.v1p4beta1.SafeSearchAnnotation.toObject(message.safeSearchAnnotation, options); - if (message.imagePropertiesAnnotation != null && message.hasOwnProperty("imagePropertiesAnnotation")) - object.imagePropertiesAnnotation = $root.google.cloud.vision.v1p4beta1.ImageProperties.toObject(message.imagePropertiesAnnotation, options); - if (message.error != null && message.hasOwnProperty("error")) - object.error = $root.google.rpc.Status.toObject(message.error, options); - if (message.cropHintsAnnotation != null && message.hasOwnProperty("cropHintsAnnotation")) - object.cropHintsAnnotation = $root.google.cloud.vision.v1p4beta1.CropHintsAnnotation.toObject(message.cropHintsAnnotation, options); - if (message.fullTextAnnotation != null && message.hasOwnProperty("fullTextAnnotation")) - object.fullTextAnnotation = $root.google.cloud.vision.v1p4beta1.TextAnnotation.toObject(message.fullTextAnnotation, options); - if (message.webDetection != null && message.hasOwnProperty("webDetection")) - object.webDetection = $root.google.cloud.vision.v1p4beta1.WebDetection.toObject(message.webDetection, options); - if (message.productSearchResults != null && message.hasOwnProperty("productSearchResults")) - object.productSearchResults = $root.google.cloud.vision.v1p4beta1.ProductSearchResults.toObject(message.productSearchResults, options); - if (message.context != null && message.hasOwnProperty("context")) - object.context = $root.google.cloud.vision.v1p4beta1.ImageAnnotationContext.toObject(message.context, options); - if (message.localizedObjectAnnotations && message.localizedObjectAnnotations.length) { - object.localizedObjectAnnotations = []; - for (var j = 0; j < message.localizedObjectAnnotations.length; ++j) - object.localizedObjectAnnotations[j] = $root.google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation.toObject(message.localizedObjectAnnotations[j], options); + if (options.arrays || options.defaults) + object.cropHints = []; + if (message.cropHints && message.cropHints.length) { + object.cropHints = []; + for (var j = 0; j < message.cropHints.length; ++j) + object.cropHints[j] = $root.google.cloud.vision.v1p4beta1.CropHint.toObject(message.cropHints[j], options); } return object; }; /** - * Converts this AnnotateImageResponse to JSON. + * Converts this CropHintsAnnotation to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse + * @memberof google.cloud.vision.v1p4beta1.CropHintsAnnotation * @instance * @returns {Object.} JSON object */ - AnnotateImageResponse.prototype.toJSON = function toJSON() { + CropHintsAnnotation.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AnnotateImageResponse; + return CropHintsAnnotation; })(); - v1p4beta1.BatchAnnotateImagesRequest = (function() { + v1p4beta1.CropHintsParams = (function() { /** - * Properties of a BatchAnnotateImagesRequest. + * Properties of a CropHintsParams. * @memberof google.cloud.vision.v1p4beta1 - * @interface IBatchAnnotateImagesRequest - * @property {Array.|null} [requests] BatchAnnotateImagesRequest requests + * @interface ICropHintsParams + * @property {Array.|null} [aspectRatios] CropHintsParams aspectRatios */ /** - * Constructs a new BatchAnnotateImagesRequest. + * Constructs a new CropHintsParams. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a BatchAnnotateImagesRequest. - * @implements IBatchAnnotateImagesRequest + * @classdesc Represents a CropHintsParams. + * @implements ICropHintsParams * @constructor - * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.ICropHintsParams=} [properties] Properties to set */ - function BatchAnnotateImagesRequest(properties) { - this.requests = []; + function CropHintsParams(properties) { + this.aspectRatios = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -80017,78 +79717,86 @@ } /** - * BatchAnnotateImagesRequest requests. - * @member {Array.} requests - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest + * CropHintsParams aspectRatios. + * @member {Array.} aspectRatios + * @memberof google.cloud.vision.v1p4beta1.CropHintsParams * @instance */ - BatchAnnotateImagesRequest.prototype.requests = $util.emptyArray; + CropHintsParams.prototype.aspectRatios = $util.emptyArray; /** - * Creates a new BatchAnnotateImagesRequest instance using the specified properties. + * Creates a new CropHintsParams instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p4beta1.CropHintsParams * @static - * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest instance + * @param {google.cloud.vision.v1p4beta1.ICropHintsParams=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.CropHintsParams} CropHintsParams instance */ - BatchAnnotateImagesRequest.create = function create(properties) { - return new BatchAnnotateImagesRequest(properties); + CropHintsParams.create = function create(properties) { + return new CropHintsParams(properties); }; /** - * Encodes the specified BatchAnnotateImagesRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest.verify|verify} messages. + * Encodes the specified CropHintsParams message. Does not implicitly {@link google.cloud.vision.v1p4beta1.CropHintsParams.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p4beta1.CropHintsParams * @static - * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest} message BatchAnnotateImagesRequest message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.ICropHintsParams} message CropHintsParams message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchAnnotateImagesRequest.encode = function encode(message, writer) { + CropHintsParams.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.requests != null && message.requests.length) - for (var i = 0; i < message.requests.length; ++i) - $root.google.cloud.vision.v1p4beta1.AnnotateImageRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.aspectRatios != null && message.aspectRatios.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.aspectRatios.length; ++i) + writer.float(message.aspectRatios[i]); + writer.ldelim(); + } return writer; }; /** - * Encodes the specified BatchAnnotateImagesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest.verify|verify} messages. + * Encodes the specified CropHintsParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.CropHintsParams.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p4beta1.CropHintsParams * @static - * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest} message BatchAnnotateImagesRequest message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.ICropHintsParams} message CropHintsParams message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchAnnotateImagesRequest.encodeDelimited = function encodeDelimited(message, writer) { + CropHintsParams.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer. + * Decodes a CropHintsParams message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p4beta1.CropHintsParams * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest + * @returns {google.cloud.vision.v1p4beta1.CropHintsParams} CropHintsParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchAnnotateImagesRequest.decode = function decode(reader, length) { + CropHintsParams.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.vision.v1p4beta1.BatchAnnotateImagesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.CropHintsParams(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.requests && message.requests.length)) - message.requests = []; - message.requests.push($root.google.cloud.vision.v1p4beta1.AnnotateImageRequest.decode(reader, reader.uint32())); + if (!(message.aspectRatios && message.aspectRatios.length)) + message.aspectRatios = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.aspectRatios.push(reader.float()); + } else + message.aspectRatios.push(reader.float()); break; default: reader.skipType(tag & 7); @@ -80099,125 +79807,119 @@ }; /** - * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. + * Decodes a CropHintsParams message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p4beta1.CropHintsParams * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest + * @returns {google.cloud.vision.v1p4beta1.CropHintsParams} CropHintsParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchAnnotateImagesRequest.decodeDelimited = function decodeDelimited(reader) { + CropHintsParams.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BatchAnnotateImagesRequest message. + * Verifies a CropHintsParams message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p4beta1.CropHintsParams * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BatchAnnotateImagesRequest.verify = function verify(message) { + CropHintsParams.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.requests != null && message.hasOwnProperty("requests")) { - if (!Array.isArray(message.requests)) - return "requests: array expected"; - for (var i = 0; i < message.requests.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.AnnotateImageRequest.verify(message.requests[i]); - if (error) - return "requests." + error; - } + if (message.aspectRatios != null && message.hasOwnProperty("aspectRatios")) { + if (!Array.isArray(message.aspectRatios)) + return "aspectRatios: array expected"; + for (var i = 0; i < message.aspectRatios.length; ++i) + if (typeof message.aspectRatios[i] !== "number") + return "aspectRatios: number[] expected"; } return null; }; /** - * Creates a BatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. + * Creates a CropHintsParams message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p4beta1.CropHintsParams * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest + * @returns {google.cloud.vision.v1p4beta1.CropHintsParams} CropHintsParams */ - BatchAnnotateImagesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest) + CropHintsParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.CropHintsParams) return object; - var message = new $root.google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest(); - if (object.requests) { - if (!Array.isArray(object.requests)) - throw TypeError(".google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest.requests: array expected"); - message.requests = []; - for (var i = 0; i < object.requests.length; ++i) { - if (typeof object.requests[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest.requests: object expected"); - message.requests[i] = $root.google.cloud.vision.v1p4beta1.AnnotateImageRequest.fromObject(object.requests[i]); - } + var message = new $root.google.cloud.vision.v1p4beta1.CropHintsParams(); + if (object.aspectRatios) { + if (!Array.isArray(object.aspectRatios)) + throw TypeError(".google.cloud.vision.v1p4beta1.CropHintsParams.aspectRatios: array expected"); + message.aspectRatios = []; + for (var i = 0; i < object.aspectRatios.length; ++i) + message.aspectRatios[i] = Number(object.aspectRatios[i]); } return message; }; /** - * Creates a plain object from a BatchAnnotateImagesRequest message. Also converts values to other types if specified. + * Creates a plain object from a CropHintsParams message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p4beta1.CropHintsParams * @static - * @param {google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest} message BatchAnnotateImagesRequest + * @param {google.cloud.vision.v1p4beta1.CropHintsParams} message CropHintsParams * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BatchAnnotateImagesRequest.toObject = function toObject(message, options) { + CropHintsParams.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.requests = []; - if (message.requests && message.requests.length) { - object.requests = []; - for (var j = 0; j < message.requests.length; ++j) - object.requests[j] = $root.google.cloud.vision.v1p4beta1.AnnotateImageRequest.toObject(message.requests[j], options); + object.aspectRatios = []; + if (message.aspectRatios && message.aspectRatios.length) { + object.aspectRatios = []; + for (var j = 0; j < message.aspectRatios.length; ++j) + object.aspectRatios[j] = options.json && !isFinite(message.aspectRatios[j]) ? String(message.aspectRatios[j]) : message.aspectRatios[j]; } return object; }; /** - * Converts this BatchAnnotateImagesRequest to JSON. + * Converts this CropHintsParams to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p4beta1.CropHintsParams * @instance * @returns {Object.} JSON object */ - BatchAnnotateImagesRequest.prototype.toJSON = function toJSON() { + CropHintsParams.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BatchAnnotateImagesRequest; + return CropHintsParams; })(); - v1p4beta1.BatchAnnotateImagesResponse = (function() { + v1p4beta1.WebDetectionParams = (function() { /** - * Properties of a BatchAnnotateImagesResponse. + * Properties of a WebDetectionParams. * @memberof google.cloud.vision.v1p4beta1 - * @interface IBatchAnnotateImagesResponse - * @property {Array.|null} [responses] BatchAnnotateImagesResponse responses + * @interface IWebDetectionParams + * @property {boolean|null} [includeGeoResults] WebDetectionParams includeGeoResults */ /** - * Constructs a new BatchAnnotateImagesResponse. + * Constructs a new WebDetectionParams. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a BatchAnnotateImagesResponse. - * @implements IBatchAnnotateImagesResponse + * @classdesc Represents a WebDetectionParams. + * @implements IWebDetectionParams * @constructor - * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IWebDetectionParams=} [properties] Properties to set */ - function BatchAnnotateImagesResponse(properties) { - this.responses = []; + function WebDetectionParams(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -80225,78 +79927,75 @@ } /** - * BatchAnnotateImagesResponse responses. - * @member {Array.} responses - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse + * WebDetectionParams includeGeoResults. + * @member {boolean} includeGeoResults + * @memberof google.cloud.vision.v1p4beta1.WebDetectionParams * @instance */ - BatchAnnotateImagesResponse.prototype.responses = $util.emptyArray; + WebDetectionParams.prototype.includeGeoResults = false; /** - * Creates a new BatchAnnotateImagesResponse instance using the specified properties. + * Creates a new WebDetectionParams instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p4beta1.WebDetectionParams * @static - * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse instance + * @param {google.cloud.vision.v1p4beta1.IWebDetectionParams=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.WebDetectionParams} WebDetectionParams instance */ - BatchAnnotateImagesResponse.create = function create(properties) { - return new BatchAnnotateImagesResponse(properties); + WebDetectionParams.create = function create(properties) { + return new WebDetectionParams(properties); }; /** - * Encodes the specified BatchAnnotateImagesResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse.verify|verify} messages. + * Encodes the specified WebDetectionParams message. Does not implicitly {@link google.cloud.vision.v1p4beta1.WebDetectionParams.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p4beta1.WebDetectionParams * @static - * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse} message BatchAnnotateImagesResponse message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IWebDetectionParams} message WebDetectionParams message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchAnnotateImagesResponse.encode = function encode(message, writer) { + WebDetectionParams.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.responses != null && message.responses.length) - for (var i = 0; i < message.responses.length; ++i) - $root.google.cloud.vision.v1p4beta1.AnnotateImageResponse.encode(message.responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.includeGeoResults != null && message.hasOwnProperty("includeGeoResults")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.includeGeoResults); return writer; }; /** - * Encodes the specified BatchAnnotateImagesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse.verify|verify} messages. + * Encodes the specified WebDetectionParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.WebDetectionParams.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p4beta1.WebDetectionParams * @static - * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse} message BatchAnnotateImagesResponse message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IWebDetectionParams} message WebDetectionParams message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchAnnotateImagesResponse.encodeDelimited = function encodeDelimited(message, writer) { + WebDetectionParams.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BatchAnnotateImagesResponse message from the specified reader or buffer. + * Decodes a WebDetectionParams message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p4beta1.WebDetectionParams * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse + * @returns {google.cloud.vision.v1p4beta1.WebDetectionParams} WebDetectionParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchAnnotateImagesResponse.decode = function decode(reader, length) { + WebDetectionParams.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.vision.v1p4beta1.BatchAnnotateImagesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.WebDetectionParams(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.responses && message.responses.length)) - message.responses = []; - message.responses.push($root.google.cloud.vision.v1p4beta1.AnnotateImageResponse.decode(reader, reader.uint32())); + case 2: + message.includeGeoResults = reader.bool(); break; default: reader.skipType(tag & 7); @@ -80307,129 +80006,113 @@ }; /** - * Decodes a BatchAnnotateImagesResponse message from the specified reader or buffer, length delimited. + * Decodes a WebDetectionParams message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p4beta1.WebDetectionParams * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse + * @returns {google.cloud.vision.v1p4beta1.WebDetectionParams} WebDetectionParams * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchAnnotateImagesResponse.decodeDelimited = function decodeDelimited(reader) { + WebDetectionParams.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BatchAnnotateImagesResponse message. + * Verifies a WebDetectionParams message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p4beta1.WebDetectionParams * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BatchAnnotateImagesResponse.verify = function verify(message) { + WebDetectionParams.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.responses != null && message.hasOwnProperty("responses")) { - if (!Array.isArray(message.responses)) - return "responses: array expected"; - for (var i = 0; i < message.responses.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.AnnotateImageResponse.verify(message.responses[i]); - if (error) - return "responses." + error; - } - } + if (message.includeGeoResults != null && message.hasOwnProperty("includeGeoResults")) + if (typeof message.includeGeoResults !== "boolean") + return "includeGeoResults: boolean expected"; return null; }; /** - * Creates a BatchAnnotateImagesResponse message from a plain object. Also converts values to their respective internal types. + * Creates a WebDetectionParams message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p4beta1.WebDetectionParams * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse + * @returns {google.cloud.vision.v1p4beta1.WebDetectionParams} WebDetectionParams */ - BatchAnnotateImagesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse) + WebDetectionParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.WebDetectionParams) return object; - var message = new $root.google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse(); - if (object.responses) { - if (!Array.isArray(object.responses)) - throw TypeError(".google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse.responses: array expected"); - message.responses = []; - for (var i = 0; i < object.responses.length; ++i) { - if (typeof object.responses[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse.responses: object expected"); - message.responses[i] = $root.google.cloud.vision.v1p4beta1.AnnotateImageResponse.fromObject(object.responses[i]); - } - } + var message = new $root.google.cloud.vision.v1p4beta1.WebDetectionParams(); + if (object.includeGeoResults != null) + message.includeGeoResults = Boolean(object.includeGeoResults); return message; }; /** - * Creates a plain object from a BatchAnnotateImagesResponse message. Also converts values to other types if specified. + * Creates a plain object from a WebDetectionParams message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p4beta1.WebDetectionParams * @static - * @param {google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse} message BatchAnnotateImagesResponse + * @param {google.cloud.vision.v1p4beta1.WebDetectionParams} message WebDetectionParams * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BatchAnnotateImagesResponse.toObject = function toObject(message, options) { + WebDetectionParams.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.responses = []; - if (message.responses && message.responses.length) { - object.responses = []; - for (var j = 0; j < message.responses.length; ++j) - object.responses[j] = $root.google.cloud.vision.v1p4beta1.AnnotateImageResponse.toObject(message.responses[j], options); - } + if (options.defaults) + object.includeGeoResults = false; + if (message.includeGeoResults != null && message.hasOwnProperty("includeGeoResults")) + object.includeGeoResults = message.includeGeoResults; return object; }; /** - * Converts this BatchAnnotateImagesResponse to JSON. + * Converts this WebDetectionParams to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p4beta1.WebDetectionParams * @instance * @returns {Object.} JSON object */ - BatchAnnotateImagesResponse.prototype.toJSON = function toJSON() { + WebDetectionParams.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BatchAnnotateImagesResponse; + return WebDetectionParams; })(); - v1p4beta1.AnnotateFileRequest = (function() { + v1p4beta1.ImageContext = (function() { /** - * Properties of an AnnotateFileRequest. + * Properties of an ImageContext. * @memberof google.cloud.vision.v1p4beta1 - * @interface IAnnotateFileRequest - * @property {google.cloud.vision.v1p4beta1.IInputConfig|null} [inputConfig] AnnotateFileRequest inputConfig - * @property {Array.|null} [features] AnnotateFileRequest features - * @property {google.cloud.vision.v1p4beta1.IImageContext|null} [imageContext] AnnotateFileRequest imageContext - * @property {Array.|null} [pages] AnnotateFileRequest pages + * @interface IImageContext + * @property {google.cloud.vision.v1p4beta1.ILatLongRect|null} [latLongRect] ImageContext latLongRect + * @property {Array.|null} [languageHints] ImageContext languageHints + * @property {google.cloud.vision.v1p4beta1.ICropHintsParams|null} [cropHintsParams] ImageContext cropHintsParams + * @property {google.cloud.vision.v1p4beta1.IFaceRecognitionParams|null} [faceRecognitionParams] ImageContext faceRecognitionParams + * @property {google.cloud.vision.v1p4beta1.IProductSearchParams|null} [productSearchParams] ImageContext productSearchParams + * @property {google.cloud.vision.v1p4beta1.IWebDetectionParams|null} [webDetectionParams] ImageContext webDetectionParams */ /** - * Constructs a new AnnotateFileRequest. + * Constructs a new ImageContext. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an AnnotateFileRequest. - * @implements IAnnotateFileRequest + * @classdesc Represents an ImageContext. + * @implements IImageContext * @constructor - * @param {google.cloud.vision.v1p4beta1.IAnnotateFileRequest=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IImageContext=} [properties] Properties to set */ - function AnnotateFileRequest(properties) { - this.features = []; - this.pages = []; + function ImageContext(properties) { + this.languageHints = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -80437,128 +80120,143 @@ } /** - * AnnotateFileRequest inputConfig. - * @member {google.cloud.vision.v1p4beta1.IInputConfig|null|undefined} inputConfig - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest + * ImageContext latLongRect. + * @member {google.cloud.vision.v1p4beta1.ILatLongRect|null|undefined} latLongRect + * @memberof google.cloud.vision.v1p4beta1.ImageContext * @instance */ - AnnotateFileRequest.prototype.inputConfig = null; + ImageContext.prototype.latLongRect = null; /** - * AnnotateFileRequest features. - * @member {Array.} features - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest + * ImageContext languageHints. + * @member {Array.} languageHints + * @memberof google.cloud.vision.v1p4beta1.ImageContext * @instance */ - AnnotateFileRequest.prototype.features = $util.emptyArray; + ImageContext.prototype.languageHints = $util.emptyArray; /** - * AnnotateFileRequest imageContext. - * @member {google.cloud.vision.v1p4beta1.IImageContext|null|undefined} imageContext - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest + * ImageContext cropHintsParams. + * @member {google.cloud.vision.v1p4beta1.ICropHintsParams|null|undefined} cropHintsParams + * @memberof google.cloud.vision.v1p4beta1.ImageContext * @instance */ - AnnotateFileRequest.prototype.imageContext = null; + ImageContext.prototype.cropHintsParams = null; /** - * AnnotateFileRequest pages. - * @member {Array.} pages - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest + * ImageContext faceRecognitionParams. + * @member {google.cloud.vision.v1p4beta1.IFaceRecognitionParams|null|undefined} faceRecognitionParams + * @memberof google.cloud.vision.v1p4beta1.ImageContext * @instance */ - AnnotateFileRequest.prototype.pages = $util.emptyArray; + ImageContext.prototype.faceRecognitionParams = null; /** - * Creates a new AnnotateFileRequest instance using the specified properties. + * ImageContext productSearchParams. + * @member {google.cloud.vision.v1p4beta1.IProductSearchParams|null|undefined} productSearchParams + * @memberof google.cloud.vision.v1p4beta1.ImageContext + * @instance + */ + ImageContext.prototype.productSearchParams = null; + + /** + * ImageContext webDetectionParams. + * @member {google.cloud.vision.v1p4beta1.IWebDetectionParams|null|undefined} webDetectionParams + * @memberof google.cloud.vision.v1p4beta1.ImageContext + * @instance + */ + ImageContext.prototype.webDetectionParams = null; + + /** + * Creates a new ImageContext instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest + * @memberof google.cloud.vision.v1p4beta1.ImageContext * @static - * @param {google.cloud.vision.v1p4beta1.IAnnotateFileRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.AnnotateFileRequest} AnnotateFileRequest instance + * @param {google.cloud.vision.v1p4beta1.IImageContext=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.ImageContext} ImageContext instance */ - AnnotateFileRequest.create = function create(properties) { - return new AnnotateFileRequest(properties); + ImageContext.create = function create(properties) { + return new ImageContext(properties); }; /** - * Encodes the specified AnnotateFileRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateFileRequest.verify|verify} messages. + * Encodes the specified ImageContext message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageContext.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest + * @memberof google.cloud.vision.v1p4beta1.ImageContext * @static - * @param {google.cloud.vision.v1p4beta1.IAnnotateFileRequest} message AnnotateFileRequest message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IImageContext} message ImageContext message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateFileRequest.encode = function encode(message, writer) { + ImageContext.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - $root.google.cloud.vision.v1p4beta1.InputConfig.encode(message.inputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.features != null && message.features.length) - for (var i = 0; i < message.features.length; ++i) - $root.google.cloud.vision.v1p4beta1.Feature.encode(message.features[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.imageContext != null && message.hasOwnProperty("imageContext")) - $root.google.cloud.vision.v1p4beta1.ImageContext.encode(message.imageContext, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.pages != null && message.pages.length) { - writer.uint32(/* id 4, wireType 2 =*/34).fork(); - for (var i = 0; i < message.pages.length; ++i) - writer.int32(message.pages[i]); - writer.ldelim(); - } + if (message.latLongRect != null && message.hasOwnProperty("latLongRect")) + $root.google.cloud.vision.v1p4beta1.LatLongRect.encode(message.latLongRect, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.languageHints != null && message.languageHints.length) + for (var i = 0; i < message.languageHints.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageHints[i]); + if (message.cropHintsParams != null && message.hasOwnProperty("cropHintsParams")) + $root.google.cloud.vision.v1p4beta1.CropHintsParams.encode(message.cropHintsParams, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.productSearchParams != null && message.hasOwnProperty("productSearchParams")) + $root.google.cloud.vision.v1p4beta1.ProductSearchParams.encode(message.productSearchParams, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.webDetectionParams != null && message.hasOwnProperty("webDetectionParams")) + $root.google.cloud.vision.v1p4beta1.WebDetectionParams.encode(message.webDetectionParams, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.faceRecognitionParams != null && message.hasOwnProperty("faceRecognitionParams")) + $root.google.cloud.vision.v1p4beta1.FaceRecognitionParams.encode(message.faceRecognitionParams, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); return writer; }; /** - * Encodes the specified AnnotateFileRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateFileRequest.verify|verify} messages. + * Encodes the specified ImageContext message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageContext.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest + * @memberof google.cloud.vision.v1p4beta1.ImageContext * @static - * @param {google.cloud.vision.v1p4beta1.IAnnotateFileRequest} message AnnotateFileRequest message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IImageContext} message ImageContext message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateFileRequest.encodeDelimited = function encodeDelimited(message, writer) { + ImageContext.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AnnotateFileRequest message from the specified reader or buffer. + * Decodes an ImageContext message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest + * @memberof google.cloud.vision.v1p4beta1.ImageContext * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.AnnotateFileRequest} AnnotateFileRequest + * @returns {google.cloud.vision.v1p4beta1.ImageContext} ImageContext * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateFileRequest.decode = function decode(reader, length) { + ImageContext.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.vision.v1p4beta1.AnnotateFileRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.ImageContext(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.inputConfig = $root.google.cloud.vision.v1p4beta1.InputConfig.decode(reader, reader.uint32()); + message.latLongRect = $root.google.cloud.vision.v1p4beta1.LatLongRect.decode(reader, reader.uint32()); break; case 2: - if (!(message.features && message.features.length)) - message.features = []; - message.features.push($root.google.cloud.vision.v1p4beta1.Feature.decode(reader, reader.uint32())); - break; - case 3: - message.imageContext = $root.google.cloud.vision.v1p4beta1.ImageContext.decode(reader, reader.uint32()); + if (!(message.languageHints && message.languageHints.length)) + message.languageHints = []; + message.languageHints.push(reader.string()); break; case 4: - if (!(message.pages && message.pages.length)) - message.pages = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.pages.push(reader.int32()); - } else - message.pages.push(reader.int32()); + message.cropHintsParams = $root.google.cloud.vision.v1p4beta1.CropHintsParams.decode(reader, reader.uint32()); + break; + case 10: + message.faceRecognitionParams = $root.google.cloud.vision.v1p4beta1.FaceRecognitionParams.decode(reader, reader.uint32()); + break; + case 5: + message.productSearchParams = $root.google.cloud.vision.v1p4beta1.ProductSearchParams.decode(reader, reader.uint32()); + break; + case 6: + message.webDetectionParams = $root.google.cloud.vision.v1p4beta1.WebDetectionParams.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -80569,177 +80267,189 @@ }; /** - * Decodes an AnnotateFileRequest message from the specified reader or buffer, length delimited. + * Decodes an ImageContext message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest + * @memberof google.cloud.vision.v1p4beta1.ImageContext * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.AnnotateFileRequest} AnnotateFileRequest + * @returns {google.cloud.vision.v1p4beta1.ImageContext} ImageContext * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateFileRequest.decodeDelimited = function decodeDelimited(reader) { + ImageContext.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AnnotateFileRequest message. + * Verifies an ImageContext message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest + * @memberof google.cloud.vision.v1p4beta1.ImageContext * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AnnotateFileRequest.verify = function verify(message) { + ImageContext.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.vision.v1p4beta1.InputConfig.verify(message.inputConfig); + if (message.latLongRect != null && message.hasOwnProperty("latLongRect")) { + var error = $root.google.cloud.vision.v1p4beta1.LatLongRect.verify(message.latLongRect); if (error) - return "inputConfig." + error; + return "latLongRect." + error; } - if (message.features != null && message.hasOwnProperty("features")) { - if (!Array.isArray(message.features)) - return "features: array expected"; - for (var i = 0; i < message.features.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.Feature.verify(message.features[i]); - if (error) - return "features." + error; - } + if (message.languageHints != null && message.hasOwnProperty("languageHints")) { + if (!Array.isArray(message.languageHints)) + return "languageHints: array expected"; + for (var i = 0; i < message.languageHints.length; ++i) + if (!$util.isString(message.languageHints[i])) + return "languageHints: string[] expected"; } - if (message.imageContext != null && message.hasOwnProperty("imageContext")) { - var error = $root.google.cloud.vision.v1p4beta1.ImageContext.verify(message.imageContext); + if (message.cropHintsParams != null && message.hasOwnProperty("cropHintsParams")) { + var error = $root.google.cloud.vision.v1p4beta1.CropHintsParams.verify(message.cropHintsParams); if (error) - return "imageContext." + error; + return "cropHintsParams." + error; } - if (message.pages != null && message.hasOwnProperty("pages")) { - if (!Array.isArray(message.pages)) - return "pages: array expected"; - for (var i = 0; i < message.pages.length; ++i) - if (!$util.isInteger(message.pages[i])) - return "pages: integer[] expected"; + if (message.faceRecognitionParams != null && message.hasOwnProperty("faceRecognitionParams")) { + var error = $root.google.cloud.vision.v1p4beta1.FaceRecognitionParams.verify(message.faceRecognitionParams); + if (error) + return "faceRecognitionParams." + error; + } + if (message.productSearchParams != null && message.hasOwnProperty("productSearchParams")) { + var error = $root.google.cloud.vision.v1p4beta1.ProductSearchParams.verify(message.productSearchParams); + if (error) + return "productSearchParams." + error; + } + if (message.webDetectionParams != null && message.hasOwnProperty("webDetectionParams")) { + var error = $root.google.cloud.vision.v1p4beta1.WebDetectionParams.verify(message.webDetectionParams); + if (error) + return "webDetectionParams." + error; } return null; }; /** - * Creates an AnnotateFileRequest message from a plain object. Also converts values to their respective internal types. + * Creates an ImageContext message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest + * @memberof google.cloud.vision.v1p4beta1.ImageContext * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.AnnotateFileRequest} AnnotateFileRequest + * @returns {google.cloud.vision.v1p4beta1.ImageContext} ImageContext */ - AnnotateFileRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.AnnotateFileRequest) + ImageContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.ImageContext) return object; - var message = new $root.google.cloud.vision.v1p4beta1.AnnotateFileRequest(); - if (object.inputConfig != null) { - if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateFileRequest.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.vision.v1p4beta1.InputConfig.fromObject(object.inputConfig); + var message = new $root.google.cloud.vision.v1p4beta1.ImageContext(); + if (object.latLongRect != null) { + if (typeof object.latLongRect !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.ImageContext.latLongRect: object expected"); + message.latLongRect = $root.google.cloud.vision.v1p4beta1.LatLongRect.fromObject(object.latLongRect); } - if (object.features) { - if (!Array.isArray(object.features)) - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateFileRequest.features: array expected"); - message.features = []; - for (var i = 0; i < object.features.length; ++i) { - if (typeof object.features[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateFileRequest.features: object expected"); - message.features[i] = $root.google.cloud.vision.v1p4beta1.Feature.fromObject(object.features[i]); - } + if (object.languageHints) { + if (!Array.isArray(object.languageHints)) + throw TypeError(".google.cloud.vision.v1p4beta1.ImageContext.languageHints: array expected"); + message.languageHints = []; + for (var i = 0; i < object.languageHints.length; ++i) + message.languageHints[i] = String(object.languageHints[i]); } - if (object.imageContext != null) { - if (typeof object.imageContext !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateFileRequest.imageContext: object expected"); - message.imageContext = $root.google.cloud.vision.v1p4beta1.ImageContext.fromObject(object.imageContext); + if (object.cropHintsParams != null) { + if (typeof object.cropHintsParams !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.ImageContext.cropHintsParams: object expected"); + message.cropHintsParams = $root.google.cloud.vision.v1p4beta1.CropHintsParams.fromObject(object.cropHintsParams); } - if (object.pages) { - if (!Array.isArray(object.pages)) - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateFileRequest.pages: array expected"); - message.pages = []; - for (var i = 0; i < object.pages.length; ++i) - message.pages[i] = object.pages[i] | 0; + if (object.faceRecognitionParams != null) { + if (typeof object.faceRecognitionParams !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.ImageContext.faceRecognitionParams: object expected"); + message.faceRecognitionParams = $root.google.cloud.vision.v1p4beta1.FaceRecognitionParams.fromObject(object.faceRecognitionParams); + } + if (object.productSearchParams != null) { + if (typeof object.productSearchParams !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.ImageContext.productSearchParams: object expected"); + message.productSearchParams = $root.google.cloud.vision.v1p4beta1.ProductSearchParams.fromObject(object.productSearchParams); + } + if (object.webDetectionParams != null) { + if (typeof object.webDetectionParams !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.ImageContext.webDetectionParams: object expected"); + message.webDetectionParams = $root.google.cloud.vision.v1p4beta1.WebDetectionParams.fromObject(object.webDetectionParams); } return message; }; /** - * Creates a plain object from an AnnotateFileRequest message. Also converts values to other types if specified. + * Creates a plain object from an ImageContext message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest + * @memberof google.cloud.vision.v1p4beta1.ImageContext * @static - * @param {google.cloud.vision.v1p4beta1.AnnotateFileRequest} message AnnotateFileRequest + * @param {google.cloud.vision.v1p4beta1.ImageContext} message ImageContext * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AnnotateFileRequest.toObject = function toObject(message, options) { + ImageContext.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.features = []; - object.pages = []; - } + if (options.arrays || options.defaults) + object.languageHints = []; if (options.defaults) { - object.inputConfig = null; - object.imageContext = null; - } - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - object.inputConfig = $root.google.cloud.vision.v1p4beta1.InputConfig.toObject(message.inputConfig, options); - if (message.features && message.features.length) { - object.features = []; - for (var j = 0; j < message.features.length; ++j) - object.features[j] = $root.google.cloud.vision.v1p4beta1.Feature.toObject(message.features[j], options); + object.latLongRect = null; + object.cropHintsParams = null; + object.productSearchParams = null; + object.webDetectionParams = null; + object.faceRecognitionParams = null; } - if (message.imageContext != null && message.hasOwnProperty("imageContext")) - object.imageContext = $root.google.cloud.vision.v1p4beta1.ImageContext.toObject(message.imageContext, options); - if (message.pages && message.pages.length) { - object.pages = []; - for (var j = 0; j < message.pages.length; ++j) - object.pages[j] = message.pages[j]; + if (message.latLongRect != null && message.hasOwnProperty("latLongRect")) + object.latLongRect = $root.google.cloud.vision.v1p4beta1.LatLongRect.toObject(message.latLongRect, options); + if (message.languageHints && message.languageHints.length) { + object.languageHints = []; + for (var j = 0; j < message.languageHints.length; ++j) + object.languageHints[j] = message.languageHints[j]; } + if (message.cropHintsParams != null && message.hasOwnProperty("cropHintsParams")) + object.cropHintsParams = $root.google.cloud.vision.v1p4beta1.CropHintsParams.toObject(message.cropHintsParams, options); + if (message.productSearchParams != null && message.hasOwnProperty("productSearchParams")) + object.productSearchParams = $root.google.cloud.vision.v1p4beta1.ProductSearchParams.toObject(message.productSearchParams, options); + if (message.webDetectionParams != null && message.hasOwnProperty("webDetectionParams")) + object.webDetectionParams = $root.google.cloud.vision.v1p4beta1.WebDetectionParams.toObject(message.webDetectionParams, options); + if (message.faceRecognitionParams != null && message.hasOwnProperty("faceRecognitionParams")) + object.faceRecognitionParams = $root.google.cloud.vision.v1p4beta1.FaceRecognitionParams.toObject(message.faceRecognitionParams, options); return object; }; /** - * Converts this AnnotateFileRequest to JSON. + * Converts this ImageContext to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest + * @memberof google.cloud.vision.v1p4beta1.ImageContext * @instance * @returns {Object.} JSON object */ - AnnotateFileRequest.prototype.toJSON = function toJSON() { + ImageContext.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AnnotateFileRequest; + return ImageContext; })(); - v1p4beta1.AnnotateFileResponse = (function() { + v1p4beta1.AnnotateImageRequest = (function() { /** - * Properties of an AnnotateFileResponse. + * Properties of an AnnotateImageRequest. * @memberof google.cloud.vision.v1p4beta1 - * @interface IAnnotateFileResponse - * @property {google.cloud.vision.v1p4beta1.IInputConfig|null} [inputConfig] AnnotateFileResponse inputConfig - * @property {Array.|null} [responses] AnnotateFileResponse responses - * @property {number|null} [totalPages] AnnotateFileResponse totalPages - * @property {google.rpc.IStatus|null} [error] AnnotateFileResponse error + * @interface IAnnotateImageRequest + * @property {google.cloud.vision.v1p4beta1.IImage|null} [image] AnnotateImageRequest image + * @property {Array.|null} [features] AnnotateImageRequest features + * @property {google.cloud.vision.v1p4beta1.IImageContext|null} [imageContext] AnnotateImageRequest imageContext */ /** - * Constructs a new AnnotateFileResponse. + * Constructs a new AnnotateImageRequest. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an AnnotateFileResponse. - * @implements IAnnotateFileResponse + * @classdesc Represents an AnnotateImageRequest. + * @implements IAnnotateImageRequest * @constructor - * @param {google.cloud.vision.v1p4beta1.IAnnotateFileResponse=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IAnnotateImageRequest=} [properties] Properties to set */ - function AnnotateFileResponse(properties) { - this.responses = []; + function AnnotateImageRequest(properties) { + this.features = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -80747,117 +80457,104 @@ } /** - * AnnotateFileResponse inputConfig. - * @member {google.cloud.vision.v1p4beta1.IInputConfig|null|undefined} inputConfig - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse - * @instance - */ - AnnotateFileResponse.prototype.inputConfig = null; - - /** - * AnnotateFileResponse responses. - * @member {Array.} responses - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse + * AnnotateImageRequest image. + * @member {google.cloud.vision.v1p4beta1.IImage|null|undefined} image + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest * @instance */ - AnnotateFileResponse.prototype.responses = $util.emptyArray; + AnnotateImageRequest.prototype.image = null; /** - * AnnotateFileResponse totalPages. - * @member {number} totalPages - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse + * AnnotateImageRequest features. + * @member {Array.} features + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest * @instance */ - AnnotateFileResponse.prototype.totalPages = 0; + AnnotateImageRequest.prototype.features = $util.emptyArray; /** - * AnnotateFileResponse error. - * @member {google.rpc.IStatus|null|undefined} error - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse + * AnnotateImageRequest imageContext. + * @member {google.cloud.vision.v1p4beta1.IImageContext|null|undefined} imageContext + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest * @instance */ - AnnotateFileResponse.prototype.error = null; + AnnotateImageRequest.prototype.imageContext = null; /** - * Creates a new AnnotateFileResponse instance using the specified properties. + * Creates a new AnnotateImageRequest instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest * @static - * @param {google.cloud.vision.v1p4beta1.IAnnotateFileResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.AnnotateFileResponse} AnnotateFileResponse instance + * @param {google.cloud.vision.v1p4beta1.IAnnotateImageRequest=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.AnnotateImageRequest} AnnotateImageRequest instance */ - AnnotateFileResponse.create = function create(properties) { - return new AnnotateFileResponse(properties); + AnnotateImageRequest.create = function create(properties) { + return new AnnotateImageRequest(properties); }; /** - * Encodes the specified AnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateFileResponse.verify|verify} messages. + * Encodes the specified AnnotateImageRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateImageRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest * @static - * @param {google.cloud.vision.v1p4beta1.IAnnotateFileResponse} message AnnotateFileResponse message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IAnnotateImageRequest} message AnnotateImageRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateFileResponse.encode = function encode(message, writer) { + AnnotateImageRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - $root.google.cloud.vision.v1p4beta1.InputConfig.encode(message.inputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.responses != null && message.responses.length) - for (var i = 0; i < message.responses.length; ++i) - $root.google.cloud.vision.v1p4beta1.AnnotateImageResponse.encode(message.responses[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.totalPages != null && message.hasOwnProperty("totalPages")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.totalPages); - if (message.error != null && message.hasOwnProperty("error")) - $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.image != null && message.hasOwnProperty("image")) + $root.google.cloud.vision.v1p4beta1.Image.encode(message.image, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.features != null && message.features.length) + for (var i = 0; i < message.features.length; ++i) + $root.google.cloud.vision.v1p4beta1.Feature.encode(message.features[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.imageContext != null && message.hasOwnProperty("imageContext")) + $root.google.cloud.vision.v1p4beta1.ImageContext.encode(message.imageContext, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; /** - * Encodes the specified AnnotateFileResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateFileResponse.verify|verify} messages. + * Encodes the specified AnnotateImageRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateImageRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest * @static - * @param {google.cloud.vision.v1p4beta1.IAnnotateFileResponse} message AnnotateFileResponse message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IAnnotateImageRequest} message AnnotateImageRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AnnotateFileResponse.encodeDelimited = function encodeDelimited(message, writer) { + AnnotateImageRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AnnotateFileResponse message from the specified reader or buffer. + * Decodes an AnnotateImageRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.AnnotateFileResponse} AnnotateFileResponse + * @returns {google.cloud.vision.v1p4beta1.AnnotateImageRequest} AnnotateImageRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateFileResponse.decode = function decode(reader, length) { + AnnotateImageRequest.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.vision.v1p4beta1.AnnotateFileResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.AnnotateImageRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.inputConfig = $root.google.cloud.vision.v1p4beta1.InputConfig.decode(reader, reader.uint32()); + message.image = $root.google.cloud.vision.v1p4beta1.Image.decode(reader, reader.uint32()); break; case 2: - if (!(message.responses && message.responses.length)) - message.responses = []; - message.responses.push($root.google.cloud.vision.v1p4beta1.AnnotateImageResponse.decode(reader, reader.uint32())); + if (!(message.features && message.features.length)) + message.features = []; + message.features.push($root.google.cloud.vision.v1p4beta1.Feature.decode(reader, reader.uint32())); break; case 3: - message.totalPages = reader.int32(); - break; - case 4: - message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); + message.imageContext = $root.google.cloud.vision.v1p4beta1.ImageContext.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -80868,161 +80565,153 @@ }; /** - * Decodes an AnnotateFileResponse message from the specified reader or buffer, length delimited. + * Decodes an AnnotateImageRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.AnnotateFileResponse} AnnotateFileResponse + * @returns {google.cloud.vision.v1p4beta1.AnnotateImageRequest} AnnotateImageRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AnnotateFileResponse.decodeDelimited = function decodeDelimited(reader) { + AnnotateImageRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AnnotateFileResponse message. + * Verifies an AnnotateImageRequest message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AnnotateFileResponse.verify = function verify(message) { + AnnotateImageRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.vision.v1p4beta1.InputConfig.verify(message.inputConfig); + if (message.image != null && message.hasOwnProperty("image")) { + var error = $root.google.cloud.vision.v1p4beta1.Image.verify(message.image); if (error) - return "inputConfig." + error; + return "image." + error; } - if (message.responses != null && message.hasOwnProperty("responses")) { - if (!Array.isArray(message.responses)) - return "responses: array expected"; - for (var i = 0; i < message.responses.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.AnnotateImageResponse.verify(message.responses[i]); + if (message.features != null && message.hasOwnProperty("features")) { + if (!Array.isArray(message.features)) + return "features: array expected"; + for (var i = 0; i < message.features.length; ++i) { + var error = $root.google.cloud.vision.v1p4beta1.Feature.verify(message.features[i]); if (error) - return "responses." + error; + return "features." + error; } } - if (message.totalPages != null && message.hasOwnProperty("totalPages")) - if (!$util.isInteger(message.totalPages)) - return "totalPages: integer expected"; - if (message.error != null && message.hasOwnProperty("error")) { - var error = $root.google.rpc.Status.verify(message.error); + if (message.imageContext != null && message.hasOwnProperty("imageContext")) { + var error = $root.google.cloud.vision.v1p4beta1.ImageContext.verify(message.imageContext); if (error) - return "error." + error; + return "imageContext." + error; } return null; }; /** - * Creates an AnnotateFileResponse message from a plain object. Also converts values to their respective internal types. + * Creates an AnnotateImageRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.AnnotateFileResponse} AnnotateFileResponse + * @returns {google.cloud.vision.v1p4beta1.AnnotateImageRequest} AnnotateImageRequest */ - AnnotateFileResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.AnnotateFileResponse) + AnnotateImageRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.AnnotateImageRequest) return object; - var message = new $root.google.cloud.vision.v1p4beta1.AnnotateFileResponse(); - if (object.inputConfig != null) { - if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateFileResponse.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.vision.v1p4beta1.InputConfig.fromObject(object.inputConfig); + var message = new $root.google.cloud.vision.v1p4beta1.AnnotateImageRequest(); + if (object.image != null) { + if (typeof object.image !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageRequest.image: object expected"); + message.image = $root.google.cloud.vision.v1p4beta1.Image.fromObject(object.image); } - if (object.responses) { - if (!Array.isArray(object.responses)) - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateFileResponse.responses: array expected"); - message.responses = []; - for (var i = 0; i < object.responses.length; ++i) { - if (typeof object.responses[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateFileResponse.responses: object expected"); - message.responses[i] = $root.google.cloud.vision.v1p4beta1.AnnotateImageResponse.fromObject(object.responses[i]); + if (object.features) { + if (!Array.isArray(object.features)) + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageRequest.features: array expected"); + message.features = []; + for (var i = 0; i < object.features.length; ++i) { + if (typeof object.features[i] !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageRequest.features: object expected"); + message.features[i] = $root.google.cloud.vision.v1p4beta1.Feature.fromObject(object.features[i]); } } - if (object.totalPages != null) - message.totalPages = object.totalPages | 0; - if (object.error != null) { - if (typeof object.error !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateFileResponse.error: object expected"); - message.error = $root.google.rpc.Status.fromObject(object.error); + if (object.imageContext != null) { + if (typeof object.imageContext !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageRequest.imageContext: object expected"); + message.imageContext = $root.google.cloud.vision.v1p4beta1.ImageContext.fromObject(object.imageContext); } return message; }; /** - * Creates a plain object from an AnnotateFileResponse message. Also converts values to other types if specified. + * Creates a plain object from an AnnotateImageRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest * @static - * @param {google.cloud.vision.v1p4beta1.AnnotateFileResponse} message AnnotateFileResponse + * @param {google.cloud.vision.v1p4beta1.AnnotateImageRequest} message AnnotateImageRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AnnotateFileResponse.toObject = function toObject(message, options) { + AnnotateImageRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.responses = []; + object.features = []; if (options.defaults) { - object.inputConfig = null; - object.totalPages = 0; - object.error = null; + object.image = null; + object.imageContext = null; } - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - object.inputConfig = $root.google.cloud.vision.v1p4beta1.InputConfig.toObject(message.inputConfig, options); - if (message.responses && message.responses.length) { - object.responses = []; - for (var j = 0; j < message.responses.length; ++j) - object.responses[j] = $root.google.cloud.vision.v1p4beta1.AnnotateImageResponse.toObject(message.responses[j], options); + if (message.image != null && message.hasOwnProperty("image")) + object.image = $root.google.cloud.vision.v1p4beta1.Image.toObject(message.image, options); + if (message.features && message.features.length) { + object.features = []; + for (var j = 0; j < message.features.length; ++j) + object.features[j] = $root.google.cloud.vision.v1p4beta1.Feature.toObject(message.features[j], options); } - if (message.totalPages != null && message.hasOwnProperty("totalPages")) - object.totalPages = message.totalPages; - if (message.error != null && message.hasOwnProperty("error")) - object.error = $root.google.rpc.Status.toObject(message.error, options); + if (message.imageContext != null && message.hasOwnProperty("imageContext")) + object.imageContext = $root.google.cloud.vision.v1p4beta1.ImageContext.toObject(message.imageContext, options); return object; }; /** - * Converts this AnnotateFileResponse to JSON. + * Converts this AnnotateImageRequest to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageRequest * @instance * @returns {Object.} JSON object */ - AnnotateFileResponse.prototype.toJSON = function toJSON() { + AnnotateImageRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AnnotateFileResponse; + return AnnotateImageRequest; })(); - v1p4beta1.BatchAnnotateFilesRequest = (function() { + v1p4beta1.ImageAnnotationContext = (function() { /** - * Properties of a BatchAnnotateFilesRequest. + * Properties of an ImageAnnotationContext. * @memberof google.cloud.vision.v1p4beta1 - * @interface IBatchAnnotateFilesRequest - * @property {Array.|null} [requests] BatchAnnotateFilesRequest requests + * @interface IImageAnnotationContext + * @property {string|null} [uri] ImageAnnotationContext uri + * @property {number|null} [pageNumber] ImageAnnotationContext pageNumber */ /** - * Constructs a new BatchAnnotateFilesRequest. + * Constructs a new ImageAnnotationContext. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a BatchAnnotateFilesRequest. - * @implements IBatchAnnotateFilesRequest + * @classdesc Represents an ImageAnnotationContext. + * @implements IImageAnnotationContext * @constructor - * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IImageAnnotationContext=} [properties] Properties to set */ - function BatchAnnotateFilesRequest(properties) { - this.requests = []; + function ImageAnnotationContext(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -81030,78 +80719,88 @@ } /** - * BatchAnnotateFilesRequest requests. - * @member {Array.} requests - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest + * ImageAnnotationContext uri. + * @member {string} uri + * @memberof google.cloud.vision.v1p4beta1.ImageAnnotationContext * @instance */ - BatchAnnotateFilesRequest.prototype.requests = $util.emptyArray; + ImageAnnotationContext.prototype.uri = ""; /** - * Creates a new BatchAnnotateFilesRequest instance using the specified properties. + * ImageAnnotationContext pageNumber. + * @member {number} pageNumber + * @memberof google.cloud.vision.v1p4beta1.ImageAnnotationContext + * @instance + */ + ImageAnnotationContext.prototype.pageNumber = 0; + + /** + * Creates a new ImageAnnotationContext instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1p4beta1.ImageAnnotationContext * @static - * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest} BatchAnnotateFilesRequest instance + * @param {google.cloud.vision.v1p4beta1.IImageAnnotationContext=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.ImageAnnotationContext} ImageAnnotationContext instance */ - BatchAnnotateFilesRequest.create = function create(properties) { - return new BatchAnnotateFilesRequest(properties); + ImageAnnotationContext.create = function create(properties) { + return new ImageAnnotationContext(properties); }; /** - * Encodes the specified BatchAnnotateFilesRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest.verify|verify} messages. + * Encodes the specified ImageAnnotationContext message. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageAnnotationContext.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1p4beta1.ImageAnnotationContext * @static - * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest} message BatchAnnotateFilesRequest message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IImageAnnotationContext} message ImageAnnotationContext message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchAnnotateFilesRequest.encode = function encode(message, writer) { + ImageAnnotationContext.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.requests != null && message.requests.length) - for (var i = 0; i < message.requests.length; ++i) - $root.google.cloud.vision.v1p4beta1.AnnotateFileRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.uri != null && message.hasOwnProperty("uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageNumber); return writer; }; /** - * Encodes the specified BatchAnnotateFilesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest.verify|verify} messages. + * Encodes the specified ImageAnnotationContext message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.ImageAnnotationContext.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1p4beta1.ImageAnnotationContext * @static - * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest} message BatchAnnotateFilesRequest message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IImageAnnotationContext} message ImageAnnotationContext message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchAnnotateFilesRequest.encodeDelimited = function encodeDelimited(message, writer) { + ImageAnnotationContext.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BatchAnnotateFilesRequest message from the specified reader or buffer. + * Decodes an ImageAnnotationContext message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1p4beta1.ImageAnnotationContext * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest} BatchAnnotateFilesRequest + * @returns {google.cloud.vision.v1p4beta1.ImageAnnotationContext} ImageAnnotationContext * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchAnnotateFilesRequest.decode = function decode(reader, length) { + ImageAnnotationContext.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.vision.v1p4beta1.BatchAnnotateFilesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.ImageAnnotationContext(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.requests && message.requests.length)) - message.requests = []; - message.requests.push($root.google.cloud.vision.v1p4beta1.AnnotateFileRequest.decode(reader, reader.uint32())); + message.uri = reader.string(); + break; + case 2: + message.pageNumber = reader.int32(); break; default: reader.skipType(tag & 7); @@ -81112,125 +80811,135 @@ }; /** - * Decodes a BatchAnnotateFilesRequest message from the specified reader or buffer, length delimited. + * Decodes an ImageAnnotationContext message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1p4beta1.ImageAnnotationContext * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest} BatchAnnotateFilesRequest + * @returns {google.cloud.vision.v1p4beta1.ImageAnnotationContext} ImageAnnotationContext * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchAnnotateFilesRequest.decodeDelimited = function decodeDelimited(reader) { + ImageAnnotationContext.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BatchAnnotateFilesRequest message. + * Verifies an ImageAnnotationContext message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1p4beta1.ImageAnnotationContext * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BatchAnnotateFilesRequest.verify = function verify(message) { + ImageAnnotationContext.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.requests != null && message.hasOwnProperty("requests")) { - if (!Array.isArray(message.requests)) - return "requests: array expected"; - for (var i = 0; i < message.requests.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.AnnotateFileRequest.verify(message.requests[i]); - if (error) - return "requests." + error; - } - } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + if (!$util.isInteger(message.pageNumber)) + return "pageNumber: integer expected"; return null; }; /** - * Creates a BatchAnnotateFilesRequest message from a plain object. Also converts values to their respective internal types. + * Creates an ImageAnnotationContext message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1p4beta1.ImageAnnotationContext * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest} BatchAnnotateFilesRequest + * @returns {google.cloud.vision.v1p4beta1.ImageAnnotationContext} ImageAnnotationContext */ - BatchAnnotateFilesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest) + ImageAnnotationContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.ImageAnnotationContext) return object; - var message = new $root.google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest(); - if (object.requests) { - if (!Array.isArray(object.requests)) - throw TypeError(".google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest.requests: array expected"); - message.requests = []; - for (var i = 0; i < object.requests.length; ++i) { - if (typeof object.requests[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest.requests: object expected"); - message.requests[i] = $root.google.cloud.vision.v1p4beta1.AnnotateFileRequest.fromObject(object.requests[i]); - } - } + var message = new $root.google.cloud.vision.v1p4beta1.ImageAnnotationContext(); + if (object.uri != null) + message.uri = String(object.uri); + if (object.pageNumber != null) + message.pageNumber = object.pageNumber | 0; return message; }; /** - * Creates a plain object from a BatchAnnotateFilesRequest message. Also converts values to other types if specified. + * Creates a plain object from an ImageAnnotationContext message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1p4beta1.ImageAnnotationContext * @static - * @param {google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest} message BatchAnnotateFilesRequest + * @param {google.cloud.vision.v1p4beta1.ImageAnnotationContext} message ImageAnnotationContext * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BatchAnnotateFilesRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.requests = []; - if (message.requests && message.requests.length) { - object.requests = []; - for (var j = 0; j < message.requests.length; ++j) - object.requests[j] = $root.google.cloud.vision.v1p4beta1.AnnotateFileRequest.toObject(message.requests[j], options); + ImageAnnotationContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.uri = ""; + object.pageNumber = 0; } + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.pageNumber != null && message.hasOwnProperty("pageNumber")) + object.pageNumber = message.pageNumber; return object; }; /** - * Converts this BatchAnnotateFilesRequest to JSON. + * Converts this ImageAnnotationContext to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1p4beta1.ImageAnnotationContext * @instance * @returns {Object.} JSON object */ - BatchAnnotateFilesRequest.prototype.toJSON = function toJSON() { + ImageAnnotationContext.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BatchAnnotateFilesRequest; + return ImageAnnotationContext; })(); - v1p4beta1.BatchAnnotateFilesResponse = (function() { + v1p4beta1.AnnotateImageResponse = (function() { /** - * Properties of a BatchAnnotateFilesResponse. + * Properties of an AnnotateImageResponse. * @memberof google.cloud.vision.v1p4beta1 - * @interface IBatchAnnotateFilesResponse - * @property {Array.|null} [responses] BatchAnnotateFilesResponse responses + * @interface IAnnotateImageResponse + * @property {Array.|null} [faceAnnotations] AnnotateImageResponse faceAnnotations + * @property {Array.|null} [landmarkAnnotations] AnnotateImageResponse landmarkAnnotations + * @property {Array.|null} [logoAnnotations] AnnotateImageResponse logoAnnotations + * @property {Array.|null} [labelAnnotations] AnnotateImageResponse labelAnnotations + * @property {Array.|null} [localizedObjectAnnotations] AnnotateImageResponse localizedObjectAnnotations + * @property {Array.|null} [textAnnotations] AnnotateImageResponse textAnnotations + * @property {google.cloud.vision.v1p4beta1.ITextAnnotation|null} [fullTextAnnotation] AnnotateImageResponse fullTextAnnotation + * @property {google.cloud.vision.v1p4beta1.ISafeSearchAnnotation|null} [safeSearchAnnotation] AnnotateImageResponse safeSearchAnnotation + * @property {google.cloud.vision.v1p4beta1.IImageProperties|null} [imagePropertiesAnnotation] AnnotateImageResponse imagePropertiesAnnotation + * @property {google.cloud.vision.v1p4beta1.ICropHintsAnnotation|null} [cropHintsAnnotation] AnnotateImageResponse cropHintsAnnotation + * @property {google.cloud.vision.v1p4beta1.IWebDetection|null} [webDetection] AnnotateImageResponse webDetection + * @property {google.cloud.vision.v1p4beta1.IProductSearchResults|null} [productSearchResults] AnnotateImageResponse productSearchResults + * @property {google.rpc.IStatus|null} [error] AnnotateImageResponse error + * @property {google.cloud.vision.v1p4beta1.IImageAnnotationContext|null} [context] AnnotateImageResponse context */ /** - * Constructs a new BatchAnnotateFilesResponse. + * Constructs a new AnnotateImageResponse. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a BatchAnnotateFilesResponse. - * @implements IBatchAnnotateFilesResponse + * @classdesc Represents an AnnotateImageResponse. + * @implements IAnnotateImageResponse * @constructor - * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IAnnotateImageResponse=} [properties] Properties to set */ - function BatchAnnotateFilesResponse(properties) { - this.responses = []; + function AnnotateImageResponse(properties) { + this.faceAnnotations = []; + this.landmarkAnnotations = []; + this.logoAnnotations = []; + this.labelAnnotations = []; + this.localizedObjectAnnotations = []; + this.textAnnotations = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -81238,78 +80947,262 @@ } /** - * BatchAnnotateFilesResponse responses. - * @member {Array.} responses - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse + * AnnotateImageResponse faceAnnotations. + * @member {Array.} faceAnnotations + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse * @instance */ - BatchAnnotateFilesResponse.prototype.responses = $util.emptyArray; + AnnotateImageResponse.prototype.faceAnnotations = $util.emptyArray; /** - * Creates a new BatchAnnotateFilesResponse instance using the specified properties. + * AnnotateImageResponse landmarkAnnotations. + * @member {Array.} landmarkAnnotations + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse + * @instance + */ + AnnotateImageResponse.prototype.landmarkAnnotations = $util.emptyArray; + + /** + * AnnotateImageResponse logoAnnotations. + * @member {Array.} logoAnnotations + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse + * @instance + */ + AnnotateImageResponse.prototype.logoAnnotations = $util.emptyArray; + + /** + * AnnotateImageResponse labelAnnotations. + * @member {Array.} labelAnnotations + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse + * @instance + */ + AnnotateImageResponse.prototype.labelAnnotations = $util.emptyArray; + + /** + * AnnotateImageResponse localizedObjectAnnotations. + * @member {Array.} localizedObjectAnnotations + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse + * @instance + */ + AnnotateImageResponse.prototype.localizedObjectAnnotations = $util.emptyArray; + + /** + * AnnotateImageResponse textAnnotations. + * @member {Array.} textAnnotations + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse + * @instance + */ + AnnotateImageResponse.prototype.textAnnotations = $util.emptyArray; + + /** + * AnnotateImageResponse fullTextAnnotation. + * @member {google.cloud.vision.v1p4beta1.ITextAnnotation|null|undefined} fullTextAnnotation + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse + * @instance + */ + AnnotateImageResponse.prototype.fullTextAnnotation = null; + + /** + * AnnotateImageResponse safeSearchAnnotation. + * @member {google.cloud.vision.v1p4beta1.ISafeSearchAnnotation|null|undefined} safeSearchAnnotation + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse + * @instance + */ + AnnotateImageResponse.prototype.safeSearchAnnotation = null; + + /** + * AnnotateImageResponse imagePropertiesAnnotation. + * @member {google.cloud.vision.v1p4beta1.IImageProperties|null|undefined} imagePropertiesAnnotation + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse + * @instance + */ + AnnotateImageResponse.prototype.imagePropertiesAnnotation = null; + + /** + * AnnotateImageResponse cropHintsAnnotation. + * @member {google.cloud.vision.v1p4beta1.ICropHintsAnnotation|null|undefined} cropHintsAnnotation + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse + * @instance + */ + AnnotateImageResponse.prototype.cropHintsAnnotation = null; + + /** + * AnnotateImageResponse webDetection. + * @member {google.cloud.vision.v1p4beta1.IWebDetection|null|undefined} webDetection + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse + * @instance + */ + AnnotateImageResponse.prototype.webDetection = null; + + /** + * AnnotateImageResponse productSearchResults. + * @member {google.cloud.vision.v1p4beta1.IProductSearchResults|null|undefined} productSearchResults + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse + * @instance + */ + AnnotateImageResponse.prototype.productSearchResults = null; + + /** + * AnnotateImageResponse error. + * @member {google.rpc.IStatus|null|undefined} error + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse + * @instance + */ + AnnotateImageResponse.prototype.error = null; + + /** + * AnnotateImageResponse context. + * @member {google.cloud.vision.v1p4beta1.IImageAnnotationContext|null|undefined} context + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse + * @instance + */ + AnnotateImageResponse.prototype.context = null; + + /** + * Creates a new AnnotateImageResponse instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse * @static - * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse} BatchAnnotateFilesResponse instance + * @param {google.cloud.vision.v1p4beta1.IAnnotateImageResponse=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.AnnotateImageResponse} AnnotateImageResponse instance */ - BatchAnnotateFilesResponse.create = function create(properties) { - return new BatchAnnotateFilesResponse(properties); + AnnotateImageResponse.create = function create(properties) { + return new AnnotateImageResponse(properties); }; /** - * Encodes the specified BatchAnnotateFilesResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse.verify|verify} messages. + * Encodes the specified AnnotateImageResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateImageResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse * @static - * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse} message BatchAnnotateFilesResponse message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IAnnotateImageResponse} message AnnotateImageResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchAnnotateFilesResponse.encode = function encode(message, writer) { + AnnotateImageResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.responses != null && message.responses.length) - for (var i = 0; i < message.responses.length; ++i) - $root.google.cloud.vision.v1p4beta1.AnnotateFileResponse.encode(message.responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.faceAnnotations != null && message.faceAnnotations.length) + for (var i = 0; i < message.faceAnnotations.length; ++i) + $root.google.cloud.vision.v1p4beta1.FaceAnnotation.encode(message.faceAnnotations[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.landmarkAnnotations != null && message.landmarkAnnotations.length) + for (var i = 0; i < message.landmarkAnnotations.length; ++i) + $root.google.cloud.vision.v1p4beta1.EntityAnnotation.encode(message.landmarkAnnotations[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.logoAnnotations != null && message.logoAnnotations.length) + for (var i = 0; i < message.logoAnnotations.length; ++i) + $root.google.cloud.vision.v1p4beta1.EntityAnnotation.encode(message.logoAnnotations[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.labelAnnotations != null && message.labelAnnotations.length) + for (var i = 0; i < message.labelAnnotations.length; ++i) + $root.google.cloud.vision.v1p4beta1.EntityAnnotation.encode(message.labelAnnotations[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.textAnnotations != null && message.textAnnotations.length) + for (var i = 0; i < message.textAnnotations.length; ++i) + $root.google.cloud.vision.v1p4beta1.EntityAnnotation.encode(message.textAnnotations[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.safeSearchAnnotation != null && message.hasOwnProperty("safeSearchAnnotation")) + $root.google.cloud.vision.v1p4beta1.SafeSearchAnnotation.encode(message.safeSearchAnnotation, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.imagePropertiesAnnotation != null && message.hasOwnProperty("imagePropertiesAnnotation")) + $root.google.cloud.vision.v1p4beta1.ImageProperties.encode(message.imagePropertiesAnnotation, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.error != null && message.hasOwnProperty("error")) + $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.cropHintsAnnotation != null && message.hasOwnProperty("cropHintsAnnotation")) + $root.google.cloud.vision.v1p4beta1.CropHintsAnnotation.encode(message.cropHintsAnnotation, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.fullTextAnnotation != null && message.hasOwnProperty("fullTextAnnotation")) + $root.google.cloud.vision.v1p4beta1.TextAnnotation.encode(message.fullTextAnnotation, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.webDetection != null && message.hasOwnProperty("webDetection")) + $root.google.cloud.vision.v1p4beta1.WebDetection.encode(message.webDetection, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.productSearchResults != null && message.hasOwnProperty("productSearchResults")) + $root.google.cloud.vision.v1p4beta1.ProductSearchResults.encode(message.productSearchResults, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.context != null && message.hasOwnProperty("context")) + $root.google.cloud.vision.v1p4beta1.ImageAnnotationContext.encode(message.context, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.localizedObjectAnnotations != null && message.localizedObjectAnnotations.length) + for (var i = 0; i < message.localizedObjectAnnotations.length; ++i) + $root.google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation.encode(message.localizedObjectAnnotations[i], writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); return writer; }; /** - * Encodes the specified BatchAnnotateFilesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse.verify|verify} messages. + * Encodes the specified AnnotateImageResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateImageResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse * @static - * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse} message BatchAnnotateFilesResponse message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IAnnotateImageResponse} message AnnotateImageResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BatchAnnotateFilesResponse.encodeDelimited = function encodeDelimited(message, writer) { + AnnotateImageResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BatchAnnotateFilesResponse message from the specified reader or buffer. + * Decodes an AnnotateImageResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse} BatchAnnotateFilesResponse + * @returns {google.cloud.vision.v1p4beta1.AnnotateImageResponse} AnnotateImageResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchAnnotateFilesResponse.decode = function decode(reader, length) { + AnnotateImageResponse.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.vision.v1p4beta1.BatchAnnotateFilesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.AnnotateImageResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.responses && message.responses.length)) - message.responses = []; - message.responses.push($root.google.cloud.vision.v1p4beta1.AnnotateFileResponse.decode(reader, reader.uint32())); + if (!(message.faceAnnotations && message.faceAnnotations.length)) + message.faceAnnotations = []; + message.faceAnnotations.push($root.google.cloud.vision.v1p4beta1.FaceAnnotation.decode(reader, reader.uint32())); + break; + case 2: + if (!(message.landmarkAnnotations && message.landmarkAnnotations.length)) + message.landmarkAnnotations = []; + message.landmarkAnnotations.push($root.google.cloud.vision.v1p4beta1.EntityAnnotation.decode(reader, reader.uint32())); + break; + case 3: + if (!(message.logoAnnotations && message.logoAnnotations.length)) + message.logoAnnotations = []; + message.logoAnnotations.push($root.google.cloud.vision.v1p4beta1.EntityAnnotation.decode(reader, reader.uint32())); + break; + case 4: + if (!(message.labelAnnotations && message.labelAnnotations.length)) + message.labelAnnotations = []; + message.labelAnnotations.push($root.google.cloud.vision.v1p4beta1.EntityAnnotation.decode(reader, reader.uint32())); + break; + case 22: + if (!(message.localizedObjectAnnotations && message.localizedObjectAnnotations.length)) + message.localizedObjectAnnotations = []; + message.localizedObjectAnnotations.push($root.google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation.decode(reader, reader.uint32())); + break; + case 5: + if (!(message.textAnnotations && message.textAnnotations.length)) + message.textAnnotations = []; + message.textAnnotations.push($root.google.cloud.vision.v1p4beta1.EntityAnnotation.decode(reader, reader.uint32())); + break; + case 12: + message.fullTextAnnotation = $root.google.cloud.vision.v1p4beta1.TextAnnotation.decode(reader, reader.uint32()); + break; + case 6: + message.safeSearchAnnotation = $root.google.cloud.vision.v1p4beta1.SafeSearchAnnotation.decode(reader, reader.uint32()); + break; + case 8: + message.imagePropertiesAnnotation = $root.google.cloud.vision.v1p4beta1.ImageProperties.decode(reader, reader.uint32()); + break; + case 11: + message.cropHintsAnnotation = $root.google.cloud.vision.v1p4beta1.CropHintsAnnotation.decode(reader, reader.uint32()); + break; + case 13: + message.webDetection = $root.google.cloud.vision.v1p4beta1.WebDetection.decode(reader, reader.uint32()); + break; + case 14: + message.productSearchResults = $root.google.cloud.vision.v1p4beta1.ProductSearchResults.decode(reader, reader.uint32()); + break; + case 9: + message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + case 21: + message.context = $root.google.cloud.vision.v1p4beta1.ImageAnnotationContext.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -81320,128 +81213,357 @@ }; /** - * Decodes a BatchAnnotateFilesResponse message from the specified reader or buffer, length delimited. + * Decodes an AnnotateImageResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse} BatchAnnotateFilesResponse + * @returns {google.cloud.vision.v1p4beta1.AnnotateImageResponse} AnnotateImageResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BatchAnnotateFilesResponse.decodeDelimited = function decodeDelimited(reader) { + AnnotateImageResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BatchAnnotateFilesResponse message. + * Verifies an AnnotateImageResponse message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BatchAnnotateFilesResponse.verify = function verify(message) { + AnnotateImageResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.responses != null && message.hasOwnProperty("responses")) { - if (!Array.isArray(message.responses)) - return "responses: array expected"; - for (var i = 0; i < message.responses.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.AnnotateFileResponse.verify(message.responses[i]); + if (message.faceAnnotations != null && message.hasOwnProperty("faceAnnotations")) { + if (!Array.isArray(message.faceAnnotations)) + return "faceAnnotations: array expected"; + for (var i = 0; i < message.faceAnnotations.length; ++i) { + var error = $root.google.cloud.vision.v1p4beta1.FaceAnnotation.verify(message.faceAnnotations[i]); if (error) - return "responses." + error; + return "faceAnnotations." + error; + } + } + if (message.landmarkAnnotations != null && message.hasOwnProperty("landmarkAnnotations")) { + if (!Array.isArray(message.landmarkAnnotations)) + return "landmarkAnnotations: array expected"; + for (var i = 0; i < message.landmarkAnnotations.length; ++i) { + var error = $root.google.cloud.vision.v1p4beta1.EntityAnnotation.verify(message.landmarkAnnotations[i]); + if (error) + return "landmarkAnnotations." + error; + } + } + if (message.logoAnnotations != null && message.hasOwnProperty("logoAnnotations")) { + if (!Array.isArray(message.logoAnnotations)) + return "logoAnnotations: array expected"; + for (var i = 0; i < message.logoAnnotations.length; ++i) { + var error = $root.google.cloud.vision.v1p4beta1.EntityAnnotation.verify(message.logoAnnotations[i]); + if (error) + return "logoAnnotations." + error; + } + } + if (message.labelAnnotations != null && message.hasOwnProperty("labelAnnotations")) { + if (!Array.isArray(message.labelAnnotations)) + return "labelAnnotations: array expected"; + for (var i = 0; i < message.labelAnnotations.length; ++i) { + var error = $root.google.cloud.vision.v1p4beta1.EntityAnnotation.verify(message.labelAnnotations[i]); + if (error) + return "labelAnnotations." + error; + } + } + if (message.localizedObjectAnnotations != null && message.hasOwnProperty("localizedObjectAnnotations")) { + if (!Array.isArray(message.localizedObjectAnnotations)) + return "localizedObjectAnnotations: array expected"; + for (var i = 0; i < message.localizedObjectAnnotations.length; ++i) { + var error = $root.google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation.verify(message.localizedObjectAnnotations[i]); + if (error) + return "localizedObjectAnnotations." + error; + } + } + if (message.textAnnotations != null && message.hasOwnProperty("textAnnotations")) { + if (!Array.isArray(message.textAnnotations)) + return "textAnnotations: array expected"; + for (var i = 0; i < message.textAnnotations.length; ++i) { + var error = $root.google.cloud.vision.v1p4beta1.EntityAnnotation.verify(message.textAnnotations[i]); + if (error) + return "textAnnotations." + error; + } + } + if (message.fullTextAnnotation != null && message.hasOwnProperty("fullTextAnnotation")) { + var error = $root.google.cloud.vision.v1p4beta1.TextAnnotation.verify(message.fullTextAnnotation); + if (error) + return "fullTextAnnotation." + error; + } + if (message.safeSearchAnnotation != null && message.hasOwnProperty("safeSearchAnnotation")) { + var error = $root.google.cloud.vision.v1p4beta1.SafeSearchAnnotation.verify(message.safeSearchAnnotation); + if (error) + return "safeSearchAnnotation." + error; + } + if (message.imagePropertiesAnnotation != null && message.hasOwnProperty("imagePropertiesAnnotation")) { + var error = $root.google.cloud.vision.v1p4beta1.ImageProperties.verify(message.imagePropertiesAnnotation); + if (error) + return "imagePropertiesAnnotation." + error; + } + if (message.cropHintsAnnotation != null && message.hasOwnProperty("cropHintsAnnotation")) { + var error = $root.google.cloud.vision.v1p4beta1.CropHintsAnnotation.verify(message.cropHintsAnnotation); + if (error) + return "cropHintsAnnotation." + error; + } + if (message.webDetection != null && message.hasOwnProperty("webDetection")) { + var error = $root.google.cloud.vision.v1p4beta1.WebDetection.verify(message.webDetection); + if (error) + return "webDetection." + error; + } + if (message.productSearchResults != null && message.hasOwnProperty("productSearchResults")) { + var error = $root.google.cloud.vision.v1p4beta1.ProductSearchResults.verify(message.productSearchResults); + if (error) + return "productSearchResults." + error; + } + if (message.error != null && message.hasOwnProperty("error")) { + var error = $root.google.rpc.Status.verify(message.error); + if (error) + return "error." + error; + } + if (message.context != null && message.hasOwnProperty("context")) { + var error = $root.google.cloud.vision.v1p4beta1.ImageAnnotationContext.verify(message.context); + if (error) + return "context." + error; + } + return null; + }; + + /** + * Creates an AnnotateImageResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.vision.v1p4beta1.AnnotateImageResponse} AnnotateImageResponse + */ + AnnotateImageResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.AnnotateImageResponse) + return object; + var message = new $root.google.cloud.vision.v1p4beta1.AnnotateImageResponse(); + if (object.faceAnnotations) { + if (!Array.isArray(object.faceAnnotations)) + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.faceAnnotations: array expected"); + message.faceAnnotations = []; + for (var i = 0; i < object.faceAnnotations.length; ++i) { + if (typeof object.faceAnnotations[i] !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.faceAnnotations: object expected"); + message.faceAnnotations[i] = $root.google.cloud.vision.v1p4beta1.FaceAnnotation.fromObject(object.faceAnnotations[i]); + } + } + if (object.landmarkAnnotations) { + if (!Array.isArray(object.landmarkAnnotations)) + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.landmarkAnnotations: array expected"); + message.landmarkAnnotations = []; + for (var i = 0; i < object.landmarkAnnotations.length; ++i) { + if (typeof object.landmarkAnnotations[i] !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.landmarkAnnotations: object expected"); + message.landmarkAnnotations[i] = $root.google.cloud.vision.v1p4beta1.EntityAnnotation.fromObject(object.landmarkAnnotations[i]); + } + } + if (object.logoAnnotations) { + if (!Array.isArray(object.logoAnnotations)) + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.logoAnnotations: array expected"); + message.logoAnnotations = []; + for (var i = 0; i < object.logoAnnotations.length; ++i) { + if (typeof object.logoAnnotations[i] !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.logoAnnotations: object expected"); + message.logoAnnotations[i] = $root.google.cloud.vision.v1p4beta1.EntityAnnotation.fromObject(object.logoAnnotations[i]); + } + } + if (object.labelAnnotations) { + if (!Array.isArray(object.labelAnnotations)) + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.labelAnnotations: array expected"); + message.labelAnnotations = []; + for (var i = 0; i < object.labelAnnotations.length; ++i) { + if (typeof object.labelAnnotations[i] !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.labelAnnotations: object expected"); + message.labelAnnotations[i] = $root.google.cloud.vision.v1p4beta1.EntityAnnotation.fromObject(object.labelAnnotations[i]); + } + } + if (object.localizedObjectAnnotations) { + if (!Array.isArray(object.localizedObjectAnnotations)) + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.localizedObjectAnnotations: array expected"); + message.localizedObjectAnnotations = []; + for (var i = 0; i < object.localizedObjectAnnotations.length; ++i) { + if (typeof object.localizedObjectAnnotations[i] !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.localizedObjectAnnotations: object expected"); + message.localizedObjectAnnotations[i] = $root.google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation.fromObject(object.localizedObjectAnnotations[i]); + } + } + if (object.textAnnotations) { + if (!Array.isArray(object.textAnnotations)) + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.textAnnotations: array expected"); + message.textAnnotations = []; + for (var i = 0; i < object.textAnnotations.length; ++i) { + if (typeof object.textAnnotations[i] !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.textAnnotations: object expected"); + message.textAnnotations[i] = $root.google.cloud.vision.v1p4beta1.EntityAnnotation.fromObject(object.textAnnotations[i]); } } - return null; - }; - - /** - * Creates a BatchAnnotateFilesResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse} BatchAnnotateFilesResponse - */ - BatchAnnotateFilesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse(); - if (object.responses) { - if (!Array.isArray(object.responses)) - throw TypeError(".google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse.responses: array expected"); - message.responses = []; - for (var i = 0; i < object.responses.length; ++i) { - if (typeof object.responses[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse.responses: object expected"); - message.responses[i] = $root.google.cloud.vision.v1p4beta1.AnnotateFileResponse.fromObject(object.responses[i]); - } + if (object.fullTextAnnotation != null) { + if (typeof object.fullTextAnnotation !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.fullTextAnnotation: object expected"); + message.fullTextAnnotation = $root.google.cloud.vision.v1p4beta1.TextAnnotation.fromObject(object.fullTextAnnotation); + } + if (object.safeSearchAnnotation != null) { + if (typeof object.safeSearchAnnotation !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.safeSearchAnnotation: object expected"); + message.safeSearchAnnotation = $root.google.cloud.vision.v1p4beta1.SafeSearchAnnotation.fromObject(object.safeSearchAnnotation); + } + if (object.imagePropertiesAnnotation != null) { + if (typeof object.imagePropertiesAnnotation !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.imagePropertiesAnnotation: object expected"); + message.imagePropertiesAnnotation = $root.google.cloud.vision.v1p4beta1.ImageProperties.fromObject(object.imagePropertiesAnnotation); + } + if (object.cropHintsAnnotation != null) { + if (typeof object.cropHintsAnnotation !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.cropHintsAnnotation: object expected"); + message.cropHintsAnnotation = $root.google.cloud.vision.v1p4beta1.CropHintsAnnotation.fromObject(object.cropHintsAnnotation); + } + if (object.webDetection != null) { + if (typeof object.webDetection !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.webDetection: object expected"); + message.webDetection = $root.google.cloud.vision.v1p4beta1.WebDetection.fromObject(object.webDetection); + } + if (object.productSearchResults != null) { + if (typeof object.productSearchResults !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.productSearchResults: object expected"); + message.productSearchResults = $root.google.cloud.vision.v1p4beta1.ProductSearchResults.fromObject(object.productSearchResults); + } + if (object.error != null) { + if (typeof object.error !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.error: object expected"); + message.error = $root.google.rpc.Status.fromObject(object.error); + } + if (object.context != null) { + if (typeof object.context !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateImageResponse.context: object expected"); + message.context = $root.google.cloud.vision.v1p4beta1.ImageAnnotationContext.fromObject(object.context); } return message; }; /** - * Creates a plain object from a BatchAnnotateFilesResponse message. Also converts values to other types if specified. + * Creates a plain object from an AnnotateImageResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse * @static - * @param {google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse} message BatchAnnotateFilesResponse + * @param {google.cloud.vision.v1p4beta1.AnnotateImageResponse} message AnnotateImageResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BatchAnnotateFilesResponse.toObject = function toObject(message, options) { + AnnotateImageResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.responses = []; - if (message.responses && message.responses.length) { - object.responses = []; - for (var j = 0; j < message.responses.length; ++j) - object.responses[j] = $root.google.cloud.vision.v1p4beta1.AnnotateFileResponse.toObject(message.responses[j], options); + if (options.arrays || options.defaults) { + object.faceAnnotations = []; + object.landmarkAnnotations = []; + object.logoAnnotations = []; + object.labelAnnotations = []; + object.textAnnotations = []; + object.localizedObjectAnnotations = []; + } + if (options.defaults) { + object.safeSearchAnnotation = null; + object.imagePropertiesAnnotation = null; + object.error = null; + object.cropHintsAnnotation = null; + object.fullTextAnnotation = null; + object.webDetection = null; + object.productSearchResults = null; + object.context = null; + } + if (message.faceAnnotations && message.faceAnnotations.length) { + object.faceAnnotations = []; + for (var j = 0; j < message.faceAnnotations.length; ++j) + object.faceAnnotations[j] = $root.google.cloud.vision.v1p4beta1.FaceAnnotation.toObject(message.faceAnnotations[j], options); + } + if (message.landmarkAnnotations && message.landmarkAnnotations.length) { + object.landmarkAnnotations = []; + for (var j = 0; j < message.landmarkAnnotations.length; ++j) + object.landmarkAnnotations[j] = $root.google.cloud.vision.v1p4beta1.EntityAnnotation.toObject(message.landmarkAnnotations[j], options); + } + if (message.logoAnnotations && message.logoAnnotations.length) { + object.logoAnnotations = []; + for (var j = 0; j < message.logoAnnotations.length; ++j) + object.logoAnnotations[j] = $root.google.cloud.vision.v1p4beta1.EntityAnnotation.toObject(message.logoAnnotations[j], options); + } + if (message.labelAnnotations && message.labelAnnotations.length) { + object.labelAnnotations = []; + for (var j = 0; j < message.labelAnnotations.length; ++j) + object.labelAnnotations[j] = $root.google.cloud.vision.v1p4beta1.EntityAnnotation.toObject(message.labelAnnotations[j], options); + } + if (message.textAnnotations && message.textAnnotations.length) { + object.textAnnotations = []; + for (var j = 0; j < message.textAnnotations.length; ++j) + object.textAnnotations[j] = $root.google.cloud.vision.v1p4beta1.EntityAnnotation.toObject(message.textAnnotations[j], options); + } + if (message.safeSearchAnnotation != null && message.hasOwnProperty("safeSearchAnnotation")) + object.safeSearchAnnotation = $root.google.cloud.vision.v1p4beta1.SafeSearchAnnotation.toObject(message.safeSearchAnnotation, options); + if (message.imagePropertiesAnnotation != null && message.hasOwnProperty("imagePropertiesAnnotation")) + object.imagePropertiesAnnotation = $root.google.cloud.vision.v1p4beta1.ImageProperties.toObject(message.imagePropertiesAnnotation, options); + if (message.error != null && message.hasOwnProperty("error")) + object.error = $root.google.rpc.Status.toObject(message.error, options); + if (message.cropHintsAnnotation != null && message.hasOwnProperty("cropHintsAnnotation")) + object.cropHintsAnnotation = $root.google.cloud.vision.v1p4beta1.CropHintsAnnotation.toObject(message.cropHintsAnnotation, options); + if (message.fullTextAnnotation != null && message.hasOwnProperty("fullTextAnnotation")) + object.fullTextAnnotation = $root.google.cloud.vision.v1p4beta1.TextAnnotation.toObject(message.fullTextAnnotation, options); + if (message.webDetection != null && message.hasOwnProperty("webDetection")) + object.webDetection = $root.google.cloud.vision.v1p4beta1.WebDetection.toObject(message.webDetection, options); + if (message.productSearchResults != null && message.hasOwnProperty("productSearchResults")) + object.productSearchResults = $root.google.cloud.vision.v1p4beta1.ProductSearchResults.toObject(message.productSearchResults, options); + if (message.context != null && message.hasOwnProperty("context")) + object.context = $root.google.cloud.vision.v1p4beta1.ImageAnnotationContext.toObject(message.context, options); + if (message.localizedObjectAnnotations && message.localizedObjectAnnotations.length) { + object.localizedObjectAnnotations = []; + for (var j = 0; j < message.localizedObjectAnnotations.length; ++j) + object.localizedObjectAnnotations[j] = $root.google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation.toObject(message.localizedObjectAnnotations[j], options); } return object; }; /** - * Converts this BatchAnnotateFilesResponse to JSON. + * Converts this AnnotateImageResponse to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1p4beta1.AnnotateImageResponse * @instance * @returns {Object.} JSON object */ - BatchAnnotateFilesResponse.prototype.toJSON = function toJSON() { + AnnotateImageResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BatchAnnotateFilesResponse; + return AnnotateImageResponse; })(); - v1p4beta1.AsyncAnnotateFileRequest = (function() { + v1p4beta1.BatchAnnotateImagesRequest = (function() { /** - * Properties of an AsyncAnnotateFileRequest. + * Properties of a BatchAnnotateImagesRequest. * @memberof google.cloud.vision.v1p4beta1 - * @interface IAsyncAnnotateFileRequest - * @property {google.cloud.vision.v1p4beta1.IInputConfig|null} [inputConfig] AsyncAnnotateFileRequest inputConfig - * @property {Array.|null} [features] AsyncAnnotateFileRequest features - * @property {google.cloud.vision.v1p4beta1.IImageContext|null} [imageContext] AsyncAnnotateFileRequest imageContext - * @property {google.cloud.vision.v1p4beta1.IOutputConfig|null} [outputConfig] AsyncAnnotateFileRequest outputConfig + * @interface IBatchAnnotateImagesRequest + * @property {Array.|null} [requests] BatchAnnotateImagesRequest requests */ /** - * Constructs a new AsyncAnnotateFileRequest. + * Constructs a new BatchAnnotateImagesRequest. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an AsyncAnnotateFileRequest. - * @implements IAsyncAnnotateFileRequest + * @classdesc Represents a BatchAnnotateImagesRequest. + * @implements IBatchAnnotateImagesRequest * @constructor - * @param {google.cloud.vision.v1p4beta1.IAsyncAnnotateFileRequest=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest=} [properties] Properties to set */ - function AsyncAnnotateFileRequest(properties) { - this.features = []; + function BatchAnnotateImagesRequest(properties) { + this.requests = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -81449,117 +81571,78 @@ } /** - * AsyncAnnotateFileRequest inputConfig. - * @member {google.cloud.vision.v1p4beta1.IInputConfig|null|undefined} inputConfig - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest - * @instance - */ - AsyncAnnotateFileRequest.prototype.inputConfig = null; - - /** - * AsyncAnnotateFileRequest features. - * @member {Array.} features - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest - * @instance - */ - AsyncAnnotateFileRequest.prototype.features = $util.emptyArray; - - /** - * AsyncAnnotateFileRequest imageContext. - * @member {google.cloud.vision.v1p4beta1.IImageContext|null|undefined} imageContext - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest - * @instance - */ - AsyncAnnotateFileRequest.prototype.imageContext = null; - - /** - * AsyncAnnotateFileRequest outputConfig. - * @member {google.cloud.vision.v1p4beta1.IOutputConfig|null|undefined} outputConfig - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest + * BatchAnnotateImagesRequest requests. + * @member {Array.} requests + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest * @instance */ - AsyncAnnotateFileRequest.prototype.outputConfig = null; + BatchAnnotateImagesRequest.prototype.requests = $util.emptyArray; /** - * Creates a new AsyncAnnotateFileRequest instance using the specified properties. + * Creates a new BatchAnnotateImagesRequest instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest * @static - * @param {google.cloud.vision.v1p4beta1.IAsyncAnnotateFileRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest instance + * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest instance */ - AsyncAnnotateFileRequest.create = function create(properties) { - return new AsyncAnnotateFileRequest(properties); + BatchAnnotateImagesRequest.create = function create(properties) { + return new BatchAnnotateImagesRequest(properties); }; /** - * Encodes the specified AsyncAnnotateFileRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest.verify|verify} messages. + * Encodes the specified BatchAnnotateImagesRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest * @static - * @param {google.cloud.vision.v1p4beta1.IAsyncAnnotateFileRequest} message AsyncAnnotateFileRequest message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest} message BatchAnnotateImagesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncAnnotateFileRequest.encode = function encode(message, writer) { + BatchAnnotateImagesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - $root.google.cloud.vision.v1p4beta1.InputConfig.encode(message.inputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.features != null && message.features.length) - for (var i = 0; i < message.features.length; ++i) - $root.google.cloud.vision.v1p4beta1.Feature.encode(message.features[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.imageContext != null && message.hasOwnProperty("imageContext")) - $root.google.cloud.vision.v1p4beta1.ImageContext.encode(message.imageContext, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) - $root.google.cloud.vision.v1p4beta1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.requests != null && message.requests.length) + for (var i = 0; i < message.requests.length; ++i) + $root.google.cloud.vision.v1p4beta1.AnnotateImageRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified AsyncAnnotateFileRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest.verify|verify} messages. + * Encodes the specified BatchAnnotateImagesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest * @static - * @param {google.cloud.vision.v1p4beta1.IAsyncAnnotateFileRequest} message AsyncAnnotateFileRequest message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest} message BatchAnnotateImagesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncAnnotateFileRequest.encodeDelimited = function encodeDelimited(message, writer) { + BatchAnnotateImagesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer. + * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest + * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncAnnotateFileRequest.decode = function decode(reader, length) { + BatchAnnotateImagesRequest.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.vision.v1p4beta1.AsyncAnnotateFileRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.inputConfig = $root.google.cloud.vision.v1p4beta1.InputConfig.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.features && message.features.length)) - message.features = []; - message.features.push($root.google.cloud.vision.v1p4beta1.Feature.decode(reader, reader.uint32())); - break; - case 3: - message.imageContext = $root.google.cloud.vision.v1p4beta1.ImageContext.decode(reader, reader.uint32()); - break; - case 4: - message.outputConfig = $root.google.cloud.vision.v1p4beta1.OutputConfig.decode(reader, reader.uint32()); + if (!(message.requests && message.requests.length)) + message.requests = []; + message.requests.push($root.google.cloud.vision.v1p4beta1.AnnotateImageRequest.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -81570,165 +81653,125 @@ }; /** - * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer, length delimited. + * Decodes a BatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest + * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncAnnotateFileRequest.decodeDelimited = function decodeDelimited(reader) { + BatchAnnotateImagesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AsyncAnnotateFileRequest message. + * Verifies a BatchAnnotateImagesRequest message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AsyncAnnotateFileRequest.verify = function verify(message) { + BatchAnnotateImagesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { - var error = $root.google.cloud.vision.v1p4beta1.InputConfig.verify(message.inputConfig); - if (error) - return "inputConfig." + error; - } - if (message.features != null && message.hasOwnProperty("features")) { - if (!Array.isArray(message.features)) - return "features: array expected"; - for (var i = 0; i < message.features.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.Feature.verify(message.features[i]); + if (message.requests != null && message.hasOwnProperty("requests")) { + if (!Array.isArray(message.requests)) + return "requests: array expected"; + for (var i = 0; i < message.requests.length; ++i) { + var error = $root.google.cloud.vision.v1p4beta1.AnnotateImageRequest.verify(message.requests[i]); if (error) - return "features." + error; + return "requests." + error; } } - if (message.imageContext != null && message.hasOwnProperty("imageContext")) { - var error = $root.google.cloud.vision.v1p4beta1.ImageContext.verify(message.imageContext); - if (error) - return "imageContext." + error; - } - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { - var error = $root.google.cloud.vision.v1p4beta1.OutputConfig.verify(message.outputConfig); - if (error) - return "outputConfig." + error; - } return null; }; /** - * Creates an AsyncAnnotateFileRequest message from a plain object. Also converts values to their respective internal types. + * Creates a BatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest + * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest} BatchAnnotateImagesRequest */ - AsyncAnnotateFileRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest) + BatchAnnotateImagesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest) return object; - var message = new $root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest(); - if (object.inputConfig != null) { - if (typeof object.inputConfig !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest.inputConfig: object expected"); - message.inputConfig = $root.google.cloud.vision.v1p4beta1.InputConfig.fromObject(object.inputConfig); - } - if (object.features) { - if (!Array.isArray(object.features)) - throw TypeError(".google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest.features: array expected"); - message.features = []; - for (var i = 0; i < object.features.length; ++i) { - if (typeof object.features[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest.features: object expected"); - message.features[i] = $root.google.cloud.vision.v1p4beta1.Feature.fromObject(object.features[i]); + var message = new $root.google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest(); + if (object.requests) { + if (!Array.isArray(object.requests)) + throw TypeError(".google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest.requests: array expected"); + message.requests = []; + for (var i = 0; i < object.requests.length; ++i) { + if (typeof object.requests[i] !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest.requests: object expected"); + message.requests[i] = $root.google.cloud.vision.v1p4beta1.AnnotateImageRequest.fromObject(object.requests[i]); } } - if (object.imageContext != null) { - if (typeof object.imageContext !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest.imageContext: object expected"); - message.imageContext = $root.google.cloud.vision.v1p4beta1.ImageContext.fromObject(object.imageContext); - } - if (object.outputConfig != null) { - if (typeof object.outputConfig !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest.outputConfig: object expected"); - message.outputConfig = $root.google.cloud.vision.v1p4beta1.OutputConfig.fromObject(object.outputConfig); - } return message; }; /** - * Creates a plain object from an AsyncAnnotateFileRequest message. Also converts values to other types if specified. + * Creates a plain object from a BatchAnnotateImagesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest * @static - * @param {google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest} message AsyncAnnotateFileRequest + * @param {google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest} message BatchAnnotateImagesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AsyncAnnotateFileRequest.toObject = function toObject(message, options) { + BatchAnnotateImagesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.features = []; - if (options.defaults) { - object.inputConfig = null; - object.imageContext = null; - object.outputConfig = null; - } - if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) - object.inputConfig = $root.google.cloud.vision.v1p4beta1.InputConfig.toObject(message.inputConfig, options); - if (message.features && message.features.length) { - object.features = []; - for (var j = 0; j < message.features.length; ++j) - object.features[j] = $root.google.cloud.vision.v1p4beta1.Feature.toObject(message.features[j], options); + object.requests = []; + if (message.requests && message.requests.length) { + object.requests = []; + for (var j = 0; j < message.requests.length; ++j) + object.requests[j] = $root.google.cloud.vision.v1p4beta1.AnnotateImageRequest.toObject(message.requests[j], options); } - if (message.imageContext != null && message.hasOwnProperty("imageContext")) - object.imageContext = $root.google.cloud.vision.v1p4beta1.ImageContext.toObject(message.imageContext, options); - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) - object.outputConfig = $root.google.cloud.vision.v1p4beta1.OutputConfig.toObject(message.outputConfig, options); return object; }; /** - * Converts this AsyncAnnotateFileRequest to JSON. + * Converts this BatchAnnotateImagesRequest to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest * @instance * @returns {Object.} JSON object */ - AsyncAnnotateFileRequest.prototype.toJSON = function toJSON() { + BatchAnnotateImagesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AsyncAnnotateFileRequest; + return BatchAnnotateImagesRequest; })(); - v1p4beta1.AsyncAnnotateFileResponse = (function() { + v1p4beta1.BatchAnnotateImagesResponse = (function() { /** - * Properties of an AsyncAnnotateFileResponse. + * Properties of a BatchAnnotateImagesResponse. * @memberof google.cloud.vision.v1p4beta1 - * @interface IAsyncAnnotateFileResponse - * @property {google.cloud.vision.v1p4beta1.IOutputConfig|null} [outputConfig] AsyncAnnotateFileResponse outputConfig + * @interface IBatchAnnotateImagesResponse + * @property {Array.|null} [responses] BatchAnnotateImagesResponse responses */ /** - * Constructs a new AsyncAnnotateFileResponse. + * Constructs a new BatchAnnotateImagesResponse. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an AsyncAnnotateFileResponse. - * @implements IAsyncAnnotateFileResponse + * @classdesc Represents a BatchAnnotateImagesResponse. + * @implements IBatchAnnotateImagesResponse * @constructor - * @param {google.cloud.vision.v1p4beta1.IAsyncAnnotateFileResponse=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse=} [properties] Properties to set */ - function AsyncAnnotateFileResponse(properties) { + function BatchAnnotateImagesResponse(properties) { + this.responses = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -81736,75 +81779,78 @@ } /** - * AsyncAnnotateFileResponse outputConfig. - * @member {google.cloud.vision.v1p4beta1.IOutputConfig|null|undefined} outputConfig - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse + * BatchAnnotateImagesResponse responses. + * @member {Array.} responses + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse * @instance */ - AsyncAnnotateFileResponse.prototype.outputConfig = null; + BatchAnnotateImagesResponse.prototype.responses = $util.emptyArray; /** - * Creates a new AsyncAnnotateFileResponse instance using the specified properties. + * Creates a new BatchAnnotateImagesResponse instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse * @static - * @param {google.cloud.vision.v1p4beta1.IAsyncAnnotateFileResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse instance + * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse instance */ - AsyncAnnotateFileResponse.create = function create(properties) { - return new AsyncAnnotateFileResponse(properties); + BatchAnnotateImagesResponse.create = function create(properties) { + return new BatchAnnotateImagesResponse(properties); }; /** - * Encodes the specified AsyncAnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse.verify|verify} messages. + * Encodes the specified BatchAnnotateImagesResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse * @static - * @param {google.cloud.vision.v1p4beta1.IAsyncAnnotateFileResponse} message AsyncAnnotateFileResponse message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse} message BatchAnnotateImagesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncAnnotateFileResponse.encode = function encode(message, writer) { + BatchAnnotateImagesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) - $root.google.cloud.vision.v1p4beta1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.responses != null && message.responses.length) + for (var i = 0; i < message.responses.length; ++i) + $root.google.cloud.vision.v1p4beta1.AnnotateImageResponse.encode(message.responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified AsyncAnnotateFileResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse.verify|verify} messages. + * Encodes the specified BatchAnnotateImagesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse * @static - * @param {google.cloud.vision.v1p4beta1.IAsyncAnnotateFileResponse} message AsyncAnnotateFileResponse message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse} message BatchAnnotateImagesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncAnnotateFileResponse.encodeDelimited = function encodeDelimited(message, writer) { + BatchAnnotateImagesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer. + * Decodes a BatchAnnotateImagesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse + * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncAnnotateFileResponse.decode = function decode(reader, length) { + BatchAnnotateImagesResponse.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.vision.v1p4beta1.AsyncAnnotateFileResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.outputConfig = $root.google.cloud.vision.v1p4beta1.OutputConfig.decode(reader, reader.uint32()); + if (!(message.responses && message.responses.length)) + message.responses = []; + message.responses.push($root.google.cloud.vision.v1p4beta1.AnnotateImageResponse.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -81815,114 +81861,129 @@ }; /** - * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer, length delimited. + * Decodes a BatchAnnotateImagesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse + * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncAnnotateFileResponse.decodeDelimited = function decodeDelimited(reader) { + BatchAnnotateImagesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AsyncAnnotateFileResponse message. + * Verifies a BatchAnnotateImagesResponse message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AsyncAnnotateFileResponse.verify = function verify(message) { + BatchAnnotateImagesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { - var error = $root.google.cloud.vision.v1p4beta1.OutputConfig.verify(message.outputConfig); - if (error) - return "outputConfig." + error; + if (message.responses != null && message.hasOwnProperty("responses")) { + if (!Array.isArray(message.responses)) + return "responses: array expected"; + for (var i = 0; i < message.responses.length; ++i) { + var error = $root.google.cloud.vision.v1p4beta1.AnnotateImageResponse.verify(message.responses[i]); + if (error) + return "responses." + error; + } } return null; }; /** - * Creates an AsyncAnnotateFileResponse message from a plain object. Also converts values to their respective internal types. + * Creates a BatchAnnotateImagesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse + * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse} BatchAnnotateImagesResponse */ - AsyncAnnotateFileResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse) + BatchAnnotateImagesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse) return object; - var message = new $root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse(); - if (object.outputConfig != null) { - if (typeof object.outputConfig !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse.outputConfig: object expected"); - message.outputConfig = $root.google.cloud.vision.v1p4beta1.OutputConfig.fromObject(object.outputConfig); + var message = new $root.google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse(); + if (object.responses) { + if (!Array.isArray(object.responses)) + throw TypeError(".google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse.responses: array expected"); + message.responses = []; + for (var i = 0; i < object.responses.length; ++i) { + if (typeof object.responses[i] !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse.responses: object expected"); + message.responses[i] = $root.google.cloud.vision.v1p4beta1.AnnotateImageResponse.fromObject(object.responses[i]); + } } return message; }; /** - * Creates a plain object from an AsyncAnnotateFileResponse message. Also converts values to other types if specified. + * Creates a plain object from a BatchAnnotateImagesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse * @static - * @param {google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse} message AsyncAnnotateFileResponse + * @param {google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse} message BatchAnnotateImagesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AsyncAnnotateFileResponse.toObject = function toObject(message, options) { + BatchAnnotateImagesResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.outputConfig = null; - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) - object.outputConfig = $root.google.cloud.vision.v1p4beta1.OutputConfig.toObject(message.outputConfig, options); + if (options.arrays || options.defaults) + object.responses = []; + if (message.responses && message.responses.length) { + object.responses = []; + for (var j = 0; j < message.responses.length; ++j) + object.responses[j] = $root.google.cloud.vision.v1p4beta1.AnnotateImageResponse.toObject(message.responses[j], options); + } return object; }; /** - * Converts this AsyncAnnotateFileResponse to JSON. + * Converts this BatchAnnotateImagesResponse to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse * @instance * @returns {Object.} JSON object */ - AsyncAnnotateFileResponse.prototype.toJSON = function toJSON() { + BatchAnnotateImagesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AsyncAnnotateFileResponse; + return BatchAnnotateImagesResponse; })(); - v1p4beta1.AsyncBatchAnnotateImagesRequest = (function() { + v1p4beta1.AnnotateFileRequest = (function() { /** - * Properties of an AsyncBatchAnnotateImagesRequest. + * Properties of an AnnotateFileRequest. * @memberof google.cloud.vision.v1p4beta1 - * @interface IAsyncBatchAnnotateImagesRequest - * @property {Array.|null} [requests] AsyncBatchAnnotateImagesRequest requests - * @property {google.cloud.vision.v1p4beta1.IOutputConfig|null} [outputConfig] AsyncBatchAnnotateImagesRequest outputConfig + * @interface IAnnotateFileRequest + * @property {google.cloud.vision.v1p4beta1.IInputConfig|null} [inputConfig] AnnotateFileRequest inputConfig + * @property {Array.|null} [features] AnnotateFileRequest features + * @property {google.cloud.vision.v1p4beta1.IImageContext|null} [imageContext] AnnotateFileRequest imageContext + * @property {Array.|null} [pages] AnnotateFileRequest pages */ /** - * Constructs a new AsyncBatchAnnotateImagesRequest. + * Constructs a new AnnotateFileRequest. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an AsyncBatchAnnotateImagesRequest. - * @implements IAsyncBatchAnnotateImagesRequest + * @classdesc Represents an AnnotateFileRequest. + * @implements IAnnotateFileRequest * @constructor - * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IAnnotateFileRequest=} [properties] Properties to set */ - function AsyncBatchAnnotateImagesRequest(properties) { - this.requests = []; + function AnnotateFileRequest(properties) { + this.features = []; + this.pages = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -81930,91 +81991,128 @@ } /** - * AsyncBatchAnnotateImagesRequest requests. - * @member {Array.} requests - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest + * AnnotateFileRequest inputConfig. + * @member {google.cloud.vision.v1p4beta1.IInputConfig|null|undefined} inputConfig + * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest * @instance */ - AsyncBatchAnnotateImagesRequest.prototype.requests = $util.emptyArray; + AnnotateFileRequest.prototype.inputConfig = null; /** - * AsyncBatchAnnotateImagesRequest outputConfig. - * @member {google.cloud.vision.v1p4beta1.IOutputConfig|null|undefined} outputConfig - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest + * AnnotateFileRequest features. + * @member {Array.} features + * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest * @instance */ - AsyncBatchAnnotateImagesRequest.prototype.outputConfig = null; + AnnotateFileRequest.prototype.features = $util.emptyArray; /** - * Creates a new AsyncBatchAnnotateImagesRequest instance using the specified properties. + * AnnotateFileRequest imageContext. + * @member {google.cloud.vision.v1p4beta1.IImageContext|null|undefined} imageContext + * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest + * @instance + */ + AnnotateFileRequest.prototype.imageContext = null; + + /** + * AnnotateFileRequest pages. + * @member {Array.} pages + * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest + * @instance + */ + AnnotateFileRequest.prototype.pages = $util.emptyArray; + + /** + * Creates a new AnnotateFileRequest instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest * @static - * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest} AsyncBatchAnnotateImagesRequest instance + * @param {google.cloud.vision.v1p4beta1.IAnnotateFileRequest=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.AnnotateFileRequest} AnnotateFileRequest instance */ - AsyncBatchAnnotateImagesRequest.create = function create(properties) { - return new AsyncBatchAnnotateImagesRequest(properties); + AnnotateFileRequest.create = function create(properties) { + return new AnnotateFileRequest(properties); }; /** - * Encodes the specified AsyncBatchAnnotateImagesRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest.verify|verify} messages. + * Encodes the specified AnnotateFileRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateFileRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest * @static - * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest} message AsyncBatchAnnotateImagesRequest message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IAnnotateFileRequest} message AnnotateFileRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncBatchAnnotateImagesRequest.encode = function encode(message, writer) { + AnnotateFileRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.requests != null && message.requests.length) - for (var i = 0; i < message.requests.length; ++i) - $root.google.cloud.vision.v1p4beta1.AnnotateImageRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) - $root.google.cloud.vision.v1p4beta1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + $root.google.cloud.vision.v1p4beta1.InputConfig.encode(message.inputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.features != null && message.features.length) + for (var i = 0; i < message.features.length; ++i) + $root.google.cloud.vision.v1p4beta1.Feature.encode(message.features[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.imageContext != null && message.hasOwnProperty("imageContext")) + $root.google.cloud.vision.v1p4beta1.ImageContext.encode(message.imageContext, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.pages != null && message.pages.length) { + writer.uint32(/* id 4, wireType 2 =*/34).fork(); + for (var i = 0; i < message.pages.length; ++i) + writer.int32(message.pages[i]); + writer.ldelim(); + } return writer; }; /** - * Encodes the specified AsyncBatchAnnotateImagesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest.verify|verify} messages. + * Encodes the specified AnnotateFileRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateFileRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest * @static - * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest} message AsyncBatchAnnotateImagesRequest message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IAnnotateFileRequest} message AnnotateFileRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncBatchAnnotateImagesRequest.encodeDelimited = function encodeDelimited(message, writer) { + AnnotateFileRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AsyncBatchAnnotateImagesRequest message from the specified reader or buffer. + * Decodes an AnnotateFileRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest} AsyncBatchAnnotateImagesRequest + * @returns {google.cloud.vision.v1p4beta1.AnnotateFileRequest} AnnotateFileRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncBatchAnnotateImagesRequest.decode = function decode(reader, length) { + AnnotateFileRequest.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.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.AnnotateFileRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.requests && message.requests.length)) - message.requests = []; - message.requests.push($root.google.cloud.vision.v1p4beta1.AnnotateImageRequest.decode(reader, reader.uint32())); + message.inputConfig = $root.google.cloud.vision.v1p4beta1.InputConfig.decode(reader, reader.uint32()); break; case 2: - message.outputConfig = $root.google.cloud.vision.v1p4beta1.OutputConfig.decode(reader, reader.uint32()); + if (!(message.features && message.features.length)) + message.features = []; + message.features.push($root.google.cloud.vision.v1p4beta1.Feature.decode(reader, reader.uint32())); + break; + case 3: + message.imageContext = $root.google.cloud.vision.v1p4beta1.ImageContext.decode(reader, reader.uint32()); + break; + case 4: + if (!(message.pages && message.pages.length)) + message.pages = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.pages.push(reader.int32()); + } else + message.pages.push(reader.int32()); break; default: reader.skipType(tag & 7); @@ -82025,138 +82123,177 @@ }; /** - * Decodes an AsyncBatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. + * Decodes an AnnotateFileRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest} AsyncBatchAnnotateImagesRequest + * @returns {google.cloud.vision.v1p4beta1.AnnotateFileRequest} AnnotateFileRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncBatchAnnotateImagesRequest.decodeDelimited = function decodeDelimited(reader) { + AnnotateFileRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AsyncBatchAnnotateImagesRequest message. + * Verifies an AnnotateFileRequest message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AsyncBatchAnnotateImagesRequest.verify = function verify(message) { + AnnotateFileRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.requests != null && message.hasOwnProperty("requests")) { - if (!Array.isArray(message.requests)) - return "requests: array expected"; - for (var i = 0; i < message.requests.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.AnnotateImageRequest.verify(message.requests[i]); + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.vision.v1p4beta1.InputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; + } + if (message.features != null && message.hasOwnProperty("features")) { + if (!Array.isArray(message.features)) + return "features: array expected"; + for (var i = 0; i < message.features.length; ++i) { + var error = $root.google.cloud.vision.v1p4beta1.Feature.verify(message.features[i]); if (error) - return "requests." + error; + return "features." + error; } } - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { - var error = $root.google.cloud.vision.v1p4beta1.OutputConfig.verify(message.outputConfig); + if (message.imageContext != null && message.hasOwnProperty("imageContext")) { + var error = $root.google.cloud.vision.v1p4beta1.ImageContext.verify(message.imageContext); if (error) - return "outputConfig." + error; + return "imageContext." + error; + } + if (message.pages != null && message.hasOwnProperty("pages")) { + if (!Array.isArray(message.pages)) + return "pages: array expected"; + for (var i = 0; i < message.pages.length; ++i) + if (!$util.isInteger(message.pages[i])) + return "pages: integer[] expected"; } return null; }; /** - * Creates an AsyncBatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. + * Creates an AnnotateFileRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest} AsyncBatchAnnotateImagesRequest + * @returns {google.cloud.vision.v1p4beta1.AnnotateFileRequest} AnnotateFileRequest */ - AsyncBatchAnnotateImagesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest) + AnnotateFileRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.AnnotateFileRequest) return object; - var message = new $root.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest(); - if (object.requests) { - if (!Array.isArray(object.requests)) - throw TypeError(".google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest.requests: array expected"); - message.requests = []; - for (var i = 0; i < object.requests.length; ++i) { - if (typeof object.requests[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest.requests: object expected"); - message.requests[i] = $root.google.cloud.vision.v1p4beta1.AnnotateImageRequest.fromObject(object.requests[i]); + var message = new $root.google.cloud.vision.v1p4beta1.AnnotateFileRequest(); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateFileRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.vision.v1p4beta1.InputConfig.fromObject(object.inputConfig); + } + if (object.features) { + if (!Array.isArray(object.features)) + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateFileRequest.features: array expected"); + message.features = []; + for (var i = 0; i < object.features.length; ++i) { + if (typeof object.features[i] !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateFileRequest.features: object expected"); + message.features[i] = $root.google.cloud.vision.v1p4beta1.Feature.fromObject(object.features[i]); } } - if (object.outputConfig != null) { - if (typeof object.outputConfig !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest.outputConfig: object expected"); - message.outputConfig = $root.google.cloud.vision.v1p4beta1.OutputConfig.fromObject(object.outputConfig); + if (object.imageContext != null) { + if (typeof object.imageContext !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateFileRequest.imageContext: object expected"); + message.imageContext = $root.google.cloud.vision.v1p4beta1.ImageContext.fromObject(object.imageContext); + } + if (object.pages) { + if (!Array.isArray(object.pages)) + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateFileRequest.pages: array expected"); + message.pages = []; + for (var i = 0; i < object.pages.length; ++i) + message.pages[i] = object.pages[i] | 0; } return message; }; /** - * Creates a plain object from an AsyncBatchAnnotateImagesRequest message. Also converts values to other types if specified. + * Creates a plain object from an AnnotateFileRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest * @static - * @param {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest} message AsyncBatchAnnotateImagesRequest + * @param {google.cloud.vision.v1p4beta1.AnnotateFileRequest} message AnnotateFileRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AsyncBatchAnnotateImagesRequest.toObject = function toObject(message, options) { + AnnotateFileRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) - object.requests = []; - if (options.defaults) - object.outputConfig = null; - if (message.requests && message.requests.length) { - object.requests = []; - for (var j = 0; j < message.requests.length; ++j) - object.requests[j] = $root.google.cloud.vision.v1p4beta1.AnnotateImageRequest.toObject(message.requests[j], options); + if (options.arrays || options.defaults) { + object.features = []; + object.pages = []; + } + if (options.defaults) { + object.inputConfig = null; + object.imageContext = null; + } + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.vision.v1p4beta1.InputConfig.toObject(message.inputConfig, options); + if (message.features && message.features.length) { + object.features = []; + for (var j = 0; j < message.features.length; ++j) + object.features[j] = $root.google.cloud.vision.v1p4beta1.Feature.toObject(message.features[j], options); + } + if (message.imageContext != null && message.hasOwnProperty("imageContext")) + object.imageContext = $root.google.cloud.vision.v1p4beta1.ImageContext.toObject(message.imageContext, options); + if (message.pages && message.pages.length) { + object.pages = []; + for (var j = 0; j < message.pages.length; ++j) + object.pages[j] = message.pages[j]; } - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) - object.outputConfig = $root.google.cloud.vision.v1p4beta1.OutputConfig.toObject(message.outputConfig, options); return object; }; /** - * Converts this AsyncBatchAnnotateImagesRequest to JSON. + * Converts this AnnotateFileRequest to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest + * @memberof google.cloud.vision.v1p4beta1.AnnotateFileRequest * @instance * @returns {Object.} JSON object */ - AsyncBatchAnnotateImagesRequest.prototype.toJSON = function toJSON() { + AnnotateFileRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AsyncBatchAnnotateImagesRequest; + return AnnotateFileRequest; })(); - v1p4beta1.AsyncBatchAnnotateImagesResponse = (function() { + v1p4beta1.AnnotateFileResponse = (function() { /** - * Properties of an AsyncBatchAnnotateImagesResponse. + * Properties of an AnnotateFileResponse. * @memberof google.cloud.vision.v1p4beta1 - * @interface IAsyncBatchAnnotateImagesResponse - * @property {google.cloud.vision.v1p4beta1.IOutputConfig|null} [outputConfig] AsyncBatchAnnotateImagesResponse outputConfig + * @interface IAnnotateFileResponse + * @property {google.cloud.vision.v1p4beta1.IInputConfig|null} [inputConfig] AnnotateFileResponse inputConfig + * @property {Array.|null} [responses] AnnotateFileResponse responses + * @property {number|null} [totalPages] AnnotateFileResponse totalPages + * @property {google.rpc.IStatus|null} [error] AnnotateFileResponse error */ /** - * Constructs a new AsyncBatchAnnotateImagesResponse. + * Constructs a new AnnotateFileResponse. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an AsyncBatchAnnotateImagesResponse. - * @implements IAsyncBatchAnnotateImagesResponse + * @classdesc Represents an AnnotateFileResponse. + * @implements IAnnotateFileResponse * @constructor - * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IAnnotateFileResponse=} [properties] Properties to set */ - function AsyncBatchAnnotateImagesResponse(properties) { + function AnnotateFileResponse(properties) { + this.responses = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -82164,75 +82301,117 @@ } /** - * AsyncBatchAnnotateImagesResponse outputConfig. - * @member {google.cloud.vision.v1p4beta1.IOutputConfig|null|undefined} outputConfig - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse + * AnnotateFileResponse inputConfig. + * @member {google.cloud.vision.v1p4beta1.IInputConfig|null|undefined} inputConfig + * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse * @instance */ - AsyncBatchAnnotateImagesResponse.prototype.outputConfig = null; + AnnotateFileResponse.prototype.inputConfig = null; /** - * Creates a new AsyncBatchAnnotateImagesResponse instance using the specified properties. + * AnnotateFileResponse responses. + * @member {Array.} responses + * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse + * @instance + */ + AnnotateFileResponse.prototype.responses = $util.emptyArray; + + /** + * AnnotateFileResponse totalPages. + * @member {number} totalPages + * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse + * @instance + */ + AnnotateFileResponse.prototype.totalPages = 0; + + /** + * AnnotateFileResponse error. + * @member {google.rpc.IStatus|null|undefined} error + * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse + * @instance + */ + AnnotateFileResponse.prototype.error = null; + + /** + * Creates a new AnnotateFileResponse instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse * @static - * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse} AsyncBatchAnnotateImagesResponse instance + * @param {google.cloud.vision.v1p4beta1.IAnnotateFileResponse=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.AnnotateFileResponse} AnnotateFileResponse instance */ - AsyncBatchAnnotateImagesResponse.create = function create(properties) { - return new AsyncBatchAnnotateImagesResponse(properties); + AnnotateFileResponse.create = function create(properties) { + return new AnnotateFileResponse(properties); }; /** - * Encodes the specified AsyncBatchAnnotateImagesResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse.verify|verify} messages. + * Encodes the specified AnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateFileResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse * @static - * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse} message AsyncBatchAnnotateImagesResponse message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IAnnotateFileResponse} message AnnotateFileResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncBatchAnnotateImagesResponse.encode = function encode(message, writer) { + AnnotateFileResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) - $root.google.cloud.vision.v1p4beta1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + $root.google.cloud.vision.v1p4beta1.InputConfig.encode(message.inputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.responses != null && message.responses.length) + for (var i = 0; i < message.responses.length; ++i) + $root.google.cloud.vision.v1p4beta1.AnnotateImageResponse.encode(message.responses[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.totalPages != null && message.hasOwnProperty("totalPages")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.totalPages); + if (message.error != null && message.hasOwnProperty("error")) + $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); return writer; }; /** - * Encodes the specified AsyncBatchAnnotateImagesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse.verify|verify} messages. + * Encodes the specified AnnotateFileResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AnnotateFileResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse * @static - * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse} message AsyncBatchAnnotateImagesResponse message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IAnnotateFileResponse} message AnnotateFileResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncBatchAnnotateImagesResponse.encodeDelimited = function encodeDelimited(message, writer) { + AnnotateFileResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AsyncBatchAnnotateImagesResponse message from the specified reader or buffer. + * Decodes an AnnotateFileResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse} AsyncBatchAnnotateImagesResponse + * @returns {google.cloud.vision.v1p4beta1.AnnotateFileResponse} AnnotateFileResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncBatchAnnotateImagesResponse.decode = function decode(reader, length) { + AnnotateFileResponse.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.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.AnnotateFileResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.outputConfig = $root.google.cloud.vision.v1p4beta1.OutputConfig.decode(reader, reader.uint32()); + message.inputConfig = $root.google.cloud.vision.v1p4beta1.InputConfig.decode(reader, reader.uint32()); + break; + case 2: + if (!(message.responses && message.responses.length)) + message.responses = []; + message.responses.push($root.google.cloud.vision.v1p4beta1.AnnotateImageResponse.decode(reader, reader.uint32())); + break; + case 3: + message.totalPages = reader.int32(); + break; + case 4: + message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -82243,112 +82422,160 @@ }; /** - * Decodes an AsyncBatchAnnotateImagesResponse message from the specified reader or buffer, length delimited. + * Decodes an AnnotateFileResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse} AsyncBatchAnnotateImagesResponse + * @returns {google.cloud.vision.v1p4beta1.AnnotateFileResponse} AnnotateFileResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncBatchAnnotateImagesResponse.decodeDelimited = function decodeDelimited(reader) { + AnnotateFileResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AsyncBatchAnnotateImagesResponse message. + * Verifies an AnnotateFileResponse message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AsyncBatchAnnotateImagesResponse.verify = function verify(message) { + AnnotateFileResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { - var error = $root.google.cloud.vision.v1p4beta1.OutputConfig.verify(message.outputConfig); + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.vision.v1p4beta1.InputConfig.verify(message.inputConfig); if (error) - return "outputConfig." + error; + return "inputConfig." + error; + } + if (message.responses != null && message.hasOwnProperty("responses")) { + if (!Array.isArray(message.responses)) + return "responses: array expected"; + for (var i = 0; i < message.responses.length; ++i) { + var error = $root.google.cloud.vision.v1p4beta1.AnnotateImageResponse.verify(message.responses[i]); + if (error) + return "responses." + error; + } + } + if (message.totalPages != null && message.hasOwnProperty("totalPages")) + if (!$util.isInteger(message.totalPages)) + return "totalPages: integer expected"; + if (message.error != null && message.hasOwnProperty("error")) { + var error = $root.google.rpc.Status.verify(message.error); + if (error) + return "error." + error; } return null; }; /** - * Creates an AsyncBatchAnnotateImagesResponse message from a plain object. Also converts values to their respective internal types. + * Creates an AnnotateFileResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse} AsyncBatchAnnotateImagesResponse + * @returns {google.cloud.vision.v1p4beta1.AnnotateFileResponse} AnnotateFileResponse */ - AsyncBatchAnnotateImagesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse) + AnnotateFileResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.AnnotateFileResponse) return object; - var message = new $root.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse(); - if (object.outputConfig != null) { - if (typeof object.outputConfig !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse.outputConfig: object expected"); - message.outputConfig = $root.google.cloud.vision.v1p4beta1.OutputConfig.fromObject(object.outputConfig); + var message = new $root.google.cloud.vision.v1p4beta1.AnnotateFileResponse(); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateFileResponse.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.vision.v1p4beta1.InputConfig.fromObject(object.inputConfig); + } + if (object.responses) { + if (!Array.isArray(object.responses)) + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateFileResponse.responses: array expected"); + message.responses = []; + for (var i = 0; i < object.responses.length; ++i) { + if (typeof object.responses[i] !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateFileResponse.responses: object expected"); + message.responses[i] = $root.google.cloud.vision.v1p4beta1.AnnotateImageResponse.fromObject(object.responses[i]); + } + } + if (object.totalPages != null) + message.totalPages = object.totalPages | 0; + if (object.error != null) { + if (typeof object.error !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AnnotateFileResponse.error: object expected"); + message.error = $root.google.rpc.Status.fromObject(object.error); } return message; }; /** - * Creates a plain object from an AsyncBatchAnnotateImagesResponse message. Also converts values to other types if specified. + * Creates a plain object from an AnnotateFileResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse * @static - * @param {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse} message AsyncBatchAnnotateImagesResponse + * @param {google.cloud.vision.v1p4beta1.AnnotateFileResponse} message AnnotateFileResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AsyncBatchAnnotateImagesResponse.toObject = function toObject(message, options) { + AnnotateFileResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) - object.outputConfig = null; - if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) - object.outputConfig = $root.google.cloud.vision.v1p4beta1.OutputConfig.toObject(message.outputConfig, options); + if (options.arrays || options.defaults) + object.responses = []; + if (options.defaults) { + object.inputConfig = null; + object.totalPages = 0; + object.error = null; + } + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.vision.v1p4beta1.InputConfig.toObject(message.inputConfig, options); + if (message.responses && message.responses.length) { + object.responses = []; + for (var j = 0; j < message.responses.length; ++j) + object.responses[j] = $root.google.cloud.vision.v1p4beta1.AnnotateImageResponse.toObject(message.responses[j], options); + } + if (message.totalPages != null && message.hasOwnProperty("totalPages")) + object.totalPages = message.totalPages; + if (message.error != null && message.hasOwnProperty("error")) + object.error = $root.google.rpc.Status.toObject(message.error, options); return object; }; /** - * Converts this AsyncBatchAnnotateImagesResponse to JSON. + * Converts this AnnotateFileResponse to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse + * @memberof google.cloud.vision.v1p4beta1.AnnotateFileResponse * @instance * @returns {Object.} JSON object */ - AsyncBatchAnnotateImagesResponse.prototype.toJSON = function toJSON() { + AnnotateFileResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AsyncBatchAnnotateImagesResponse; + return AnnotateFileResponse; })(); - v1p4beta1.AsyncBatchAnnotateFilesRequest = (function() { + v1p4beta1.BatchAnnotateFilesRequest = (function() { /** - * Properties of an AsyncBatchAnnotateFilesRequest. + * Properties of a BatchAnnotateFilesRequest. * @memberof google.cloud.vision.v1p4beta1 - * @interface IAsyncBatchAnnotateFilesRequest - * @property {Array.|null} [requests] AsyncBatchAnnotateFilesRequest requests + * @interface IBatchAnnotateFilesRequest + * @property {Array.|null} [requests] BatchAnnotateFilesRequest requests */ /** - * Constructs a new AsyncBatchAnnotateFilesRequest. + * Constructs a new BatchAnnotateFilesRequest. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an AsyncBatchAnnotateFilesRequest. - * @implements IAsyncBatchAnnotateFilesRequest + * @classdesc Represents a BatchAnnotateFilesRequest. + * @implements IBatchAnnotateFilesRequest * @constructor - * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest=} [properties] Properties to set */ - function AsyncBatchAnnotateFilesRequest(properties) { + function BatchAnnotateFilesRequest(properties) { this.requests = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) @@ -82357,78 +82584,78 @@ } /** - * AsyncBatchAnnotateFilesRequest requests. - * @member {Array.} requests - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest + * BatchAnnotateFilesRequest requests. + * @member {Array.} requests + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest * @instance */ - AsyncBatchAnnotateFilesRequest.prototype.requests = $util.emptyArray; + BatchAnnotateFilesRequest.prototype.requests = $util.emptyArray; /** - * Creates a new AsyncBatchAnnotateFilesRequest instance using the specified properties. + * Creates a new BatchAnnotateFilesRequest instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest * @static - * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest instance + * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest} BatchAnnotateFilesRequest instance */ - AsyncBatchAnnotateFilesRequest.create = function create(properties) { - return new AsyncBatchAnnotateFilesRequest(properties); + BatchAnnotateFilesRequest.create = function create(properties) { + return new BatchAnnotateFilesRequest(properties); }; /** - * Encodes the specified AsyncBatchAnnotateFilesRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest.verify|verify} messages. + * Encodes the specified BatchAnnotateFilesRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest * @static - * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest} message AsyncBatchAnnotateFilesRequest message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest} message BatchAnnotateFilesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncBatchAnnotateFilesRequest.encode = function encode(message, writer) { + BatchAnnotateFilesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.requests != null && message.requests.length) for (var i = 0; i < message.requests.length; ++i) - $root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.cloud.vision.v1p4beta1.AnnotateFileRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified AsyncBatchAnnotateFilesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest.verify|verify} messages. + * Encodes the specified BatchAnnotateFilesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest * @static - * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest} message AsyncBatchAnnotateFilesRequest message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest} message BatchAnnotateFilesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncBatchAnnotateFilesRequest.encodeDelimited = function encodeDelimited(message, writer) { + BatchAnnotateFilesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AsyncBatchAnnotateFilesRequest message from the specified reader or buffer. + * Decodes a BatchAnnotateFilesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest + * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest} BatchAnnotateFilesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncBatchAnnotateFilesRequest.decode = function decode(reader, length) { + BatchAnnotateFilesRequest.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.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: if (!(message.requests && message.requests.length)) message.requests = []; - message.requests.push($root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest.decode(reader, reader.uint32())); + message.requests.push($root.google.cloud.vision.v1p4beta1.AnnotateFileRequest.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -82439,37 +82666,37 @@ }; /** - * Decodes an AsyncBatchAnnotateFilesRequest message from the specified reader or buffer, length delimited. + * Decodes a BatchAnnotateFilesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest + * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest} BatchAnnotateFilesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncBatchAnnotateFilesRequest.decodeDelimited = function decodeDelimited(reader) { + BatchAnnotateFilesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AsyncBatchAnnotateFilesRequest message. + * Verifies a BatchAnnotateFilesRequest message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AsyncBatchAnnotateFilesRequest.verify = function verify(message) { + BatchAnnotateFilesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.requests != null && message.hasOwnProperty("requests")) { if (!Array.isArray(message.requests)) return "requests: array expected"; for (var i = 0; i < message.requests.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest.verify(message.requests[i]); + var error = $root.google.cloud.vision.v1p4beta1.AnnotateFileRequest.verify(message.requests[i]); if (error) return "requests." + error; } @@ -82478,40 +82705,40 @@ }; /** - * Creates an AsyncBatchAnnotateFilesRequest message from a plain object. Also converts values to their respective internal types. + * Creates a BatchAnnotateFilesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest + * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest} BatchAnnotateFilesRequest */ - AsyncBatchAnnotateFilesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest) + BatchAnnotateFilesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest) return object; - var message = new $root.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest(); + var message = new $root.google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest(); if (object.requests) { if (!Array.isArray(object.requests)) - throw TypeError(".google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest.requests: array expected"); + throw TypeError(".google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest.requests: array expected"); message.requests = []; for (var i = 0; i < object.requests.length; ++i) { if (typeof object.requests[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest.requests: object expected"); - message.requests[i] = $root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest.fromObject(object.requests[i]); + throw TypeError(".google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest.requests: object expected"); + message.requests[i] = $root.google.cloud.vision.v1p4beta1.AnnotateFileRequest.fromObject(object.requests[i]); } } return message; }; /** - * Creates a plain object from an AsyncBatchAnnotateFilesRequest message. Also converts values to other types if specified. + * Creates a plain object from a BatchAnnotateFilesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest * @static - * @param {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest} message AsyncBatchAnnotateFilesRequest + * @param {google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest} message BatchAnnotateFilesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AsyncBatchAnnotateFilesRequest.toObject = function toObject(message, options) { + BatchAnnotateFilesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; @@ -82520,43 +82747,43 @@ if (message.requests && message.requests.length) { object.requests = []; for (var j = 0; j < message.requests.length; ++j) - object.requests[j] = $root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest.toObject(message.requests[j], options); + object.requests[j] = $root.google.cloud.vision.v1p4beta1.AnnotateFileRequest.toObject(message.requests[j], options); } return object; }; /** - * Converts this AsyncBatchAnnotateFilesRequest to JSON. + * Converts this BatchAnnotateFilesRequest to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest * @instance * @returns {Object.} JSON object */ - AsyncBatchAnnotateFilesRequest.prototype.toJSON = function toJSON() { + BatchAnnotateFilesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AsyncBatchAnnotateFilesRequest; + return BatchAnnotateFilesRequest; })(); - v1p4beta1.AsyncBatchAnnotateFilesResponse = (function() { + v1p4beta1.BatchAnnotateFilesResponse = (function() { /** - * Properties of an AsyncBatchAnnotateFilesResponse. + * Properties of a BatchAnnotateFilesResponse. * @memberof google.cloud.vision.v1p4beta1 - * @interface IAsyncBatchAnnotateFilesResponse - * @property {Array.|null} [responses] AsyncBatchAnnotateFilesResponse responses + * @interface IBatchAnnotateFilesResponse + * @property {Array.|null} [responses] BatchAnnotateFilesResponse responses */ /** - * Constructs a new AsyncBatchAnnotateFilesResponse. + * Constructs a new BatchAnnotateFilesResponse. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an AsyncBatchAnnotateFilesResponse. - * @implements IAsyncBatchAnnotateFilesResponse + * @classdesc Represents a BatchAnnotateFilesResponse. + * @implements IBatchAnnotateFilesResponse * @constructor - * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse=} [properties] Properties to set */ - function AsyncBatchAnnotateFilesResponse(properties) { + function BatchAnnotateFilesResponse(properties) { this.responses = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) @@ -82565,78 +82792,78 @@ } /** - * AsyncBatchAnnotateFilesResponse responses. - * @member {Array.} responses - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse + * BatchAnnotateFilesResponse responses. + * @member {Array.} responses + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse * @instance */ - AsyncBatchAnnotateFilesResponse.prototype.responses = $util.emptyArray; + BatchAnnotateFilesResponse.prototype.responses = $util.emptyArray; /** - * Creates a new AsyncBatchAnnotateFilesResponse instance using the specified properties. + * Creates a new BatchAnnotateFilesResponse instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse * @static - * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse instance + * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse} BatchAnnotateFilesResponse instance */ - AsyncBatchAnnotateFilesResponse.create = function create(properties) { - return new AsyncBatchAnnotateFilesResponse(properties); + BatchAnnotateFilesResponse.create = function create(properties) { + return new BatchAnnotateFilesResponse(properties); }; /** - * Encodes the specified AsyncBatchAnnotateFilesResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse.verify|verify} messages. + * Encodes the specified BatchAnnotateFilesResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse * @static - * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse} message AsyncBatchAnnotateFilesResponse message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse} message BatchAnnotateFilesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncBatchAnnotateFilesResponse.encode = function encode(message, writer) { + BatchAnnotateFilesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); if (message.responses != null && message.responses.length) for (var i = 0; i < message.responses.length; ++i) - $root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse.encode(message.responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.google.cloud.vision.v1p4beta1.AnnotateFileResponse.encode(message.responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified AsyncBatchAnnotateFilesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse.verify|verify} messages. + * Encodes the specified BatchAnnotateFilesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse * @static - * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse} message AsyncBatchAnnotateFilesResponse message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse} message BatchAnnotateFilesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - AsyncBatchAnnotateFilesResponse.encodeDelimited = function encodeDelimited(message, writer) { + BatchAnnotateFilesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an AsyncBatchAnnotateFilesResponse message from the specified reader or buffer. + * Decodes a BatchAnnotateFilesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse + * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse} BatchAnnotateFilesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncBatchAnnotateFilesResponse.decode = function decode(reader, length) { + BatchAnnotateFilesResponse.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.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: if (!(message.responses && message.responses.length)) message.responses = []; - message.responses.push($root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse.decode(reader, reader.uint32())); + message.responses.push($root.google.cloud.vision.v1p4beta1.AnnotateFileResponse.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -82647,37 +82874,37 @@ }; /** - * Decodes an AsyncBatchAnnotateFilesResponse message from the specified reader or buffer, length delimited. + * Decodes a BatchAnnotateFilesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse + * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse} BatchAnnotateFilesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - AsyncBatchAnnotateFilesResponse.decodeDelimited = function decodeDelimited(reader) { + BatchAnnotateFilesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an AsyncBatchAnnotateFilesResponse message. + * Verifies a BatchAnnotateFilesResponse message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - AsyncBatchAnnotateFilesResponse.verify = function verify(message) { + BatchAnnotateFilesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.responses != null && message.hasOwnProperty("responses")) { if (!Array.isArray(message.responses)) return "responses: array expected"; for (var i = 0; i < message.responses.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse.verify(message.responses[i]); + var error = $root.google.cloud.vision.v1p4beta1.AnnotateFileResponse.verify(message.responses[i]); if (error) return "responses." + error; } @@ -82686,40 +82913,40 @@ }; /** - * Creates an AsyncBatchAnnotateFilesResponse message from a plain object. Also converts values to their respective internal types. + * Creates a BatchAnnotateFilesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse + * @returns {google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse} BatchAnnotateFilesResponse */ - AsyncBatchAnnotateFilesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse) + BatchAnnotateFilesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse) return object; - var message = new $root.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse(); + var message = new $root.google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse(); if (object.responses) { if (!Array.isArray(object.responses)) - throw TypeError(".google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse.responses: array expected"); + throw TypeError(".google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse.responses: array expected"); message.responses = []; for (var i = 0; i < object.responses.length; ++i) { if (typeof object.responses[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse.responses: object expected"); - message.responses[i] = $root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse.fromObject(object.responses[i]); + throw TypeError(".google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse.responses: object expected"); + message.responses[i] = $root.google.cloud.vision.v1p4beta1.AnnotateFileResponse.fromObject(object.responses[i]); } } return message; }; /** - * Creates a plain object from an AsyncBatchAnnotateFilesResponse message. Also converts values to other types if specified. + * Creates a plain object from a BatchAnnotateFilesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse * @static - * @param {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse} message AsyncBatchAnnotateFilesResponse + * @param {google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse} message BatchAnnotateFilesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - AsyncBatchAnnotateFilesResponse.toObject = function toObject(message, options) { + BatchAnnotateFilesResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; @@ -82728,45 +82955,47 @@ if (message.responses && message.responses.length) { object.responses = []; for (var j = 0; j < message.responses.length; ++j) - object.responses[j] = $root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse.toObject(message.responses[j], options); + object.responses[j] = $root.google.cloud.vision.v1p4beta1.AnnotateFileResponse.toObject(message.responses[j], options); } return object; }; /** - * Converts this AsyncBatchAnnotateFilesResponse to JSON. + * Converts this BatchAnnotateFilesResponse to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse + * @memberof google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse * @instance * @returns {Object.} JSON object */ - AsyncBatchAnnotateFilesResponse.prototype.toJSON = function toJSON() { + BatchAnnotateFilesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return AsyncBatchAnnotateFilesResponse; + return BatchAnnotateFilesResponse; })(); - v1p4beta1.InputConfig = (function() { + v1p4beta1.AsyncAnnotateFileRequest = (function() { /** - * Properties of an InputConfig. + * Properties of an AsyncAnnotateFileRequest. * @memberof google.cloud.vision.v1p4beta1 - * @interface IInputConfig - * @property {google.cloud.vision.v1p4beta1.IGcsSource|null} [gcsSource] InputConfig gcsSource - * @property {Uint8Array|null} [content] InputConfig content - * @property {string|null} [mimeType] InputConfig mimeType + * @interface IAsyncAnnotateFileRequest + * @property {google.cloud.vision.v1p4beta1.IInputConfig|null} [inputConfig] AsyncAnnotateFileRequest inputConfig + * @property {Array.|null} [features] AsyncAnnotateFileRequest features + * @property {google.cloud.vision.v1p4beta1.IImageContext|null} [imageContext] AsyncAnnotateFileRequest imageContext + * @property {google.cloud.vision.v1p4beta1.IOutputConfig|null} [outputConfig] AsyncAnnotateFileRequest outputConfig */ /** - * Constructs a new InputConfig. + * Constructs a new AsyncAnnotateFileRequest. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an InputConfig. - * @implements IInputConfig + * @classdesc Represents an AsyncAnnotateFileRequest. + * @implements IAsyncAnnotateFileRequest * @constructor - * @param {google.cloud.vision.v1p4beta1.IInputConfig=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IAsyncAnnotateFileRequest=} [properties] Properties to set */ - function InputConfig(properties) { + function AsyncAnnotateFileRequest(properties) { + this.features = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -82774,333 +83003,117 @@ } /** - * InputConfig gcsSource. - * @member {google.cloud.vision.v1p4beta1.IGcsSource|null|undefined} gcsSource - * @memberof google.cloud.vision.v1p4beta1.InputConfig - * @instance - */ - InputConfig.prototype.gcsSource = null; - - /** - * InputConfig content. - * @member {Uint8Array} content - * @memberof google.cloud.vision.v1p4beta1.InputConfig - * @instance - */ - InputConfig.prototype.content = $util.newBuffer([]); - - /** - * InputConfig mimeType. - * @member {string} mimeType - * @memberof google.cloud.vision.v1p4beta1.InputConfig + * AsyncAnnotateFileRequest inputConfig. + * @member {google.cloud.vision.v1p4beta1.IInputConfig|null|undefined} inputConfig + * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest * @instance */ - InputConfig.prototype.mimeType = ""; - - /** - * Creates a new InputConfig instance using the specified properties. - * @function create - * @memberof google.cloud.vision.v1p4beta1.InputConfig - * @static - * @param {google.cloud.vision.v1p4beta1.IInputConfig=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.InputConfig} InputConfig instance - */ - InputConfig.create = function create(properties) { - return new InputConfig(properties); - }; - - /** - * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.vision.v1p4beta1.InputConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.vision.v1p4beta1.InputConfig - * @static - * @param {google.cloud.vision.v1p4beta1.IInputConfig} message InputConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InputConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) - $root.google.cloud.vision.v1p4beta1.GcsSource.encode(message.gcsSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.mimeType != null && message.hasOwnProperty("mimeType")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimeType); - if (message.content != null && message.hasOwnProperty("content")) - writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.content); - return writer; - }; - - /** - * Encodes the specified InputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.InputConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.InputConfig - * @static - * @param {google.cloud.vision.v1p4beta1.IInputConfig} message InputConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InputConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InputConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.vision.v1p4beta1.InputConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.InputConfig} InputConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InputConfig.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.vision.v1p4beta1.InputConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.gcsSource = $root.google.cloud.vision.v1p4beta1.GcsSource.decode(reader, reader.uint32()); - break; - case 3: - message.content = reader.bytes(); - break; - case 2: - message.mimeType = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InputConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.InputConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.InputConfig} InputConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InputConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InputConfig message. - * @function verify - * @memberof google.cloud.vision.v1p4beta1.InputConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InputConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { - var error = $root.google.cloud.vision.v1p4beta1.GcsSource.verify(message.gcsSource); - if (error) - return "gcsSource." + error; - } - if (message.content != null && message.hasOwnProperty("content")) - if (!(message.content && typeof message.content.length === "number" || $util.isString(message.content))) - return "content: buffer expected"; - if (message.mimeType != null && message.hasOwnProperty("mimeType")) - if (!$util.isString(message.mimeType)) - return "mimeType: string expected"; - return null; - }; - - /** - * Creates an InputConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.InputConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.InputConfig} InputConfig - */ - InputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.InputConfig) - return object; - var message = new $root.google.cloud.vision.v1p4beta1.InputConfig(); - if (object.gcsSource != null) { - if (typeof object.gcsSource !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.InputConfig.gcsSource: object expected"); - message.gcsSource = $root.google.cloud.vision.v1p4beta1.GcsSource.fromObject(object.gcsSource); - } - if (object.content != null) - if (typeof object.content === "string") - $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); - else if (object.content.length) - message.content = object.content; - if (object.mimeType != null) - message.mimeType = String(object.mimeType); - return message; - }; - - /** - * Creates a plain object from an InputConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.vision.v1p4beta1.InputConfig - * @static - * @param {google.cloud.vision.v1p4beta1.InputConfig} message InputConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InputConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.gcsSource = null; - object.mimeType = ""; - if (options.bytes === String) - object.content = ""; - else { - object.content = []; - if (options.bytes !== Array) - object.content = $util.newBuffer(object.content); - } - } - if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) - object.gcsSource = $root.google.cloud.vision.v1p4beta1.GcsSource.toObject(message.gcsSource, options); - if (message.mimeType != null && message.hasOwnProperty("mimeType")) - object.mimeType = message.mimeType; - if (message.content != null && message.hasOwnProperty("content")) - object.content = options.bytes === String ? $util.base64.encode(message.content, 0, message.content.length) : options.bytes === Array ? Array.prototype.slice.call(message.content) : message.content; - return object; - }; + AsyncAnnotateFileRequest.prototype.inputConfig = null; /** - * Converts this InputConfig to JSON. - * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.InputConfig + * AsyncAnnotateFileRequest features. + * @member {Array.} features + * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest * @instance - * @returns {Object.} JSON object - */ - InputConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - return InputConfig; - })(); - - v1p4beta1.OutputConfig = (function() { - - /** - * Properties of an OutputConfig. - * @memberof google.cloud.vision.v1p4beta1 - * @interface IOutputConfig - * @property {google.cloud.vision.v1p4beta1.IGcsDestination|null} [gcsDestination] OutputConfig gcsDestination - * @property {number|null} [batchSize] OutputConfig batchSize - */ - - /** - * Constructs a new OutputConfig. - * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an OutputConfig. - * @implements IOutputConfig - * @constructor - * @param {google.cloud.vision.v1p4beta1.IOutputConfig=} [properties] Properties to set */ - function OutputConfig(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]]; - } + AsyncAnnotateFileRequest.prototype.features = $util.emptyArray; /** - * OutputConfig gcsDestination. - * @member {google.cloud.vision.v1p4beta1.IGcsDestination|null|undefined} gcsDestination - * @memberof google.cloud.vision.v1p4beta1.OutputConfig + * AsyncAnnotateFileRequest imageContext. + * @member {google.cloud.vision.v1p4beta1.IImageContext|null|undefined} imageContext + * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest * @instance */ - OutputConfig.prototype.gcsDestination = null; + AsyncAnnotateFileRequest.prototype.imageContext = null; - /** - * OutputConfig batchSize. - * @member {number} batchSize - * @memberof google.cloud.vision.v1p4beta1.OutputConfig + /** + * AsyncAnnotateFileRequest outputConfig. + * @member {google.cloud.vision.v1p4beta1.IOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest * @instance */ - OutputConfig.prototype.batchSize = 0; + AsyncAnnotateFileRequest.prototype.outputConfig = null; /** - * Creates a new OutputConfig instance using the specified properties. + * Creates a new AsyncAnnotateFileRequest instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.OutputConfig + * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest * @static - * @param {google.cloud.vision.v1p4beta1.IOutputConfig=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.OutputConfig} OutputConfig instance + * @param {google.cloud.vision.v1p4beta1.IAsyncAnnotateFileRequest=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest instance */ - OutputConfig.create = function create(properties) { - return new OutputConfig(properties); + AsyncAnnotateFileRequest.create = function create(properties) { + return new AsyncAnnotateFileRequest(properties); }; /** - * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.vision.v1p4beta1.OutputConfig.verify|verify} messages. + * Encodes the specified AsyncAnnotateFileRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.OutputConfig + * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest * @static - * @param {google.cloud.vision.v1p4beta1.IOutputConfig} message OutputConfig message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IAsyncAnnotateFileRequest} message AsyncAnnotateFileRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OutputConfig.encode = function encode(message, writer) { + AsyncAnnotateFileRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) - $root.google.cloud.vision.v1p4beta1.GcsDestination.encode(message.gcsDestination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.batchSize != null && message.hasOwnProperty("batchSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.batchSize); + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + $root.google.cloud.vision.v1p4beta1.InputConfig.encode(message.inputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.features != null && message.features.length) + for (var i = 0; i < message.features.length; ++i) + $root.google.cloud.vision.v1p4beta1.Feature.encode(message.features[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.imageContext != null && message.hasOwnProperty("imageContext")) + $root.google.cloud.vision.v1p4beta1.ImageContext.encode(message.imageContext, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + $root.google.cloud.vision.v1p4beta1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); return writer; }; /** - * Encodes the specified OutputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.OutputConfig.verify|verify} messages. + * Encodes the specified AsyncAnnotateFileRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.OutputConfig + * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest * @static - * @param {google.cloud.vision.v1p4beta1.IOutputConfig} message OutputConfig message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IAsyncAnnotateFileRequest} message AsyncAnnotateFileRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OutputConfig.encodeDelimited = function encodeDelimited(message, writer) { + AsyncAnnotateFileRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an OutputConfig message from the specified reader or buffer. + * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.OutputConfig + * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.OutputConfig} OutputConfig + * @returns {google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OutputConfig.decode = function decode(reader, length) { + AsyncAnnotateFileRequest.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.vision.v1p4beta1.OutputConfig(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.gcsDestination = $root.google.cloud.vision.v1p4beta1.GcsDestination.decode(reader, reader.uint32()); + message.inputConfig = $root.google.cloud.vision.v1p4beta1.InputConfig.decode(reader, reader.uint32()); break; case 2: - message.batchSize = reader.int32(); + if (!(message.features && message.features.length)) + message.features = []; + message.features.push($root.google.cloud.vision.v1p4beta1.Feature.decode(reader, reader.uint32())); + break; + case 3: + message.imageContext = $root.google.cloud.vision.v1p4beta1.ImageContext.decode(reader, reader.uint32()); + break; + case 4: + message.outputConfig = $root.google.cloud.vision.v1p4beta1.OutputConfig.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -83111,121 +83124,165 @@ }; /** - * Decodes an OutputConfig message from the specified reader or buffer, length delimited. + * Decodes an AsyncAnnotateFileRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.OutputConfig + * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.OutputConfig} OutputConfig + * @returns {google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OutputConfig.decodeDelimited = function decodeDelimited(reader) { + AsyncAnnotateFileRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an OutputConfig message. + * Verifies an AsyncAnnotateFileRequest message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.OutputConfig + * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - OutputConfig.verify = function verify(message) { + AsyncAnnotateFileRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { - var error = $root.google.cloud.vision.v1p4beta1.GcsDestination.verify(message.gcsDestination); + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.vision.v1p4beta1.InputConfig.verify(message.inputConfig); if (error) - return "gcsDestination." + error; + return "inputConfig." + error; + } + if (message.features != null && message.hasOwnProperty("features")) { + if (!Array.isArray(message.features)) + return "features: array expected"; + for (var i = 0; i < message.features.length; ++i) { + var error = $root.google.cloud.vision.v1p4beta1.Feature.verify(message.features[i]); + if (error) + return "features." + error; + } + } + if (message.imageContext != null && message.hasOwnProperty("imageContext")) { + var error = $root.google.cloud.vision.v1p4beta1.ImageContext.verify(message.imageContext); + if (error) + return "imageContext." + error; + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + var error = $root.google.cloud.vision.v1p4beta1.OutputConfig.verify(message.outputConfig); + if (error) + return "outputConfig." + error; } - if (message.batchSize != null && message.hasOwnProperty("batchSize")) - if (!$util.isInteger(message.batchSize)) - return "batchSize: integer expected"; return null; }; /** - * Creates an OutputConfig message from a plain object. Also converts values to their respective internal types. + * Creates an AsyncAnnotateFileRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.OutputConfig + * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.OutputConfig} OutputConfig + * @returns {google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest} AsyncAnnotateFileRequest */ - OutputConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.OutputConfig) + AsyncAnnotateFileRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest) return object; - var message = new $root.google.cloud.vision.v1p4beta1.OutputConfig(); - if (object.gcsDestination != null) { - if (typeof object.gcsDestination !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.OutputConfig.gcsDestination: object expected"); - message.gcsDestination = $root.google.cloud.vision.v1p4beta1.GcsDestination.fromObject(object.gcsDestination); + var message = new $root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest(); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.vision.v1p4beta1.InputConfig.fromObject(object.inputConfig); + } + if (object.features) { + if (!Array.isArray(object.features)) + throw TypeError(".google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest.features: array expected"); + message.features = []; + for (var i = 0; i < object.features.length; ++i) { + if (typeof object.features[i] !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest.features: object expected"); + message.features[i] = $root.google.cloud.vision.v1p4beta1.Feature.fromObject(object.features[i]); + } + } + if (object.imageContext != null) { + if (typeof object.imageContext !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest.imageContext: object expected"); + message.imageContext = $root.google.cloud.vision.v1p4beta1.ImageContext.fromObject(object.imageContext); + } + if (object.outputConfig != null) { + if (typeof object.outputConfig !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest.outputConfig: object expected"); + message.outputConfig = $root.google.cloud.vision.v1p4beta1.OutputConfig.fromObject(object.outputConfig); } - if (object.batchSize != null) - message.batchSize = object.batchSize | 0; return message; }; /** - * Creates a plain object from an OutputConfig message. Also converts values to other types if specified. + * Creates a plain object from an AsyncAnnotateFileRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.OutputConfig + * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest * @static - * @param {google.cloud.vision.v1p4beta1.OutputConfig} message OutputConfig + * @param {google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest} message AsyncAnnotateFileRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - OutputConfig.toObject = function toObject(message, options) { + AsyncAnnotateFileRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.features = []; if (options.defaults) { - object.gcsDestination = null; - object.batchSize = 0; + object.inputConfig = null; + object.imageContext = null; + object.outputConfig = null; } - if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) - object.gcsDestination = $root.google.cloud.vision.v1p4beta1.GcsDestination.toObject(message.gcsDestination, options); - if (message.batchSize != null && message.hasOwnProperty("batchSize")) - object.batchSize = message.batchSize; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.vision.v1p4beta1.InputConfig.toObject(message.inputConfig, options); + if (message.features && message.features.length) { + object.features = []; + for (var j = 0; j < message.features.length; ++j) + object.features[j] = $root.google.cloud.vision.v1p4beta1.Feature.toObject(message.features[j], options); + } + if (message.imageContext != null && message.hasOwnProperty("imageContext")) + object.imageContext = $root.google.cloud.vision.v1p4beta1.ImageContext.toObject(message.imageContext, options); + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + object.outputConfig = $root.google.cloud.vision.v1p4beta1.OutputConfig.toObject(message.outputConfig, options); return object; }; /** - * Converts this OutputConfig to JSON. + * Converts this AsyncAnnotateFileRequest to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.OutputConfig + * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest * @instance * @returns {Object.} JSON object */ - OutputConfig.prototype.toJSON = function toJSON() { + AsyncAnnotateFileRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return OutputConfig; + return AsyncAnnotateFileRequest; })(); - v1p4beta1.GcsSource = (function() { + v1p4beta1.AsyncAnnotateFileResponse = (function() { /** - * Properties of a GcsSource. + * Properties of an AsyncAnnotateFileResponse. * @memberof google.cloud.vision.v1p4beta1 - * @interface IGcsSource - * @property {string|null} [uri] GcsSource uri + * @interface IAsyncAnnotateFileResponse + * @property {google.cloud.vision.v1p4beta1.IOutputConfig|null} [outputConfig] AsyncAnnotateFileResponse outputConfig */ /** - * Constructs a new GcsSource. + * Constructs a new AsyncAnnotateFileResponse. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a GcsSource. - * @implements IGcsSource + * @classdesc Represents an AsyncAnnotateFileResponse. + * @implements IAsyncAnnotateFileResponse * @constructor - * @param {google.cloud.vision.v1p4beta1.IGcsSource=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IAsyncAnnotateFileResponse=} [properties] Properties to set */ - function GcsSource(properties) { + function AsyncAnnotateFileResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -83233,75 +83290,75 @@ } /** - * GcsSource uri. - * @member {string} uri - * @memberof google.cloud.vision.v1p4beta1.GcsSource + * AsyncAnnotateFileResponse outputConfig. + * @member {google.cloud.vision.v1p4beta1.IOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse * @instance */ - GcsSource.prototype.uri = ""; + AsyncAnnotateFileResponse.prototype.outputConfig = null; /** - * Creates a new GcsSource instance using the specified properties. + * Creates a new AsyncAnnotateFileResponse instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.GcsSource + * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse * @static - * @param {google.cloud.vision.v1p4beta1.IGcsSource=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.GcsSource} GcsSource instance + * @param {google.cloud.vision.v1p4beta1.IAsyncAnnotateFileResponse=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse instance */ - GcsSource.create = function create(properties) { - return new GcsSource(properties); + AsyncAnnotateFileResponse.create = function create(properties) { + return new AsyncAnnotateFileResponse(properties); }; /** - * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.vision.v1p4beta1.GcsSource.verify|verify} messages. + * Encodes the specified AsyncAnnotateFileResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.GcsSource + * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse * @static - * @param {google.cloud.vision.v1p4beta1.IGcsSource} message GcsSource message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IAsyncAnnotateFileResponse} message AsyncAnnotateFileResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsSource.encode = function encode(message, writer) { + AsyncAnnotateFileResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.uri != null && message.hasOwnProperty("uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + $root.google.cloud.vision.v1p4beta1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.GcsSource.verify|verify} messages. + * Encodes the specified AsyncAnnotateFileResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.GcsSource + * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse * @static - * @param {google.cloud.vision.v1p4beta1.IGcsSource} message GcsSource message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IAsyncAnnotateFileResponse} message AsyncAnnotateFileResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsSource.encodeDelimited = function encodeDelimited(message, writer) { + AsyncAnnotateFileResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GcsSource message from the specified reader or buffer. + * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.GcsSource + * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.GcsSource} GcsSource + * @returns {google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsSource.decode = function decode(reader, length) { + AsyncAnnotateFileResponse.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.vision.v1p4beta1.GcsSource(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.uri = reader.string(); + message.outputConfig = $root.google.cloud.vision.v1p4beta1.OutputConfig.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -83312,107 +83369,114 @@ }; /** - * Decodes a GcsSource message from the specified reader or buffer, length delimited. + * Decodes an AsyncAnnotateFileResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.GcsSource + * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.GcsSource} GcsSource + * @returns {google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsSource.decodeDelimited = function decodeDelimited(reader) { + AsyncAnnotateFileResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GcsSource message. + * Verifies an AsyncAnnotateFileResponse message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.GcsSource + * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GcsSource.verify = function verify(message) { + AsyncAnnotateFileResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + var error = $root.google.cloud.vision.v1p4beta1.OutputConfig.verify(message.outputConfig); + if (error) + return "outputConfig." + error; + } return null; }; /** - * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. + * Creates an AsyncAnnotateFileResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.GcsSource + * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.GcsSource} GcsSource + * @returns {google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse} AsyncAnnotateFileResponse */ - GcsSource.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.GcsSource) + AsyncAnnotateFileResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse) return object; - var message = new $root.google.cloud.vision.v1p4beta1.GcsSource(); - if (object.uri != null) - message.uri = String(object.uri); + var message = new $root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse(); + if (object.outputConfig != null) { + if (typeof object.outputConfig !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse.outputConfig: object expected"); + message.outputConfig = $root.google.cloud.vision.v1p4beta1.OutputConfig.fromObject(object.outputConfig); + } return message; }; /** - * Creates a plain object from a GcsSource message. Also converts values to other types if specified. + * Creates a plain object from an AsyncAnnotateFileResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.GcsSource + * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse * @static - * @param {google.cloud.vision.v1p4beta1.GcsSource} message GcsSource + * @param {google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse} message AsyncAnnotateFileResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GcsSource.toObject = function toObject(message, options) { + AsyncAnnotateFileResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) - object.uri = ""; - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; + object.outputConfig = null; + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + object.outputConfig = $root.google.cloud.vision.v1p4beta1.OutputConfig.toObject(message.outputConfig, options); return object; }; /** - * Converts this GcsSource to JSON. + * Converts this AsyncAnnotateFileResponse to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.GcsSource + * @memberof google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse * @instance * @returns {Object.} JSON object */ - GcsSource.prototype.toJSON = function toJSON() { + AsyncAnnotateFileResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GcsSource; + return AsyncAnnotateFileResponse; })(); - v1p4beta1.GcsDestination = (function() { + v1p4beta1.AsyncBatchAnnotateImagesRequest = (function() { /** - * Properties of a GcsDestination. + * Properties of an AsyncBatchAnnotateImagesRequest. * @memberof google.cloud.vision.v1p4beta1 - * @interface IGcsDestination - * @property {string|null} [uri] GcsDestination uri + * @interface IAsyncBatchAnnotateImagesRequest + * @property {Array.|null} [requests] AsyncBatchAnnotateImagesRequest requests + * @property {google.cloud.vision.v1p4beta1.IOutputConfig|null} [outputConfig] AsyncBatchAnnotateImagesRequest outputConfig */ /** - * Constructs a new GcsDestination. + * Constructs a new AsyncBatchAnnotateImagesRequest. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a GcsDestination. - * @implements IGcsDestination + * @classdesc Represents an AsyncBatchAnnotateImagesRequest. + * @implements IAsyncBatchAnnotateImagesRequest * @constructor - * @param {google.cloud.vision.v1p4beta1.IGcsDestination=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest=} [properties] Properties to set */ - function GcsDestination(properties) { + function AsyncBatchAnnotateImagesRequest(properties) { + this.requests = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -83420,75 +83484,91 @@ } /** - * GcsDestination uri. - * @member {string} uri - * @memberof google.cloud.vision.v1p4beta1.GcsDestination + * AsyncBatchAnnotateImagesRequest requests. + * @member {Array.} requests + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest * @instance */ - GcsDestination.prototype.uri = ""; + AsyncBatchAnnotateImagesRequest.prototype.requests = $util.emptyArray; /** - * Creates a new GcsDestination instance using the specified properties. + * AsyncBatchAnnotateImagesRequest outputConfig. + * @member {google.cloud.vision.v1p4beta1.IOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest + * @instance + */ + AsyncBatchAnnotateImagesRequest.prototype.outputConfig = null; + + /** + * Creates a new AsyncBatchAnnotateImagesRequest instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.GcsDestination + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest * @static - * @param {google.cloud.vision.v1p4beta1.IGcsDestination=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.GcsDestination} GcsDestination instance + * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest} AsyncBatchAnnotateImagesRequest instance */ - GcsDestination.create = function create(properties) { - return new GcsDestination(properties); + AsyncBatchAnnotateImagesRequest.create = function create(properties) { + return new AsyncBatchAnnotateImagesRequest(properties); }; /** - * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.vision.v1p4beta1.GcsDestination.verify|verify} messages. + * Encodes the specified AsyncBatchAnnotateImagesRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.GcsDestination + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest * @static - * @param {google.cloud.vision.v1p4beta1.IGcsDestination} message GcsDestination message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest} message AsyncBatchAnnotateImagesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsDestination.encode = function encode(message, writer) { + AsyncBatchAnnotateImagesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.uri != null && message.hasOwnProperty("uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.requests != null && message.requests.length) + for (var i = 0; i < message.requests.length; ++i) + $root.google.cloud.vision.v1p4beta1.AnnotateImageRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + $root.google.cloud.vision.v1p4beta1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.GcsDestination.verify|verify} messages. + * Encodes the specified AsyncBatchAnnotateImagesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.GcsDestination + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest * @static - * @param {google.cloud.vision.v1p4beta1.IGcsDestination} message GcsDestination message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest} message AsyncBatchAnnotateImagesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - GcsDestination.encodeDelimited = function encodeDelimited(message, writer) { + AsyncBatchAnnotateImagesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a GcsDestination message from the specified reader or buffer. + * Decodes an AsyncBatchAnnotateImagesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.GcsDestination + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.GcsDestination} GcsDestination + * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest} AsyncBatchAnnotateImagesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsDestination.decode = function decode(reader, length) { + AsyncBatchAnnotateImagesRequest.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.vision.v1p4beta1.GcsDestination(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.uri = reader.string(); + if (!(message.requests && message.requests.length)) + message.requests = []; + message.requests.push($root.google.cloud.vision.v1p4beta1.AnnotateImageRequest.decode(reader, reader.uint32())); + break; + case 2: + message.outputConfig = $root.google.cloud.vision.v1p4beta1.OutputConfig.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -83499,109 +83579,138 @@ }; /** - * Decodes a GcsDestination message from the specified reader or buffer, length delimited. + * Decodes an AsyncBatchAnnotateImagesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.GcsDestination + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.GcsDestination} GcsDestination + * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest} AsyncBatchAnnotateImagesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - GcsDestination.decodeDelimited = function decodeDelimited(reader) { + AsyncBatchAnnotateImagesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a GcsDestination message. + * Verifies an AsyncBatchAnnotateImagesRequest message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.GcsDestination + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - GcsDestination.verify = function verify(message) { + AsyncBatchAnnotateImagesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; + if (message.requests != null && message.hasOwnProperty("requests")) { + if (!Array.isArray(message.requests)) + return "requests: array expected"; + for (var i = 0; i < message.requests.length; ++i) { + var error = $root.google.cloud.vision.v1p4beta1.AnnotateImageRequest.verify(message.requests[i]); + if (error) + return "requests." + error; + } + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + var error = $root.google.cloud.vision.v1p4beta1.OutputConfig.verify(message.outputConfig); + if (error) + return "outputConfig." + error; + } return null; }; /** - * Creates a GcsDestination message from a plain object. Also converts values to their respective internal types. + * Creates an AsyncBatchAnnotateImagesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.GcsDestination + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.GcsDestination} GcsDestination + * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest} AsyncBatchAnnotateImagesRequest */ - GcsDestination.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.GcsDestination) + AsyncBatchAnnotateImagesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest) return object; - var message = new $root.google.cloud.vision.v1p4beta1.GcsDestination(); - if (object.uri != null) - message.uri = String(object.uri); + var message = new $root.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest(); + if (object.requests) { + if (!Array.isArray(object.requests)) + throw TypeError(".google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest.requests: array expected"); + message.requests = []; + for (var i = 0; i < object.requests.length; ++i) { + if (typeof object.requests[i] !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest.requests: object expected"); + message.requests[i] = $root.google.cloud.vision.v1p4beta1.AnnotateImageRequest.fromObject(object.requests[i]); + } + } + if (object.outputConfig != null) { + if (typeof object.outputConfig !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest.outputConfig: object expected"); + message.outputConfig = $root.google.cloud.vision.v1p4beta1.OutputConfig.fromObject(object.outputConfig); + } return message; }; /** - * Creates a plain object from a GcsDestination message. Also converts values to other types if specified. + * Creates a plain object from an AsyncBatchAnnotateImagesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.GcsDestination + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest * @static - * @param {google.cloud.vision.v1p4beta1.GcsDestination} message GcsDestination + * @param {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest} message AsyncBatchAnnotateImagesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - GcsDestination.toObject = function toObject(message, options) { + AsyncBatchAnnotateImagesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.requests = []; if (options.defaults) - object.uri = ""; - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; + object.outputConfig = null; + if (message.requests && message.requests.length) { + object.requests = []; + for (var j = 0; j < message.requests.length; ++j) + object.requests[j] = $root.google.cloud.vision.v1p4beta1.AnnotateImageRequest.toObject(message.requests[j], options); + } + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + object.outputConfig = $root.google.cloud.vision.v1p4beta1.OutputConfig.toObject(message.outputConfig, options); return object; }; /** - * Converts this GcsDestination to JSON. + * Converts this AsyncBatchAnnotateImagesRequest to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.GcsDestination + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest * @instance * @returns {Object.} JSON object */ - GcsDestination.prototype.toJSON = function toJSON() { + AsyncBatchAnnotateImagesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return GcsDestination; + return AsyncBatchAnnotateImagesRequest; })(); - v1p4beta1.OperationMetadata = (function() { + v1p4beta1.AsyncBatchAnnotateImagesResponse = (function() { /** - * Properties of an OperationMetadata. + * Properties of an AsyncBatchAnnotateImagesResponse. * @memberof google.cloud.vision.v1p4beta1 - * @interface IOperationMetadata - * @property {google.cloud.vision.v1p4beta1.OperationMetadata.State|null} [state] OperationMetadata state - * @property {google.protobuf.ITimestamp|null} [createTime] OperationMetadata createTime - * @property {google.protobuf.ITimestamp|null} [updateTime] OperationMetadata updateTime + * @interface IAsyncBatchAnnotateImagesResponse + * @property {google.cloud.vision.v1p4beta1.IOutputConfig|null} [outputConfig] AsyncBatchAnnotateImagesResponse outputConfig */ /** - * Constructs a new OperationMetadata. + * Constructs a new AsyncBatchAnnotateImagesResponse. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents an OperationMetadata. - * @implements IOperationMetadata + * @classdesc Represents an AsyncBatchAnnotateImagesResponse. + * @implements IAsyncBatchAnnotateImagesResponse * @constructor - * @param {google.cloud.vision.v1p4beta1.IOperationMetadata=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse=} [properties] Properties to set */ - function OperationMetadata(properties) { + function AsyncBatchAnnotateImagesResponse(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -83609,101 +83718,75 @@ } /** - * OperationMetadata state. - * @member {google.cloud.vision.v1p4beta1.OperationMetadata.State} state - * @memberof google.cloud.vision.v1p4beta1.OperationMetadata - * @instance - */ - OperationMetadata.prototype.state = 0; - - /** - * OperationMetadata createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.vision.v1p4beta1.OperationMetadata - * @instance - */ - OperationMetadata.prototype.createTime = null; - - /** - * OperationMetadata updateTime. - * @member {google.protobuf.ITimestamp|null|undefined} updateTime - * @memberof google.cloud.vision.v1p4beta1.OperationMetadata + * AsyncBatchAnnotateImagesResponse outputConfig. + * @member {google.cloud.vision.v1p4beta1.IOutputConfig|null|undefined} outputConfig + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse * @instance */ - OperationMetadata.prototype.updateTime = null; + AsyncBatchAnnotateImagesResponse.prototype.outputConfig = null; /** - * Creates a new OperationMetadata instance using the specified properties. + * Creates a new AsyncBatchAnnotateImagesResponse instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.OperationMetadata + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse * @static - * @param {google.cloud.vision.v1p4beta1.IOperationMetadata=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.OperationMetadata} OperationMetadata instance + * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse} AsyncBatchAnnotateImagesResponse instance */ - OperationMetadata.create = function create(properties) { - return new OperationMetadata(properties); + AsyncBatchAnnotateImagesResponse.create = function create(properties) { + return new AsyncBatchAnnotateImagesResponse(properties); }; /** - * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.vision.v1p4beta1.OperationMetadata.verify|verify} messages. + * Encodes the specified AsyncBatchAnnotateImagesResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.OperationMetadata + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse * @static - * @param {google.cloud.vision.v1p4beta1.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse} message AsyncBatchAnnotateImagesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OperationMetadata.encode = function encode(message, writer) { + AsyncBatchAnnotateImagesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.state != null && message.hasOwnProperty("state")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); - if (message.createTime != null && message.hasOwnProperty("createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.updateTime != null && message.hasOwnProperty("updateTime")) - $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + $root.google.cloud.vision.v1p4beta1.OutputConfig.encode(message.outputConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.OperationMetadata.verify|verify} messages. + * Encodes the specified AsyncBatchAnnotateImagesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.OperationMetadata + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse * @static - * @param {google.cloud.vision.v1p4beta1.IOperationMetadata} message OperationMetadata message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse} message AsyncBatchAnnotateImagesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - OperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + AsyncBatchAnnotateImagesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an OperationMetadata message from the specified reader or buffer. + * Decodes an AsyncBatchAnnotateImagesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.OperationMetadata + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.OperationMetadata} OperationMetadata + * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse} AsyncBatchAnnotateImagesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OperationMetadata.decode = function decode(reader, length) { + AsyncBatchAnnotateImagesResponse.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.vision.v1p4beta1.OperationMetadata(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.state = reader.int32(); - break; - case 5: - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - case 6: - message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + message.outputConfig = $root.google.cloud.vision.v1p4beta1.OutputConfig.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -83714,183 +83797,113 @@ }; /** - * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. + * Decodes an AsyncBatchAnnotateImagesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.OperationMetadata + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.OperationMetadata} OperationMetadata + * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse} AsyncBatchAnnotateImagesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - OperationMetadata.decodeDelimited = function decodeDelimited(reader) { + AsyncBatchAnnotateImagesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an OperationMetadata message. + * Verifies an AsyncBatchAnnotateImagesResponse message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.OperationMetadata + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - OperationMetadata.verify = function verify(message) { + AsyncBatchAnnotateImagesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.state != null && message.hasOwnProperty("state")) - switch (message.state) { - default: - return "state: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; - } - if (message.createTime != null && message.hasOwnProperty("createTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.createTime); - if (error) - return "createTime." + error; - } - if (message.updateTime != null && message.hasOwnProperty("updateTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) { + var error = $root.google.cloud.vision.v1p4beta1.OutputConfig.verify(message.outputConfig); if (error) - return "updateTime." + error; + return "outputConfig." + error; } return null; }; /** - * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. + * Creates an AsyncBatchAnnotateImagesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.OperationMetadata + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.OperationMetadata} OperationMetadata + * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse} AsyncBatchAnnotateImagesResponse */ - OperationMetadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.OperationMetadata) + AsyncBatchAnnotateImagesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse) return object; - var message = new $root.google.cloud.vision.v1p4beta1.OperationMetadata(); - switch (object.state) { - case "STATE_UNSPECIFIED": - case 0: - message.state = 0; - break; - case "CREATED": - case 1: - message.state = 1; - break; - case "RUNNING": - case 2: - message.state = 2; - break; - case "DONE": - case 3: - message.state = 3; - break; - case "CANCELLED": - case 4: - message.state = 4; - break; - } - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.OperationMetadata.createTime: object expected"); - message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); - } - if (object.updateTime != null) { - if (typeof object.updateTime !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.OperationMetadata.updateTime: object expected"); - message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + var message = new $root.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse(); + if (object.outputConfig != null) { + if (typeof object.outputConfig !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse.outputConfig: object expected"); + message.outputConfig = $root.google.cloud.vision.v1p4beta1.OutputConfig.fromObject(object.outputConfig); } return message; }; /** - * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. + * Creates a plain object from an AsyncBatchAnnotateImagesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.OperationMetadata + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse * @static - * @param {google.cloud.vision.v1p4beta1.OperationMetadata} message OperationMetadata + * @param {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse} message AsyncBatchAnnotateImagesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - OperationMetadata.toObject = function toObject(message, options) { + AsyncBatchAnnotateImagesResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; - object.createTime = null; - object.updateTime = null; - } - if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.vision.v1p4beta1.OperationMetadata.State[message.state] : message.state; - if (message.createTime != null && message.hasOwnProperty("createTime")) - object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); - if (message.updateTime != null && message.hasOwnProperty("updateTime")) - object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (options.defaults) + object.outputConfig = null; + if (message.outputConfig != null && message.hasOwnProperty("outputConfig")) + object.outputConfig = $root.google.cloud.vision.v1p4beta1.OutputConfig.toObject(message.outputConfig, options); return object; }; /** - * Converts this OperationMetadata to JSON. + * Converts this AsyncBatchAnnotateImagesResponse to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.OperationMetadata + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse * @instance * @returns {Object.} JSON object */ - OperationMetadata.prototype.toJSON = function toJSON() { + AsyncBatchAnnotateImagesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - /** - * State enum. - * @name google.cloud.vision.v1p4beta1.OperationMetadata.State - * @enum {string} - * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value - * @property {number} CREATED=1 CREATED value - * @property {number} RUNNING=2 RUNNING value - * @property {number} DONE=3 DONE value - * @property {number} CANCELLED=4 CANCELLED value - */ - OperationMetadata.State = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; - values[valuesById[1] = "CREATED"] = 1; - values[valuesById[2] = "RUNNING"] = 2; - values[valuesById[3] = "DONE"] = 3; - values[valuesById[4] = "CANCELLED"] = 4; - return values; - })(); - - return OperationMetadata; + return AsyncBatchAnnotateImagesResponse; })(); - v1p4beta1.FaceRecognitionParams = (function() { + v1p4beta1.AsyncBatchAnnotateFilesRequest = (function() { /** - * Properties of a FaceRecognitionParams. + * Properties of an AsyncBatchAnnotateFilesRequest. * @memberof google.cloud.vision.v1p4beta1 - * @interface IFaceRecognitionParams - * @property {Array.|null} [celebritySet] FaceRecognitionParams celebritySet + * @interface IAsyncBatchAnnotateFilesRequest + * @property {Array.|null} [requests] AsyncBatchAnnotateFilesRequest requests */ /** - * Constructs a new FaceRecognitionParams. + * Constructs a new AsyncBatchAnnotateFilesRequest. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a FaceRecognitionParams. - * @implements IFaceRecognitionParams + * @classdesc Represents an AsyncBatchAnnotateFilesRequest. + * @implements IAsyncBatchAnnotateFilesRequest * @constructor - * @param {google.cloud.vision.v1p4beta1.IFaceRecognitionParams=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest=} [properties] Properties to set */ - function FaceRecognitionParams(properties) { - this.celebritySet = []; + function AsyncBatchAnnotateFilesRequest(properties) { + this.requests = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -83898,78 +83911,78 @@ } /** - * FaceRecognitionParams celebritySet. - * @member {Array.} celebritySet - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionParams + * AsyncBatchAnnotateFilesRequest requests. + * @member {Array.} requests + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest * @instance */ - FaceRecognitionParams.prototype.celebritySet = $util.emptyArray; + AsyncBatchAnnotateFilesRequest.prototype.requests = $util.emptyArray; /** - * Creates a new FaceRecognitionParams instance using the specified properties. + * Creates a new AsyncBatchAnnotateFilesRequest instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionParams + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest * @static - * @param {google.cloud.vision.v1p4beta1.IFaceRecognitionParams=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.FaceRecognitionParams} FaceRecognitionParams instance + * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest instance */ - FaceRecognitionParams.create = function create(properties) { - return new FaceRecognitionParams(properties); + AsyncBatchAnnotateFilesRequest.create = function create(properties) { + return new AsyncBatchAnnotateFilesRequest(properties); }; /** - * Encodes the specified FaceRecognitionParams message. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceRecognitionParams.verify|verify} messages. + * Encodes the specified AsyncBatchAnnotateFilesRequest message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionParams + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest * @static - * @param {google.cloud.vision.v1p4beta1.IFaceRecognitionParams} message FaceRecognitionParams message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest} message AsyncBatchAnnotateFilesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FaceRecognitionParams.encode = function encode(message, writer) { + AsyncBatchAnnotateFilesRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.celebritySet != null && message.celebritySet.length) - for (var i = 0; i < message.celebritySet.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.celebritySet[i]); + if (message.requests != null && message.requests.length) + for (var i = 0; i < message.requests.length; ++i) + $root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest.encode(message.requests[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified FaceRecognitionParams message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceRecognitionParams.verify|verify} messages. + * Encodes the specified AsyncBatchAnnotateFilesRequest message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionParams + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest * @static - * @param {google.cloud.vision.v1p4beta1.IFaceRecognitionParams} message FaceRecognitionParams message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest} message AsyncBatchAnnotateFilesRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FaceRecognitionParams.encodeDelimited = function encodeDelimited(message, writer) { + AsyncBatchAnnotateFilesRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FaceRecognitionParams message from the specified reader or buffer. + * Decodes an AsyncBatchAnnotateFilesRequest message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionParams + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.FaceRecognitionParams} FaceRecognitionParams + * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FaceRecognitionParams.decode = function decode(reader, length) { + AsyncBatchAnnotateFilesRequest.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.vision.v1p4beta1.FaceRecognitionParams(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.celebritySet && message.celebritySet.length)) - message.celebritySet = []; - message.celebritySet.push(reader.string()); + if (!(message.requests && message.requests.length)) + message.requests = []; + message.requests.push($root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -83980,121 +83993,125 @@ }; /** - * Decodes a FaceRecognitionParams message from the specified reader or buffer, length delimited. + * Decodes an AsyncBatchAnnotateFilesRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionParams + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.FaceRecognitionParams} FaceRecognitionParams + * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FaceRecognitionParams.decodeDelimited = function decodeDelimited(reader) { + AsyncBatchAnnotateFilesRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FaceRecognitionParams message. + * Verifies an AsyncBatchAnnotateFilesRequest message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionParams + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FaceRecognitionParams.verify = function verify(message) { + AsyncBatchAnnotateFilesRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.celebritySet != null && message.hasOwnProperty("celebritySet")) { - if (!Array.isArray(message.celebritySet)) - return "celebritySet: array expected"; - for (var i = 0; i < message.celebritySet.length; ++i) - if (!$util.isString(message.celebritySet[i])) - return "celebritySet: string[] expected"; + if (message.requests != null && message.hasOwnProperty("requests")) { + if (!Array.isArray(message.requests)) + return "requests: array expected"; + for (var i = 0; i < message.requests.length; ++i) { + var error = $root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest.verify(message.requests[i]); + if (error) + return "requests." + error; + } } return null; }; /** - * Creates a FaceRecognitionParams message from a plain object. Also converts values to their respective internal types. + * Creates an AsyncBatchAnnotateFilesRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionParams + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.FaceRecognitionParams} FaceRecognitionParams + * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest} AsyncBatchAnnotateFilesRequest */ - FaceRecognitionParams.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.FaceRecognitionParams) + AsyncBatchAnnotateFilesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest) return object; - var message = new $root.google.cloud.vision.v1p4beta1.FaceRecognitionParams(); - if (object.celebritySet) { - if (!Array.isArray(object.celebritySet)) - throw TypeError(".google.cloud.vision.v1p4beta1.FaceRecognitionParams.celebritySet: array expected"); - message.celebritySet = []; - for (var i = 0; i < object.celebritySet.length; ++i) - message.celebritySet[i] = String(object.celebritySet[i]); + var message = new $root.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest(); + if (object.requests) { + if (!Array.isArray(object.requests)) + throw TypeError(".google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest.requests: array expected"); + message.requests = []; + for (var i = 0; i < object.requests.length; ++i) { + if (typeof object.requests[i] !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest.requests: object expected"); + message.requests[i] = $root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest.fromObject(object.requests[i]); + } } return message; }; /** - * Creates a plain object from a FaceRecognitionParams message. Also converts values to other types if specified. + * Creates a plain object from an AsyncBatchAnnotateFilesRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionParams + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest * @static - * @param {google.cloud.vision.v1p4beta1.FaceRecognitionParams} message FaceRecognitionParams + * @param {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest} message AsyncBatchAnnotateFilesRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FaceRecognitionParams.toObject = function toObject(message, options) { + AsyncBatchAnnotateFilesRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.arrays || options.defaults) - object.celebritySet = []; - if (message.celebritySet && message.celebritySet.length) { - object.celebritySet = []; - for (var j = 0; j < message.celebritySet.length; ++j) - object.celebritySet[j] = message.celebritySet[j]; + object.requests = []; + if (message.requests && message.requests.length) { + object.requests = []; + for (var j = 0; j < message.requests.length; ++j) + object.requests[j] = $root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest.toObject(message.requests[j], options); } return object; }; /** - * Converts this FaceRecognitionParams to JSON. + * Converts this AsyncBatchAnnotateFilesRequest to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionParams + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest * @instance * @returns {Object.} JSON object */ - FaceRecognitionParams.prototype.toJSON = function toJSON() { + AsyncBatchAnnotateFilesRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return FaceRecognitionParams; + return AsyncBatchAnnotateFilesRequest; })(); - v1p4beta1.Celebrity = (function() { + v1p4beta1.AsyncBatchAnnotateFilesResponse = (function() { /** - * Properties of a Celebrity. + * Properties of an AsyncBatchAnnotateFilesResponse. * @memberof google.cloud.vision.v1p4beta1 - * @interface ICelebrity - * @property {string|null} [name] Celebrity name - * @property {string|null} [displayName] Celebrity displayName - * @property {string|null} [description] Celebrity description + * @interface IAsyncBatchAnnotateFilesResponse + * @property {Array.|null} [responses] AsyncBatchAnnotateFilesResponse responses */ /** - * Constructs a new Celebrity. + * Constructs a new AsyncBatchAnnotateFilesResponse. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a Celebrity. - * @implements ICelebrity + * @classdesc Represents an AsyncBatchAnnotateFilesResponse. + * @implements IAsyncBatchAnnotateFilesResponse * @constructor - * @param {google.cloud.vision.v1p4beta1.ICelebrity=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse=} [properties] Properties to set */ - function Celebrity(properties) { + function AsyncBatchAnnotateFilesResponse(properties) { + this.responses = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -84102,101 +84119,78 @@ } /** - * Celebrity name. - * @member {string} name - * @memberof google.cloud.vision.v1p4beta1.Celebrity - * @instance - */ - Celebrity.prototype.name = ""; - - /** - * Celebrity displayName. - * @member {string} displayName - * @memberof google.cloud.vision.v1p4beta1.Celebrity - * @instance - */ - Celebrity.prototype.displayName = ""; - - /** - * Celebrity description. - * @member {string} description - * @memberof google.cloud.vision.v1p4beta1.Celebrity + * AsyncBatchAnnotateFilesResponse responses. + * @member {Array.} responses + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse * @instance */ - Celebrity.prototype.description = ""; + AsyncBatchAnnotateFilesResponse.prototype.responses = $util.emptyArray; /** - * Creates a new Celebrity instance using the specified properties. + * Creates a new AsyncBatchAnnotateFilesResponse instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.Celebrity + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse * @static - * @param {google.cloud.vision.v1p4beta1.ICelebrity=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.Celebrity} Celebrity instance + * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse instance */ - Celebrity.create = function create(properties) { - return new Celebrity(properties); + AsyncBatchAnnotateFilesResponse.create = function create(properties) { + return new AsyncBatchAnnotateFilesResponse(properties); }; /** - * Encodes the specified Celebrity message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Celebrity.verify|verify} messages. + * Encodes the specified AsyncBatchAnnotateFilesResponse message. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.Celebrity + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse * @static - * @param {google.cloud.vision.v1p4beta1.ICelebrity} message Celebrity message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse} message AsyncBatchAnnotateFilesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Celebrity.encode = function encode(message, writer) { + AsyncBatchAnnotateFilesResponse.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && message.hasOwnProperty("name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.displayName != null && message.hasOwnProperty("displayName")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); - if (message.description != null && message.hasOwnProperty("description")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + if (message.responses != null && message.responses.length) + for (var i = 0; i < message.responses.length; ++i) + $root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse.encode(message.responses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified Celebrity message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Celebrity.verify|verify} messages. + * Encodes the specified AsyncBatchAnnotateFilesResponse message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.Celebrity + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse * @static - * @param {google.cloud.vision.v1p4beta1.ICelebrity} message Celebrity message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse} message AsyncBatchAnnotateFilesResponse message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Celebrity.encodeDelimited = function encodeDelimited(message, writer) { + AsyncBatchAnnotateFilesResponse.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Celebrity message from the specified reader or buffer. + * Decodes an AsyncBatchAnnotateFilesResponse message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.Celebrity + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.Celebrity} Celebrity + * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Celebrity.decode = function decode(reader, length) { + AsyncBatchAnnotateFilesResponse.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.vision.v1p4beta1.Celebrity(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.name = reader.string(); - break; - case 2: - message.displayName = reader.string(); - break; - case 3: - message.description = reader.string(); + if (!(message.responses && message.responses.length)) + message.responses = []; + message.responses.push($root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -84207,125 +84201,126 @@ }; /** - * Decodes a Celebrity message from the specified reader or buffer, length delimited. + * Decodes an AsyncBatchAnnotateFilesResponse message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.Celebrity + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.Celebrity} Celebrity + * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Celebrity.decodeDelimited = function decodeDelimited(reader) { + AsyncBatchAnnotateFilesResponse.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Celebrity message. + * Verifies an AsyncBatchAnnotateFilesResponse message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.Celebrity + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Celebrity.verify = function verify(message) { + AsyncBatchAnnotateFilesResponse.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.displayName != null && message.hasOwnProperty("displayName")) - if (!$util.isString(message.displayName)) - return "displayName: string expected"; - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; + if (message.responses != null && message.hasOwnProperty("responses")) { + if (!Array.isArray(message.responses)) + return "responses: array expected"; + for (var i = 0; i < message.responses.length; ++i) { + var error = $root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse.verify(message.responses[i]); + if (error) + return "responses." + error; + } + } return null; }; /** - * Creates a Celebrity message from a plain object. Also converts values to their respective internal types. + * Creates an AsyncBatchAnnotateFilesResponse message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.Celebrity + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.Celebrity} Celebrity + * @returns {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse} AsyncBatchAnnotateFilesResponse */ - Celebrity.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.Celebrity) + AsyncBatchAnnotateFilesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse) return object; - var message = new $root.google.cloud.vision.v1p4beta1.Celebrity(); - if (object.name != null) - message.name = String(object.name); - if (object.displayName != null) - message.displayName = String(object.displayName); - if (object.description != null) - message.description = String(object.description); + var message = new $root.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse(); + if (object.responses) { + if (!Array.isArray(object.responses)) + throw TypeError(".google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse.responses: array expected"); + message.responses = []; + for (var i = 0; i < object.responses.length; ++i) { + if (typeof object.responses[i] !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse.responses: object expected"); + message.responses[i] = $root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse.fromObject(object.responses[i]); + } + } return message; }; /** - * Creates a plain object from a Celebrity message. Also converts values to other types if specified. + * Creates a plain object from an AsyncBatchAnnotateFilesResponse message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.Celebrity + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse * @static - * @param {google.cloud.vision.v1p4beta1.Celebrity} message Celebrity + * @param {google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse} message AsyncBatchAnnotateFilesResponse * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Celebrity.toObject = function toObject(message, options) { + AsyncBatchAnnotateFilesResponse.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.name = ""; - object.displayName = ""; - object.description = ""; + if (options.arrays || options.defaults) + object.responses = []; + if (message.responses && message.responses.length) { + object.responses = []; + for (var j = 0; j < message.responses.length; ++j) + object.responses[j] = $root.google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse.toObject(message.responses[j], options); } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.displayName != null && message.hasOwnProperty("displayName")) - object.displayName = message.displayName; - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; return object; }; /** - * Converts this Celebrity to JSON. + * Converts this AsyncBatchAnnotateFilesResponse to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.Celebrity + * @memberof google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse * @instance * @returns {Object.} JSON object */ - Celebrity.prototype.toJSON = function toJSON() { + AsyncBatchAnnotateFilesResponse.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Celebrity; + return AsyncBatchAnnotateFilesResponse; })(); - v1p4beta1.FaceRecognitionResult = (function() { + v1p4beta1.InputConfig = (function() { /** - * Properties of a FaceRecognitionResult. + * Properties of an InputConfig. * @memberof google.cloud.vision.v1p4beta1 - * @interface IFaceRecognitionResult - * @property {google.cloud.vision.v1p4beta1.ICelebrity|null} [celebrity] FaceRecognitionResult celebrity - * @property {number|null} [confidence] FaceRecognitionResult confidence + * @interface IInputConfig + * @property {google.cloud.vision.v1p4beta1.IGcsSource|null} [gcsSource] InputConfig gcsSource + * @property {Uint8Array|null} [content] InputConfig content + * @property {string|null} [mimeType] InputConfig mimeType */ /** - * Constructs a new FaceRecognitionResult. + * Constructs a new InputConfig. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a FaceRecognitionResult. - * @implements IFaceRecognitionResult + * @classdesc Represents an InputConfig. + * @implements IInputConfig * @constructor - * @param {google.cloud.vision.v1p4beta1.IFaceRecognitionResult=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IInputConfig=} [properties] Properties to set */ - function FaceRecognitionResult(properties) { + function InputConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -84333,88 +84328,101 @@ } /** - * FaceRecognitionResult celebrity. - * @member {google.cloud.vision.v1p4beta1.ICelebrity|null|undefined} celebrity - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult + * InputConfig gcsSource. + * @member {google.cloud.vision.v1p4beta1.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.vision.v1p4beta1.InputConfig * @instance */ - FaceRecognitionResult.prototype.celebrity = null; + InputConfig.prototype.gcsSource = null; /** - * FaceRecognitionResult confidence. - * @member {number} confidence - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult + * InputConfig content. + * @member {Uint8Array} content + * @memberof google.cloud.vision.v1p4beta1.InputConfig * @instance */ - FaceRecognitionResult.prototype.confidence = 0; + InputConfig.prototype.content = $util.newBuffer([]); /** - * Creates a new FaceRecognitionResult instance using the specified properties. + * InputConfig mimeType. + * @member {string} mimeType + * @memberof google.cloud.vision.v1p4beta1.InputConfig + * @instance + */ + InputConfig.prototype.mimeType = ""; + + /** + * Creates a new InputConfig instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult + * @memberof google.cloud.vision.v1p4beta1.InputConfig * @static - * @param {google.cloud.vision.v1p4beta1.IFaceRecognitionResult=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.FaceRecognitionResult} FaceRecognitionResult instance + * @param {google.cloud.vision.v1p4beta1.IInputConfig=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.InputConfig} InputConfig instance */ - FaceRecognitionResult.create = function create(properties) { - return new FaceRecognitionResult(properties); + InputConfig.create = function create(properties) { + return new InputConfig(properties); }; /** - * Encodes the specified FaceRecognitionResult message. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceRecognitionResult.verify|verify} messages. + * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.vision.v1p4beta1.InputConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult + * @memberof google.cloud.vision.v1p4beta1.InputConfig * @static - * @param {google.cloud.vision.v1p4beta1.IFaceRecognitionResult} message FaceRecognitionResult message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IInputConfig} message InputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FaceRecognitionResult.encode = function encode(message, writer) { + InputConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.celebrity != null && message.hasOwnProperty("celebrity")) - $root.google.cloud.vision.v1p4beta1.Celebrity.encode(message.celebrity, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.confidence != null && message.hasOwnProperty("confidence")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) + $root.google.cloud.vision.v1p4beta1.GcsSource.encode(message.gcsSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.mimeType); + if (message.content != null && message.hasOwnProperty("content")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.content); return writer; }; /** - * Encodes the specified FaceRecognitionResult message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.FaceRecognitionResult.verify|verify} messages. + * Encodes the specified InputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.InputConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult + * @memberof google.cloud.vision.v1p4beta1.InputConfig * @static - * @param {google.cloud.vision.v1p4beta1.IFaceRecognitionResult} message FaceRecognitionResult message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IInputConfig} message InputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - FaceRecognitionResult.encodeDelimited = function encodeDelimited(message, writer) { + InputConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a FaceRecognitionResult message from the specified reader or buffer. + * Decodes an InputConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult + * @memberof google.cloud.vision.v1p4beta1.InputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.FaceRecognitionResult} FaceRecognitionResult + * @returns {google.cloud.vision.v1p4beta1.InputConfig} InputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FaceRecognitionResult.decode = function decode(reader, length) { + InputConfig.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.vision.v1p4beta1.FaceRecognitionResult(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.InputConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.celebrity = $root.google.cloud.vision.v1p4beta1.Celebrity.decode(reader, reader.uint32()); + message.gcsSource = $root.google.cloud.vision.v1p4beta1.GcsSource.decode(reader, reader.uint32()); + break; + case 3: + message.content = reader.bytes(); break; case 2: - message.confidence = reader.float(); + message.mimeType = reader.string(); break; default: reader.skipType(tag & 7); @@ -84425,122 +84433,139 @@ }; /** - * Decodes a FaceRecognitionResult message from the specified reader or buffer, length delimited. + * Decodes an InputConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult + * @memberof google.cloud.vision.v1p4beta1.InputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.FaceRecognitionResult} FaceRecognitionResult + * @returns {google.cloud.vision.v1p4beta1.InputConfig} InputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - FaceRecognitionResult.decodeDelimited = function decodeDelimited(reader) { + InputConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a FaceRecognitionResult message. + * Verifies an InputConfig message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult + * @memberof google.cloud.vision.v1p4beta1.InputConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - FaceRecognitionResult.verify = function verify(message) { + InputConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.celebrity != null && message.hasOwnProperty("celebrity")) { - var error = $root.google.cloud.vision.v1p4beta1.Celebrity.verify(message.celebrity); + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + var error = $root.google.cloud.vision.v1p4beta1.GcsSource.verify(message.gcsSource); if (error) - return "celebrity." + error; + return "gcsSource." + error; } - if (message.confidence != null && message.hasOwnProperty("confidence")) - if (typeof message.confidence !== "number") - return "confidence: number expected"; + if (message.content != null && message.hasOwnProperty("content")) + if (!(message.content && typeof message.content.length === "number" || $util.isString(message.content))) + return "content: buffer expected"; + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; return null; }; /** - * Creates a FaceRecognitionResult message from a plain object. Also converts values to their respective internal types. + * Creates an InputConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult + * @memberof google.cloud.vision.v1p4beta1.InputConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.FaceRecognitionResult} FaceRecognitionResult + * @returns {google.cloud.vision.v1p4beta1.InputConfig} InputConfig */ - FaceRecognitionResult.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.FaceRecognitionResult) + InputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.InputConfig) return object; - var message = new $root.google.cloud.vision.v1p4beta1.FaceRecognitionResult(); - if (object.celebrity != null) { - if (typeof object.celebrity !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.FaceRecognitionResult.celebrity: object expected"); - message.celebrity = $root.google.cloud.vision.v1p4beta1.Celebrity.fromObject(object.celebrity); + var message = new $root.google.cloud.vision.v1p4beta1.InputConfig(); + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.InputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.vision.v1p4beta1.GcsSource.fromObject(object.gcsSource); } - if (object.confidence != null) - message.confidence = Number(object.confidence); + if (object.content != null) + if (typeof object.content === "string") + $util.base64.decode(object.content, message.content = $util.newBuffer($util.base64.length(object.content)), 0); + else if (object.content.length) + message.content = object.content; + if (object.mimeType != null) + message.mimeType = String(object.mimeType); return message; }; /** - * Creates a plain object from a FaceRecognitionResult message. Also converts values to other types if specified. + * Creates a plain object from an InputConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult + * @memberof google.cloud.vision.v1p4beta1.InputConfig * @static - * @param {google.cloud.vision.v1p4beta1.FaceRecognitionResult} message FaceRecognitionResult + * @param {google.cloud.vision.v1p4beta1.InputConfig} message InputConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - FaceRecognitionResult.toObject = function toObject(message, options) { + InputConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.celebrity = null; - object.confidence = 0; + object.gcsSource = null; + object.mimeType = ""; + if (options.bytes === String) + object.content = ""; + else { + object.content = []; + if (options.bytes !== Array) + object.content = $util.newBuffer(object.content); + } } - if (message.celebrity != null && message.hasOwnProperty("celebrity")) - object.celebrity = $root.google.cloud.vision.v1p4beta1.Celebrity.toObject(message.celebrity, options); - if (message.confidence != null && message.hasOwnProperty("confidence")) - object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) + object.gcsSource = $root.google.cloud.vision.v1p4beta1.GcsSource.toObject(message.gcsSource, options); + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + if (message.content != null && message.hasOwnProperty("content")) + object.content = options.bytes === String ? $util.base64.encode(message.content, 0, message.content.length) : options.bytes === Array ? Array.prototype.slice.call(message.content) : message.content; return object; }; /** - * Converts this FaceRecognitionResult to JSON. + * Converts this InputConfig to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.FaceRecognitionResult + * @memberof google.cloud.vision.v1p4beta1.InputConfig * @instance * @returns {Object.} JSON object */ - FaceRecognitionResult.prototype.toJSON = function toJSON() { + InputConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return FaceRecognitionResult; + return InputConfig; })(); - v1p4beta1.Vertex = (function() { + v1p4beta1.OutputConfig = (function() { /** - * Properties of a Vertex. + * Properties of an OutputConfig. * @memberof google.cloud.vision.v1p4beta1 - * @interface IVertex - * @property {number|null} [x] Vertex x - * @property {number|null} [y] Vertex y + * @interface IOutputConfig + * @property {google.cloud.vision.v1p4beta1.IGcsDestination|null} [gcsDestination] OutputConfig gcsDestination + * @property {number|null} [batchSize] OutputConfig batchSize */ /** - * Constructs a new Vertex. + * Constructs a new OutputConfig. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a Vertex. - * @implements IVertex + * @classdesc Represents an OutputConfig. + * @implements IOutputConfig * @constructor - * @param {google.cloud.vision.v1p4beta1.IVertex=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IOutputConfig=} [properties] Properties to set */ - function Vertex(properties) { + function OutputConfig(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -84548,88 +84573,88 @@ } /** - * Vertex x. - * @member {number} x - * @memberof google.cloud.vision.v1p4beta1.Vertex + * OutputConfig gcsDestination. + * @member {google.cloud.vision.v1p4beta1.IGcsDestination|null|undefined} gcsDestination + * @memberof google.cloud.vision.v1p4beta1.OutputConfig * @instance */ - Vertex.prototype.x = 0; + OutputConfig.prototype.gcsDestination = null; /** - * Vertex y. - * @member {number} y - * @memberof google.cloud.vision.v1p4beta1.Vertex + * OutputConfig batchSize. + * @member {number} batchSize + * @memberof google.cloud.vision.v1p4beta1.OutputConfig * @instance */ - Vertex.prototype.y = 0; + OutputConfig.prototype.batchSize = 0; /** - * Creates a new Vertex instance using the specified properties. + * Creates a new OutputConfig instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.Vertex + * @memberof google.cloud.vision.v1p4beta1.OutputConfig * @static - * @param {google.cloud.vision.v1p4beta1.IVertex=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.Vertex} Vertex instance + * @param {google.cloud.vision.v1p4beta1.IOutputConfig=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.OutputConfig} OutputConfig instance */ - Vertex.create = function create(properties) { - return new Vertex(properties); + OutputConfig.create = function create(properties) { + return new OutputConfig(properties); }; /** - * Encodes the specified Vertex message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Vertex.verify|verify} messages. + * Encodes the specified OutputConfig message. Does not implicitly {@link google.cloud.vision.v1p4beta1.OutputConfig.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.Vertex + * @memberof google.cloud.vision.v1p4beta1.OutputConfig * @static - * @param {google.cloud.vision.v1p4beta1.IVertex} message Vertex message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IOutputConfig} message OutputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Vertex.encode = function encode(message, writer) { + OutputConfig.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.x != null && message.hasOwnProperty("x")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.x); - if (message.y != null && message.hasOwnProperty("y")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.y); + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) + $root.google.cloud.vision.v1p4beta1.GcsDestination.encode(message.gcsDestination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.batchSize != null && message.hasOwnProperty("batchSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.batchSize); return writer; }; /** - * Encodes the specified Vertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Vertex.verify|verify} messages. + * Encodes the specified OutputConfig message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.OutputConfig.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.Vertex + * @memberof google.cloud.vision.v1p4beta1.OutputConfig * @static - * @param {google.cloud.vision.v1p4beta1.IVertex} message Vertex message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IOutputConfig} message OutputConfig message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Vertex.encodeDelimited = function encodeDelimited(message, writer) { + OutputConfig.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Vertex message from the specified reader or buffer. + * Decodes an OutputConfig message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.Vertex + * @memberof google.cloud.vision.v1p4beta1.OutputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.Vertex} Vertex + * @returns {google.cloud.vision.v1p4beta1.OutputConfig} OutputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Vertex.decode = function decode(reader, length) { + OutputConfig.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.vision.v1p4beta1.Vertex(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.OutputConfig(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.x = reader.int32(); + message.gcsDestination = $root.google.cloud.vision.v1p4beta1.GcsDestination.decode(reader, reader.uint32()); break; case 2: - message.y = reader.int32(); + message.batchSize = reader.int32(); break; default: reader.skipType(tag & 7); @@ -84640,117 +84665,121 @@ }; /** - * Decodes a Vertex message from the specified reader or buffer, length delimited. + * Decodes an OutputConfig message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.Vertex + * @memberof google.cloud.vision.v1p4beta1.OutputConfig * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.Vertex} Vertex + * @returns {google.cloud.vision.v1p4beta1.OutputConfig} OutputConfig * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Vertex.decodeDelimited = function decodeDelimited(reader) { + OutputConfig.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Vertex message. + * Verifies an OutputConfig message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.Vertex + * @memberof google.cloud.vision.v1p4beta1.OutputConfig * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Vertex.verify = function verify(message) { + OutputConfig.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.x != null && message.hasOwnProperty("x")) - if (!$util.isInteger(message.x)) - return "x: integer expected"; - if (message.y != null && message.hasOwnProperty("y")) - if (!$util.isInteger(message.y)) - return "y: integer expected"; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { + var error = $root.google.cloud.vision.v1p4beta1.GcsDestination.verify(message.gcsDestination); + if (error) + return "gcsDestination." + error; + } + if (message.batchSize != null && message.hasOwnProperty("batchSize")) + if (!$util.isInteger(message.batchSize)) + return "batchSize: integer expected"; return null; }; /** - * Creates a Vertex message from a plain object. Also converts values to their respective internal types. + * Creates an OutputConfig message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.Vertex + * @memberof google.cloud.vision.v1p4beta1.OutputConfig * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.Vertex} Vertex + * @returns {google.cloud.vision.v1p4beta1.OutputConfig} OutputConfig */ - Vertex.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.Vertex) + OutputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.OutputConfig) return object; - var message = new $root.google.cloud.vision.v1p4beta1.Vertex(); - if (object.x != null) - message.x = object.x | 0; - if (object.y != null) - message.y = object.y | 0; + var message = new $root.google.cloud.vision.v1p4beta1.OutputConfig(); + if (object.gcsDestination != null) { + if (typeof object.gcsDestination !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.OutputConfig.gcsDestination: object expected"); + message.gcsDestination = $root.google.cloud.vision.v1p4beta1.GcsDestination.fromObject(object.gcsDestination); + } + if (object.batchSize != null) + message.batchSize = object.batchSize | 0; return message; }; /** - * Creates a plain object from a Vertex message. Also converts values to other types if specified. + * Creates a plain object from an OutputConfig message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.Vertex + * @memberof google.cloud.vision.v1p4beta1.OutputConfig * @static - * @param {google.cloud.vision.v1p4beta1.Vertex} message Vertex + * @param {google.cloud.vision.v1p4beta1.OutputConfig} message OutputConfig * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Vertex.toObject = function toObject(message, options) { + OutputConfig.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.x = 0; - object.y = 0; + object.gcsDestination = null; + object.batchSize = 0; } - if (message.x != null && message.hasOwnProperty("x")) - object.x = message.x; - if (message.y != null && message.hasOwnProperty("y")) - object.y = message.y; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) + object.gcsDestination = $root.google.cloud.vision.v1p4beta1.GcsDestination.toObject(message.gcsDestination, options); + if (message.batchSize != null && message.hasOwnProperty("batchSize")) + object.batchSize = message.batchSize; return object; }; /** - * Converts this Vertex to JSON. + * Converts this OutputConfig to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.Vertex + * @memberof google.cloud.vision.v1p4beta1.OutputConfig * @instance * @returns {Object.} JSON object */ - Vertex.prototype.toJSON = function toJSON() { + OutputConfig.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Vertex; + return OutputConfig; })(); - v1p4beta1.NormalizedVertex = (function() { + v1p4beta1.GcsSource = (function() { /** - * Properties of a NormalizedVertex. + * Properties of a GcsSource. * @memberof google.cloud.vision.v1p4beta1 - * @interface INormalizedVertex - * @property {number|null} [x] NormalizedVertex x - * @property {number|null} [y] NormalizedVertex y + * @interface IGcsSource + * @property {string|null} [uri] GcsSource uri */ /** - * Constructs a new NormalizedVertex. + * Constructs a new GcsSource. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a NormalizedVertex. - * @implements INormalizedVertex + * @classdesc Represents a GcsSource. + * @implements IGcsSource * @constructor - * @param {google.cloud.vision.v1p4beta1.INormalizedVertex=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IGcsSource=} [properties] Properties to set */ - function NormalizedVertex(properties) { + function GcsSource(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -84758,88 +84787,75 @@ } /** - * NormalizedVertex x. - * @member {number} x - * @memberof google.cloud.vision.v1p4beta1.NormalizedVertex - * @instance - */ - NormalizedVertex.prototype.x = 0; - - /** - * NormalizedVertex y. - * @member {number} y - * @memberof google.cloud.vision.v1p4beta1.NormalizedVertex + * GcsSource uri. + * @member {string} uri + * @memberof google.cloud.vision.v1p4beta1.GcsSource * @instance */ - NormalizedVertex.prototype.y = 0; + GcsSource.prototype.uri = ""; /** - * Creates a new NormalizedVertex instance using the specified properties. + * Creates a new GcsSource instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.NormalizedVertex + * @memberof google.cloud.vision.v1p4beta1.GcsSource * @static - * @param {google.cloud.vision.v1p4beta1.INormalizedVertex=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.NormalizedVertex} NormalizedVertex instance + * @param {google.cloud.vision.v1p4beta1.IGcsSource=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.GcsSource} GcsSource instance */ - NormalizedVertex.create = function create(properties) { - return new NormalizedVertex(properties); + GcsSource.create = function create(properties) { + return new GcsSource(properties); }; /** - * Encodes the specified NormalizedVertex message. Does not implicitly {@link google.cloud.vision.v1p4beta1.NormalizedVertex.verify|verify} messages. + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.vision.v1p4beta1.GcsSource.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.NormalizedVertex + * @memberof google.cloud.vision.v1p4beta1.GcsSource * @static - * @param {google.cloud.vision.v1p4beta1.INormalizedVertex} message NormalizedVertex message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IGcsSource} message GcsSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - NormalizedVertex.encode = function encode(message, writer) { + GcsSource.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.x != null && message.hasOwnProperty("x")) - writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); - if (message.y != null && message.hasOwnProperty("y")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); + if (message.uri != null && message.hasOwnProperty("uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); return writer; }; /** - * Encodes the specified NormalizedVertex message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.NormalizedVertex.verify|verify} messages. + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.GcsSource.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.NormalizedVertex + * @memberof google.cloud.vision.v1p4beta1.GcsSource * @static - * @param {google.cloud.vision.v1p4beta1.INormalizedVertex} message NormalizedVertex message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IGcsSource} message GcsSource message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - NormalizedVertex.encodeDelimited = function encodeDelimited(message, writer) { + GcsSource.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a NormalizedVertex message from the specified reader or buffer. + * Decodes a GcsSource message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.NormalizedVertex + * @memberof google.cloud.vision.v1p4beta1.GcsSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.NormalizedVertex} NormalizedVertex + * @returns {google.cloud.vision.v1p4beta1.GcsSource} GcsSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - NormalizedVertex.decode = function decode(reader, length) { + GcsSource.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.vision.v1p4beta1.NormalizedVertex(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.GcsSource(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.x = reader.float(); - break; - case 2: - message.y = reader.float(); + message.uri = reader.string(); break; default: reader.skipType(tag & 7); @@ -84850,119 +84866,107 @@ }; /** - * Decodes a NormalizedVertex message from the specified reader or buffer, length delimited. + * Decodes a GcsSource message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.NormalizedVertex + * @memberof google.cloud.vision.v1p4beta1.GcsSource * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.NormalizedVertex} NormalizedVertex + * @returns {google.cloud.vision.v1p4beta1.GcsSource} GcsSource * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - NormalizedVertex.decodeDelimited = function decodeDelimited(reader) { + GcsSource.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a NormalizedVertex message. + * Verifies a GcsSource message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.NormalizedVertex + * @memberof google.cloud.vision.v1p4beta1.GcsSource * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - NormalizedVertex.verify = function verify(message) { + GcsSource.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.x != null && message.hasOwnProperty("x")) - if (typeof message.x !== "number") - return "x: number expected"; - if (message.y != null && message.hasOwnProperty("y")) - if (typeof message.y !== "number") - return "y: number expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; return null; }; /** - * Creates a NormalizedVertex message from a plain object. Also converts values to their respective internal types. + * Creates a GcsSource message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.NormalizedVertex + * @memberof google.cloud.vision.v1p4beta1.GcsSource * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.NormalizedVertex} NormalizedVertex + * @returns {google.cloud.vision.v1p4beta1.GcsSource} GcsSource */ - NormalizedVertex.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.NormalizedVertex) + GcsSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.GcsSource) return object; - var message = new $root.google.cloud.vision.v1p4beta1.NormalizedVertex(); - if (object.x != null) - message.x = Number(object.x); - if (object.y != null) - message.y = Number(object.y); + var message = new $root.google.cloud.vision.v1p4beta1.GcsSource(); + if (object.uri != null) + message.uri = String(object.uri); return message; }; /** - * Creates a plain object from a NormalizedVertex message. Also converts values to other types if specified. + * Creates a plain object from a GcsSource message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.NormalizedVertex + * @memberof google.cloud.vision.v1p4beta1.GcsSource * @static - * @param {google.cloud.vision.v1p4beta1.NormalizedVertex} message NormalizedVertex + * @param {google.cloud.vision.v1p4beta1.GcsSource} message GcsSource * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - NormalizedVertex.toObject = function toObject(message, options) { + GcsSource.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.defaults) { - object.x = 0; - object.y = 0; - } - if (message.x != null && message.hasOwnProperty("x")) - object.x = options.json && !isFinite(message.x) ? String(message.x) : message.x; - if (message.y != null && message.hasOwnProperty("y")) - object.y = options.json && !isFinite(message.y) ? String(message.y) : message.y; + if (options.defaults) + object.uri = ""; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; return object; }; /** - * Converts this NormalizedVertex to JSON. + * Converts this GcsSource to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.NormalizedVertex + * @memberof google.cloud.vision.v1p4beta1.GcsSource * @instance * @returns {Object.} JSON object */ - NormalizedVertex.prototype.toJSON = function toJSON() { + GcsSource.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return NormalizedVertex; + return GcsSource; })(); - v1p4beta1.BoundingPoly = (function() { + v1p4beta1.GcsDestination = (function() { /** - * Properties of a BoundingPoly. + * Properties of a GcsDestination. * @memberof google.cloud.vision.v1p4beta1 - * @interface IBoundingPoly - * @property {Array.|null} [vertices] BoundingPoly vertices - * @property {Array.|null} [normalizedVertices] BoundingPoly normalizedVertices + * @interface IGcsDestination + * @property {string|null} [uri] GcsDestination uri */ /** - * Constructs a new BoundingPoly. + * Constructs a new GcsDestination. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a BoundingPoly. - * @implements IBoundingPoly + * @classdesc Represents a GcsDestination. + * @implements IGcsDestination * @constructor - * @param {google.cloud.vision.v1p4beta1.IBoundingPoly=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IGcsDestination=} [properties] Properties to set */ - function BoundingPoly(properties) { - this.vertices = []; - this.normalizedVertices = []; + function GcsDestination(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -84970,94 +84974,75 @@ } /** - * BoundingPoly vertices. - * @member {Array.} vertices - * @memberof google.cloud.vision.v1p4beta1.BoundingPoly - * @instance - */ - BoundingPoly.prototype.vertices = $util.emptyArray; - - /** - * BoundingPoly normalizedVertices. - * @member {Array.} normalizedVertices - * @memberof google.cloud.vision.v1p4beta1.BoundingPoly + * GcsDestination uri. + * @member {string} uri + * @memberof google.cloud.vision.v1p4beta1.GcsDestination * @instance */ - BoundingPoly.prototype.normalizedVertices = $util.emptyArray; + GcsDestination.prototype.uri = ""; /** - * Creates a new BoundingPoly instance using the specified properties. + * Creates a new GcsDestination instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.BoundingPoly + * @memberof google.cloud.vision.v1p4beta1.GcsDestination * @static - * @param {google.cloud.vision.v1p4beta1.IBoundingPoly=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.BoundingPoly} BoundingPoly instance + * @param {google.cloud.vision.v1p4beta1.IGcsDestination=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.GcsDestination} GcsDestination instance */ - BoundingPoly.create = function create(properties) { - return new BoundingPoly(properties); + GcsDestination.create = function create(properties) { + return new GcsDestination(properties); }; /** - * Encodes the specified BoundingPoly message. Does not implicitly {@link google.cloud.vision.v1p4beta1.BoundingPoly.verify|verify} messages. + * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.vision.v1p4beta1.GcsDestination.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.BoundingPoly + * @memberof google.cloud.vision.v1p4beta1.GcsDestination * @static - * @param {google.cloud.vision.v1p4beta1.IBoundingPoly} message BoundingPoly message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IGcsDestination} message GcsDestination message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BoundingPoly.encode = function encode(message, writer) { + GcsDestination.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.vertices != null && message.vertices.length) - for (var i = 0; i < message.vertices.length; ++i) - $root.google.cloud.vision.v1p4beta1.Vertex.encode(message.vertices[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.normalizedVertices != null && message.normalizedVertices.length) - for (var i = 0; i < message.normalizedVertices.length; ++i) - $root.google.cloud.vision.v1p4beta1.NormalizedVertex.encode(message.normalizedVertices[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.uri != null && message.hasOwnProperty("uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); return writer; }; /** - * Encodes the specified BoundingPoly message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.BoundingPoly.verify|verify} messages. + * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.GcsDestination.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.BoundingPoly + * @memberof google.cloud.vision.v1p4beta1.GcsDestination * @static - * @param {google.cloud.vision.v1p4beta1.IBoundingPoly} message BoundingPoly message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IGcsDestination} message GcsDestination message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - BoundingPoly.encodeDelimited = function encodeDelimited(message, writer) { + GcsDestination.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a BoundingPoly message from the specified reader or buffer. + * Decodes a GcsDestination message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.BoundingPoly + * @memberof google.cloud.vision.v1p4beta1.GcsDestination * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.BoundingPoly} BoundingPoly + * @returns {google.cloud.vision.v1p4beta1.GcsDestination} GcsDestination * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BoundingPoly.decode = function decode(reader, length) { + GcsDestination.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.vision.v1p4beta1.BoundingPoly(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.GcsDestination(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - if (!(message.vertices && message.vertices.length)) - message.vertices = []; - message.vertices.push($root.google.cloud.vision.v1p4beta1.Vertex.decode(reader, reader.uint32())); - break; - case 2: - if (!(message.normalizedVertices && message.normalizedVertices.length)) - message.normalizedVertices = []; - message.normalizedVertices.push($root.google.cloud.vision.v1p4beta1.NormalizedVertex.decode(reader, reader.uint32())); + message.uri = reader.string(); break; default: reader.skipType(tag & 7); @@ -85068,152 +85053,109 @@ }; /** - * Decodes a BoundingPoly message from the specified reader or buffer, length delimited. + * Decodes a GcsDestination message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.BoundingPoly + * @memberof google.cloud.vision.v1p4beta1.GcsDestination * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.BoundingPoly} BoundingPoly + * @returns {google.cloud.vision.v1p4beta1.GcsDestination} GcsDestination * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - BoundingPoly.decodeDelimited = function decodeDelimited(reader) { + GcsDestination.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a BoundingPoly message. + * Verifies a GcsDestination message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.BoundingPoly + * @memberof google.cloud.vision.v1p4beta1.GcsDestination * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - BoundingPoly.verify = function verify(message) { + GcsDestination.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.vertices != null && message.hasOwnProperty("vertices")) { - if (!Array.isArray(message.vertices)) - return "vertices: array expected"; - for (var i = 0; i < message.vertices.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.Vertex.verify(message.vertices[i]); - if (error) - return "vertices." + error; - } - } - if (message.normalizedVertices != null && message.hasOwnProperty("normalizedVertices")) { - if (!Array.isArray(message.normalizedVertices)) - return "normalizedVertices: array expected"; - for (var i = 0; i < message.normalizedVertices.length; ++i) { - var error = $root.google.cloud.vision.v1p4beta1.NormalizedVertex.verify(message.normalizedVertices[i]); - if (error) - return "normalizedVertices." + error; - } - } + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; return null; }; /** - * Creates a BoundingPoly message from a plain object. Also converts values to their respective internal types. + * Creates a GcsDestination message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.BoundingPoly + * @memberof google.cloud.vision.v1p4beta1.GcsDestination * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.BoundingPoly} BoundingPoly + * @returns {google.cloud.vision.v1p4beta1.GcsDestination} GcsDestination */ - BoundingPoly.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.BoundingPoly) + GcsDestination.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.GcsDestination) return object; - var message = new $root.google.cloud.vision.v1p4beta1.BoundingPoly(); - if (object.vertices) { - if (!Array.isArray(object.vertices)) - throw TypeError(".google.cloud.vision.v1p4beta1.BoundingPoly.vertices: array expected"); - message.vertices = []; - for (var i = 0; i < object.vertices.length; ++i) { - if (typeof object.vertices[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.BoundingPoly.vertices: object expected"); - message.vertices[i] = $root.google.cloud.vision.v1p4beta1.Vertex.fromObject(object.vertices[i]); - } - } - if (object.normalizedVertices) { - if (!Array.isArray(object.normalizedVertices)) - throw TypeError(".google.cloud.vision.v1p4beta1.BoundingPoly.normalizedVertices: array expected"); - message.normalizedVertices = []; - for (var i = 0; i < object.normalizedVertices.length; ++i) { - if (typeof object.normalizedVertices[i] !== "object") - throw TypeError(".google.cloud.vision.v1p4beta1.BoundingPoly.normalizedVertices: object expected"); - message.normalizedVertices[i] = $root.google.cloud.vision.v1p4beta1.NormalizedVertex.fromObject(object.normalizedVertices[i]); - } - } + var message = new $root.google.cloud.vision.v1p4beta1.GcsDestination(); + if (object.uri != null) + message.uri = String(object.uri); return message; }; /** - * Creates a plain object from a BoundingPoly message. Also converts values to other types if specified. + * Creates a plain object from a GcsDestination message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.BoundingPoly + * @memberof google.cloud.vision.v1p4beta1.GcsDestination * @static - * @param {google.cloud.vision.v1p4beta1.BoundingPoly} message BoundingPoly + * @param {google.cloud.vision.v1p4beta1.GcsDestination} message GcsDestination * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - BoundingPoly.toObject = function toObject(message, options) { + GcsDestination.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; - if (options.arrays || options.defaults) { - object.vertices = []; - object.normalizedVertices = []; - } - if (message.vertices && message.vertices.length) { - object.vertices = []; - for (var j = 0; j < message.vertices.length; ++j) - object.vertices[j] = $root.google.cloud.vision.v1p4beta1.Vertex.toObject(message.vertices[j], options); - } - if (message.normalizedVertices && message.normalizedVertices.length) { - object.normalizedVertices = []; - for (var j = 0; j < message.normalizedVertices.length; ++j) - object.normalizedVertices[j] = $root.google.cloud.vision.v1p4beta1.NormalizedVertex.toObject(message.normalizedVertices[j], options); - } + if (options.defaults) + object.uri = ""; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; return object; }; /** - * Converts this BoundingPoly to JSON. + * Converts this GcsDestination to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.BoundingPoly + * @memberof google.cloud.vision.v1p4beta1.GcsDestination * @instance * @returns {Object.} JSON object */ - BoundingPoly.prototype.toJSON = function toJSON() { + GcsDestination.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return BoundingPoly; + return GcsDestination; })(); - v1p4beta1.Position = (function() { + v1p4beta1.OperationMetadata = (function() { /** - * Properties of a Position. + * Properties of an OperationMetadata. * @memberof google.cloud.vision.v1p4beta1 - * @interface IPosition - * @property {number|null} [x] Position x - * @property {number|null} [y] Position y - * @property {number|null} [z] Position z + * @interface IOperationMetadata + * @property {google.cloud.vision.v1p4beta1.OperationMetadata.State|null} [state] OperationMetadata state + * @property {google.protobuf.ITimestamp|null} [createTime] OperationMetadata createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] OperationMetadata updateTime */ /** - * Constructs a new Position. + * Constructs a new OperationMetadata. * @memberof google.cloud.vision.v1p4beta1 - * @classdesc Represents a Position. - * @implements IPosition + * @classdesc Represents an OperationMetadata. + * @implements IOperationMetadata * @constructor - * @param {google.cloud.vision.v1p4beta1.IPosition=} [properties] Properties to set + * @param {google.cloud.vision.v1p4beta1.IOperationMetadata=} [properties] Properties to set */ - function Position(properties) { + function OperationMetadata(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -85221,101 +85163,101 @@ } /** - * Position x. - * @member {number} x - * @memberof google.cloud.vision.v1p4beta1.Position + * OperationMetadata state. + * @member {google.cloud.vision.v1p4beta1.OperationMetadata.State} state + * @memberof google.cloud.vision.v1p4beta1.OperationMetadata * @instance */ - Position.prototype.x = 0; + OperationMetadata.prototype.state = 0; /** - * Position y. - * @member {number} y - * @memberof google.cloud.vision.v1p4beta1.Position + * OperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.vision.v1p4beta1.OperationMetadata * @instance */ - Position.prototype.y = 0; + OperationMetadata.prototype.createTime = null; /** - * Position z. - * @member {number} z - * @memberof google.cloud.vision.v1p4beta1.Position + * OperationMetadata updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.vision.v1p4beta1.OperationMetadata * @instance */ - Position.prototype.z = 0; + OperationMetadata.prototype.updateTime = null; /** - * Creates a new Position instance using the specified properties. + * Creates a new OperationMetadata instance using the specified properties. * @function create - * @memberof google.cloud.vision.v1p4beta1.Position + * @memberof google.cloud.vision.v1p4beta1.OperationMetadata * @static - * @param {google.cloud.vision.v1p4beta1.IPosition=} [properties] Properties to set - * @returns {google.cloud.vision.v1p4beta1.Position} Position instance + * @param {google.cloud.vision.v1p4beta1.IOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.vision.v1p4beta1.OperationMetadata} OperationMetadata instance */ - Position.create = function create(properties) { - return new Position(properties); + OperationMetadata.create = function create(properties) { + return new OperationMetadata(properties); }; /** - * Encodes the specified Position message. Does not implicitly {@link google.cloud.vision.v1p4beta1.Position.verify|verify} messages. + * Encodes the specified OperationMetadata message. Does not implicitly {@link google.cloud.vision.v1p4beta1.OperationMetadata.verify|verify} messages. * @function encode - * @memberof google.cloud.vision.v1p4beta1.Position + * @memberof google.cloud.vision.v1p4beta1.OperationMetadata * @static - * @param {google.cloud.vision.v1p4beta1.IPosition} message Position message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IOperationMetadata} message OperationMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Position.encode = function encode(message, writer) { + OperationMetadata.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.x != null && message.hasOwnProperty("x")) - writer.uint32(/* id 1, wireType 5 =*/13).float(message.x); - if (message.y != null && message.hasOwnProperty("y")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.y); - if (message.z != null && message.hasOwnProperty("z")) - writer.uint32(/* id 3, wireType 5 =*/29).float(message.z); + if (message.state != null && message.hasOwnProperty("state")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.state); + if (message.createTime != null && message.hasOwnProperty("createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); return writer; }; /** - * Encodes the specified Position message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.Position.verify|verify} messages. + * Encodes the specified OperationMetadata message, length delimited. Does not implicitly {@link google.cloud.vision.v1p4beta1.OperationMetadata.verify|verify} messages. * @function encodeDelimited - * @memberof google.cloud.vision.v1p4beta1.Position + * @memberof google.cloud.vision.v1p4beta1.OperationMetadata * @static - * @param {google.cloud.vision.v1p4beta1.IPosition} message Position message or plain object to encode + * @param {google.cloud.vision.v1p4beta1.IOperationMetadata} message OperationMetadata message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Position.encodeDelimited = function encodeDelimited(message, writer) { + OperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Position message from the specified reader or buffer. + * Decodes an OperationMetadata message from the specified reader or buffer. * @function decode - * @memberof google.cloud.vision.v1p4beta1.Position + * @memberof google.cloud.vision.v1p4beta1.OperationMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.vision.v1p4beta1.Position} Position + * @returns {google.cloud.vision.v1p4beta1.OperationMetadata} OperationMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Position.decode = function decode(reader, length) { + OperationMetadata.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.vision.v1p4beta1.Position(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.vision.v1p4beta1.OperationMetadata(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.x = reader.float(); + message.state = reader.int32(); break; - case 2: - message.y = reader.float(); + case 5: + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; - case 3: - message.z = reader.float(); + case 6: + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); @@ -85326,104 +85268,162 @@ }; /** - * Decodes a Position message from the specified reader or buffer, length delimited. + * Decodes an OperationMetadata message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.cloud.vision.v1p4beta1.Position + * @memberof google.cloud.vision.v1p4beta1.OperationMetadata * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.vision.v1p4beta1.Position} Position + * @returns {google.cloud.vision.v1p4beta1.OperationMetadata} OperationMetadata * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Position.decodeDelimited = function decodeDelimited(reader) { + OperationMetadata.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Position message. + * Verifies an OperationMetadata message. * @function verify - * @memberof google.cloud.vision.v1p4beta1.Position + * @memberof google.cloud.vision.v1p4beta1.OperationMetadata * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Position.verify = function verify(message) { + OperationMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.x != null && message.hasOwnProperty("x")) - if (typeof message.x !== "number") - return "x: number expected"; - if (message.y != null && message.hasOwnProperty("y")) - if (typeof message.y !== "number") - return "y: number expected"; - if (message.z != null && message.hasOwnProperty("z")) - if (typeof message.z !== "number") - return "z: number expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } return null; }; /** - * Creates a Position message from a plain object. Also converts values to their respective internal types. + * Creates an OperationMetadata message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.cloud.vision.v1p4beta1.Position + * @memberof google.cloud.vision.v1p4beta1.OperationMetadata * @static * @param {Object.} object Plain object - * @returns {google.cloud.vision.v1p4beta1.Position} Position + * @returns {google.cloud.vision.v1p4beta1.OperationMetadata} OperationMetadata */ - Position.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.vision.v1p4beta1.Position) + OperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.vision.v1p4beta1.OperationMetadata) return object; - var message = new $root.google.cloud.vision.v1p4beta1.Position(); - if (object.x != null) - message.x = Number(object.x); - if (object.y != null) - message.y = Number(object.y); - if (object.z != null) - message.z = Number(object.z); + var message = new $root.google.cloud.vision.v1p4beta1.OperationMetadata(); + switch (object.state) { + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "CREATED": + case 1: + message.state = 1; + break; + case "RUNNING": + case 2: + message.state = 2; + break; + case "DONE": + case 3: + message.state = 3; + break; + case "CANCELLED": + case 4: + message.state = 4; + break; + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.OperationMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.vision.v1p4beta1.OperationMetadata.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } return message; }; /** - * Creates a plain object from a Position message. Also converts values to other types if specified. + * Creates a plain object from an OperationMetadata message. Also converts values to other types if specified. * @function toObject - * @memberof google.cloud.vision.v1p4beta1.Position + * @memberof google.cloud.vision.v1p4beta1.OperationMetadata * @static - * @param {google.cloud.vision.v1p4beta1.Position} message Position + * @param {google.cloud.vision.v1p4beta1.OperationMetadata} message OperationMetadata * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Position.toObject = function toObject(message, options) { + OperationMetadata.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.x = 0; - object.y = 0; - object.z = 0; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.createTime = null; + object.updateTime = null; } - if (message.x != null && message.hasOwnProperty("x")) - object.x = options.json && !isFinite(message.x) ? String(message.x) : message.x; - if (message.y != null && message.hasOwnProperty("y")) - object.y = options.json && !isFinite(message.y) ? String(message.y) : message.y; - if (message.z != null && message.hasOwnProperty("z")) - object.z = options.json && !isFinite(message.z) ? String(message.z) : message.z; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.vision.v1p4beta1.OperationMetadata.State[message.state] : message.state; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); return object; }; /** - * Converts this Position to JSON. + * Converts this OperationMetadata to JSON. * @function toJSON - * @memberof google.cloud.vision.v1p4beta1.Position + * @memberof google.cloud.vision.v1p4beta1.OperationMetadata * @instance * @returns {Object.} JSON object */ - Position.prototype.toJSON = function toJSON() { + OperationMetadata.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Position; + /** + * State enum. + * @name google.cloud.vision.v1p4beta1.OperationMetadata.State + * @enum {string} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} CREATED=1 CREATED value + * @property {number} RUNNING=2 RUNNING value + * @property {number} DONE=3 DONE value + * @property {number} CANCELLED=4 CANCELLED value + */ + OperationMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "CREATED"] = 1; + values[valuesById[2] = "RUNNING"] = 2; + values[valuesById[3] = "DONE"] = 3; + values[valuesById[4] = "CANCELLED"] = 4; + return values; + })(); + + return OperationMetadata; })(); v1p4beta1.ProductSearchParams = (function() { diff --git a/packages/google-cloud-vision/protos/protos.json b/packages/google-cloud-vision/protos/protos.json index 964f3e656aa..7c8ed705885 100644 --- a/packages/google-cloud-vision/protos/protos.json +++ b/packages/google-cloud-vision/protos/protos.json @@ -16,6 +16,60 @@ "objc_class_prefix": "GCVN" }, "nested": { + "Vertex": { + "fields": { + "x": { + "type": "int32", + "id": 1 + }, + "y": { + "type": "int32", + "id": 2 + } + } + }, + "NormalizedVertex": { + "fields": { + "x": { + "type": "float", + "id": 1 + }, + "y": { + "type": "float", + "id": 2 + } + } + }, + "BoundingPoly": { + "fields": { + "vertices": { + "rule": "repeated", + "type": "Vertex", + "id": 1 + }, + "normalizedVertices": { + "rule": "repeated", + "type": "NormalizedVertex", + "id": 2 + } + } + }, + "Position": { + "fields": { + "x": { + "type": "float", + "id": 1 + }, + "y": { + "type": "float", + "id": 2 + }, + "z": { + "type": "float", + "id": 3 + } + } + }, "ImageAnnotator": { "options": { "(google.api.default_host)": "vision.googleapis.com", @@ -858,60 +912,6 @@ } } }, - "Vertex": { - "fields": { - "x": { - "type": "int32", - "id": 1 - }, - "y": { - "type": "int32", - "id": 2 - } - } - }, - "NormalizedVertex": { - "fields": { - "x": { - "type": "float", - "id": 1 - }, - "y": { - "type": "float", - "id": 2 - } - } - }, - "BoundingPoly": { - "fields": { - "vertices": { - "rule": "repeated", - "type": "Vertex", - "id": 1 - }, - "normalizedVertices": { - "rule": "repeated", - "type": "NormalizedVertex", - "id": 2 - } - } - }, - "Position": { - "fields": { - "x": { - "type": "float", - "id": 1 - }, - "y": { - "type": "float", - "id": 2 - }, - "z": { - "type": "float", - "id": 3 - } - } - }, "ProductSearchParams": { "fields": { "boundingPoly": { @@ -2057,6 +2057,43 @@ "java_package": "com.google.cloud.vision.v1p1beta1" }, "nested": { + "Vertex": { + "fields": { + "x": { + "type": "int32", + "id": 1 + }, + "y": { + "type": "int32", + "id": 2 + } + } + }, + "BoundingPoly": { + "fields": { + "vertices": { + "rule": "repeated", + "type": "Vertex", + "id": 1 + } + } + }, + "Position": { + "fields": { + "x": { + "type": "float", + "id": 1 + }, + "y": { + "type": "float", + "id": 2 + }, + "z": { + "type": "float", + "id": 3 + } + } + }, "ImageAnnotator": { "options": { "(google.api.default_host)": "vision.googleapis.com", @@ -2550,43 +2587,6 @@ "VERY_LIKELY": 5 } }, - "Vertex": { - "fields": { - "x": { - "type": "int32", - "id": 1 - }, - "y": { - "type": "int32", - "id": 2 - } - } - }, - "BoundingPoly": { - "fields": { - "vertices": { - "rule": "repeated", - "type": "Vertex", - "id": 1 - } - } - }, - "Position": { - "fields": { - "x": { - "type": "float", - "id": 1 - }, - "y": { - "type": "float", - "id": 2 - }, - "z": { - "type": "float", - "id": 3 - } - } - }, "TextAnnotation": { "fields": { "pages": { @@ -2888,6 +2888,60 @@ "java_package": "com.google.cloud.vision.v1p2beta1" }, "nested": { + "Vertex": { + "fields": { + "x": { + "type": "int32", + "id": 1 + }, + "y": { + "type": "int32", + "id": 2 + } + } + }, + "NormalizedVertex": { + "fields": { + "x": { + "type": "float", + "id": 1 + }, + "y": { + "type": "float", + "id": 2 + } + } + }, + "BoundingPoly": { + "fields": { + "vertices": { + "rule": "repeated", + "type": "Vertex", + "id": 1 + }, + "normalizedVertices": { + "rule": "repeated", + "type": "NormalizedVertex", + "id": 2 + } + } + }, + "Position": { + "fields": { + "x": { + "type": "float", + "id": 1 + }, + "y": { + "type": "float", + "id": 2 + }, + "z": { + "type": "float", + "id": 3 + } + } + }, "ImageAnnotator": { "options": { "(google.api.default_host)": "vision.googleapis.com", @@ -3538,69 +3592,15 @@ "VERY_LIKELY": 5 } }, - "Vertex": { + "TextAnnotation": { "fields": { - "x": { - "type": "int32", + "pages": { + "rule": "repeated", + "type": "Page", "id": 1 }, - "y": { - "type": "int32", - "id": 2 - } - } - }, - "NormalizedVertex": { - "fields": { - "x": { - "type": "float", - "id": 1 - }, - "y": { - "type": "float", - "id": 2 - } - } - }, - "BoundingPoly": { - "fields": { - "vertices": { - "rule": "repeated", - "type": "Vertex", - "id": 1 - }, - "normalizedVertices": { - "rule": "repeated", - "type": "NormalizedVertex", - "id": 2 - } - } - }, - "Position": { - "fields": { - "x": { - "type": "float", - "id": 1 - }, - "y": { - "type": "float", - "id": 2 - }, - "z": { - "type": "float", - "id": 3 - } - } - }, - "TextAnnotation": { - "fields": { - "pages": { - "rule": "repeated", - "type": "Page", - "id": 1 - }, - "text": { - "type": "string", + "text": { + "type": "string", "id": 2 } }, @@ -3893,6 +3893,69 @@ "java_package": "com.google.cloud.vision.v1p3beta1" }, "nested": { + "Vertex": { + "fields": { + "x": { + "type": "int32", + "id": 1 + }, + "y": { + "type": "int32", + "id": 2 + } + } + }, + "NormalizedVertex": { + "fields": { + "x": { + "type": "float", + "id": 1 + }, + "y": { + "type": "float", + "id": 2 + } + } + }, + "BoundingPoly": { + "fields": { + "vertices": { + "rule": "repeated", + "type": "Vertex", + "id": 1 + }, + "normalizedVertices": { + "rule": "repeated", + "type": "NormalizedVertex", + "id": 2 + } + } + }, + "NormalizedBoundingPoly": { + "fields": { + "vertices": { + "rule": "repeated", + "type": "NormalizedVertex", + "id": 1 + } + } + }, + "Position": { + "fields": { + "x": { + "type": "float", + "id": 1 + }, + "y": { + "type": "float", + "id": 2 + }, + "z": { + "type": "float", + "id": 3 + } + } + }, "ImageAnnotator": { "options": { "(google.api.default_host)": "vision.googleapis.com", @@ -4579,69 +4642,6 @@ } } }, - "Vertex": { - "fields": { - "x": { - "type": "int32", - "id": 1 - }, - "y": { - "type": "int32", - "id": 2 - } - } - }, - "NormalizedVertex": { - "fields": { - "x": { - "type": "float", - "id": 1 - }, - "y": { - "type": "float", - "id": 2 - } - } - }, - "BoundingPoly": { - "fields": { - "vertices": { - "rule": "repeated", - "type": "Vertex", - "id": 1 - }, - "normalizedVertices": { - "rule": "repeated", - "type": "NormalizedVertex", - "id": 2 - } - } - }, - "NormalizedBoundingPoly": { - "fields": { - "vertices": { - "rule": "repeated", - "type": "NormalizedVertex", - "id": 1 - } - } - }, - "Position": { - "fields": { - "x": { - "type": "float", - "id": 1 - }, - "y": { - "type": "float", - "id": 2 - }, - "z": { - "type": "float", - "id": 3 - } - } - }, "ProductSearchParams": { "fields": { "catalogName": { @@ -5756,6 +5756,97 @@ "objc_class_prefix": "GCVN" }, "nested": { + "FaceRecognitionParams": { + "fields": { + "celebritySet": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "Celebrity": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2 + }, + "description": { + "type": "string", + "id": 3 + } + } + }, + "FaceRecognitionResult": { + "fields": { + "celebrity": { + "type": "Celebrity", + "id": 1 + }, + "confidence": { + "type": "float", + "id": 2 + } + } + }, + "Vertex": { + "fields": { + "x": { + "type": "int32", + "id": 1 + }, + "y": { + "type": "int32", + "id": 2 + } + } + }, + "NormalizedVertex": { + "fields": { + "x": { + "type": "float", + "id": 1 + }, + "y": { + "type": "float", + "id": 2 + } + } + }, + "BoundingPoly": { + "fields": { + "vertices": { + "rule": "repeated", + "type": "Vertex", + "id": 1 + }, + "normalizedVertices": { + "rule": "repeated", + "type": "NormalizedVertex", + "id": 2 + } + } + }, + "Position": { + "fields": { + "x": { + "type": "float", + "id": 1 + }, + "y": { + "type": "float", + "id": 2 + }, + "z": { + "type": "float", + "id": 3 + } + } + }, "ImageAnnotator": { "options": { "(google.api.default_host)": "vision.googleapis.com", @@ -6559,97 +6650,6 @@ } } }, - "FaceRecognitionParams": { - "fields": { - "celebritySet": { - "rule": "repeated", - "type": "string", - "id": 1 - } - } - }, - "Celebrity": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "displayName": { - "type": "string", - "id": 2 - }, - "description": { - "type": "string", - "id": 3 - } - } - }, - "FaceRecognitionResult": { - "fields": { - "celebrity": { - "type": "Celebrity", - "id": 1 - }, - "confidence": { - "type": "float", - "id": 2 - } - } - }, - "Vertex": { - "fields": { - "x": { - "type": "int32", - "id": 1 - }, - "y": { - "type": "int32", - "id": 2 - } - } - }, - "NormalizedVertex": { - "fields": { - "x": { - "type": "float", - "id": 1 - }, - "y": { - "type": "float", - "id": 2 - } - } - }, - "BoundingPoly": { - "fields": { - "vertices": { - "rule": "repeated", - "type": "Vertex", - "id": 1 - }, - "normalizedVertices": { - "rule": "repeated", - "type": "NormalizedVertex", - "id": 2 - } - } - }, - "Position": { - "fields": { - "x": { - "type": "float", - "id": 1 - }, - "y": { - "type": "float", - "id": 2 - }, - "z": { - "type": "float", - "id": 3 - } - } - }, "ProductSearchParams": { "fields": { "boundingPoly": { diff --git a/packages/google-cloud-vision/src/helpers.js b/packages/google-cloud-vision/src/helpers.ts similarity index 80% rename from packages/google-cloud-vision/src/helpers.js rename to packages/google-cloud-vision/src/helpers.ts index e306f62f816..bc5cfc664b9 100644 --- a/packages/google-cloud-vision/src/helpers.js +++ b/packages/google-cloud-vision/src/helpers.ts @@ -1,76 +1,123 @@ -/*! - * Copyright 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2017 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** -'use strict'; +import * as fs from 'fs'; +import * as is from 'is'; +import {promisify} from '@google-cloud/promisify'; +import * as gax from 'google-gax'; +import * as protoTypes from '../protos/protos'; +interface FeatureFunction { + (request: string | ImprovedRequest | Buffer): Promise< + [protoTypes.google.cloud.vision.v1.IAnnotateImageResponse] + >; +} +export interface FeaturesMethod { + annotateImage: FeatureFunction; + faceDetection: FeatureFunction; + landmarkDetection: FeatureFunction; + labelDetection: FeatureFunction; + safeSearchDetection: FeatureFunction; + imageProperties: FeatureFunction; + cropHints: FeatureFunction; + webDetection: FeatureFunction; + logoDetection: FeatureFunction; + textDetection: FeatureFunction; + documentTextDetection: FeatureFunction; + productSearch?: FeatureFunction; + objectLocalization?: FeatureFunction; +} +interface ImprovedRequest { + image?: {source?: {filename: string}; content?: Uint8Array | string | null}; + // tslint:disable-next-line no-any + features?: any; +} -const fs = require('fs'); -const is = require('is'); -const {promisify} = require('@google-cloud/promisify'); -const gax = require('google-gax'); +interface VisionClient { + batchAnnotateImages( + request: protoTypes.google.cloud.vision.v1.IBatchAnnotateImagesRequest, + options?: gax.CallOptions + ): Promise< + [ + protoTypes.google.cloud.vision.v1.IBatchAnnotateImagesResponse, + protoTypes.google.cloud.vision.v1.IBatchAnnotateImagesRequest | undefined, + {} | undefined + ] + >; + batchAnnotateImages( + request: protoTypes.google.cloud.vision.v1.IBatchAnnotateImagesRequest, + options?: gax.CallOptions, + callback?: gax.Callback< + protoTypes.google.cloud.vision.v1.IBatchAnnotateImagesResponse, + protoTypes.google.cloud.vision.v1.IBatchAnnotateImagesRequest | undefined, + {} | undefined + > + ): void; + annotateImage( + request: ImprovedRequest, + callOptions?: gax.CallOptions + ): Promise; + annotateImage( + request: ImprovedRequest, + callOptions: gax.CallOptions | undefined, + callback: gax.Callback< + protoTypes.google.cloud.vision.v1.IAnnotateImageResponse, + {}, + {} + > + ): void; +} -// We only need to have a Feature enum from the protos, and we want -// this enum to work for both gRPC and fallback scenarios. -// It's enough to have the contents of JSON proto for this purpose. -const jsonProto = require('../protos/protos.json'); - -/*! - * Convert non-object request forms into a correctly-formatted object. - * - * @param {object|string|Buffer} request An object representing an - * AnnotateImageRequest. May also be a string representing the path - * (filename or URL) to the image, or a buffer representing the image itself. - * - * @returns An object representing an AnnotateImageRequest. - */ -const _requestToObject = request => { +// tslint:disable-next-line no-any +const _requestToObject = (request: any) => { if (is.string(request)) { // Is this a URL or a local file? // Guess based on what the string looks like, and build the full // request object in the correct format. if (request.indexOf('://') === -1 || request.indexOf('file://') === 0) { - request = {image: {source: {filename: request}}}; + request = ({ + image: {source: {filename: request}}, + } as unknown) as ImprovedRequest; } else { - request = {image: {source: {imageUri: request}}}; + request = ({ + image: {source: {imageUri: request}}, + } as unknown) as ImprovedRequest; } } else if (Buffer.isBuffer(request)) { // Drop the buffer one level lower; it will get dealt with later // in the function. This allows sending and {image: } to // both work identically. - request = {image: request}; + request = ({image: request} as unknown) as ImprovedRequest; } - return request; + return (request as unknown) as ImprovedRequest; }; -/*! - * Coerce several nicer iterations of "how to specify an image" to the - * full sturcture expected by the Vision API. - * - * @param {object} request An object representing an AnnotateImageRequest. - * It may include `image.source.filename` or a buffer passed to - * `image.content`, which are coerced into their canonical forms by this - * function. - * @param {function} callback The callback to run. - */ -const _coerceRequest = (request, callback) => { +const _coerceRequest = ( + request: ImprovedRequest, + callback: ( + err: Error | null, + request?: protoTypes.google.cloud.vision.v1.IAnnotateImageRequest + ) => void +) => { // At this point, request must be an object with an `image` key; if not, // it is an error. If there is no image, throw an exception. if (!is.object(request) || is.undefined(request.image)) { return callback(new Error('No image present.')); } - // If this is a buffer, read it and send the object // that the Vision API expects. if (Buffer.isBuffer(request.image)) { @@ -79,46 +126,65 @@ const _coerceRequest = (request, callback) => { // If the file is specified as a filename and exists on disk, read it // and coerce it into the base64 content. - if (request.image.source && request.image.source.filename) { - fs.readFile(request.image.source.filename, (err, blob) => { + if (request.image!.source && request.image!.source.filename) { + fs.readFile(request.image!.source.filename, (err, blob) => { if (err) { callback(err); return; } - request.image.content = blob.toString('base64'); - delete request.image.source; - return callback(null, request); + request.image!.content = blob.toString('base64'); + delete request.image!.source; + return callback( + null, + request as protoTypes.google.cloud.vision.v1.IAnnotateImageRequest + ); }); } else { - return callback(null, request); + return callback( + null, + request as protoTypes.google.cloud.vision.v1.IAnnotateImageRequest + ); } }; -/*! - * - * Return a method that calls annotateImage asking for a single feature. - * - * @param {number} featureValue The feature being requested. This is taken - * from the Feature.Type enum, and will be an integer. - * - * @returns {function} The function that, when called, will call annotateImage - * asking for the single feature annotation. - */ -const _createSingleFeatureMethod = featureValue => { - return function(annotateImageRequest, callOptions, callback) { +const _createSingleFeatureMethod = ( + featureValue: protoTypes.google.cloud.vision.v1.Feature.Type +) => { + return function( + this: VisionClient, + request: string, + callOptionsOrCallback?: + | gax.CallOptions + | gax.Callback< + protoTypes.google.cloud.vision.v1.IAnnotateImageResponse, + {}, + {} + >, + callback?: gax.Callback< + protoTypes.google.cloud.vision.v1.IAnnotateImageResponse, + {}, + {} + > + ) { // Sanity check: If we got a string or buffer, we need this to be // in object form now, so we can tack on the features list. // // Do the minimum required conversion, which can also be guaranteed to // be synchronous (e.g. no file loading yet; that is handled by // annotateImage later. - annotateImageRequest = _requestToObject(annotateImageRequest); - + const annotateImageRequest: ImprovedRequest = _requestToObject(request); // If a callback was provided and options were skipped, normalize // the argument names. - if (is.undefined(callback) && is.function(callOptions)) { - callback = callOptions; + let callOptions: gax.CallOptions | undefined; + if (is.undefined(callback) && is.function(callOptionsOrCallback)) { + callback = callOptionsOrCallback as gax.Callback< + protoTypes.google.cloud.vision.v1.IAnnotateImageResponse, + {}, + {} + >; callOptions = undefined; + } else { + callOptions = callOptionsOrCallback as gax.CallOptions | undefined; } // Add the feature to the request. @@ -138,24 +204,13 @@ const _createSingleFeatureMethod = featureValue => { ); } } - // Call the underlying #annotateImage method. - return this.annotateImage(annotateImageRequest, callOptions, callback); + return this.annotateImage(annotateImageRequest, callOptions, callback!); }; }; -/*! - * Return a dictionary-like object with helpers to augment the Vision - * GAPIC. - * - * @param {string} apiVersion The API version (e.g. "v1") - * - * @returns {object} An object with keys and functions which are placed - * onto the pure GAPIC. - */ -module.exports = apiVersion => { - const methods = {}; - +export function call(apiVersion: string) { + const methods: FeaturesMethod = ({} as unknown) as FeaturesMethod; /** * Annotate a single image with the requested features. * @@ -213,43 +268,96 @@ module.exports = apiVersion => { * console.error(err); * }); */ - methods.annotateImage = promisify(function(request, callOptions, callback) { + + methods.annotateImage = promisify(function( + this: VisionClient, + request: ImprovedRequest, + callOptionsOrCallback: + | gax.Callback< + protoTypes.google.cloud.vision.v1.IAnnotateImageResponse, + {}, + {} + > + | gax.CallOptions, + callback?: gax.Callback< + protoTypes.google.cloud.vision.v1.IAnnotateImageResponse, + {}, + {} + > + ) { // If a callback was provided and options were skipped, normalize // the argument names. - if (is.undefined(callback) && is.function(callOptions)) { - callback = callOptions; + let callOptions: gax.CallOptions | undefined; + if (is.undefined(callback) && is.function(callOptionsOrCallback)) { + callback = callOptionsOrCallback as gax.Callback< + protoTypes.google.cloud.vision.v1.IAnnotateImageResponse, + {}, + {} + >; callOptions = undefined; + } else { + callOptions = callOptionsOrCallback as gax.CallOptions | undefined; } // If we got a filename for the image, open the file and transform // it to content. - return _coerceRequest(request, (err, req) => { - if (err) { - return callback(err); - } - - // Call the GAPIC batch annotation function. - const requests = {requests: [req]}; - return this.batchAnnotateImages(requests, callOptions, (err, r) => { - // If there is an error, handle it. + return _coerceRequest( + request, + ( + err: Error | null, + req: protoTypes.google.cloud.vision.v1.IAnnotateImageRequest | undefined + ) => { if (err) { - return callback(err); + return ((callback as unknown) as gax.Callback< + protoTypes.google.cloud.vision.v1.IAnnotateImageResponse, + {}, + {} + >)(err); } - // We are guaranteed to only have one response element, since we - // only sent one image. - const response = r.responses[0]; + // Call the GAPIC batch annotation function. + const requests = {requests: [req!]}; + return this.batchAnnotateImages( + requests, + callOptions, + ( + err: Error | null | undefined, + r: + | protoTypes.google.cloud.vision.v1.IBatchAnnotateImagesResponse + | null + | undefined + ) => { + // If there is an error, handle it. + if (err) { + return ((callback as unknown) as gax.Callback< + protoTypes.google.cloud.vision.v1.IAnnotateImageResponse, + {}, + {} + >)(err); + } - // Fire the callback if applicable. - return callback(undefined, response); - }); - }); + // We are guaranteed to only have one response element, since we + // only sent one image. + const response = r!.responses![0]; + + // Fire the callback if applicable. + return ((callback as unknown) as gax.Callback< + protoTypes.google.cloud.vision.v1.IAnnotateImageResponse, + {}, + {} + >)(undefined, response); + } + ); + } + ); }); - const protoFilesRoot = gax.protobuf.Root.fromJSON(jsonProto); - const features = protoFilesRoot.lookup( + const protoFilesRoot = gax.protobuf.Root.fromJSON( + require('../protos/protos.json') + ); + const features = (protoFilesRoot.lookup( `google.cloud.vision.${apiVersion}.Feature.Type` - ).values; + ) as gax.protobuf.Enum).values; /** * Annotate a single image with face detection. @@ -304,10 +412,10 @@ module.exports = apiVersion => { * console.error(err); * }); */ + methods.faceDetection = promisify( - _createSingleFeatureMethod(features.FACE_DETECTION) + _createSingleFeatureMethod(features!.FACE_DETECTION) ); - /** * Annotate a single image with landmark detection. * @@ -361,10 +469,10 @@ module.exports = apiVersion => { * console.error(err); * }); */ + methods.landmarkDetection = promisify( - _createSingleFeatureMethod(features.LANDMARK_DETECTION) + _createSingleFeatureMethod(features!.LANDMARK_DETECTION) ); - /** * Annotate a single image with logo detection. * @@ -418,10 +526,10 @@ module.exports = apiVersion => { * console.error(err); * }); */ + methods.logoDetection = promisify( _createSingleFeatureMethod(features.LOGO_DETECTION) ); - /** * Annotate a single image with label detection. * @@ -475,10 +583,10 @@ module.exports = apiVersion => { * console.error(err); * }); */ + methods.labelDetection = promisify( - _createSingleFeatureMethod(features.LABEL_DETECTION) + _createSingleFeatureMethod(features!.LABEL_DETECTION) ); - /** * Annotate a single image with text detection. * @@ -532,10 +640,10 @@ module.exports = apiVersion => { * console.error(err); * }); */ + methods.textDetection = promisify( _createSingleFeatureMethod(features.TEXT_DETECTION) ); - /** * Annotate a single image with document text detection. * @@ -589,10 +697,10 @@ module.exports = apiVersion => { * console.error(err); * }); */ + methods.documentTextDetection = promisify( _createSingleFeatureMethod(features.DOCUMENT_TEXT_DETECTION) ); - /** * Annotate a single image with safe search detection. * @@ -646,10 +754,10 @@ module.exports = apiVersion => { * console.error(err); * }); */ + methods.safeSearchDetection = promisify( - _createSingleFeatureMethod(features.SAFE_SEARCH_DETECTION) + _createSingleFeatureMethod(features!.SAFE_SEARCH_DETECTION) ); - /** * Annotate a single image with image properties. * @@ -703,10 +811,10 @@ module.exports = apiVersion => { * console.error(err); * }); */ + methods.imageProperties = promisify( - _createSingleFeatureMethod(features.IMAGE_PROPERTIES) + _createSingleFeatureMethod(features!.IMAGE_PROPERTIES) ); - /** * Annotate a single image with crop hints. * @@ -760,10 +868,10 @@ module.exports = apiVersion => { * console.error(err); * }); */ + methods.cropHints = promisify( - _createSingleFeatureMethod(features.CROP_HINTS) + _createSingleFeatureMethod(features!.CROP_HINTS) ); - /** * Annotate a single image with web detection. * @@ -817,10 +925,10 @@ module.exports = apiVersion => { * console.error(err); * }); */ + methods.webDetection = promisify( - _createSingleFeatureMethod(features.WEB_DETECTION) + _createSingleFeatureMethod(features!.WEB_DETECTION) ); - /** * Annotate a single image with the result from Product Search. * @@ -872,12 +980,11 @@ module.exports = apiVersion => { * console.error(err); * }); */ - if (features.PRODUCT_SEARCH !== undefined) { + if (features!.PRODUCT_SEARCH !== undefined) { methods.productSearch = promisify( - _createSingleFeatureMethod(features.PRODUCT_SEARCH) + _createSingleFeatureMethod(features!.PRODUCT_SEARCH) ); } - /** * Annotate a single image with localization vectors. * @@ -932,11 +1039,10 @@ module.exports = apiVersion => { * console.error(err); * }); */ - if (features.OBJECT_LOCALIZATION !== undefined) { + if (features!.OBJECT_LOCALIZATION !== undefined) { methods.objectLocalization = promisify( - _createSingleFeatureMethod(features.OBJECT_LOCALIZATION) + _createSingleFeatureMethod(features!.OBJECT_LOCALIZATION) ); } - return methods; -}; +} diff --git a/packages/google-cloud-vision/src/index.js b/packages/google-cloud-vision/src/index.js deleted file mode 100644 index f70be4fdca4..00000000000 --- a/packages/google-cloud-vision/src/index.js +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright 2017, Google LLC All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * @namespace google.cloud.vision.v1 - */ -/** - * @namespace google.cloud.vision.v1p1beta1 - */ -/** - * @namespace google.cloud.vision.v1p2beta1 - */ -/** - * @namespace google.cloud.vision.v1p3beta1 - */ -/** - * @namespace google.cloud.vision.v1p4beta1 - */ -/** - * @namespace google.longrunning - */ -/** - * @namespace google.protobuf - */ -/** - * @namespace google.rpc - */ -/** - * @namespace google.type - */ - -'use strict'; - -const helpers = require('./helpers'); - -// Import the clients for each version supported by this package. -const gapic = Object.freeze({ - v1: require('./v1'), - v1p1beta1: require('./v1p1beta1'), - v1p2beta1: require('./v1p2beta1'), - v1p3beta1: require('./v1p3beta1'), - v1p4beta1: require('./v1p4beta1'), -}); - -// Augment the SpeechClient objects with the helpers. -for (const gapicVersion of Object.keys(gapic)) { - const clientProto = gapic[gapicVersion].ImageAnnotatorClient.prototype; - Object.assign(clientProto, helpers(gapicVersion)); -} - -/** - * The `@google-cloud/vision` package has the following named exports: - * - * - `ImageAnnotatorClient` - Reference to {@link v1.ImageAnnotatorClient}. - * - `v1` - This is used for selecting or pinning a particular backend service - * version. It exports: - * - `ImageAnnotatorClient` - Reference to {@link v1.ImageAnnotatorClient}. - * - * @module {object} @google-cloud/vision - * @alias nodejs-vision - * - * @example Install the client library with npm: - * npm install --save @google-cloud/vision - * - * @example Import the client library: - * const vision = require('@google-cloud/vision'); - * - * @example Create a client that uses Application Default Credentials (ADC): - * const client = new vision.ImageAnnotatorClient(); - * - * @example Create a client with explicit credentials: - * const client = new vision.ImageAnnotatorClient({ - * projectId: 'your-project-id', - * keyFilename: '/path/to/keyfile.json', - * }); - */ -module.exports = gapic.v1; - -/** - * @type {object} - * @property {constructor} ImageAnnotatorClient - * Reference to {@link v1.ImageAnnotatorClient} - */ -module.exports.v1 = gapic.v1; - -/** - * @type {object} - * @property {constructor} ImageAnnotatorClient - * Reference to {@link v1p1beta1.ImageAnnotatorClient} - */ -module.exports.v1p1beta1 = gapic.v1p1beta1; - -/** - * @type {object} - * @property {constructor} ImageAnnotatorClient - * Reference to {@link v1p2beta1.ImageAnnotatorClient} - */ -module.exports.v1p2beta1 = gapic.v1p2beta1; - -/** - * @type {object} - * @property {constructor} ImageAnnotatorClient - * Reference to {@link v1p3beta1.ImageAnnotatorClient} - */ -module.exports.v1p3beta1 = gapic.v1p3beta1; - -/** - * @type {object} - * @property {constructor} ImageAnnotatorClient - * Reference to {@link v1p4beta1.ImageAnnotatorClient} - */ -module.exports.v1p4beta1 = gapic.v1p4beta1; - -// Alias `module.exports` as `module.exports.default`, for future-proofing. -module.exports.default = Object.assign({}, module.exports); diff --git a/packages/google-cloud-vision/src/index.ts b/packages/google-cloud-vision/src/index.ts new file mode 100644 index 00000000000..86b09427951 --- /dev/null +++ b/packages/google-cloud-vision/src/index.ts @@ -0,0 +1,63 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v1 from './v1'; +import * as v1p1beta1 from './v1p1beta1'; +import * as v1p2beta1 from './v1p2beta1'; +import * as v1p3beta1 from './v1p3beta1'; +import * as v1p4beta1 from './v1p4beta1'; +import * as helpers from './helpers'; +Object.assign(v1.ImageAnnotatorClient.prototype, helpers.call('v1')); +Object.assign( + v1p1beta1.ImageAnnotatorClient.prototype, + helpers.call('v1p1beta1') +); +Object.assign( + v1p2beta1.ImageAnnotatorClient.prototype, + helpers.call('v1p2beta1') +); +Object.assign( + v1p3beta1.ImageAnnotatorClient.prototype, + helpers.call('v1p3beta1') +); +Object.assign( + v1p4beta1.ImageAnnotatorClient.prototype, + helpers.call('v1p4beta1') +); +const ImageAnnotatorClient = v1.ImageAnnotatorClient; +const ProductSearchClient = v1.ProductSearchClient; +export { + v1, + v1p1beta1, + v1p2beta1, + v1p3beta1, + v1p4beta1, + ImageAnnotatorClient, + ProductSearchClient, +}; +// For compatibility with JavaScript libraries we need to provide this default export: +// tslint:disable-next-line no-default-export +export default { + v1, + v1p1beta1, + v1p2beta1, + v1p3beta1, + v1p4beta1, + ImageAnnotatorClient, + ProductSearchClient, +}; diff --git a/packages/google-cloud-vision/src/v1/doc/google/cloud/vision/v1/doc_geometry.js b/packages/google-cloud-vision/src/v1/doc/google/cloud/vision/v1/doc_geometry.js deleted file mode 100644 index 406b714642f..00000000000 --- a/packages/google-cloud-vision/src/v1/doc/google/cloud/vision/v1/doc_geometry.js +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * A vertex represents a 2D point in the image. - * NOTE: the vertex coordinates are in the same scale as the original image. - * - * @property {number} x - * X coordinate. - * - * @property {number} y - * Y coordinate. - * - * @typedef Vertex - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.Vertex definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/geometry.proto} - */ -const Vertex = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A vertex represents a 2D point in the image. - * NOTE: the normalized vertex coordinates are relative to the original image - * and range from 0 to 1. - * - * @property {number} x - * X coordinate. - * - * @property {number} y - * Y coordinate. - * - * @typedef NormalizedVertex - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.NormalizedVertex definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/geometry.proto} - */ -const NormalizedVertex = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A bounding polygon for the detected image annotation. - * - * @property {Object[]} vertices - * The bounding polygon vertices. - * - * This object should have the same structure as [Vertex]{@link google.cloud.vision.v1.Vertex} - * - * @property {Object[]} normalizedVertices - * The bounding polygon normalized vertices. - * - * This object should have the same structure as [NormalizedVertex]{@link google.cloud.vision.v1.NormalizedVertex} - * - * @typedef BoundingPoly - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.BoundingPoly definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/geometry.proto} - */ -const BoundingPoly = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A 3D position in the image, used primarily for Face detection landmarks. - * A valid Position must have both x and y coordinates. - * The position coordinates are in the same scale as the original image. - * - * @property {number} x - * X coordinate. - * - * @property {number} y - * Y coordinate. - * - * @property {number} z - * Z coordinate (or depth). - * - * @typedef Position - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.Position definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/geometry.proto} - */ -const Position = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1/doc/google/cloud/vision/v1/doc_image_annotator.js b/packages/google-cloud-vision/src/v1/doc/google/cloud/vision/v1/doc_image_annotator.js deleted file mode 100644 index 57de73951a8..00000000000 --- a/packages/google-cloud-vision/src/v1/doc/google/cloud/vision/v1/doc_image_annotator.js +++ /dev/null @@ -1,1525 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * The type of Google Cloud Vision API detection to perform, and the maximum - * number of results to return for that type. Multiple `Feature` objects can - * be specified in the `features` list. - * - * @property {number} type - * The feature type. - * - * The number should be among the values of [Type]{@link google.cloud.vision.v1.Type} - * - * @property {number} maxResults - * Maximum number of results of this type. Does not apply to - * `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`. - * - * @property {string} model - * Model to use for the feature. - * Supported values: "builtin/stable" (the default if unset) and - * "builtin/latest". - * - * @typedef Feature - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.Feature definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const Feature = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Type of Google Cloud Vision API feature to be extracted. - * - * @enum {number} - * @memberof google.cloud.vision.v1 - */ - Type: { - - /** - * Unspecified feature type. - */ - TYPE_UNSPECIFIED: 0, - - /** - * Run face detection. - */ - FACE_DETECTION: 1, - - /** - * Run landmark detection. - */ - LANDMARK_DETECTION: 2, - - /** - * Run logo detection. - */ - LOGO_DETECTION: 3, - - /** - * Run label detection. - */ - LABEL_DETECTION: 4, - - /** - * Run text detection / optical character recognition (OCR). Text detection - * is optimized for areas of text within a larger image; if the image is - * a document, use `DOCUMENT_TEXT_DETECTION` instead. - */ - TEXT_DETECTION: 5, - - /** - * Run dense text document OCR. Takes precedence when both - * `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` are present. - */ - DOCUMENT_TEXT_DETECTION: 11, - - /** - * Run Safe Search to detect potentially unsafe - * or undesirable content. - */ - SAFE_SEARCH_DETECTION: 6, - - /** - * Compute a set of image properties, such as the - * image's dominant colors. - */ - IMAGE_PROPERTIES: 7, - - /** - * Run crop hints. - */ - CROP_HINTS: 9, - - /** - * Run web detection. - */ - WEB_DETECTION: 10, - - /** - * Run Product Search. - */ - PRODUCT_SEARCH: 12, - - /** - * Run localizer for object detection. - */ - OBJECT_LOCALIZATION: 19 - } -}; - -/** - * External image source (Google Cloud Storage or web URL image location). - * - * @property {string} gcsImageUri - * **Use `image_uri` instead.** - * - * The Google Cloud Storage URI of the form - * `gs://bucket_name/object_name`. Object versioning is not supported. See - * [Google Cloud Storage Request - * URIs](https://cloud.google.com/storage/docs/reference-uris) for more info. - * - * @property {string} imageUri - * The URI of the source image. Can be either: - * - * 1. A Google Cloud Storage URI of the form - * `gs://bucket_name/object_name`. Object versioning is not supported. See - * [Google Cloud Storage Request - * URIs](https://cloud.google.com/storage/docs/reference-uris) for more - * info. - * - * 2. A publicly-accessible image HTTP/HTTPS URL. When fetching images from - * HTTP/HTTPS URLs, Google cannot guarantee that the request will be - * completed. Your request may fail if the specified host denies the - * request (e.g. due to request throttling or DOS prevention), or if Google - * throttles requests to the site for abuse prevention. You should not - * depend on externally-hosted images for production applications. - * - * When both `gcs_image_uri` and `image_uri` are specified, `image_uri` takes - * precedence. - * - * @typedef ImageSource - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.ImageSource definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const ImageSource = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Client image to perform Google Cloud Vision API tasks over. - * - * @property {Buffer} content - * Image content, represented as a stream of bytes. - * Note: As with all `bytes` fields, protobuffers use a pure binary - * representation, whereas JSON representations use base64. - * - * @property {Object} source - * Google Cloud Storage image location, or publicly-accessible image - * URL. If both `content` and `source` are provided for an image, `content` - * takes precedence and is used to perform the image annotation request. - * - * This object should have the same structure as [ImageSource]{@link google.cloud.vision.v1.ImageSource} - * - * @typedef Image - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.Image definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const Image = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A face annotation object contains the results of face detection. - * - * @property {Object} boundingPoly - * The bounding polygon around the face. The coordinates of the bounding box - * are in the original image's scale. - * The bounding box is computed to "frame" the face in accordance with human - * expectations. It is based on the landmarker results. - * Note that one or more x and/or y coordinates may not be generated in the - * `BoundingPoly` (the polygon will be unbounded) if only a partial face - * appears in the image to be annotated. - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1.BoundingPoly} - * - * @property {Object} fdBoundingPoly - * The `fd_bounding_poly` bounding polygon is tighter than the - * `boundingPoly`, and encloses only the skin part of the face. Typically, it - * is used to eliminate the face from any image analysis that detects the - * "amount of skin" visible in an image. It is not based on the - * landmarker results, only on the initial face detection, hence - * the fd (face detection) prefix. - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1.BoundingPoly} - * - * @property {Object[]} landmarks - * Detected face landmarks. - * - * This object should have the same structure as [Landmark]{@link google.cloud.vision.v1.Landmark} - * - * @property {number} rollAngle - * Roll angle, which indicates the amount of clockwise/anti-clockwise rotation - * of the face relative to the image vertical about the axis perpendicular to - * the face. Range [-180,180]. - * - * @property {number} panAngle - * Yaw angle, which indicates the leftward/rightward angle that the face is - * pointing relative to the vertical plane perpendicular to the image. Range - * [-180,180]. - * - * @property {number} tiltAngle - * Pitch angle, which indicates the upwards/downwards angle that the face is - * pointing relative to the image's horizontal plane. Range [-180,180]. - * - * @property {number} detectionConfidence - * Detection confidence. Range [0, 1]. - * - * @property {number} landmarkingConfidence - * Face landmarking confidence. Range [0, 1]. - * - * @property {number} joyLikelihood - * Joy likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1.Likelihood} - * - * @property {number} sorrowLikelihood - * Sorrow likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1.Likelihood} - * - * @property {number} angerLikelihood - * Anger likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1.Likelihood} - * - * @property {number} surpriseLikelihood - * Surprise likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1.Likelihood} - * - * @property {number} underExposedLikelihood - * Under-exposed likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1.Likelihood} - * - * @property {number} blurredLikelihood - * Blurred likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1.Likelihood} - * - * @property {number} headwearLikelihood - * Headwear likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1.Likelihood} - * - * @typedef FaceAnnotation - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.FaceAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const FaceAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * A face-specific landmark (for example, a face feature). - * - * @property {number} type - * Face landmark type. - * - * The number should be among the values of [Type]{@link google.cloud.vision.v1.Type} - * - * @property {Object} position - * Face landmark position. - * - * This object should have the same structure as [Position]{@link google.cloud.vision.v1.Position} - * - * @typedef Landmark - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.FaceAnnotation.Landmark definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ - Landmark: { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Face landmark (feature) type. - * Left and right are defined from the vantage of the viewer of the image - * without considering mirror projections typical of photos. So, `LEFT_EYE`, - * typically, is the person's right eye. - * - * @enum {number} - * @memberof google.cloud.vision.v1 - */ - Type: { - - /** - * Unknown face landmark detected. Should not be filled. - */ - UNKNOWN_LANDMARK: 0, - - /** - * Left eye. - */ - LEFT_EYE: 1, - - /** - * Right eye. - */ - RIGHT_EYE: 2, - - /** - * Left of left eyebrow. - */ - LEFT_OF_LEFT_EYEBROW: 3, - - /** - * Right of left eyebrow. - */ - RIGHT_OF_LEFT_EYEBROW: 4, - - /** - * Left of right eyebrow. - */ - LEFT_OF_RIGHT_EYEBROW: 5, - - /** - * Right of right eyebrow. - */ - RIGHT_OF_RIGHT_EYEBROW: 6, - - /** - * Midpoint between eyes. - */ - MIDPOINT_BETWEEN_EYES: 7, - - /** - * Nose tip. - */ - NOSE_TIP: 8, - - /** - * Upper lip. - */ - UPPER_LIP: 9, - - /** - * Lower lip. - */ - LOWER_LIP: 10, - - /** - * Mouth left. - */ - MOUTH_LEFT: 11, - - /** - * Mouth right. - */ - MOUTH_RIGHT: 12, - - /** - * Mouth center. - */ - MOUTH_CENTER: 13, - - /** - * Nose, bottom right. - */ - NOSE_BOTTOM_RIGHT: 14, - - /** - * Nose, bottom left. - */ - NOSE_BOTTOM_LEFT: 15, - - /** - * Nose, bottom center. - */ - NOSE_BOTTOM_CENTER: 16, - - /** - * Left eye, top boundary. - */ - LEFT_EYE_TOP_BOUNDARY: 17, - - /** - * Left eye, right corner. - */ - LEFT_EYE_RIGHT_CORNER: 18, - - /** - * Left eye, bottom boundary. - */ - LEFT_EYE_BOTTOM_BOUNDARY: 19, - - /** - * Left eye, left corner. - */ - LEFT_EYE_LEFT_CORNER: 20, - - /** - * Right eye, top boundary. - */ - RIGHT_EYE_TOP_BOUNDARY: 21, - - /** - * Right eye, right corner. - */ - RIGHT_EYE_RIGHT_CORNER: 22, - - /** - * Right eye, bottom boundary. - */ - RIGHT_EYE_BOTTOM_BOUNDARY: 23, - - /** - * Right eye, left corner. - */ - RIGHT_EYE_LEFT_CORNER: 24, - - /** - * Left eyebrow, upper midpoint. - */ - LEFT_EYEBROW_UPPER_MIDPOINT: 25, - - /** - * Right eyebrow, upper midpoint. - */ - RIGHT_EYEBROW_UPPER_MIDPOINT: 26, - - /** - * Left ear tragion. - */ - LEFT_EAR_TRAGION: 27, - - /** - * Right ear tragion. - */ - RIGHT_EAR_TRAGION: 28, - - /** - * Left eye pupil. - */ - LEFT_EYE_PUPIL: 29, - - /** - * Right eye pupil. - */ - RIGHT_EYE_PUPIL: 30, - - /** - * Forehead glabella. - */ - FOREHEAD_GLABELLA: 31, - - /** - * Chin gnathion. - */ - CHIN_GNATHION: 32, - - /** - * Chin left gonion. - */ - CHIN_LEFT_GONION: 33, - - /** - * Chin right gonion. - */ - CHIN_RIGHT_GONION: 34 - } - } -}; - -/** - * Detected entity location information. - * - * @property {Object} latLng - * lat/long location coordinates. - * - * This object should have the same structure as [LatLng]{@link google.type.LatLng} - * - * @typedef LocationInfo - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.LocationInfo definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const LocationInfo = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A `Property` consists of a user-supplied name/value pair. - * - * @property {string} name - * Name of the property. - * - * @property {string} value - * Value of the property. - * - * @property {number} uint64Value - * Value of numeric properties. - * - * @typedef Property - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.Property definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const Property = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Set of detected entity features. - * - * @property {string} mid - * Opaque entity ID. Some IDs may be available in - * [Google Knowledge Graph Search - * API](https://developers.google.com/knowledge-graph/). - * - * @property {string} locale - * The language code for the locale in which the entity textual - * `description` is expressed. - * - * @property {string} description - * Entity textual description, expressed in its `locale` language. - * - * @property {number} score - * Overall score of the result. Range [0, 1]. - * - * @property {number} confidence - * **Deprecated. Use `score` instead.** - * The accuracy of the entity detection in an image. - * For example, for an image in which the "Eiffel Tower" entity is detected, - * this field represents the confidence that there is a tower in the query - * image. Range [0, 1]. - * - * @property {number} topicality - * The relevancy of the ICA (Image Content Annotation) label to the - * image. For example, the relevancy of "tower" is likely higher to an image - * containing the detected "Eiffel Tower" than to an image containing a - * detected distant towering building, even though the confidence that - * there is a tower in each image may be the same. Range [0, 1]. - * - * @property {Object} boundingPoly - * Image region to which this entity belongs. Not produced - * for `LABEL_DETECTION` features. - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1.BoundingPoly} - * - * @property {Object[]} locations - * The location information for the detected entity. Multiple - * `LocationInfo` elements can be present because one location may - * indicate the location of the scene in the image, and another location - * may indicate the location of the place where the image was taken. - * Location information is usually present for landmarks. - * - * This object should have the same structure as [LocationInfo]{@link google.cloud.vision.v1.LocationInfo} - * - * @property {Object[]} properties - * Some entities may have optional user-supplied `Property` (name/value) - * fields, such a score or string that qualifies the entity. - * - * This object should have the same structure as [Property]{@link google.cloud.vision.v1.Property} - * - * @typedef EntityAnnotation - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.EntityAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const EntityAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Set of detected objects with bounding boxes. - * - * @property {string} mid - * Object ID that should align with EntityAnnotation mid. - * - * @property {string} languageCode - * The BCP-47 language code, such as "en-US" or "sr-Latn". For more - * information, see - * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. - * - * @property {string} name - * Object name, expressed in its `language_code` language. - * - * @property {number} score - * Score of the result. Range [0, 1]. - * - * @property {Object} boundingPoly - * Image region to which this object belongs. This must be populated. - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1.BoundingPoly} - * - * @typedef LocalizedObjectAnnotation - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.LocalizedObjectAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const LocalizedObjectAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Set of features pertaining to the image, computed by computer vision - * methods over safe-search verticals (for example, adult, spoof, medical, - * violence). - * - * @property {number} adult - * Represents the adult content likelihood for the image. Adult content may - * contain elements such as nudity, pornographic images or cartoons, or - * sexual activities. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1.Likelihood} - * - * @property {number} spoof - * Spoof likelihood. The likelihood that an modification - * was made to the image's canonical version to make it appear - * funny or offensive. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1.Likelihood} - * - * @property {number} medical - * Likelihood that this is a medical image. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1.Likelihood} - * - * @property {number} violence - * Likelihood that this image contains violent content. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1.Likelihood} - * - * @property {number} racy - * Likelihood that the request image contains racy content. Racy content may - * include (but is not limited to) skimpy or sheer clothing, strategically - * covered nudity, lewd or provocative poses, or close-ups of sensitive - * body areas. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1.Likelihood} - * - * @property {number} adultConfidence - * Confidence of adult_score. Range [0, 1]. 0 means not confident, 1 means - * very confident. - * - * @property {number} spoofConfidence - * Confidence of spoof_score. Range [0, 1]. 0 means not confident, 1 means - * very confident. - * - * @property {number} medicalConfidence - * Confidence of medical_score. Range [0, 1]. 0 means not confident, 1 means - * very confident. - * - * @property {number} violenceConfidence - * Confidence of violence_score. Range [0, 1]. 0 means not confident, 1 means - * very confident. - * - * @property {number} racyConfidence - * Confidence of racy_score. Range [0, 1]. 0 means not confident, 1 means very - * confident. - * - * @property {number} nsfwConfidence - * Confidence of nsfw_score. Range [0, 1]. 0 means not confident, 1 means very - * confident. - * - * @typedef SafeSearchAnnotation - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.SafeSearchAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const SafeSearchAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Rectangle determined by min and max `LatLng` pairs. - * - * @property {Object} minLatLng - * Min lat/long pair. - * - * This object should have the same structure as [LatLng]{@link google.type.LatLng} - * - * @property {Object} maxLatLng - * Max lat/long pair. - * - * This object should have the same structure as [LatLng]{@link google.type.LatLng} - * - * @typedef LatLongRect - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.LatLongRect definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const LatLongRect = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Color information consists of RGB channels, score, and the fraction of - * the image that the color occupies in the image. - * - * @property {Object} color - * RGB components of the color. - * - * This object should have the same structure as [Color]{@link google.type.Color} - * - * @property {number} score - * Image-specific score for this color. Value in range [0, 1]. - * - * @property {number} pixelFraction - * The fraction of pixels the color occupies in the image. - * Value in range [0, 1]. - * - * @typedef ColorInfo - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.ColorInfo definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const ColorInfo = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Set of dominant colors and their corresponding scores. - * - * @property {Object[]} colors - * RGB color values with their score and pixel fraction. - * - * This object should have the same structure as [ColorInfo]{@link google.cloud.vision.v1.ColorInfo} - * - * @typedef DominantColorsAnnotation - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.DominantColorsAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const DominantColorsAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Stores image properties, such as dominant colors. - * - * @property {Object} dominantColors - * If present, dominant colors completed successfully. - * - * This object should have the same structure as [DominantColorsAnnotation]{@link google.cloud.vision.v1.DominantColorsAnnotation} - * - * @typedef ImageProperties - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.ImageProperties definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const ImageProperties = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Single crop hint that is used to generate a new crop when serving an image. - * - * @property {Object} boundingPoly - * The bounding polygon for the crop region. The coordinates of the bounding - * box are in the original image's scale. - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1.BoundingPoly} - * - * @property {number} confidence - * Confidence of this being a salient region. Range [0, 1]. - * - * @property {number} importanceFraction - * Fraction of importance of this salient region with respect to the original - * image. - * - * @typedef CropHint - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.CropHint definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const CropHint = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Set of crop hints that are used to generate new crops when serving images. - * - * @property {Object[]} cropHints - * Crop hint results. - * - * This object should have the same structure as [CropHint]{@link google.cloud.vision.v1.CropHint} - * - * @typedef CropHintsAnnotation - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.CropHintsAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const CropHintsAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Parameters for crop hints annotation request. - * - * @property {number[]} aspectRatios - * Aspect ratios in floats, representing the ratio of the width to the height - * of the image. For example, if the desired aspect ratio is 4/3, the - * corresponding float value should be 1.33333. If not specified, the - * best possible crop is returned. The number of provided aspect ratios is - * limited to a maximum of 16; any aspect ratios provided after the 16th are - * ignored. - * - * @typedef CropHintsParams - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.CropHintsParams definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const CropHintsParams = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Parameters for web detection request. - * - * @property {boolean} includeGeoResults - * Whether to include results derived from the geo information in the image. - * - * @typedef WebDetectionParams - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.WebDetectionParams definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const WebDetectionParams = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Image context and/or feature-specific parameters. - * - * @property {Object} latLongRect - * Not used. - * - * This object should have the same structure as [LatLongRect]{@link google.cloud.vision.v1.LatLongRect} - * - * @property {string[]} languageHints - * List of languages to use for TEXT_DETECTION. In most cases, an empty value - * yields the best results since it enables automatic language detection. For - * languages based on the Latin alphabet, setting `language_hints` is not - * needed. In rare cases, when the language of the text in the image is known, - * setting a hint will help get better results (although it will be a - * significant hindrance if the hint is wrong). Text detection returns an - * error if one or more of the specified languages is not one of the - * [supported languages](https://cloud.google.com/vision/docs/languages). - * - * @property {Object} cropHintsParams - * Parameters for crop hints annotation request. - * - * This object should have the same structure as [CropHintsParams]{@link google.cloud.vision.v1.CropHintsParams} - * - * @property {Object} productSearchParams - * Parameters for product search. - * - * This object should have the same structure as [ProductSearchParams]{@link google.cloud.vision.v1.ProductSearchParams} - * - * @property {Object} webDetectionParams - * Parameters for web detection. - * - * This object should have the same structure as [WebDetectionParams]{@link google.cloud.vision.v1.WebDetectionParams} - * - * @typedef ImageContext - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.ImageContext definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const ImageContext = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request for performing Google Cloud Vision API tasks over a user-provided - * image, with user-requested features, and with context information. - * - * @property {Object} image - * The image to be processed. - * - * This object should have the same structure as [Image]{@link google.cloud.vision.v1.Image} - * - * @property {Object[]} features - * Requested features. - * - * This object should have the same structure as [Feature]{@link google.cloud.vision.v1.Feature} - * - * @property {Object} imageContext - * Additional context that may accompany the image. - * - * This object should have the same structure as [ImageContext]{@link google.cloud.vision.v1.ImageContext} - * - * @typedef AnnotateImageRequest - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.AnnotateImageRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const AnnotateImageRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * If an image was produced from a file (e.g. a PDF), this message gives - * information about the source of that image. - * - * @property {string} uri - * The URI of the file used to produce the image. - * - * @property {number} pageNumber - * If the file was a PDF or TIFF, this field gives the page number within - * the file used to produce the image. - * - * @typedef ImageAnnotationContext - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.ImageAnnotationContext definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const ImageAnnotationContext = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response to an image annotation request. - * - * @property {Object[]} faceAnnotations - * If present, face detection has completed successfully. - * - * This object should have the same structure as [FaceAnnotation]{@link google.cloud.vision.v1.FaceAnnotation} - * - * @property {Object[]} landmarkAnnotations - * If present, landmark detection has completed successfully. - * - * This object should have the same structure as [EntityAnnotation]{@link google.cloud.vision.v1.EntityAnnotation} - * - * @property {Object[]} logoAnnotations - * If present, logo detection has completed successfully. - * - * This object should have the same structure as [EntityAnnotation]{@link google.cloud.vision.v1.EntityAnnotation} - * - * @property {Object[]} labelAnnotations - * If present, label detection has completed successfully. - * - * This object should have the same structure as [EntityAnnotation]{@link google.cloud.vision.v1.EntityAnnotation} - * - * @property {Object[]} localizedObjectAnnotations - * If present, localized object detection has completed successfully. - * This will be sorted descending by confidence score. - * - * This object should have the same structure as [LocalizedObjectAnnotation]{@link google.cloud.vision.v1.LocalizedObjectAnnotation} - * - * @property {Object[]} textAnnotations - * If present, text (OCR) detection has completed successfully. - * - * This object should have the same structure as [EntityAnnotation]{@link google.cloud.vision.v1.EntityAnnotation} - * - * @property {Object} fullTextAnnotation - * If present, text (OCR) detection or document (OCR) text detection has - * completed successfully. - * This annotation provides the structural hierarchy for the OCR detected - * text. - * - * This object should have the same structure as [TextAnnotation]{@link google.cloud.vision.v1.TextAnnotation} - * - * @property {Object} safeSearchAnnotation - * If present, safe-search annotation has completed successfully. - * - * This object should have the same structure as [SafeSearchAnnotation]{@link google.cloud.vision.v1.SafeSearchAnnotation} - * - * @property {Object} imagePropertiesAnnotation - * If present, image properties were extracted successfully. - * - * This object should have the same structure as [ImageProperties]{@link google.cloud.vision.v1.ImageProperties} - * - * @property {Object} cropHintsAnnotation - * If present, crop hints have completed successfully. - * - * This object should have the same structure as [CropHintsAnnotation]{@link google.cloud.vision.v1.CropHintsAnnotation} - * - * @property {Object} webDetection - * If present, web detection has completed successfully. - * - * This object should have the same structure as [WebDetection]{@link google.cloud.vision.v1.WebDetection} - * - * @property {Object} productSearchResults - * If present, product search has completed successfully. - * - * This object should have the same structure as [ProductSearchResults]{@link google.cloud.vision.v1.ProductSearchResults} - * - * @property {Object} error - * If set, represents the error message for the operation. - * Note that filled-in image annotations are guaranteed to be - * correct, even when `error` is set. - * - * This object should have the same structure as [Status]{@link google.rpc.Status} - * - * @property {Object} context - * If present, contextual information is needed to understand where this image - * comes from. - * - * This object should have the same structure as [ImageAnnotationContext]{@link google.cloud.vision.v1.ImageAnnotationContext} - * - * @typedef AnnotateImageResponse - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.AnnotateImageResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const AnnotateImageResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Multiple image annotation requests are batched into a single service call. - * - * @property {Object[]} requests - * Required. Individual image annotation requests for this batch. - * - * This object should have the same structure as [AnnotateImageRequest]{@link google.cloud.vision.v1.AnnotateImageRequest} - * - * @property {string} parent - * Optional. Target project and location to make a call. - * - * Format: `projects/{project-id}/locations/{location-id}`. - * - * If no parent is specified, a region will be chosen automatically. - * - * Supported location-ids: - * `us`: USA country only, - * `asia`: East asia areas, like Japan, Taiwan, - * `eu`: The European Union. - * - * Example: `projects/project-A/locations/eu`. - * - * @typedef BatchAnnotateImagesRequest - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.BatchAnnotateImagesRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const BatchAnnotateImagesRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response to a batch image annotation request. - * - * @property {Object[]} responses - * Individual responses to image annotation requests within the batch. - * - * This object should have the same structure as [AnnotateImageResponse]{@link google.cloud.vision.v1.AnnotateImageResponse} - * - * @typedef BatchAnnotateImagesResponse - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.BatchAnnotateImagesResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const BatchAnnotateImagesResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A request to annotate one single file, e.g. a PDF, TIFF or GIF file. - * - * @property {Object} inputConfig - * Required. Information about the input file. - * - * This object should have the same structure as [InputConfig]{@link google.cloud.vision.v1.InputConfig} - * - * @property {Object[]} features - * Required. Requested features. - * - * This object should have the same structure as [Feature]{@link google.cloud.vision.v1.Feature} - * - * @property {Object} imageContext - * Additional context that may accompany the image(s) in the file. - * - * This object should have the same structure as [ImageContext]{@link google.cloud.vision.v1.ImageContext} - * - * @property {number[]} pages - * Pages of the file to perform image annotation. - * - * Pages starts from 1, we assume the first page of the file is page 1. - * At most 5 pages are supported per request. Pages can be negative. - * - * Page 1 means the first page. - * Page 2 means the second page. - * Page -1 means the last page. - * Page -2 means the second to the last page. - * - * If the file is GIF instead of PDF or TIFF, page refers to GIF frames. - * - * If this field is empty, by default the service performs image annotation - * for the first 5 pages of the file. - * - * @typedef AnnotateFileRequest - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.AnnotateFileRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const AnnotateFileRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response to a single file annotation request. A file may contain one or more - * images, which individually have their own responses. - * - * @property {Object} inputConfig - * Information about the file for which this response is generated. - * - * This object should have the same structure as [InputConfig]{@link google.cloud.vision.v1.InputConfig} - * - * @property {Object[]} responses - * Individual responses to images found within the file. This field will be - * empty if the `error` field is set. - * - * This object should have the same structure as [AnnotateImageResponse]{@link google.cloud.vision.v1.AnnotateImageResponse} - * - * @property {number} totalPages - * This field gives the total number of pages in the file. - * - * @property {Object} error - * If set, represents the error message for the failed request. The - * `responses` field will not be set in this case. - * - * This object should have the same structure as [Status]{@link google.rpc.Status} - * - * @typedef AnnotateFileResponse - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.AnnotateFileResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const AnnotateFileResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A list of requests to annotate files using the BatchAnnotateFiles API. - * - * @property {Object[]} requests - * Required. The list of file annotation requests. Right now we support only one - * AnnotateFileRequest in BatchAnnotateFilesRequest. - * - * This object should have the same structure as [AnnotateFileRequest]{@link google.cloud.vision.v1.AnnotateFileRequest} - * - * @property {string} parent - * Optional. Target project and location to make a call. - * - * Format: `projects/{project-id}/locations/{location-id}`. - * - * If no parent is specified, a region will be chosen automatically. - * - * Supported location-ids: - * `us`: USA country only, - * `asia`: East asia areas, like Japan, Taiwan, - * `eu`: The European Union. - * - * Example: `projects/project-A/locations/eu`. - * - * @typedef BatchAnnotateFilesRequest - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.BatchAnnotateFilesRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const BatchAnnotateFilesRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A list of file annotation responses. - * - * @property {Object[]} responses - * The list of file annotation responses, each response corresponding to each - * AnnotateFileRequest in BatchAnnotateFilesRequest. - * - * This object should have the same structure as [AnnotateFileResponse]{@link google.cloud.vision.v1.AnnotateFileResponse} - * - * @typedef BatchAnnotateFilesResponse - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.BatchAnnotateFilesResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const BatchAnnotateFilesResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * An offline file annotation request. - * - * @property {Object} inputConfig - * Required. Information about the input file. - * - * This object should have the same structure as [InputConfig]{@link google.cloud.vision.v1.InputConfig} - * - * @property {Object[]} features - * Required. Requested features. - * - * This object should have the same structure as [Feature]{@link google.cloud.vision.v1.Feature} - * - * @property {Object} imageContext - * Additional context that may accompany the image(s) in the file. - * - * This object should have the same structure as [ImageContext]{@link google.cloud.vision.v1.ImageContext} - * - * @property {Object} outputConfig - * Required. The desired output location and metadata (e.g. format). - * - * This object should have the same structure as [OutputConfig]{@link google.cloud.vision.v1.OutputConfig} - * - * @typedef AsyncAnnotateFileRequest - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.AsyncAnnotateFileRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const AsyncAnnotateFileRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The response for a single offline file annotation request. - * - * @property {Object} outputConfig - * The output location and metadata from AsyncAnnotateFileRequest. - * - * This object should have the same structure as [OutputConfig]{@link google.cloud.vision.v1.OutputConfig} - * - * @typedef AsyncAnnotateFileResponse - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.AsyncAnnotateFileResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const AsyncAnnotateFileResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request for async image annotation for a list of images. - * - * @property {Object[]} requests - * Required. Individual image annotation requests for this batch. - * - * This object should have the same structure as [AnnotateImageRequest]{@link google.cloud.vision.v1.AnnotateImageRequest} - * - * @property {Object} outputConfig - * Required. The desired output location and metadata (e.g. format). - * - * This object should have the same structure as [OutputConfig]{@link google.cloud.vision.v1.OutputConfig} - * - * @property {string} parent - * Optional. Target project and location to make a call. - * - * Format: `projects/{project-id}/locations/{location-id}`. - * - * If no parent is specified, a region will be chosen automatically. - * - * Supported location-ids: - * `us`: USA country only, - * `asia`: East asia areas, like Japan, Taiwan, - * `eu`: The European Union. - * - * Example: `projects/project-A/locations/eu`. - * - * @typedef AsyncBatchAnnotateImagesRequest - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const AsyncBatchAnnotateImagesRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response to an async batch image annotation request. - * - * @property {Object} outputConfig - * The output location and metadata from AsyncBatchAnnotateImagesRequest. - * - * This object should have the same structure as [OutputConfig]{@link google.cloud.vision.v1.OutputConfig} - * - * @typedef AsyncBatchAnnotateImagesResponse - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const AsyncBatchAnnotateImagesResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Multiple async file annotation requests are batched into a single service - * call. - * - * @property {Object[]} requests - * Required. Individual async file annotation requests for this batch. - * - * This object should have the same structure as [AsyncAnnotateFileRequest]{@link google.cloud.vision.v1.AsyncAnnotateFileRequest} - * - * @property {string} parent - * Optional. Target project and location to make a call. - * - * Format: `projects/{project-id}/locations/{location-id}`. - * - * If no parent is specified, a region will be chosen automatically. - * - * Supported location-ids: - * `us`: USA country only, - * `asia`: East asia areas, like Japan, Taiwan, - * `eu`: The European Union. - * - * Example: `projects/project-A/locations/eu`. - * - * @typedef AsyncBatchAnnotateFilesRequest - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const AsyncBatchAnnotateFilesRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response to an async batch file annotation request. - * - * @property {Object[]} responses - * The list of file annotation responses, one for each request in - * AsyncBatchAnnotateFilesRequest. - * - * This object should have the same structure as [AsyncAnnotateFileResponse]{@link google.cloud.vision.v1.AsyncAnnotateFileResponse} - * - * @typedef AsyncBatchAnnotateFilesResponse - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const AsyncBatchAnnotateFilesResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The desired input location and metadata. - * - * @property {Object} gcsSource - * The Google Cloud Storage location to read the input from. - * - * This object should have the same structure as [GcsSource]{@link google.cloud.vision.v1.GcsSource} - * - * @property {Buffer} content - * File content, represented as a stream of bytes. - * Note: As with all `bytes` fields, protobuffers use a pure binary - * representation, whereas JSON representations use base64. - * - * Currently, this field only works for BatchAnnotateFiles requests. It does - * not work for AsyncBatchAnnotateFiles requests. - * - * @property {string} mimeType - * The type of the file. Currently only "application/pdf", "image/tiff" and - * "image/gif" are supported. Wildcards are not supported. - * - * @typedef InputConfig - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.InputConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const InputConfig = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The desired output location and metadata. - * - * @property {Object} gcsDestination - * The Google Cloud Storage location to write the output(s) to. - * - * This object should have the same structure as [GcsDestination]{@link google.cloud.vision.v1.GcsDestination} - * - * @property {number} batchSize - * The max number of response protos to put into each output JSON file on - * Google Cloud Storage. - * The valid range is [1, 100]. If not specified, the default value is 20. - * - * For example, for one pdf file with 100 pages, 100 response protos will - * be generated. If `batch_size` = 20, then 5 json files each - * containing 20 response protos will be written under the prefix - * `gcs_destination`.`uri`. - * - * Currently, batch_size only applies to GcsDestination, with potential future - * support for other output configurations. - * - * @typedef OutputConfig - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.OutputConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const OutputConfig = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The Google Cloud Storage location where the input will be read from. - * - * @property {string} uri - * Google Cloud Storage URI for the input file. This must only be a - * Google Cloud Storage object. Wildcards are not currently supported. - * - * @typedef GcsSource - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.GcsSource definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const GcsSource = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The Google Cloud Storage location where the output will be written to. - * - * @property {string} uri - * Google Cloud Storage URI prefix where the results will be stored. Results - * will be in JSON format and preceded by its corresponding input URI prefix. - * This field can either represent a gcs file prefix or gcs directory. In - * either case, the uri should be unique because in order to get all of the - * output files, you will need to do a wildcard gcs search on the uri prefix - * you provide. - * - * Examples: - * - * * File Prefix: gs://bucket-name/here/filenameprefix The output files - * will be created in gs://bucket-name/here/ and the names of the - * output files will begin with "filenameprefix". - * - * * Directory Prefix: gs://bucket-name/some/location/ The output files - * will be created in gs://bucket-name/some/location/ and the names of the - * output files could be anything because there was no filename prefix - * specified. - * - * If multiple outputs, each response is still AnnotateFileResponse, each of - * which contains some subset of the full list of AnnotateImageResponse. - * Multiple outputs can happen if, for example, the output JSON is too large - * and overflows into multiple sharded files. - * - * @typedef GcsDestination - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.GcsDestination definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const GcsDestination = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Contains metadata for the BatchAnnotateImages operation. - * - * @property {number} state - * Current state of the batch operation. - * - * The number should be among the values of [State]{@link google.cloud.vision.v1.State} - * - * @property {Object} createTime - * The time when the batch request was received. - * - * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} - * - * @property {Object} updateTime - * The time when the operation result was last updated. - * - * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} - * - * @typedef OperationMetadata - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.OperationMetadata definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/image_annotator.proto} - */ -const OperationMetadata = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Batch operation states. - * - * @enum {number} - * @memberof google.cloud.vision.v1 - */ - State: { - - /** - * Invalid. - */ - STATE_UNSPECIFIED: 0, - - /** - * Request is received. - */ - CREATED: 1, - - /** - * Request is actively being processed. - */ - RUNNING: 2, - - /** - * The batch processing is done. - */ - DONE: 3, - - /** - * The batch processing was cancelled. - */ - CANCELLED: 4 - } -}; - -/** - * A bucketized representation of likelihood, which is intended to give clients - * highly stable results across model upgrades. - * - * @enum {number} - * @memberof google.cloud.vision.v1 - */ -const Likelihood = { - - /** - * Unknown likelihood. - */ - UNKNOWN: 0, - - /** - * It is very unlikely. - */ - VERY_UNLIKELY: 1, - - /** - * It is unlikely. - */ - UNLIKELY: 2, - - /** - * It is possible. - */ - POSSIBLE: 3, - - /** - * It is likely. - */ - LIKELY: 4, - - /** - * It is very likely. - */ - VERY_LIKELY: 5 -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1/doc/google/cloud/vision/v1/doc_product_search.js b/packages/google-cloud-vision/src/v1/doc/google/cloud/vision/v1/doc_product_search.js deleted file mode 100644 index 384a356d7a7..00000000000 --- a/packages/google-cloud-vision/src/v1/doc/google/cloud/vision/v1/doc_product_search.js +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * Parameters for a product search request. - * - * @property {Object} boundingPoly - * The bounding polygon around the area of interest in the image. - * Optional. If it is not specified, system discretion will be applied. - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1.BoundingPoly} - * - * @property {string} productSet - * The resource name of a ProductSet to be searched for similar images. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. - * - * @property {string[]} productCategories - * The list of product categories to search in. Currently, we only consider - * the first category, and either "homegoods-v2", "apparel-v2", "toys-v2", - * "packagedgoods-v1", or "general-v1" should be specified. The legacy - * categories "homegoods", "apparel", and "toys" are still supported but will - * be deprecated. For new products, please use "homegoods-v2", "apparel-v2", - * or "toys-v2" for better product search accuracy. It is recommended to - * migrate existing products to these categories as well. - * - * @property {string} filter - * The filtering expression. This can be used to restrict search results based - * on Product labels. We currently support an AND of OR of key-value - * expressions, where each expression within an OR must have the same key. An - * '=' should be used to connect the key and value. - * - * For example, "(color = red OR color = blue) AND brand = Google" is - * acceptable, but "(color = red OR brand = Google)" is not acceptable. - * "color: red" is not acceptable because it uses a ':' instead of an '='. - * - * @typedef ProductSearchParams - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.ProductSearchParams definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search.proto} - */ -const ProductSearchParams = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Results for a product search request. - * - * @property {Object} indexTime - * Timestamp of the index which provided these results. Products added to the - * product set and products removed from the product set after this time are - * not reflected in the current results. - * - * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} - * - * @property {Object[]} results - * List of results, one for each product match. - * - * This object should have the same structure as [Result]{@link google.cloud.vision.v1.Result} - * - * @property {Object[]} productGroupedResults - * List of results grouped by products detected in the query image. Each entry - * corresponds to one bounding polygon in the query image, and contains the - * matching products specific to that region. There may be duplicate product - * matches in the union of all the per-product results. - * - * This object should have the same structure as [GroupedResult]{@link google.cloud.vision.v1.GroupedResult} - * - * @typedef ProductSearchResults - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.ProductSearchResults definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search.proto} - */ -const ProductSearchResults = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Information about a product. - * - * @property {Object} product - * The Product. - * - * This object should have the same structure as [Product]{@link google.cloud.vision.v1.Product} - * - * @property {number} score - * A confidence level on the match, ranging from 0 (no confidence) to - * 1 (full confidence). - * - * @property {string} image - * The resource name of the image from the product that is the closest match - * to the query. - * - * @typedef Result - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.ProductSearchResults.Result definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search.proto} - */ - Result: { - // This is for documentation. Actual contents will be loaded by gRPC. - }, - - /** - * Prediction for what the object in the bounding box is. - * - * @property {string} mid - * Object ID that should align with EntityAnnotation mid. - * - * @property {string} languageCode - * The BCP-47 language code, such as "en-US" or "sr-Latn". For more - * information, see - * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. - * - * @property {string} name - * Object name, expressed in its `language_code` language. - * - * @property {number} score - * Score of the result. Range [0, 1]. - * - * @typedef ObjectAnnotation - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search.proto} - */ - ObjectAnnotation: { - // This is for documentation. Actual contents will be loaded by gRPC. - }, - - /** - * Information about the products similar to a single product in a query - * image. - * - * @property {Object} boundingPoly - * The bounding polygon around the product detected in the query image. - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1.BoundingPoly} - * - * @property {Object[]} results - * List of results, one for each product match. - * - * This object should have the same structure as [Result]{@link google.cloud.vision.v1.Result} - * - * @property {Object[]} objectAnnotations - * List of generic predictions for the object in the bounding box. - * - * This object should have the same structure as [ObjectAnnotation]{@link google.cloud.vision.v1.ObjectAnnotation} - * - * @typedef GroupedResult - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.ProductSearchResults.GroupedResult definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search.proto} - */ - GroupedResult: { - // This is for documentation. Actual contents will be loaded by gRPC. - } -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1/doc/google/cloud/vision/v1/doc_product_search_service.js b/packages/google-cloud-vision/src/v1/doc/google/cloud/vision/v1/doc_product_search_service.js deleted file mode 100644 index 48558d59f03..00000000000 --- a/packages/google-cloud-vision/src/v1/doc/google/cloud/vision/v1/doc_product_search_service.js +++ /dev/null @@ -1,881 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * A Product contains ReferenceImages. - * - * @property {string} name - * The resource name of the product. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. - * - * This field is ignored when creating a product. - * - * @property {string} displayName - * The user-provided name for this Product. Must not be empty. Must be at most - * 4096 characters long. - * - * @property {string} description - * User-provided metadata to be stored with this product. Must be at most 4096 - * characters long. - * - * @property {string} productCategory - * Immutable. The category for the product identified by the reference image. This should - * be either "homegoods-v2", "apparel-v2", or "toys-v2". The legacy categories - * "homegoods", "apparel", and "toys" are still supported, but these should - * not be used for new products. - * - * @property {Object[]} productLabels - * Key-value pairs that can be attached to a product. At query time, - * constraints can be specified based on the product_labels. - * - * Note that integer values can be provided as strings, e.g. "1199". Only - * strings with integer values can match a range-based restriction which is - * to be supported soon. - * - * Multiple values can be assigned to the same key. One product may have up to - * 500 product_labels. - * - * Notice that the total number of distinct product_labels over all products - * in one ProductSet cannot exceed 1M, otherwise the product search pipeline - * will refuse to work for that ProductSet. - * - * This object should have the same structure as [KeyValue]{@link google.cloud.vision.v1.KeyValue} - * - * @typedef Product - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.Product definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const Product = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * A product label represented as a key-value pair. - * - * @property {string} key - * The key of the label attached to the product. Cannot be empty and cannot - * exceed 128 bytes. - * - * @property {string} value - * The value of the label attached to the product. Cannot be empty and - * cannot exceed 128 bytes. - * - * @typedef KeyValue - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.Product.KeyValue definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ - KeyValue: { - // This is for documentation. Actual contents will be loaded by gRPC. - } -}; - -/** - * A ProductSet contains Products. A ProductSet can contain a maximum of 1 - * million reference images. If the limit is exceeded, periodic indexing will - * fail. - * - * @property {string} name - * The resource name of the ProductSet. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. - * - * This field is ignored when creating a ProductSet. - * - * @property {string} displayName - * The user-provided name for this ProductSet. Must not be empty. Must be at - * most 4096 characters long. - * - * @property {Object} indexTime - * Output only. The time at which this ProductSet was last indexed. Query - * results will reflect all updates before this time. If this ProductSet has - * never been indexed, this timestamp is the default value - * "1970-01-01T00:00:00Z". - * - * This field is ignored when creating a ProductSet. - * - * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} - * - * @property {Object} indexError - * Output only. If there was an error with indexing the product set, the field - * is populated. - * - * This field is ignored when creating a ProductSet. - * - * This object should have the same structure as [Status]{@link google.rpc.Status} - * - * @typedef ProductSet - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.ProductSet definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const ProductSet = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A `ReferenceImage` represents a product image and its associated metadata, - * such as bounding boxes. - * - * @property {string} name - * The resource name of the reference image. - * - * Format is: - * - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. - * - * This field is ignored when creating a reference image. - * - * @property {string} uri - * Required. The Google Cloud Storage URI of the reference image. - * - * The URI must start with `gs://`. - * - * @property {Object[]} boundingPolys - * Optional. Bounding polygons around the areas of interest in the reference image. - * If this field is empty, the system will try to detect regions of - * interest. At most 10 bounding polygons will be used. - * - * The provided shape is converted into a non-rotated rectangle. Once - * converted, the small edge of the rectangle must be greater than or equal - * to 300 pixels. The aspect ratio must be 1:4 or less (i.e. 1:3 is ok; 1:5 - * is not). - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1.BoundingPoly} - * - * @typedef ReferenceImage - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.ReferenceImage definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const ReferenceImage = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `CreateProduct` method. - * - * @property {string} parent - * Required. The project in which the Product should be created. - * - * Format is - * `projects/PROJECT_ID/locations/LOC_ID`. - * - * @property {Object} product - * Required. The product to create. - * - * This object should have the same structure as [Product]{@link google.cloud.vision.v1.Product} - * - * @property {string} productId - * A user-supplied resource id for this Product. If set, the server will - * attempt to use this value as the resource id. If it is already in use, an - * error is returned with code ALREADY_EXISTS. Must be at most 128 characters - * long. It cannot contain the character `/`. - * - * @typedef CreateProductRequest - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.CreateProductRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const CreateProductRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `ListProducts` method. - * - * @property {string} parent - * Required. The project OR ProductSet from which Products should be listed. - * - * Format: - * `projects/PROJECT_ID/locations/LOC_ID` - * - * @property {number} pageSize - * The maximum number of items to return. Default 10, maximum 100. - * - * @property {string} pageToken - * The next_page_token returned from a previous List request, if any. - * - * @typedef ListProductsRequest - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.ListProductsRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const ListProductsRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response message for the `ListProducts` method. - * - * @property {Object[]} products - * List of products. - * - * This object should have the same structure as [Product]{@link google.cloud.vision.v1.Product} - * - * @property {string} nextPageToken - * Token to retrieve the next page of results, or empty if there are no more - * results in the list. - * - * @typedef ListProductsResponse - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.ListProductsResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const ListProductsResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `GetProduct` method. - * - * @property {string} name - * Required. Resource name of the Product to get. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - * - * @typedef GetProductRequest - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.GetProductRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const GetProductRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `UpdateProduct` method. - * - * @property {Object} product - * Required. The Product resource which replaces the one on the server. - * product.name is immutable. - * - * This object should have the same structure as [Product]{@link google.cloud.vision.v1.Product} - * - * @property {Object} updateMask - * The FieldMask that specifies which fields - * to update. - * If update_mask isn't specified, all mutable fields are to be updated. - * Valid mask paths include `product_labels`, `display_name`, and - * `description`. - * - * This object should have the same structure as [FieldMask]{@link google.protobuf.FieldMask} - * - * @typedef UpdateProductRequest - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.UpdateProductRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const UpdateProductRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `DeleteProduct` method. - * - * @property {string} name - * Required. Resource name of product to delete. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - * - * @typedef DeleteProductRequest - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.DeleteProductRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const DeleteProductRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `CreateProductSet` method. - * - * @property {string} parent - * Required. The project in which the ProductSet should be created. - * - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - * - * @property {Object} productSet - * Required. The ProductSet to create. - * - * This object should have the same structure as [ProductSet]{@link google.cloud.vision.v1.ProductSet} - * - * @property {string} productSetId - * A user-supplied resource id for this ProductSet. If set, the server will - * attempt to use this value as the resource id. If it is already in use, an - * error is returned with code ALREADY_EXISTS. Must be at most 128 characters - * long. It cannot contain the character `/`. - * - * @typedef CreateProductSetRequest - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.CreateProductSetRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const CreateProductSetRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `ListProductSets` method. - * - * @property {string} parent - * Required. The project from which ProductSets should be listed. - * - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - * - * @property {number} pageSize - * The maximum number of items to return. Default 10, maximum 100. - * - * @property {string} pageToken - * The next_page_token returned from a previous List request, if any. - * - * @typedef ListProductSetsRequest - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.ListProductSetsRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const ListProductSetsRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response message for the `ListProductSets` method. - * - * @property {Object[]} productSets - * List of ProductSets. - * - * This object should have the same structure as [ProductSet]{@link google.cloud.vision.v1.ProductSet} - * - * @property {string} nextPageToken - * Token to retrieve the next page of results, or empty if there are no more - * results in the list. - * - * @typedef ListProductSetsResponse - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.ListProductSetsResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const ListProductSetsResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `GetProductSet` method. - * - * @property {string} name - * Required. Resource name of the ProductSet to get. - * - * Format is: - * `projects/PROJECT_ID/locations/LOG_ID/productSets/PRODUCT_SET_ID` - * - * @typedef GetProductSetRequest - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.GetProductSetRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const GetProductSetRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `UpdateProductSet` method. - * - * @property {Object} productSet - * Required. The ProductSet resource which replaces the one on the server. - * - * This object should have the same structure as [ProductSet]{@link google.cloud.vision.v1.ProductSet} - * - * @property {Object} updateMask - * The FieldMask that specifies which fields to - * update. - * If update_mask isn't specified, all mutable fields are to be updated. - * Valid mask path is `display_name`. - * - * This object should have the same structure as [FieldMask]{@link google.protobuf.FieldMask} - * - * @typedef UpdateProductSetRequest - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.UpdateProductSetRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const UpdateProductSetRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `DeleteProductSet` method. - * - * @property {string} name - * Required. Resource name of the ProductSet to delete. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * - * @typedef DeleteProductSetRequest - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.DeleteProductSetRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const DeleteProductSetRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `CreateReferenceImage` method. - * - * @property {string} parent - * Required. Resource name of the product in which to create the reference image. - * - * Format is - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. - * - * @property {Object} referenceImage - * Required. The reference image to create. - * If an image ID is specified, it is ignored. - * - * This object should have the same structure as [ReferenceImage]{@link google.cloud.vision.v1.ReferenceImage} - * - * @property {string} referenceImageId - * A user-supplied resource id for the ReferenceImage to be added. If set, - * the server will attempt to use this value as the resource id. If it is - * already in use, an error is returned with code ALREADY_EXISTS. Must be at - * most 128 characters long. It cannot contain the character `/`. - * - * @typedef CreateReferenceImageRequest - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.CreateReferenceImageRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const CreateReferenceImageRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `ListReferenceImages` method. - * - * @property {string} parent - * Required. Resource name of the product containing the reference images. - * - * Format is - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. - * - * @property {number} pageSize - * The maximum number of items to return. Default 10, maximum 100. - * - * @property {string} pageToken - * A token identifying a page of results to be returned. This is the value - * of `nextPageToken` returned in a previous reference image list request. - * - * Defaults to the first page if not specified. - * - * @typedef ListReferenceImagesRequest - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.ListReferenceImagesRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const ListReferenceImagesRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response message for the `ListReferenceImages` method. - * - * @property {Object[]} referenceImages - * The list of reference images. - * - * This object should have the same structure as [ReferenceImage]{@link google.cloud.vision.v1.ReferenceImage} - * - * @property {number} pageSize - * The maximum number of items to return. Default 10, maximum 100. - * - * @property {string} nextPageToken - * The next_page_token returned from a previous List request, if any. - * - * @typedef ListReferenceImagesResponse - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.ListReferenceImagesResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const ListReferenceImagesResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `GetReferenceImage` method. - * - * @property {string} name - * Required. The resource name of the ReferenceImage to get. - * - * Format is: - * - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. - * - * @typedef GetReferenceImageRequest - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.GetReferenceImageRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const GetReferenceImageRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `DeleteReferenceImage` method. - * - * @property {string} name - * Required. The resource name of the reference image to delete. - * - * Format is: - * - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` - * - * @typedef DeleteReferenceImageRequest - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.DeleteReferenceImageRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const DeleteReferenceImageRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `AddProductToProductSet` method. - * - * @property {string} name - * Required. The resource name for the ProductSet to modify. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * - * @property {string} product - * Required. The resource name for the Product to be added to this ProductSet. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - * - * @typedef AddProductToProductSetRequest - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.AddProductToProductSetRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const AddProductToProductSetRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `RemoveProductFromProductSet` method. - * - * @property {string} name - * Required. The resource name for the ProductSet to modify. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * - * @property {string} product - * Required. The resource name for the Product to be removed from this ProductSet. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - * - * @typedef RemoveProductFromProductSetRequest - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.RemoveProductFromProductSetRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const RemoveProductFromProductSetRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `ListProductsInProductSet` method. - * - * @property {string} name - * Required. The ProductSet resource for which to retrieve Products. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * - * @property {number} pageSize - * The maximum number of items to return. Default 10, maximum 100. - * - * @property {string} pageToken - * The next_page_token returned from a previous List request, if any. - * - * @typedef ListProductsInProductSetRequest - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.ListProductsInProductSetRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const ListProductsInProductSetRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response message for the `ListProductsInProductSet` method. - * - * @property {Object[]} products - * The list of Products. - * - * This object should have the same structure as [Product]{@link google.cloud.vision.v1.Product} - * - * @property {string} nextPageToken - * Token to retrieve the next page of results, or empty if there are no more - * results in the list. - * - * @typedef ListProductsInProductSetResponse - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.ListProductsInProductSetResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const ListProductsInProductSetResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The Google Cloud Storage location for a csv file which preserves a list of - * ImportProductSetRequests in each line. - * - * @property {string} csvFileUri - * The Google Cloud Storage URI of the input csv file. - * - * The URI must start with `gs://`. - * - * The format of the input csv file should be one image per line. - * In each line, there are 8 columns. - * - * 1. image-uri - * 2. image-id - * 3. product-set-id - * 4. product-id - * 5. product-category - * 6. product-display-name - * 7. labels - * 8. bounding-poly - * - * The `image-uri`, `product-set-id`, `product-id`, and `product-category` - * columns are required. All other columns are optional. - * - * If the `ProductSet` or `Product` specified by the `product-set-id` and - * `product-id` values does not exist, then the system will create a new - * `ProductSet` or `Product` for the image. In this case, the - * `product-display-name` column refers to - * display_name, the - * `product-category` column refers to - * product_category, and the - * `labels` column refers to product_labels. - * - * The `image-id` column is optional but must be unique if provided. If it is - * empty, the system will automatically assign a unique id to the image. - * - * The `product-display-name` column is optional. If it is empty, the system - * sets the display_name field for the product to a - * space (" "). You can update the `display_name` later by using the API. - * - * If a `Product` with the specified `product-id` already exists, then the - * system ignores the `product-display-name`, `product-category`, and `labels` - * columns. - * - * The `labels` column (optional) is a line containing a list of - * comma-separated key-value pairs, in the following format: - * - * "key_1=value_1,key_2=value_2,...,key_n=value_n" - * - * The `bounding-poly` column (optional) identifies one region of - * interest from the image in the same manner as `CreateReferenceImage`. If - * you do not specify the `bounding-poly` column, then the system will try to - * detect regions of interest automatically. - * - * At most one `bounding-poly` column is allowed per line. If the image - * contains multiple regions of interest, add a line to the CSV file that - * includes the same product information, and the `bounding-poly` values for - * each region of interest. - * - * The `bounding-poly` column must contain an even number of comma-separated - * numbers, in the format "p1_x,p1_y,p2_x,p2_y,...,pn_x,pn_y". Use - * non-negative integers for absolute bounding polygons, and float values - * in [0, 1] for normalized bounding polygons. - * - * The system will resize the image if the image resolution is too - * large to process (larger than 20MP). - * - * @typedef ImportProductSetsGcsSource - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.ImportProductSetsGcsSource definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const ImportProductSetsGcsSource = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The input content for the `ImportProductSets` method. - * - * @property {Object} gcsSource - * The Google Cloud Storage location for a csv file which preserves a list - * of ImportProductSetRequests in each line. - * - * This object should have the same structure as [ImportProductSetsGcsSource]{@link google.cloud.vision.v1.ImportProductSetsGcsSource} - * - * @typedef ImportProductSetsInputConfig - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.ImportProductSetsInputConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const ImportProductSetsInputConfig = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `ImportProductSets` method. - * - * @property {string} parent - * Required. The project in which the ProductSets should be imported. - * - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - * - * @property {Object} inputConfig - * Required. The input content for the list of requests. - * - * This object should have the same structure as [ImportProductSetsInputConfig]{@link google.cloud.vision.v1.ImportProductSetsInputConfig} - * - * @typedef ImportProductSetsRequest - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.ImportProductSetsRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const ImportProductSetsRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response message for the `ImportProductSets` method. - * - * This message is returned by the - * google.longrunning.Operations.GetOperation method in the returned - * google.longrunning.Operation.response field. - * - * @property {Object[]} referenceImages - * The list of reference_images that are imported successfully. - * - * This object should have the same structure as [ReferenceImage]{@link google.cloud.vision.v1.ReferenceImage} - * - * @property {Object[]} statuses - * The rpc status for each ImportProductSet request, including both successes - * and errors. - * - * The number of statuses here matches the number of lines in the csv file, - * and statuses[i] stores the success or failure status of processing the i-th - * line of the csv, starting from line 0. - * - * This object should have the same structure as [Status]{@link google.rpc.Status} - * - * @typedef ImportProductSetsResponse - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.ImportProductSetsResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const ImportProductSetsResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Metadata for the batch operations such as the current state. - * - * This is included in the `metadata` field of the `Operation` returned by the - * `GetOperation` call of the `google::longrunning::Operations` service. - * - * @property {number} state - * The current state of the batch operation. - * - * The number should be among the values of [State]{@link google.cloud.vision.v1.State} - * - * @property {Object} submitTime - * The time when the batch request was submitted to the server. - * - * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} - * - * @property {Object} endTime - * The time when the batch request is finished and - * google.longrunning.Operation.done is set to true. - * - * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} - * - * @typedef BatchOperationMetadata - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.BatchOperationMetadata definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const BatchOperationMetadata = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Enumerates the possible states that the batch request can be in. - * - * @enum {number} - * @memberof google.cloud.vision.v1 - */ - State: { - - /** - * Invalid. - */ - STATE_UNSPECIFIED: 0, - - /** - * Request is actively being processed. - */ - PROCESSING: 1, - - /** - * The request is done and at least one item has been successfully - * processed. - */ - SUCCESSFUL: 2, - - /** - * The request is done and no item has been successfully processed. - */ - FAILED: 3, - - /** - * The request is done after the longrunning.Operations.CancelOperation has - * been called by the user. Any records that were processed before the - * cancel command are output as specified in the request. - */ - CANCELLED: 4 - } -}; - -/** - * Config to control which ProductSet contains the Products to be deleted. - * - * @property {string} productSetId - * The ProductSet that contains the Products to delete. If a Product is a - * member of product_set_id in addition to other ProductSets, the Product will - * still be deleted. - * - * @typedef ProductSetPurgeConfig - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.ProductSetPurgeConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const ProductSetPurgeConfig = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `PurgeProducts` method. - * - * @property {Object} productSetPurgeConfig - * Specify which ProductSet contains the Products to be deleted. - * - * This object should have the same structure as [ProductSetPurgeConfig]{@link google.cloud.vision.v1.ProductSetPurgeConfig} - * - * @property {boolean} deleteOrphanProducts - * If delete_orphan_products is true, all Products that are not in any - * ProductSet will be deleted. - * - * @property {string} parent - * Required. The project and location in which the Products should be deleted. - * - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - * - * @property {boolean} force - * The default value is false. Override this value to true to actually perform - * the purge. - * - * @typedef PurgeProductsRequest - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.PurgeProductsRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/product_search_service.proto} - */ -const PurgeProductsRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1/doc/google/cloud/vision/v1/doc_text_annotation.js b/packages/google-cloud-vision/src/v1/doc/google/cloud/vision/v1/doc_text_annotation.js deleted file mode 100644 index 68af8e26c17..00000000000 --- a/packages/google-cloud-vision/src/v1/doc/google/cloud/vision/v1/doc_text_annotation.js +++ /dev/null @@ -1,392 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * TextAnnotation contains a structured representation of OCR extracted text. - * The hierarchy of an OCR extracted text structure is like this: - * TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol - * Each structural component, starting from Page, may further have their own - * properties. Properties describe detected languages, breaks etc.. Please refer - * to the TextAnnotation.TextProperty message definition below for more - * detail. - * - * @property {Object[]} pages - * List of pages detected by OCR. - * - * This object should have the same structure as [Page]{@link google.cloud.vision.v1.Page} - * - * @property {string} text - * UTF-8 text detected on the pages. - * - * @typedef TextAnnotation - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.TextAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/text_annotation.proto} - */ -const TextAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Detected language for a structural component. - * - * @property {string} languageCode - * The BCP-47 language code, such as "en-US" or "sr-Latn". For more - * information, see - * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. - * - * @property {number} confidence - * Confidence of detected language. Range [0, 1]. - * - * @typedef DetectedLanguage - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.TextAnnotation.DetectedLanguage definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/text_annotation.proto} - */ - DetectedLanguage: { - // This is for documentation. Actual contents will be loaded by gRPC. - }, - - /** - * Detected start or end of a structural component. - * - * @property {number} type - * Detected break type. - * - * The number should be among the values of [BreakType]{@link google.cloud.vision.v1.BreakType} - * - * @property {boolean} isPrefix - * True if break prepends the element. - * - * @typedef DetectedBreak - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.TextAnnotation.DetectedBreak definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/text_annotation.proto} - */ - DetectedBreak: { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Enum to denote the type of break found. New line, space etc. - * - * @enum {number} - * @memberof google.cloud.vision.v1 - */ - BreakType: { - - /** - * Unknown break label type. - */ - UNKNOWN: 0, - - /** - * Regular space. - */ - SPACE: 1, - - /** - * Sure space (very wide). - */ - SURE_SPACE: 2, - - /** - * Line-wrapping break. - */ - EOL_SURE_SPACE: 3, - - /** - * End-line hyphen that is not present in text; does not co-occur with - * `SPACE`, `LEADER_SPACE`, or `LINE_BREAK`. - */ - HYPHEN: 4, - - /** - * Line break that ends a paragraph. - */ - LINE_BREAK: 5 - } - }, - - /** - * Additional information detected on the structural component. - * - * @property {Object[]} detectedLanguages - * A list of detected languages together with confidence. - * - * This object should have the same structure as [DetectedLanguage]{@link google.cloud.vision.v1.DetectedLanguage} - * - * @property {Object} detectedBreak - * Detected start or end of a text segment. - * - * This object should have the same structure as [DetectedBreak]{@link google.cloud.vision.v1.DetectedBreak} - * - * @typedef TextProperty - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.TextAnnotation.TextProperty definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/text_annotation.proto} - */ - TextProperty: { - // This is for documentation. Actual contents will be loaded by gRPC. - } -}; - -/** - * Detected page from OCR. - * - * @property {Object} property - * Additional information detected on the page. - * - * This object should have the same structure as [TextProperty]{@link google.cloud.vision.v1.TextProperty} - * - * @property {number} width - * Page width. For PDFs the unit is points. For images (including - * TIFFs) the unit is pixels. - * - * @property {number} height - * Page height. For PDFs the unit is points. For images (including - * TIFFs) the unit is pixels. - * - * @property {Object[]} blocks - * List of blocks of text, images etc on this page. - * - * This object should have the same structure as [Block]{@link google.cloud.vision.v1.Block} - * - * @property {number} confidence - * Confidence of the OCR results on the page. Range [0, 1]. - * - * @typedef Page - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.Page definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/text_annotation.proto} - */ -const Page = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Logical element on the page. - * - * @property {Object} property - * Additional information detected for the block. - * - * This object should have the same structure as [TextProperty]{@link google.cloud.vision.v1.TextProperty} - * - * @property {Object} boundingBox - * The bounding box for the block. - * The vertices are in the order of top-left, top-right, bottom-right, - * bottom-left. When a rotation of the bounding box is detected the rotation - * is represented as around the top-left corner as defined when the text is - * read in the 'natural' orientation. - * For example: - * - * * when the text is horizontal it might look like: - * - * 0----1 - * | | - * 3----2 - * - * * when it's rotated 180 degrees around the top-left corner it becomes: - * - * 2----3 - * | | - * 1----0 - * - * and the vertex order will still be (0, 1, 2, 3). - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1.BoundingPoly} - * - * @property {Object[]} paragraphs - * List of paragraphs in this block (if this blocks is of type text). - * - * This object should have the same structure as [Paragraph]{@link google.cloud.vision.v1.Paragraph} - * - * @property {number} blockType - * Detected block type (text, image etc) for this block. - * - * The number should be among the values of [BlockType]{@link google.cloud.vision.v1.BlockType} - * - * @property {number} confidence - * Confidence of the OCR results on the block. Range [0, 1]. - * - * @typedef Block - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.Block definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/text_annotation.proto} - */ -const Block = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Type of a block (text, image etc) as identified by OCR. - * - * @enum {number} - * @memberof google.cloud.vision.v1 - */ - BlockType: { - - /** - * Unknown block type. - */ - UNKNOWN: 0, - - /** - * Regular text block. - */ - TEXT: 1, - - /** - * Table block. - */ - TABLE: 2, - - /** - * Image block. - */ - PICTURE: 3, - - /** - * Horizontal/vertical line box. - */ - RULER: 4, - - /** - * Barcode block. - */ - BARCODE: 5 - } -}; - -/** - * Structural unit of text representing a number of words in certain order. - * - * @property {Object} property - * Additional information detected for the paragraph. - * - * This object should have the same structure as [TextProperty]{@link google.cloud.vision.v1.TextProperty} - * - * @property {Object} boundingBox - * The bounding box for the paragraph. - * The vertices are in the order of top-left, top-right, bottom-right, - * bottom-left. When a rotation of the bounding box is detected the rotation - * is represented as around the top-left corner as defined when the text is - * read in the 'natural' orientation. - * For example: - * * when the text is horizontal it might look like: - * 0----1 - * | | - * 3----2 - * * when it's rotated 180 degrees around the top-left corner it becomes: - * 2----3 - * | | - * 1----0 - * and the vertex order will still be (0, 1, 2, 3). - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1.BoundingPoly} - * - * @property {Object[]} words - * List of all words in this paragraph. - * - * This object should have the same structure as [Word]{@link google.cloud.vision.v1.Word} - * - * @property {number} confidence - * Confidence of the OCR results for the paragraph. Range [0, 1]. - * - * @typedef Paragraph - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.Paragraph definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/text_annotation.proto} - */ -const Paragraph = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A word representation. - * - * @property {Object} property - * Additional information detected for the word. - * - * This object should have the same structure as [TextProperty]{@link google.cloud.vision.v1.TextProperty} - * - * @property {Object} boundingBox - * The bounding box for the word. - * The vertices are in the order of top-left, top-right, bottom-right, - * bottom-left. When a rotation of the bounding box is detected the rotation - * is represented as around the top-left corner as defined when the text is - * read in the 'natural' orientation. - * For example: - * * when the text is horizontal it might look like: - * 0----1 - * | | - * 3----2 - * * when it's rotated 180 degrees around the top-left corner it becomes: - * 2----3 - * | | - * 1----0 - * and the vertex order will still be (0, 1, 2, 3). - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1.BoundingPoly} - * - * @property {Object[]} symbols - * List of symbols in the word. - * The order of the symbols follows the natural reading order. - * - * This object should have the same structure as [Symbol]{@link google.cloud.vision.v1.Symbol} - * - * @property {number} confidence - * Confidence of the OCR results for the word. Range [0, 1]. - * - * @typedef Word - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.Word definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/text_annotation.proto} - */ -const Word = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A single symbol representation. - * - * @property {Object} property - * Additional information detected for the symbol. - * - * This object should have the same structure as [TextProperty]{@link google.cloud.vision.v1.TextProperty} - * - * @property {Object} boundingBox - * The bounding box for the symbol. - * The vertices are in the order of top-left, top-right, bottom-right, - * bottom-left. When a rotation of the bounding box is detected the rotation - * is represented as around the top-left corner as defined when the text is - * read in the 'natural' orientation. - * For example: - * * when the text is horizontal it might look like: - * 0----1 - * | | - * 3----2 - * * when it's rotated 180 degrees around the top-left corner it becomes: - * 2----3 - * | | - * 1----0 - * and the vertex order will still be (0, 1, 2, 3). - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1.BoundingPoly} - * - * @property {string} text - * The actual UTF-8 representation of the symbol. - * - * @property {number} confidence - * Confidence of the OCR results for the symbol. Range [0, 1]. - * - * @typedef Symbol - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.Symbol definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/text_annotation.proto} - */ -const Symbol = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1/doc/google/cloud/vision/v1/doc_web_detection.js b/packages/google-cloud-vision/src/v1/doc/google/cloud/vision/v1/doc_web_detection.js deleted file mode 100644 index 751fa14db4d..00000000000 --- a/packages/google-cloud-vision/src/v1/doc/google/cloud/vision/v1/doc_web_detection.js +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * Relevant information for the image from the Internet. - * - * @property {Object[]} webEntities - * Deduced entities from similar images on the Internet. - * - * This object should have the same structure as [WebEntity]{@link google.cloud.vision.v1.WebEntity} - * - * @property {Object[]} fullMatchingImages - * Fully matching images from the Internet. - * Can include resized copies of the query image. - * - * This object should have the same structure as [WebImage]{@link google.cloud.vision.v1.WebImage} - * - * @property {Object[]} partialMatchingImages - * Partial matching images from the Internet. - * Those images are similar enough to share some key-point features. For - * example an original image will likely have partial matching for its crops. - * - * This object should have the same structure as [WebImage]{@link google.cloud.vision.v1.WebImage} - * - * @property {Object[]} pagesWithMatchingImages - * Web pages containing the matching images from the Internet. - * - * This object should have the same structure as [WebPage]{@link google.cloud.vision.v1.WebPage} - * - * @property {Object[]} visuallySimilarImages - * The visually similar image results. - * - * This object should have the same structure as [WebImage]{@link google.cloud.vision.v1.WebImage} - * - * @property {Object[]} bestGuessLabels - * The service's best guess as to the topic of the request image. - * Inferred from similar images on the open web. - * - * This object should have the same structure as [WebLabel]{@link google.cloud.vision.v1.WebLabel} - * - * @typedef WebDetection - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.WebDetection definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/web_detection.proto} - */ -const WebDetection = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Entity deduced from similar images on the Internet. - * - * @property {string} entityId - * Opaque entity ID. - * - * @property {number} score - * Overall relevancy score for the entity. - * Not normalized and not comparable across different image queries. - * - * @property {string} description - * Canonical description of the entity, in English. - * - * @typedef WebEntity - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.WebDetection.WebEntity definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/web_detection.proto} - */ - WebEntity: { - // This is for documentation. Actual contents will be loaded by gRPC. - }, - - /** - * Metadata for online images. - * - * @property {string} url - * The result image URL. - * - * @property {number} score - * (Deprecated) Overall relevancy score for the image. - * - * @typedef WebImage - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.WebDetection.WebImage definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/web_detection.proto} - */ - WebImage: { - // This is for documentation. Actual contents will be loaded by gRPC. - }, - - /** - * Metadata for web pages. - * - * @property {string} url - * The result web page URL. - * - * @property {number} score - * (Deprecated) Overall relevancy score for the web page. - * - * @property {string} pageTitle - * Title for the web page, may contain HTML markups. - * - * @property {Object[]} fullMatchingImages - * Fully matching images on the page. - * Can include resized copies of the query image. - * - * This object should have the same structure as [WebImage]{@link google.cloud.vision.v1.WebImage} - * - * @property {Object[]} partialMatchingImages - * Partial matching images on the page. - * Those images are similar enough to share some key-point features. For - * example an original image will likely have partial matching for its - * crops. - * - * This object should have the same structure as [WebImage]{@link google.cloud.vision.v1.WebImage} - * - * @typedef WebPage - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.WebDetection.WebPage definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/web_detection.proto} - */ - WebPage: { - // This is for documentation. Actual contents will be loaded by gRPC. - }, - - /** - * Label to provide extra metadata for the web detection. - * - * @property {string} label - * Label for extra metadata. - * - * @property {string} languageCode - * The BCP-47 language code for `label`, such as "en-US" or "sr-Latn". - * For more information, see - * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. - * - * @typedef WebLabel - * @memberof google.cloud.vision.v1 - * @see [google.cloud.vision.v1.WebDetection.WebLabel definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1/web_detection.proto} - */ - WebLabel: { - // This is for documentation. Actual contents will be loaded by gRPC. - } -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1/doc/google/longrunning/doc_operations.js b/packages/google-cloud-vision/src/v1/doc/google/longrunning/doc_operations.js deleted file mode 100644 index 099e418d620..00000000000 --- a/packages/google-cloud-vision/src/v1/doc/google/longrunning/doc_operations.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * This resource represents a long-running operation that is the result of a - * network API call. - * - * @property {string} name - * The server-assigned name, which is only unique within the same service that - * originally returns it. If you use the default HTTP mapping, the - * `name` should be a resource name ending with `operations/{unique_id}`. - * - * @property {Object} metadata - * Service-specific metadata associated with the operation. It typically - * contains progress information and common metadata such as create time. - * Some services might not provide such metadata. Any method that returns a - * long-running operation should document the metadata type, if any. - * - * This object should have the same structure as [Any]{@link google.protobuf.Any} - * - * @property {boolean} done - * If the value is `false`, it means the operation is still in progress. - * If `true`, the operation is completed, and either `error` or `response` is - * available. - * - * @property {Object} error - * The error result of the operation in case of failure or cancellation. - * - * This object should have the same structure as [Status]{@link google.rpc.Status} - * - * @property {Object} response - * The normal response of the operation in case of success. If the original - * method returns no data on success, such as `Delete`, the response is - * `google.protobuf.Empty`. If the original method is standard - * `Get`/`Create`/`Update`, the response should be the resource. For other - * methods, the response should have the type `XxxResponse`, where `Xxx` - * is the original method name. For example, if the original method name - * is `TakeSnapshot()`, the inferred response type is - * `TakeSnapshotResponse`. - * - * This object should have the same structure as [Any]{@link google.protobuf.Any} - * - * @typedef Operation - * @memberof google.longrunning - * @see [google.longrunning.Operation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/longrunning/operations.proto} - */ -const Operation = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1/doc/google/protobuf/doc_any.js b/packages/google-cloud-vision/src/v1/doc/google/protobuf/doc_any.js deleted file mode 100644 index 813682aa336..00000000000 --- a/packages/google-cloud-vision/src/v1/doc/google/protobuf/doc_any.js +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * `Any` contains an arbitrary serialized protocol buffer message along with a - * URL that describes the type of the serialized message. - * - * Protobuf library provides support to pack/unpack Any values in the form - * of utility functions or additional generated methods of the Any type. - * - * Example 1: Pack and unpack a message in C++. - * - * Foo foo = ...; - * Any any; - * any.PackFrom(foo); - * ... - * if (any.UnpackTo(&foo)) { - * ... - * } - * - * Example 2: Pack and unpack a message in Java. - * - * Foo foo = ...; - * Any any = Any.pack(foo); - * ... - * if (any.is(Foo.class)) { - * foo = any.unpack(Foo.class); - * } - * - * Example 3: Pack and unpack a message in Python. - * - * foo = Foo(...) - * any = Any() - * any.Pack(foo) - * ... - * if any.Is(Foo.DESCRIPTOR): - * any.Unpack(foo) - * ... - * - * Example 4: Pack and unpack a message in Go - * - * foo := &pb.Foo{...} - * any, err := ptypes.MarshalAny(foo) - * ... - * foo := &pb.Foo{} - * if err := ptypes.UnmarshalAny(any, foo); err != nil { - * ... - * } - * - * The pack methods provided by protobuf library will by default use - * 'type.googleapis.com/full.type.name' as the type URL and the unpack - * methods only use the fully qualified type name after the last '/' - * in the type URL, for example "foo.bar.com/x/y.z" will yield type - * name "y.z". - * - * - * # JSON - * - * The JSON representation of an `Any` value uses the regular - * representation of the deserialized, embedded message, with an - * additional field `@type` which contains the type URL. Example: - * - * package google.profile; - * message Person { - * string first_name = 1; - * string last_name = 2; - * } - * - * { - * "@type": "type.googleapis.com/google.profile.Person", - * "firstName": , - * "lastName": - * } - * - * If the embedded message type is well-known and has a custom JSON - * representation, that representation will be embedded adding a field - * `value` which holds the custom JSON in addition to the `@type` - * field. Example (for message google.protobuf.Duration): - * - * { - * "@type": "type.googleapis.com/google.protobuf.Duration", - * "value": "1.212s" - * } - * - * @property {string} typeUrl - * A URL/resource name that uniquely identifies the type of the serialized - * protocol buffer message. This string must contain at least - * one "/" character. The last segment of the URL's path must represent - * the fully qualified name of the type (as in - * `path/google.protobuf.Duration`). The name should be in a canonical form - * (e.g., leading "." is not accepted). - * - * In practice, teams usually precompile into the binary all types that they - * expect it to use in the context of Any. However, for URLs which use the - * scheme `http`, `https`, or no scheme, one can optionally set up a type - * server that maps type URLs to message definitions as follows: - * - * * If no scheme is provided, `https` is assumed. - * * An HTTP GET on the URL must yield a google.protobuf.Type - * value in binary format, or produce an error. - * * Applications are allowed to cache lookup results based on the - * URL, or have them precompiled into a binary to avoid any - * lookup. Therefore, binary compatibility needs to be preserved - * on changes to types. (Use versioned type names to manage - * breaking changes.) - * - * Note: this functionality is not currently available in the official - * protobuf release, and it is not used for type URLs beginning with - * type.googleapis.com. - * - * Schemes other than `http`, `https` (or the empty scheme) might be - * used with implementation specific semantics. - * - * @property {Buffer} value - * Must be a valid serialized protocol buffer of the above specified type. - * - * @typedef Any - * @memberof google.protobuf - * @see [google.protobuf.Any definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/any.proto} - */ -const Any = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1/doc/google/protobuf/doc_empty.js b/packages/google-cloud-vision/src/v1/doc/google/protobuf/doc_empty.js deleted file mode 100644 index 1e3961d6609..00000000000 --- a/packages/google-cloud-vision/src/v1/doc/google/protobuf/doc_empty.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * A generic empty message that you can re-use to avoid defining duplicated - * empty messages in your APIs. A typical example is to use it as the request - * or the response type of an API method. For instance: - * - * service Foo { - * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); - * } - * - * The JSON representation for `Empty` is empty JSON object `{}`. - * @typedef Empty - * @memberof google.protobuf - * @see [google.protobuf.Empty definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/empty.proto} - */ -const Empty = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1/doc/google/protobuf/doc_field_mask.js b/packages/google-cloud-vision/src/v1/doc/google/protobuf/doc_field_mask.js deleted file mode 100644 index 59e745f36c2..00000000000 --- a/packages/google-cloud-vision/src/v1/doc/google/protobuf/doc_field_mask.js +++ /dev/null @@ -1,228 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * `FieldMask` represents a set of symbolic field paths, for example: - * - * paths: "f.a" - * paths: "f.b.d" - * - * Here `f` represents a field in some root message, `a` and `b` - * fields in the message found in `f`, and `d` a field found in the - * message in `f.b`. - * - * Field masks are used to specify a subset of fields that should be - * returned by a get operation or modified by an update operation. - * Field masks also have a custom JSON encoding (see below). - * - * # Field Masks in Projections - * - * When used in the context of a projection, a response message or - * sub-message is filtered by the API to only contain those fields as - * specified in the mask. For example, if the mask in the previous - * example is applied to a response message as follows: - * - * f { - * a : 22 - * b { - * d : 1 - * x : 2 - * } - * y : 13 - * } - * z: 8 - * - * The result will not contain specific values for fields x,y and z - * (their value will be set to the default, and omitted in proto text - * output): - * - * - * f { - * a : 22 - * b { - * d : 1 - * } - * } - * - * A repeated field is not allowed except at the last position of a - * paths string. - * - * If a FieldMask object is not present in a get operation, the - * operation applies to all fields (as if a FieldMask of all fields - * had been specified). - * - * Note that a field mask does not necessarily apply to the - * top-level response message. In case of a REST get operation, the - * field mask applies directly to the response, but in case of a REST - * list operation, the mask instead applies to each individual message - * in the returned resource list. In case of a REST custom method, - * other definitions may be used. Where the mask applies will be - * clearly documented together with its declaration in the API. In - * any case, the effect on the returned resource/resources is required - * behavior for APIs. - * - * # Field Masks in Update Operations - * - * A field mask in update operations specifies which fields of the - * targeted resource are going to be updated. The API is required - * to only change the values of the fields as specified in the mask - * and leave the others untouched. If a resource is passed in to - * describe the updated values, the API ignores the values of all - * fields not covered by the mask. - * - * If a repeated field is specified for an update operation, new values will - * be appended to the existing repeated field in the target resource. Note that - * a repeated field is only allowed in the last position of a `paths` string. - * - * If a sub-message is specified in the last position of the field mask for an - * update operation, then new value will be merged into the existing sub-message - * in the target resource. - * - * For example, given the target message: - * - * f { - * b { - * d: 1 - * x: 2 - * } - * c: [1] - * } - * - * And an update message: - * - * f { - * b { - * d: 10 - * } - * c: [2] - * } - * - * then if the field mask is: - * - * paths: ["f.b", "f.c"] - * - * then the result will be: - * - * f { - * b { - * d: 10 - * x: 2 - * } - * c: [1, 2] - * } - * - * An implementation may provide options to override this default behavior for - * repeated and message fields. - * - * In order to reset a field's value to the default, the field must - * be in the mask and set to the default value in the provided resource. - * Hence, in order to reset all fields of a resource, provide a default - * instance of the resource and set all fields in the mask, or do - * not provide a mask as described below. - * - * If a field mask is not present on update, the operation applies to - * all fields (as if a field mask of all fields has been specified). - * Note that in the presence of schema evolution, this may mean that - * fields the client does not know and has therefore not filled into - * the request will be reset to their default. If this is unwanted - * behavior, a specific service may require a client to always specify - * a field mask, producing an error if not. - * - * As with get operations, the location of the resource which - * describes the updated values in the request message depends on the - * operation kind. In any case, the effect of the field mask is - * required to be honored by the API. - * - * ## Considerations for HTTP REST - * - * The HTTP kind of an update operation which uses a field mask must - * be set to PATCH instead of PUT in order to satisfy HTTP semantics - * (PUT must only be used for full updates). - * - * # JSON Encoding of Field Masks - * - * In JSON, a field mask is encoded as a single string where paths are - * separated by a comma. Fields name in each path are converted - * to/from lower-camel naming conventions. - * - * As an example, consider the following message declarations: - * - * message Profile { - * User user = 1; - * Photo photo = 2; - * } - * message User { - * string display_name = 1; - * string address = 2; - * } - * - * In proto a field mask for `Profile` may look as such: - * - * mask { - * paths: "user.display_name" - * paths: "photo" - * } - * - * In JSON, the same mask is represented as below: - * - * { - * mask: "user.displayName,photo" - * } - * - * # Field Masks and Oneof Fields - * - * Field masks treat fields in oneofs just as regular fields. Consider the - * following message: - * - * message SampleMessage { - * oneof test_oneof { - * string name = 4; - * SubMessage sub_message = 9; - * } - * } - * - * The field mask can be: - * - * mask { - * paths: "name" - * } - * - * Or: - * - * mask { - * paths: "sub_message" - * } - * - * Note that oneof type names ("test_oneof" in this case) cannot be used in - * paths. - * - * ## Field Mask Verification - * - * The implementation of any API method which has a FieldMask type field in the - * request should verify the included field paths, and return an - * `INVALID_ARGUMENT` error if any path is duplicated or unmappable. - * - * @property {string[]} paths - * The set of field mask paths. - * - * @typedef FieldMask - * @memberof google.protobuf - * @see [google.protobuf.FieldMask definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/field_mask.proto} - */ -const FieldMask = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1/doc/google/protobuf/doc_timestamp.js b/packages/google-cloud-vision/src/v1/doc/google/protobuf/doc_timestamp.js deleted file mode 100644 index ad801cc9a10..00000000000 --- a/packages/google-cloud-vision/src/v1/doc/google/protobuf/doc_timestamp.js +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * A Timestamp represents a point in time independent of any time zone or local - * calendar, encoded as a count of seconds and fractions of seconds at - * nanosecond resolution. The count is relative to an epoch at UTC midnight on - * January 1, 1970, in the proleptic Gregorian calendar which extends the - * Gregorian calendar backwards to year one. - * - * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - * second table is needed for interpretation, using a [24-hour linear - * smear](https://developers.google.com/time/smear). - * - * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - * restricting to that range, we ensure that we can convert to and from [RFC - * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - * - * # Examples - * - * Example 1: Compute Timestamp from POSIX `time()`. - * - * Timestamp timestamp; - * timestamp.set_seconds(time(NULL)); - * timestamp.set_nanos(0); - * - * Example 2: Compute Timestamp from POSIX `gettimeofday()`. - * - * struct timeval tv; - * gettimeofday(&tv, NULL); - * - * Timestamp timestamp; - * timestamp.set_seconds(tv.tv_sec); - * timestamp.set_nanos(tv.tv_usec * 1000); - * - * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - * - * FILETIME ft; - * GetSystemTimeAsFileTime(&ft); - * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - * - * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - * Timestamp timestamp; - * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - * - * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - * - * long millis = System.currentTimeMillis(); - * - * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - * .setNanos((int) ((millis % 1000) * 1000000)).build(); - * - * - * Example 5: Compute Timestamp from current time in Python. - * - * timestamp = Timestamp() - * timestamp.GetCurrentTime() - * - * # JSON Mapping - * - * In JSON format, the Timestamp type is encoded as a string in the - * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the - * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" - * where {year} is always expressed using four digits while {month}, {day}, - * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional - * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), - * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone - * is required. A proto3 JSON serializer should always use UTC (as indicated by - * "Z") when printing the Timestamp type and a proto3 JSON parser should be - * able to accept both UTC and other timezones (as indicated by an offset). - * - * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past - * 01:30 UTC on January 15, 2017. - * - * In JavaScript, one can convert a Date object to this format using the - * standard - * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - * method. In Python, a standard `datetime.datetime` object can be converted - * to this format using - * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with - * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use - * the Joda Time's [`ISODateTimeFormat.dateTime()`](https://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D) to obtain a formatter capable of generating timestamps in this format. - * - * @property {number} seconds - * Represents seconds of UTC time since Unix epoch - * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to - * 9999-12-31T23:59:59Z inclusive. - * - * @property {number} nanos - * Non-negative fractions of a second at nanosecond resolution. Negative - * second values with fractions must still have non-negative nanos values - * that count forward in time. Must be from 0 to 999,999,999 - * inclusive. - * - * @typedef Timestamp - * @memberof google.protobuf - * @see [google.protobuf.Timestamp definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto} - */ -const Timestamp = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1/doc/google/protobuf/doc_wrappers.js b/packages/google-cloud-vision/src/v1/doc/google/protobuf/doc_wrappers.js deleted file mode 100644 index 90e2ff4ab5a..00000000000 --- a/packages/google-cloud-vision/src/v1/doc/google/protobuf/doc_wrappers.js +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * Wrapper message for `float`. - * - * The JSON representation for `FloatValue` is JSON number. - * - * @property {number} value - * The float value. - * - * @typedef FloatValue - * @memberof google.protobuf - * @see [google.protobuf.FloatValue definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/wrappers.proto} - */ -const FloatValue = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1/doc/google/rpc/doc_status.js b/packages/google-cloud-vision/src/v1/doc/google/rpc/doc_status.js deleted file mode 100644 index 750e0af7689..00000000000 --- a/packages/google-cloud-vision/src/v1/doc/google/rpc/doc_status.js +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * The `Status` type defines a logical error model that is suitable for - * different programming environments, including REST APIs and RPC APIs. It is - * used by [gRPC](https://github.com/grpc). Each `Status` message contains - * three pieces of data: error code, error message, and error details. - * - * You can find out more about this error model and how to work with it in the - * [API Design Guide](https://cloud.google.com/apis/design/errors). - * - * @property {number} code - * The status code, which should be an enum value of google.rpc.Code. - * - * @property {string} message - * A developer-facing error message, which should be in English. Any - * user-facing error message should be localized and sent in the - * google.rpc.Status.details field, or localized by the client. - * - * @property {Object[]} details - * A list of messages that carry the error details. There is a common set of - * message types for APIs to use. - * - * This object should have the same structure as [Any]{@link google.protobuf.Any} - * - * @typedef Status - * @memberof google.rpc - * @see [google.rpc.Status definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/rpc/status.proto} - */ -const Status = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1/doc/google/type/doc_color.js b/packages/google-cloud-vision/src/v1/doc/google/type/doc_color.js deleted file mode 100644 index 9570187d502..00000000000 --- a/packages/google-cloud-vision/src/v1/doc/google/type/doc_color.js +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * Represents a color in the RGBA color space. This representation is designed - * for simplicity of conversion to/from color representations in various - * languages over compactness; for example, the fields of this representation - * can be trivially provided to the constructor of "java.awt.Color" in Java; it - * can also be trivially provided to UIColor's "+colorWithRed:green:blue:alpha" - * method in iOS; and, with just a little work, it can be easily formatted into - * a CSS "rgba()" string in JavaScript, as well. - * - * Note: this proto does not carry information about the absolute color space - * that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, - * DCI-P3, BT.2020, etc.). By default, applications SHOULD assume the sRGB color - * space. - * - * Example (Java): - * - * import com.google.type.Color; - * - * // ... - * public static java.awt.Color fromProto(Color protocolor) { - * float alpha = protocolor.hasAlpha() - * ? protocolor.getAlpha().getValue() - * : 1.0; - * - * return new java.awt.Color( - * protocolor.getRed(), - * protocolor.getGreen(), - * protocolor.getBlue(), - * alpha); - * } - * - * public static Color toProto(java.awt.Color color) { - * float red = (float) color.getRed(); - * float green = (float) color.getGreen(); - * float blue = (float) color.getBlue(); - * float denominator = 255.0; - * Color.Builder resultBuilder = - * Color - * .newBuilder() - * .setRed(red / denominator) - * .setGreen(green / denominator) - * .setBlue(blue / denominator); - * int alpha = color.getAlpha(); - * if (alpha != 255) { - * result.setAlpha( - * FloatValue - * .newBuilder() - * .setValue(((float) alpha) / denominator) - * .build()); - * } - * return resultBuilder.build(); - * } - * // ... - * - * Example (iOS / Obj-C): - * - * // ... - * static UIColor* fromProto(Color* protocolor) { - * float red = [protocolor red]; - * float green = [protocolor green]; - * float blue = [protocolor blue]; - * FloatValue* alpha_wrapper = [protocolor alpha]; - * float alpha = 1.0; - * if (alpha_wrapper != nil) { - * alpha = [alpha_wrapper value]; - * } - * return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; - * } - * - * static Color* toProto(UIColor* color) { - * CGFloat red, green, blue, alpha; - * if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { - * return nil; - * } - * Color* result = [[Color alloc] init]; - * [result setRed:red]; - * [result setGreen:green]; - * [result setBlue:blue]; - * if (alpha <= 0.9999) { - * [result setAlpha:floatWrapperWithValue(alpha)]; - * } - * [result autorelease]; - * return result; - * } - * // ... - * - * Example (JavaScript): - * - * // ... - * - * var protoToCssColor = function(rgb_color) { - * var redFrac = rgb_color.red || 0.0; - * var greenFrac = rgb_color.green || 0.0; - * var blueFrac = rgb_color.blue || 0.0; - * var red = Math.floor(redFrac * 255); - * var green = Math.floor(greenFrac * 255); - * var blue = Math.floor(blueFrac * 255); - * - * if (!('alpha' in rgb_color)) { - * return rgbToCssColor_(red, green, blue); - * } - * - * var alphaFrac = rgb_color.alpha.value || 0.0; - * var rgbParams = [red, green, blue].join(','); - * return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); - * }; - * - * var rgbToCssColor_ = function(red, green, blue) { - * var rgbNumber = new Number((red << 16) | (green << 8) | blue); - * var hexString = rgbNumber.toString(16); - * var missingZeros = 6 - hexString.length; - * var resultBuilder = ['#']; - * for (var i = 0; i < missingZeros; i++) { - * resultBuilder.push('0'); - * } - * resultBuilder.push(hexString); - * return resultBuilder.join(''); - * }; - * - * // ... - * - * @property {number} red - * The amount of red in the color as a value in the interval [0, 1]. - * - * @property {number} green - * The amount of green in the color as a value in the interval [0, 1]. - * - * @property {number} blue - * The amount of blue in the color as a value in the interval [0, 1]. - * - * @property {Object} alpha - * The fraction of this color that should be applied to the pixel. That is, - * the final pixel color is defined by the equation: - * - * pixel color = alpha * (this color) + (1.0 - alpha) * (background color) - * - * This means that a value of 1.0 corresponds to a solid color, whereas - * a value of 0.0 corresponds to a completely transparent color. This - * uses a wrapper message rather than a simple float scalar so that it is - * possible to distinguish between a default value and the value being unset. - * If omitted, this color object is to be rendered as a solid color - * (as if the alpha value had been explicitly given with a value of 1.0). - * - * This object should have the same structure as [FloatValue]{@link google.protobuf.FloatValue} - * - * @typedef Color - * @memberof google.type - * @see [google.type.Color definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/type/color.proto} - */ -const Color = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1/doc/google/type/doc_latlng.js b/packages/google-cloud-vision/src/v1/doc/google/type/doc_latlng.js deleted file mode 100644 index bacbf0e1f48..00000000000 --- a/packages/google-cloud-vision/src/v1/doc/google/type/doc_latlng.js +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * An object representing a latitude/longitude pair. This is expressed as a pair - * of doubles representing degrees latitude and degrees longitude. Unless - * specified otherwise, this must conform to the - * WGS84 - * standard. Values must be within normalized ranges. - * - * @property {number} latitude - * The latitude in degrees. It must be in the range [-90.0, +90.0]. - * - * @property {number} longitude - * The longitude in degrees. It must be in the range [-180.0, +180.0]. - * - * @typedef LatLng - * @memberof google.type - * @see [google.type.LatLng definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/type/latlng.proto} - */ -const LatLng = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1/image_annotator_client.js b/packages/google-cloud-vision/src/v1/image_annotator_client.js deleted file mode 100644 index b8d83399de5..00000000000 --- a/packages/google-cloud-vision/src/v1/image_annotator_client.js +++ /dev/null @@ -1,677 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -'use strict'; - -const gapicConfig = require('./image_annotator_client_config.json'); -const gax = require('google-gax'); -const path = require('path'); - -const VERSION = require('../../package.json').version; - -/** - * Service that performs Google Cloud Vision API detection tasks over client - * images, such as face, landmark, logo, label, and text detection. The - * ImageAnnotator service returns detected entities from the images. - * - * @class - * @memberof v1 - */ -class ImageAnnotatorClient { - /** - * Construct an instance of ImageAnnotatorClient. - * - * @param {object} [options] - The configuration object. See the subsequent - * parameters for more details. - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {function} [options.promise] - Custom promise module to use instead - * of native Promises. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - */ - constructor(opts) { - opts = opts || {}; - this._descriptors = {}; - - if (global.isBrowser) { - // If we're in browser, we use gRPC fallback. - opts.fallback = true; - } - - // If we are in browser, we are already using fallback because of the - // "browser" field in package.json. - // But if we were explicitly requested to use fallback, let's do it now. - const gaxModule = !global.isBrowser && opts.fallback ? gax.fallback : gax; - - const servicePath = - opts.servicePath || opts.apiEndpoint || this.constructor.servicePath; - - // Ensure that options include the service address and port. - opts = Object.assign( - { - clientConfig: {}, - port: this.constructor.port, - servicePath, - }, - opts - ); - - // Create a `gaxGrpc` object, with any grpc-specific options - // sent to the client. - opts.scopes = this.constructor.scopes; - const gaxGrpc = new gaxModule.GrpcClient(opts); - - // Save the auth object to the client, for use by other methods. - this.auth = gaxGrpc.auth; - - // Determine the client header string. - const clientHeader = []; - - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } - clientHeader.push(`gax/${gaxModule.version}`); - if (opts.fallback) { - clientHeader.push(`gl-web/${gaxModule.version}`); - } else { - clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`); - } - clientHeader.push(`gapic/${VERSION}`); - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - - // Load the applicable protos. - // For Node.js, pass the path to JSON proto file. - // For browsers, pass the JSON content. - - const nodejsProtoPath = path.join( - __dirname, - '..', - '..', - 'protos', - 'protos.json' - ); - const protos = gaxGrpc.loadProto( - opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath - ); - - const protoFilesRoot = opts.fallback - ? gaxModule.protobuf.Root.fromJSON(require('../../protos/protos.json')) - : gaxModule.protobuf.loadSync(nodejsProtoPath); - - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - this.operationsClient = new gaxModule.lro({ - auth: gaxGrpc.auth, - grpc: gaxGrpc.grpc, - }).operationsClient(opts); - - const asyncBatchAnnotateImagesResponse = protoFilesRoot.lookup( - 'google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse' - ); - const asyncBatchAnnotateImagesMetadata = protoFilesRoot.lookup( - 'google.cloud.vision.v1.OperationMetadata' - ); - const asyncBatchAnnotateFilesResponse = protoFilesRoot.lookup( - 'google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse' - ); - const asyncBatchAnnotateFilesMetadata = protoFilesRoot.lookup( - 'google.cloud.vision.v1.OperationMetadata' - ); - - this._descriptors.longrunning = { - asyncBatchAnnotateImages: new gaxModule.LongrunningDescriptor( - this.operationsClient, - asyncBatchAnnotateImagesResponse.decode.bind( - asyncBatchAnnotateImagesResponse - ), - asyncBatchAnnotateImagesMetadata.decode.bind( - asyncBatchAnnotateImagesMetadata - ) - ), - asyncBatchAnnotateFiles: new gaxModule.LongrunningDescriptor( - this.operationsClient, - asyncBatchAnnotateFilesResponse.decode.bind( - asyncBatchAnnotateFilesResponse - ), - asyncBatchAnnotateFilesMetadata.decode.bind( - asyncBatchAnnotateFilesMetadata - ) - ), - }; - - // Put together the default options sent with requests. - const defaults = gaxGrpc.constructSettings( - 'google.cloud.vision.v1.ImageAnnotator', - gapicConfig, - opts.clientConfig, - {'x-goog-api-client': clientHeader.join(' ')} - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this._innerApiCalls = {}; - - // Put together the "service stub" for - // google.cloud.vision.v1.ImageAnnotator. - const imageAnnotatorStub = gaxGrpc.createStub( - opts.fallback - ? protos.lookupService('google.cloud.vision.v1.ImageAnnotator') - : protos.google.cloud.vision.v1.ImageAnnotator, - opts - ); - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const imageAnnotatorStubMethods = [ - 'batchAnnotateImages', - 'batchAnnotateFiles', - 'asyncBatchAnnotateImages', - 'asyncBatchAnnotateFiles', - ]; - for (const methodName of imageAnnotatorStubMethods) { - const innerCallPromise = imageAnnotatorStub.then( - stub => (...args) => { - return stub[methodName].apply(stub, args); - }, - err => () => { - throw err; - } - ); - this._innerApiCalls[methodName] = gaxModule.createApiCall( - innerCallPromise, - defaults[methodName], - this._descriptors.longrunning[methodName] - ); - } - } - - /** - * The DNS address for this API service. - */ - static get servicePath() { - return 'vision.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - */ - static get apiEndpoint() { - return 'vision.googleapis.com'; - } - - /** - * The port for this API service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloud-vision', - ]; - } - - /** - * Return the project ID used by this class. - * @param {function(Error, string)} callback - the callback to - * be called with the current project Id. - */ - getProjectId(callback) { - return this.auth.getProjectId(callback); - } - - // ------------------- - // -- Service calls -- - // ------------------- - - /** - * Run image detection and annotation for a batch of images. - * - * @param {Object} request - * The request object that will be sent. - * @param {Object[]} request.requests - * Required. Individual image annotation requests for this batch. - * - * This object should have the same structure as [AnnotateImageRequest]{@link google.cloud.vision.v1.AnnotateImageRequest} - * @param {string} [request.parent] - * Optional. Target project and location to make a call. - * - * Format: `projects/{project-id}/locations/{location-id}`. - * - * If no parent is specified, a region will be chosen automatically. - * - * Supported location-ids: - * `us`: USA country only, - * `asia`: East asia areas, like Japan, Taiwan, - * `eu`: The European Union. - * - * Example: `projects/project-A/locations/eu`. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [BatchAnnotateImagesResponse]{@link google.cloud.vision.v1.BatchAnnotateImagesResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [BatchAnnotateImagesResponse]{@link google.cloud.vision.v1.BatchAnnotateImagesResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1.ImageAnnotatorClient({ - * // optional auth parameters. - * }); - * - * const requests = []; - * client.batchAnnotateImages({requests: requests}) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - batchAnnotateImages(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent, - }); - - return this._innerApiCalls.batchAnnotateImages(request, options, callback); - } - - /** - * Service that performs image detection and annotation for a batch of files. - * Now only "application/pdf", "image/tiff" and "image/gif" are supported. - * - * This service will extract at most 5 (customers can specify which 5 in - * AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each - * file provided and perform detection and annotation for each image - * extracted. - * - * @param {Object} request - * The request object that will be sent. - * @param {Object[]} request.requests - * Required. The list of file annotation requests. Right now we support only one - * AnnotateFileRequest in BatchAnnotateFilesRequest. - * - * This object should have the same structure as [AnnotateFileRequest]{@link google.cloud.vision.v1.AnnotateFileRequest} - * @param {string} [request.parent] - * Optional. Target project and location to make a call. - * - * Format: `projects/{project-id}/locations/{location-id}`. - * - * If no parent is specified, a region will be chosen automatically. - * - * Supported location-ids: - * `us`: USA country only, - * `asia`: East asia areas, like Japan, Taiwan, - * `eu`: The European Union. - * - * Example: `projects/project-A/locations/eu`. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [BatchAnnotateFilesResponse]{@link google.cloud.vision.v1.BatchAnnotateFilesResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [BatchAnnotateFilesResponse]{@link google.cloud.vision.v1.BatchAnnotateFilesResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1.ImageAnnotatorClient({ - * // optional auth parameters. - * }); - * - * const requests = []; - * client.batchAnnotateFiles({requests: requests}) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - batchAnnotateFiles(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent, - }); - - return this._innerApiCalls.batchAnnotateFiles(request, options, callback); - } - - /** - * Run asynchronous image detection and annotation for a list of images. - * - * Progress and results can be retrieved through the - * `google.longrunning.Operations` interface. - * `Operation.metadata` contains `OperationMetadata` (metadata). - * `Operation.response` contains `AsyncBatchAnnotateImagesResponse` (results). - * - * This service will write image annotation outputs to json files in customer - * GCS bucket, each json file containing BatchAnnotateImagesResponse proto. - * - * @param {Object} request - * The request object that will be sent. - * @param {Object[]} request.requests - * Required. Individual image annotation requests for this batch. - * - * This object should have the same structure as [AnnotateImageRequest]{@link google.cloud.vision.v1.AnnotateImageRequest} - * @param {Object} request.outputConfig - * Required. The desired output location and metadata (e.g. format). - * - * This object should have the same structure as [OutputConfig]{@link google.cloud.vision.v1.OutputConfig} - * @param {string} [request.parent] - * Optional. Target project and location to make a call. - * - * Format: `projects/{project-id}/locations/{location-id}`. - * - * If no parent is specified, a region will be chosen automatically. - * - * Supported location-ids: - * `us`: USA country only, - * `asia`: East asia areas, like Japan, Taiwan, - * `eu`: The European Union. - * - * Example: `projects/project-A/locations/eu`. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/classes/Operation.html} object. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/classes/Operation.html} object. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1.ImageAnnotatorClient({ - * // optional auth parameters. - * }); - * - * const requests = []; - * const outputConfig = {}; - * const request = { - * requests: requests, - * outputConfig: outputConfig, - * }; - * - * // Handle the operation using the promise pattern. - * client.asyncBatchAnnotateImages(request) - * .then(responses => { - * const [operation, initialApiResponse] = responses; - * - * // Operation#promise starts polling for the completion of the LRO. - * return operation.promise(); - * }) - * .then(responses => { - * const result = responses[0]; - * const metadata = responses[1]; - * const finalApiResponse = responses[2]; - * }) - * .catch(err => { - * console.error(err); - * }); - * - * const requests = []; - * const outputConfig = {}; - * const request = { - * requests: requests, - * outputConfig: outputConfig, - * }; - * - * // Handle the operation using the event emitter pattern. - * client.asyncBatchAnnotateImages(request) - * .then(responses => { - * const [operation, initialApiResponse] = responses; - * - * // Adding a listener for the "complete" event starts polling for the - * // completion of the operation. - * operation.on('complete', (result, metadata, finalApiResponse) => { - * // doSomethingWith(result); - * }); - * - * // Adding a listener for the "progress" event causes the callback to be - * // called on any change in metadata when the operation is polled. - * operation.on('progress', (metadata, apiResponse) => { - * // doSomethingWith(metadata) - * }); - * - * // Adding a listener for the "error" event handles any errors found during polling. - * operation.on('error', err => { - * // throw(err); - * }); - * }) - * .catch(err => { - * console.error(err); - * }); - * - * const requests = []; - * const outputConfig = {}; - * const request = { - * requests: requests, - * outputConfig: outputConfig, - * }; - * - * // Handle the operation using the await pattern. - * const [operation] = await client.asyncBatchAnnotateImages(request); - * - * const [response] = await operation.promise(); - */ - asyncBatchAnnotateImages(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent, - }); - - return this._innerApiCalls.asyncBatchAnnotateImages( - request, - options, - callback - ); - } - - /** - * Run asynchronous image detection and annotation for a list of generic - * files, such as PDF files, which may contain multiple pages and multiple - * images per page. Progress and results can be retrieved through the - * `google.longrunning.Operations` interface. - * `Operation.metadata` contains `OperationMetadata` (metadata). - * `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results). - * - * @param {Object} request - * The request object that will be sent. - * @param {Object[]} request.requests - * Required. Individual async file annotation requests for this batch. - * - * This object should have the same structure as [AsyncAnnotateFileRequest]{@link google.cloud.vision.v1.AsyncAnnotateFileRequest} - * @param {string} [request.parent] - * Optional. Target project and location to make a call. - * - * Format: `projects/{project-id}/locations/{location-id}`. - * - * If no parent is specified, a region will be chosen automatically. - * - * Supported location-ids: - * `us`: USA country only, - * `asia`: East asia areas, like Japan, Taiwan, - * `eu`: The European Union. - * - * Example: `projects/project-A/locations/eu`. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/classes/Operation.html} object. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/classes/Operation.html} object. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1.ImageAnnotatorClient({ - * // optional auth parameters. - * }); - * - * const requests = []; - * - * // Handle the operation using the promise pattern. - * client.asyncBatchAnnotateFiles({requests: requests}) - * .then(responses => { - * const [operation, initialApiResponse] = responses; - * - * // Operation#promise starts polling for the completion of the LRO. - * return operation.promise(); - * }) - * .then(responses => { - * const result = responses[0]; - * const metadata = responses[1]; - * const finalApiResponse = responses[2]; - * }) - * .catch(err => { - * console.error(err); - * }); - * - * const requests = []; - * - * // Handle the operation using the event emitter pattern. - * client.asyncBatchAnnotateFiles({requests: requests}) - * .then(responses => { - * const [operation, initialApiResponse] = responses; - * - * // Adding a listener for the "complete" event starts polling for the - * // completion of the operation. - * operation.on('complete', (result, metadata, finalApiResponse) => { - * // doSomethingWith(result); - * }); - * - * // Adding a listener for the "progress" event causes the callback to be - * // called on any change in metadata when the operation is polled. - * operation.on('progress', (metadata, apiResponse) => { - * // doSomethingWith(metadata) - * }); - * - * // Adding a listener for the "error" event handles any errors found during polling. - * operation.on('error', err => { - * // throw(err); - * }); - * }) - * .catch(err => { - * console.error(err); - * }); - * - * const requests = []; - * - * // Handle the operation using the await pattern. - * const [operation] = await client.asyncBatchAnnotateFiles({requests: requests}); - * - * const [response] = await operation.promise(); - */ - asyncBatchAnnotateFiles(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent, - }); - - return this._innerApiCalls.asyncBatchAnnotateFiles( - request, - options, - callback - ); - } -} - -module.exports = ImageAnnotatorClient; diff --git a/packages/google-cloud-vision/src/v1/image_annotator_client.ts b/packages/google-cloud-vision/src/v1/image_annotator_client.ts new file mode 100644 index 00000000000..9536a6b2e8f --- /dev/null +++ b/packages/google-cloud-vision/src/v1/image_annotator_client.ts @@ -0,0 +1,925 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as gax from 'google-gax'; +import { + APICallback, + Callback, + CallOptions, + Descriptors, + ClientOptions, + LROperation, +} from 'google-gax'; +import * as path from 'path'; + +import * as protosTypes from '../../protos/protos'; +import * as gapicConfig from './image_annotator_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service that performs Google Cloud Vision API detection tasks over client + * images, such as face, landmark, logo, label, and text detection. The + * ImageAnnotator service returns detected entities from the images. + * @class + * @memberof v1 + */ +export class ImageAnnotatorClient { + private _descriptors: Descriptors = {page: {}, stream: {}, longrunning: {}}; + private _innerApiCalls: {[name: string]: Function}; + private _pathTemplates: {[name: string]: gax.PathTemplate}; + private _terminated = false; + auth: gax.GoogleAuth; + operationsClient: gax.OperationsClient; + imageAnnotatorStub: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ImageAnnotatorClient. + * + * @param {object} [options] - The configuration object. See the subsequent + * parameters for more details. + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {function} [options.promise] - Custom promise module to use instead + * of native Promises. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + */ + + constructor(opts?: ClientOptions) { + // Ensure that options include the service address and port. + const staticMembers = this.constructor as typeof ImageAnnotatorClient; + const servicePath = + opts && opts.servicePath + ? opts.servicePath + : opts && opts.apiEndpoint + ? opts.apiEndpoint + : staticMembers.servicePath; + const port = opts && opts.port ? opts.port : staticMembers.port; + + if (!opts) { + opts = {servicePath, port}; + } + opts.servicePath = opts.servicePath || servicePath; + opts.port = opts.port || port; + opts.clientConfig = opts.clientConfig || {}; + + const isBrowser = typeof window !== 'undefined'; + if (isBrowser) { + opts.fallback = true; + } + // If we are in browser, we are already using fallback because of the + // "browser" field in package.json. + // But if we were explicitly requested to use fallback, let's do it now. + const gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options + // sent to the client. + opts.scopes = (this.constructor as typeof ImageAnnotatorClient).scopes; + const gaxGrpc = new gaxModule.GrpcClient(opts); + + // Save the auth object to the client, for use by other methods. + this.auth = gaxGrpc.auth as gax.GoogleAuth; + + // Determine the client header string. + const clientHeader = [`gax/${gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + const protos = gaxGrpc.loadProto( + opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this._pathTemplates = { + productPathTemplate: new gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/products/{product}' + ), + productSetPathTemplate: new gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/productSets/{product_set}' + ), + referenceImagePathTemplate: new gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}' + ), + }; + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const protoFilesRoot = opts.fallback + ? gaxModule.protobuf.Root.fromJSON(require('../../protos/protos.json')) + : gaxModule.protobuf.loadSync(nodejsProtoPath); + + this.operationsClient = gaxModule + .lro({ + auth: this.auth, + grpc: 'grpc' in gaxGrpc ? gaxGrpc.grpc : undefined, + }) + .operationsClient(opts); + const asyncBatchAnnotateImagesResponse = protoFilesRoot.lookup( + '.google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse' + ) as gax.protobuf.Type; + const asyncBatchAnnotateImagesMetadata = protoFilesRoot.lookup( + '.google.cloud.vision.v1.OperationMetadata' + ) as gax.protobuf.Type; + const asyncBatchAnnotateFilesResponse = protoFilesRoot.lookup( + '.google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse' + ) as gax.protobuf.Type; + const asyncBatchAnnotateFilesMetadata = protoFilesRoot.lookup( + '.google.cloud.vision.v1.OperationMetadata' + ) as gax.protobuf.Type; + + this._descriptors.longrunning = { + asyncBatchAnnotateImages: new gaxModule.LongrunningDescriptor( + this.operationsClient, + asyncBatchAnnotateImagesResponse.decode.bind( + asyncBatchAnnotateImagesResponse + ), + asyncBatchAnnotateImagesMetadata.decode.bind( + asyncBatchAnnotateImagesMetadata + ) + ), + asyncBatchAnnotateFiles: new gaxModule.LongrunningDescriptor( + this.operationsClient, + asyncBatchAnnotateFilesResponse.decode.bind( + asyncBatchAnnotateFilesResponse + ), + asyncBatchAnnotateFilesMetadata.decode.bind( + asyncBatchAnnotateFilesMetadata + ) + ), + }; + + // Put together the default options sent with requests. + const defaults = gaxGrpc.constructSettings( + 'google.cloud.vision.v1.ImageAnnotator', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this._innerApiCalls = {}; + + // Put together the "service stub" for + // google.cloud.vision.v1.ImageAnnotator. + this.imageAnnotatorStub = gaxGrpc.createStub( + opts.fallback + ? (protos as protobuf.Root).lookupService( + 'google.cloud.vision.v1.ImageAnnotator' + ) + : // tslint:disable-next-line no-any + (protos as any).google.cloud.vision.v1.ImageAnnotator, + opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const imageAnnotatorStubMethods = [ + 'batchAnnotateImages', + 'batchAnnotateFiles', + 'asyncBatchAnnotateImages', + 'asyncBatchAnnotateFiles', + ]; + + for (const methodName of imageAnnotatorStubMethods) { + const innerCallPromise = this.imageAnnotatorStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + return stub[methodName].apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const apiCall = gaxModule.createApiCall( + innerCallPromise, + defaults[methodName], + this._descriptors.page[methodName] || + this._descriptors.stream[methodName] || + this._descriptors.longrunning[methodName] + ); + + this._innerApiCalls[methodName] = ( + argument: {}, + callOptions?: CallOptions, + callback?: APICallback + ) => { + return apiCall(argument, callOptions, callback); + }; + } + } + + /** + * The DNS address for this API service. + */ + static get servicePath() { + return 'vision.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + */ + static get apiEndpoint() { + return 'vision.googleapis.com'; + } + + /** + * The port for this API service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/cloud-vision', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @param {function(Error, string)} callback - the callback to + * be called with the current project Id. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + batchAnnotateImages( + request: protosTypes.google.cloud.vision.v1.IBatchAnnotateImagesRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1.IBatchAnnotateImagesResponse, + ( + | protosTypes.google.cloud.vision.v1.IBatchAnnotateImagesRequest + | undefined + ), + {} | undefined + ] + >; + batchAnnotateImages( + request: protosTypes.google.cloud.vision.v1.IBatchAnnotateImagesRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1.IBatchAnnotateImagesResponse, + | protosTypes.google.cloud.vision.v1.IBatchAnnotateImagesRequest + | undefined, + {} | undefined + > + ): void; + /** + * Run image detection and annotation for a batch of images. + * + * @param {Object} request + * The request object that will be sent. + * @param {number[]} request.requests + * Required. Individual image annotation requests for this batch. + * @param {string} request.parent + * Optional. Target project and location to make a call. + * + * Format: `projects/{project-id}/locations/{location-id}`. + * + * If no parent is specified, a region will be chosen automatically. + * + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * + * Example: `projects/project-A/locations/eu`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [BatchAnnotateImagesResponse]{@link google.cloud.vision.v1.BatchAnnotateImagesResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + batchAnnotateImages( + request: protosTypes.google.cloud.vision.v1.IBatchAnnotateImagesRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1.IBatchAnnotateImagesResponse, + | protosTypes.google.cloud.vision.v1.IBatchAnnotateImagesRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1.IBatchAnnotateImagesResponse, + | protosTypes.google.cloud.vision.v1.IBatchAnnotateImagesRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1.IBatchAnnotateImagesResponse, + ( + | protosTypes.google.cloud.vision.v1.IBatchAnnotateImagesRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.batchAnnotateImages(request, options, callback); + } + batchAnnotateFiles( + request: protosTypes.google.cloud.vision.v1.IBatchAnnotateFilesRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1.IBatchAnnotateFilesResponse, + protosTypes.google.cloud.vision.v1.IBatchAnnotateFilesRequest | undefined, + {} | undefined + ] + >; + batchAnnotateFiles( + request: protosTypes.google.cloud.vision.v1.IBatchAnnotateFilesRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1.IBatchAnnotateFilesResponse, + protosTypes.google.cloud.vision.v1.IBatchAnnotateFilesRequest | undefined, + {} | undefined + > + ): void; + /** + * Service that performs image detection and annotation for a batch of files. + * Now only "application/pdf", "image/tiff" and "image/gif" are supported. + * + * This service will extract at most 5 (customers can specify which 5 in + * AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each + * file provided and perform detection and annotation for each image + * extracted. + * + * @param {Object} request + * The request object that will be sent. + * @param {number[]} request.requests + * Required. The list of file annotation requests. Right now we support only one + * AnnotateFileRequest in BatchAnnotateFilesRequest. + * @param {string} request.parent + * Optional. Target project and location to make a call. + * + * Format: `projects/{project-id}/locations/{location-id}`. + * + * If no parent is specified, a region will be chosen automatically. + * + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * + * Example: `projects/project-A/locations/eu`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [BatchAnnotateFilesResponse]{@link google.cloud.vision.v1.BatchAnnotateFilesResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + batchAnnotateFiles( + request: protosTypes.google.cloud.vision.v1.IBatchAnnotateFilesRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1.IBatchAnnotateFilesResponse, + | protosTypes.google.cloud.vision.v1.IBatchAnnotateFilesRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1.IBatchAnnotateFilesResponse, + protosTypes.google.cloud.vision.v1.IBatchAnnotateFilesRequest | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1.IBatchAnnotateFilesResponse, + protosTypes.google.cloud.vision.v1.IBatchAnnotateFilesRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.batchAnnotateFiles(request, options, callback); + } + + asyncBatchAnnotateImages( + request: protosTypes.google.cloud.vision.v1.IAsyncBatchAnnotateImagesRequest, + options?: gax.CallOptions + ): Promise< + [ + LROperation< + protosTypes.google.cloud.vision.v1.IAsyncBatchAnnotateImagesResponse, + protosTypes.google.cloud.vision.v1.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + asyncBatchAnnotateImages( + request: protosTypes.google.cloud.vision.v1.IAsyncBatchAnnotateImagesRequest, + options: gax.CallOptions, + callback: Callback< + LROperation< + protosTypes.google.cloud.vision.v1.IAsyncBatchAnnotateImagesResponse, + protosTypes.google.cloud.vision.v1.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + > + ): void; + /** + * Run asynchronous image detection and annotation for a list of images. + * + * Progress and results can be retrieved through the + * `google.longrunning.Operations` interface. + * `Operation.metadata` contains `OperationMetadata` (metadata). + * `Operation.response` contains `AsyncBatchAnnotateImagesResponse` (results). + * + * This service will write image annotation outputs to json files in customer + * GCS bucket, each json file containing BatchAnnotateImagesResponse proto. + * + * @param {Object} request + * The request object that will be sent. + * @param {number[]} request.requests + * Required. Individual image annotation requests for this batch. + * @param {google.cloud.vision.v1.OutputConfig} request.outputConfig + * Required. The desired output location and metadata (e.g. format). + * @param {string} request.parent + * Optional. Target project and location to make a call. + * + * Format: `projects/{project-id}/locations/{location-id}`. + * + * If no parent is specified, a region will be chosen automatically. + * + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * + * Example: `projects/project-A/locations/eu`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + asyncBatchAnnotateImages( + request: protosTypes.google.cloud.vision.v1.IAsyncBatchAnnotateImagesRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + LROperation< + protosTypes.google.cloud.vision.v1.IAsyncBatchAnnotateImagesResponse, + protosTypes.google.cloud.vision.v1.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + >, + callback?: Callback< + LROperation< + protosTypes.google.cloud.vision.v1.IAsyncBatchAnnotateImagesResponse, + protosTypes.google.cloud.vision.v1.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + > + ): Promise< + [ + LROperation< + protosTypes.google.cloud.vision.v1.IAsyncBatchAnnotateImagesResponse, + protosTypes.google.cloud.vision.v1.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.asyncBatchAnnotateImages( + request, + options, + callback + ); + } + asyncBatchAnnotateFiles( + request: protosTypes.google.cloud.vision.v1.IAsyncBatchAnnotateFilesRequest, + options?: gax.CallOptions + ): Promise< + [ + LROperation< + protosTypes.google.cloud.vision.v1.IAsyncBatchAnnotateFilesResponse, + protosTypes.google.cloud.vision.v1.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + asyncBatchAnnotateFiles( + request: protosTypes.google.cloud.vision.v1.IAsyncBatchAnnotateFilesRequest, + options: gax.CallOptions, + callback: Callback< + LROperation< + protosTypes.google.cloud.vision.v1.IAsyncBatchAnnotateFilesResponse, + protosTypes.google.cloud.vision.v1.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + > + ): void; + /** + * Run asynchronous image detection and annotation for a list of generic + * files, such as PDF files, which may contain multiple pages and multiple + * images per page. Progress and results can be retrieved through the + * `google.longrunning.Operations` interface. + * `Operation.metadata` contains `OperationMetadata` (metadata). + * `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results). + * + * @param {Object} request + * The request object that will be sent. + * @param {number[]} request.requests + * Required. Individual async file annotation requests for this batch. + * @param {string} request.parent + * Optional. Target project and location to make a call. + * + * Format: `projects/{project-id}/locations/{location-id}`. + * + * If no parent is specified, a region will be chosen automatically. + * + * Supported location-ids: + * `us`: USA country only, + * `asia`: East asia areas, like Japan, Taiwan, + * `eu`: The European Union. + * + * Example: `projects/project-A/locations/eu`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + asyncBatchAnnotateFiles( + request: protosTypes.google.cloud.vision.v1.IAsyncBatchAnnotateFilesRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + LROperation< + protosTypes.google.cloud.vision.v1.IAsyncBatchAnnotateFilesResponse, + protosTypes.google.cloud.vision.v1.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + >, + callback?: Callback< + LROperation< + protosTypes.google.cloud.vision.v1.IAsyncBatchAnnotateFilesResponse, + protosTypes.google.cloud.vision.v1.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + > + ): Promise< + [ + LROperation< + protosTypes.google.cloud.vision.v1.IAsyncBatchAnnotateFilesResponse, + protosTypes.google.cloud.vision.v1.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.asyncBatchAnnotateFiles( + request, + options, + callback + ); + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} product + * @returns {string} Resource name string. + */ + productPath(project: string, location: string, product: string) { + return this._pathTemplates.productPathTemplate.render({ + project, + location, + product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this._pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this._pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this._pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Return a fully-qualified productSet resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} product_set + * @returns {string} Resource name string. + */ + productSetPath(project: string, location: string, productSet: string) { + return this._pathTemplates.productSetPathTemplate.render({ + project, + location, + product_set: productSet, + }); + } + + /** + * Parse the project from ProductSet resource. + * + * @param {string} productSetName + * A fully-qualified path representing ProductSet resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductSetName(productSetName: string) { + return this._pathTemplates.productSetPathTemplate.match(productSetName) + .project; + } + + /** + * Parse the location from ProductSet resource. + * + * @param {string} productSetName + * A fully-qualified path representing ProductSet resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductSetName(productSetName: string) { + return this._pathTemplates.productSetPathTemplate.match(productSetName) + .location; + } + + /** + * Parse the product_set from ProductSet resource. + * + * @param {string} productSetName + * A fully-qualified path representing ProductSet resource. + * @returns {string} A string representing the product_set. + */ + matchProductSetFromProductSetName(productSetName: string) { + return this._pathTemplates.productSetPathTemplate.match(productSetName) + .product_set; + } + + /** + * Return a fully-qualified referenceImage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} product + * @param {string} reference_image + * @returns {string} Resource name string. + */ + referenceImagePath( + project: string, + location: string, + product: string, + referenceImage: string + ) { + return this._pathTemplates.referenceImagePathTemplate.render({ + project, + location, + product, + reference_image: referenceImage, + }); + } + + /** + * Parse the project from ReferenceImage resource. + * + * @param {string} referenceImageName + * A fully-qualified path representing ReferenceImage resource. + * @returns {string} A string representing the project. + */ + matchProjectFromReferenceImageName(referenceImageName: string) { + return this._pathTemplates.referenceImagePathTemplate.match( + referenceImageName + ).project; + } + + /** + * Parse the location from ReferenceImage resource. + * + * @param {string} referenceImageName + * A fully-qualified path representing ReferenceImage resource. + * @returns {string} A string representing the location. + */ + matchLocationFromReferenceImageName(referenceImageName: string) { + return this._pathTemplates.referenceImagePathTemplate.match( + referenceImageName + ).location; + } + + /** + * Parse the product from ReferenceImage resource. + * + * @param {string} referenceImageName + * A fully-qualified path representing ReferenceImage resource. + * @returns {string} A string representing the product. + */ + matchProductFromReferenceImageName(referenceImageName: string) { + return this._pathTemplates.referenceImagePathTemplate.match( + referenceImageName + ).product; + } + + /** + * Parse the reference_image from ReferenceImage resource. + * + * @param {string} referenceImageName + * A fully-qualified path representing ReferenceImage resource. + * @returns {string} A string representing the reference_image. + */ + matchReferenceImageFromReferenceImageName(referenceImageName: string) { + return this._pathTemplates.referenceImagePathTemplate.match( + referenceImageName + ).reference_image; + } + + /** + * Terminate the GRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + */ + close(): Promise { + if (!this._terminated) { + return this.imageAnnotatorStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} +import {FeaturesMethod} from '../helpers'; +export interface ImageAnnotatorClient extends FeaturesMethod {} diff --git a/packages/google-cloud-vision/src/v1/image_annotator_client_config.json b/packages/google-cloud-vision/src/v1/image_annotator_client_config.json index 6e7354d2169..08f87df90e0 100644 --- a/packages/google-cloud-vision/src/v1/image_annotator_client_config.json +++ b/packages/google-cloud-vision/src/v1/image_annotator_client_config.json @@ -2,11 +2,11 @@ "interfaces": { "google.cloud.vision.v1.ImageAnnotator": { "retry_codes": { + "non_idempotent": [], "idempotent": [ "DEADLINE_EXCEEDED", "UNAVAILABLE" - ], - "non_idempotent": [] + ] }, "retry_params": { "default": { @@ -14,29 +14,29 @@ "retry_delay_multiplier": 1.3, "max_retry_delay_millis": 60000, "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1.0, + "rpc_timeout_multiplier": 1, "max_rpc_timeout_millis": 60000, "total_timeout_millis": 600000 } }, "methods": { "BatchAnnotateImages": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "BatchAnnotateFiles": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "AsyncBatchAnnotateImages": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "AsyncBatchAnnotateFiles": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" } diff --git a/packages/google-cloud-vision/src/v1/image_annotator_proto_list.json b/packages/google-cloud-vision/src/v1/image_annotator_proto_list.json index 8d36ebf05e2..0d468bf9c85 100644 --- a/packages/google-cloud-vision/src/v1/image_annotator_proto_list.json +++ b/packages/google-cloud-vision/src/v1/image_annotator_proto_list.json @@ -1,3 +1,8 @@ [ - "../../protos/google/cloud/vision/v1/image_annotator.proto" + "../../protos/google/cloud/vision/v1/geometry.proto", + "../../protos/google/cloud/vision/v1/image_annotator.proto", + "../../protos/google/cloud/vision/v1/product_search.proto", + "../../protos/google/cloud/vision/v1/product_search_service.proto", + "../../protos/google/cloud/vision/v1/text_annotation.proto", + "../../protos/google/cloud/vision/v1/web_detection.proto" ] diff --git a/packages/google-cloud-vision/src/v1p2beta1/index.js b/packages/google-cloud-vision/src/v1/index.ts similarity index 61% rename from packages/google-cloud-vision/src/v1p2beta1/index.js rename to packages/google-cloud-vision/src/v1/index.ts index 0ab93eefeb8..de3f335b8a0 100644 --- a/packages/google-cloud-vision/src/v1p2beta1/index.js +++ b/packages/google-cloud-vision/src/v1/index.ts @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -11,9 +11,10 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** -'use strict'; - -const ImageAnnotatorClient = require('./image_annotator_client'); - -module.exports.ImageAnnotatorClient = ImageAnnotatorClient; +export {ImageAnnotatorClient} from './image_annotator_client'; +export {ProductSearchClient} from './product_search_client'; diff --git a/packages/google-cloud-vision/src/v1/product_search_client.js b/packages/google-cloud-vision/src/v1/product_search_client.js deleted file mode 100644 index f69a0780515..00000000000 --- a/packages/google-cloud-vision/src/v1/product_search_client.js +++ /dev/null @@ -1,2348 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -'use strict'; - -const gapicConfig = require('./product_search_client_config.json'); -const gax = require('google-gax'); -const path = require('path'); - -const VERSION = require('../../package.json').version; - -/** - * Manages Products and ProductSets of reference images for use in product - * search. It uses the following resource model: - * - * - The API has a collection of ProductSet resources, named - * `projects/* /locations/* /productSets/*`, which acts as a way to put different - * products into groups to limit identification. - * - * In parallel, - * - * - The API has a collection of Product resources, named - * `projects/* /locations/* /products/*` - * - * - Each Product has a collection of ReferenceImage resources, named - * `projects/* /locations/* /products/* /referenceImages/*` - * - * @class - * @memberof v1 - */ -class ProductSearchClient { - /** - * Construct an instance of ProductSearchClient. - * - * @param {object} [options] - The configuration object. See the subsequent - * parameters for more details. - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {function} [options.promise] - Custom promise module to use instead - * of native Promises. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - */ - constructor(opts) { - opts = opts || {}; - this._descriptors = {}; - - if (global.isBrowser) { - // If we're in browser, we use gRPC fallback. - opts.fallback = true; - } - - // If we are in browser, we are already using fallback because of the - // "browser" field in package.json. - // But if we were explicitly requested to use fallback, let's do it now. - const gaxModule = !global.isBrowser && opts.fallback ? gax.fallback : gax; - - const servicePath = - opts.servicePath || opts.apiEndpoint || this.constructor.servicePath; - - // Ensure that options include the service address and port. - opts = Object.assign( - { - clientConfig: {}, - port: this.constructor.port, - servicePath, - }, - opts - ); - - // Create a `gaxGrpc` object, with any grpc-specific options - // sent to the client. - opts.scopes = this.constructor.scopes; - const gaxGrpc = new gaxModule.GrpcClient(opts); - - // Save the auth object to the client, for use by other methods. - this.auth = gaxGrpc.auth; - - // Determine the client header string. - const clientHeader = []; - - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } - clientHeader.push(`gax/${gaxModule.version}`); - if (opts.fallback) { - clientHeader.push(`gl-web/${gaxModule.version}`); - } else { - clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`); - } - clientHeader.push(`gapic/${VERSION}`); - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - - // Load the applicable protos. - // For Node.js, pass the path to JSON proto file. - // For browsers, pass the JSON content. - - const nodejsProtoPath = path.join( - __dirname, - '..', - '..', - 'protos', - 'protos.json' - ); - const protos = gaxGrpc.loadProto( - opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath - ); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this._pathTemplates = { - locationPathTemplate: new gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - productPathTemplate: new gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/products/{product}' - ), - productSetPathTemplate: new gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/productSets/{product_set}' - ), - referenceImagePathTemplate: new gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this._descriptors.page = { - listProductSets: new gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'productSets' - ), - listProducts: new gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'products' - ), - listReferenceImages: new gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'referenceImages' - ), - listProductsInProductSet: new gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'products' - ), - }; - - const protoFilesRoot = opts.fallback - ? gaxModule.protobuf.Root.fromJSON(require('../../protos/protos.json')) - : gaxModule.protobuf.loadSync(nodejsProtoPath); - - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - this.operationsClient = new gaxModule.lro({ - auth: gaxGrpc.auth, - grpc: gaxGrpc.grpc, - }).operationsClient(opts); - - const importProductSetsResponse = protoFilesRoot.lookup( - 'google.cloud.vision.v1.ImportProductSetsResponse' - ); - const importProductSetsMetadata = protoFilesRoot.lookup( - 'google.cloud.vision.v1.BatchOperationMetadata' - ); - const purgeProductsResponse = protoFilesRoot.lookup( - 'google.protobuf.Empty' - ); - const purgeProductsMetadata = protoFilesRoot.lookup( - 'google.cloud.vision.v1.BatchOperationMetadata' - ); - - this._descriptors.longrunning = { - importProductSets: new gaxModule.LongrunningDescriptor( - this.operationsClient, - importProductSetsResponse.decode.bind(importProductSetsResponse), - importProductSetsMetadata.decode.bind(importProductSetsMetadata) - ), - purgeProducts: new gaxModule.LongrunningDescriptor( - this.operationsClient, - purgeProductsResponse.decode.bind(purgeProductsResponse), - purgeProductsMetadata.decode.bind(purgeProductsMetadata) - ), - }; - - // Put together the default options sent with requests. - const defaults = gaxGrpc.constructSettings( - 'google.cloud.vision.v1.ProductSearch', - gapicConfig, - opts.clientConfig, - {'x-goog-api-client': clientHeader.join(' ')} - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this._innerApiCalls = {}; - - // Put together the "service stub" for - // google.cloud.vision.v1.ProductSearch. - const productSearchStub = gaxGrpc.createStub( - opts.fallback - ? protos.lookupService('google.cloud.vision.v1.ProductSearch') - : protos.google.cloud.vision.v1.ProductSearch, - opts - ); - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const productSearchStubMethods = [ - 'createProductSet', - 'listProductSets', - 'getProductSet', - 'updateProductSet', - 'deleteProductSet', - 'createProduct', - 'listProducts', - 'getProduct', - 'updateProduct', - 'deleteProduct', - 'createReferenceImage', - 'deleteReferenceImage', - 'listReferenceImages', - 'getReferenceImage', - 'addProductToProductSet', - 'removeProductFromProductSet', - 'listProductsInProductSet', - 'importProductSets', - 'purgeProducts', - ]; - for (const methodName of productSearchStubMethods) { - const innerCallPromise = productSearchStub.then( - stub => (...args) => { - return stub[methodName].apply(stub, args); - }, - err => () => { - throw err; - } - ); - this._innerApiCalls[methodName] = gaxModule.createApiCall( - innerCallPromise, - defaults[methodName], - this._descriptors.page[methodName] || - this._descriptors.longrunning[methodName] - ); - } - } - - /** - * The DNS address for this API service. - */ - static get servicePath() { - return 'vision.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - */ - static get apiEndpoint() { - return 'vision.googleapis.com'; - } - - /** - * The port for this API service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloud-vision', - ]; - } - - /** - * Return the project ID used by this class. - * @param {function(Error, string)} callback - the callback to - * be called with the current project Id. - */ - getProjectId(callback) { - return this.auth.getProjectId(callback); - } - - // ------------------- - // -- Service calls -- - // ------------------- - - /** - * Creates and returns a new ProductSet resource. - * - * Possible errors: - * - * * Returns INVALID_ARGUMENT if display_name is missing, or is longer than - * 4096 characters. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project in which the ProductSet should be created. - * - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - * @param {Object} request.productSet - * Required. The ProductSet to create. - * - * This object should have the same structure as [ProductSet]{@link google.cloud.vision.v1.ProductSet} - * @param {string} [request.productSetId] - * A user-supplied resource id for this ProductSet. If set, the server will - * attempt to use this value as the resource id. If it is already in use, an - * error is returned with code ALREADY_EXISTS. Must be at most 128 characters - * long. It cannot contain the character `/`. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [ProductSet]{@link google.cloud.vision.v1.ProductSet}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ProductSet]{@link google.cloud.vision.v1.ProductSet}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * const productSet = {}; - * const request = { - * parent: formattedParent, - * productSet: productSet, - * }; - * client.createProductSet(request) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - createProductSet(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent, - }); - - return this._innerApiCalls.createProductSet(request, options, callback); - } - - /** - * Lists ProductSets in an unspecified order. - * - * Possible errors: - * - * * Returns INVALID_ARGUMENT if page_size is greater than 100, or less - * than 1. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project from which ProductSets should be listed. - * - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - * @param {number} [request.pageSize] - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Array, ?Object, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is Array of [ProductSet]{@link google.cloud.vision.v1.ProductSet}. - * - * When autoPaginate: false is specified through options, it contains the result - * in a single response. If the response indicates the next page exists, the third - * parameter is set to be used for the next request object. The fourth parameter keeps - * the raw response object of an object representing [ListProductSetsResponse]{@link google.cloud.vision.v1.ListProductSetsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [ProductSet]{@link google.cloud.vision.v1.ProductSet}. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [ProductSet]{@link google.cloud.vision.v1.ProductSet} in a single response. - * The second element is the next request object if the response - * indicates the next page exists, or null. The third element is - * an object representing [ListProductSetsResponse]{@link google.cloud.vision.v1.ListProductSetsResponse}. - * - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * // Iterate over all elements. - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * - * client.listProductSets({parent: formattedParent}) - * .then(responses => { - * const resources = responses[0]; - * for (const resource of resources) { - * // doThingsWith(resource) - * } - * }) - * .catch(err => { - * console.error(err); - * }); - * - * // Or obtain the paged response. - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * - * - * const options = {autoPaginate: false}; - * const callback = responses => { - * // The actual resources in a response. - * const resources = responses[0]; - * // The next request if the response shows that there are more responses. - * const nextRequest = responses[1]; - * // The actual response object, if necessary. - * // const rawResponse = responses[2]; - * for (const resource of resources) { - * // doThingsWith(resource); - * } - * if (nextRequest) { - * // Fetch the next page. - * return client.listProductSets(nextRequest, options).then(callback); - * } - * } - * client.listProductSets({parent: formattedParent}, options) - * .then(callback) - * .catch(err => { - * console.error(err); - * }); - */ - listProductSets(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent, - }); - - return this._innerApiCalls.listProductSets(request, options, callback); - } - - /** - * Equivalent to {@link listProductSets}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link listProductSets} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project from which ProductSets should be listed. - * - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - * @param {number} [request.pageSize] - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @returns {Stream} - * An object stream which emits an object representing [ProductSet]{@link google.cloud.vision.v1.ProductSet} on 'data' event. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * client.listProductSetsStream({parent: formattedParent}) - * .on('data', element => { - * // doThingsWith(element) - * }).on('error', err => { - * console.log(err); - * }); - */ - listProductSetsStream(request, options) { - options = options || {}; - - return this._descriptors.page.listProductSets.createStream( - this._innerApiCalls.listProductSets, - request, - options - ); - } - - /** - * Gets information associated with a ProductSet. - * - * Possible errors: - * - * * Returns NOT_FOUND if the ProductSet does not exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the ProductSet to get. - * - * Format is: - * `projects/PROJECT_ID/locations/LOG_ID/productSets/PRODUCT_SET_ID` - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [ProductSet]{@link google.cloud.vision.v1.ProductSet}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ProductSet]{@link google.cloud.vision.v1.ProductSet}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedName = client.productSetPath('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); - * client.getProductSet({name: formattedName}) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - getProductSet(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name, - }); - - return this._innerApiCalls.getProductSet(request, options, callback); - } - - /** - * Makes changes to a ProductSet resource. - * Only display_name can be updated currently. - * - * Possible errors: - * - * * Returns NOT_FOUND if the ProductSet does not exist. - * * Returns INVALID_ARGUMENT if display_name is present in update_mask but - * missing from the request or longer than 4096 characters. - * - * @param {Object} request - * The request object that will be sent. - * @param {Object} request.productSet - * Required. The ProductSet resource which replaces the one on the server. - * - * This object should have the same structure as [ProductSet]{@link google.cloud.vision.v1.ProductSet} - * @param {Object} [request.updateMask] - * The FieldMask that specifies which fields to - * update. - * If update_mask isn't specified, all mutable fields are to be updated. - * Valid mask path is `display_name`. - * - * This object should have the same structure as [FieldMask]{@link google.protobuf.FieldMask} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [ProductSet]{@link google.cloud.vision.v1.ProductSet}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ProductSet]{@link google.cloud.vision.v1.ProductSet}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const productSet = {}; - * client.updateProductSet({productSet: productSet}) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - updateProductSet(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'product_set.name': request.productSet.name, - }); - - return this._innerApiCalls.updateProductSet(request, options, callback); - } - - /** - * Permanently deletes a ProductSet. Products and ReferenceImages in the - * ProductSet are not deleted. - * - * The actual image files are not deleted from Google Cloud Storage. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the ProductSet to delete. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error)} [callback] - * The function which will be called with the result of the API call. - * @returns {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedName = client.productSetPath('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); - * client.deleteProductSet({name: formattedName}).catch(err => { - * console.error(err); - * }); - */ - deleteProductSet(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name, - }); - - return this._innerApiCalls.deleteProductSet(request, options, callback); - } - - /** - * Creates and returns a new product resource. - * - * Possible errors: - * - * * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 - * characters. - * * Returns INVALID_ARGUMENT if description is longer than 4096 characters. - * * Returns INVALID_ARGUMENT if product_category is missing or invalid. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project in which the Product should be created. - * - * Format is - * `projects/PROJECT_ID/locations/LOC_ID`. - * @param {Object} request.product - * Required. The product to create. - * - * This object should have the same structure as [Product]{@link google.cloud.vision.v1.Product} - * @param {string} [request.productId] - * A user-supplied resource id for this Product. If set, the server will - * attempt to use this value as the resource id. If it is already in use, an - * error is returned with code ALREADY_EXISTS. Must be at most 128 characters - * long. It cannot contain the character `/`. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [Product]{@link google.cloud.vision.v1.Product}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Product]{@link google.cloud.vision.v1.Product}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * const product = {}; - * const request = { - * parent: formattedParent, - * product: product, - * }; - * client.createProduct(request) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - createProduct(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent, - }); - - return this._innerApiCalls.createProduct(request, options, callback); - } - - /** - * Lists products in an unspecified order. - * - * Possible errors: - * - * * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project OR ProductSet from which Products should be listed. - * - * Format: - * `projects/PROJECT_ID/locations/LOC_ID` - * @param {number} [request.pageSize] - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Array, ?Object, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is Array of [Product]{@link google.cloud.vision.v1.Product}. - * - * When autoPaginate: false is specified through options, it contains the result - * in a single response. If the response indicates the next page exists, the third - * parameter is set to be used for the next request object. The fourth parameter keeps - * the raw response object of an object representing [ListProductsResponse]{@link google.cloud.vision.v1.ListProductsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Product]{@link google.cloud.vision.v1.Product}. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [Product]{@link google.cloud.vision.v1.Product} in a single response. - * The second element is the next request object if the response - * indicates the next page exists, or null. The third element is - * an object representing [ListProductsResponse]{@link google.cloud.vision.v1.ListProductsResponse}. - * - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * // Iterate over all elements. - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * - * client.listProducts({parent: formattedParent}) - * .then(responses => { - * const resources = responses[0]; - * for (const resource of resources) { - * // doThingsWith(resource) - * } - * }) - * .catch(err => { - * console.error(err); - * }); - * - * // Or obtain the paged response. - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * - * - * const options = {autoPaginate: false}; - * const callback = responses => { - * // The actual resources in a response. - * const resources = responses[0]; - * // The next request if the response shows that there are more responses. - * const nextRequest = responses[1]; - * // The actual response object, if necessary. - * // const rawResponse = responses[2]; - * for (const resource of resources) { - * // doThingsWith(resource); - * } - * if (nextRequest) { - * // Fetch the next page. - * return client.listProducts(nextRequest, options).then(callback); - * } - * } - * client.listProducts({parent: formattedParent}, options) - * .then(callback) - * .catch(err => { - * console.error(err); - * }); - */ - listProducts(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent, - }); - - return this._innerApiCalls.listProducts(request, options, callback); - } - - /** - * Equivalent to {@link listProducts}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link listProducts} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project OR ProductSet from which Products should be listed. - * - * Format: - * `projects/PROJECT_ID/locations/LOC_ID` - * @param {number} [request.pageSize] - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @returns {Stream} - * An object stream which emits an object representing [Product]{@link google.cloud.vision.v1.Product} on 'data' event. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * client.listProductsStream({parent: formattedParent}) - * .on('data', element => { - * // doThingsWith(element) - * }).on('error', err => { - * console.log(err); - * }); - */ - listProductsStream(request, options) { - options = options || {}; - - return this._descriptors.page.listProducts.createStream( - this._innerApiCalls.listProducts, - request, - options - ); - } - - /** - * Gets information associated with a Product. - * - * Possible errors: - * - * * Returns NOT_FOUND if the Product does not exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the Product to get. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [Product]{@link google.cloud.vision.v1.Product}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Product]{@link google.cloud.vision.v1.Product}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedName = client.productPath('[PROJECT]', '[LOCATION]', '[PRODUCT]'); - * client.getProduct({name: formattedName}) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - getProduct(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name, - }); - - return this._innerApiCalls.getProduct(request, options, callback); - } - - /** - * Makes changes to a Product resource. - * Only the `display_name`, `description`, and `labels` fields can be updated - * right now. - * - * If labels are updated, the change will not be reflected in queries until - * the next index time. - * - * Possible errors: - * - * * Returns NOT_FOUND if the Product does not exist. - * * Returns INVALID_ARGUMENT if display_name is present in update_mask but is - * missing from the request or longer than 4096 characters. - * * Returns INVALID_ARGUMENT if description is present in update_mask but is - * longer than 4096 characters. - * * Returns INVALID_ARGUMENT if product_category is present in update_mask. - * - * @param {Object} request - * The request object that will be sent. - * @param {Object} request.product - * Required. The Product resource which replaces the one on the server. - * product.name is immutable. - * - * This object should have the same structure as [Product]{@link google.cloud.vision.v1.Product} - * @param {Object} [request.updateMask] - * The FieldMask that specifies which fields - * to update. - * If update_mask isn't specified, all mutable fields are to be updated. - * Valid mask paths include `product_labels`, `display_name`, and - * `description`. - * - * This object should have the same structure as [FieldMask]{@link google.protobuf.FieldMask} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [Product]{@link google.cloud.vision.v1.Product}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Product]{@link google.cloud.vision.v1.Product}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const product = {}; - * client.updateProduct({product: product}) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - updateProduct(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'product.name': request.product.name, - }); - - return this._innerApiCalls.updateProduct(request, options, callback); - } - - /** - * Permanently deletes a product and its reference images. - * - * Metadata of the product and all its images will be deleted right away, but - * search queries against ProductSets containing the product may still work - * until all related caches are refreshed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of product to delete. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error)} [callback] - * The function which will be called with the result of the API call. - * @returns {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedName = client.productPath('[PROJECT]', '[LOCATION]', '[PRODUCT]'); - * client.deleteProduct({name: formattedName}).catch(err => { - * console.error(err); - * }); - */ - deleteProduct(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name, - }); - - return this._innerApiCalls.deleteProduct(request, options, callback); - } - - /** - * Creates and returns a new ReferenceImage resource. - * - * The `bounding_poly` field is optional. If `bounding_poly` is not specified, - * the system will try to detect regions of interest in the image that are - * compatible with the product_category on the parent product. If it is - * specified, detection is ALWAYS skipped. The system converts polygons into - * non-rotated rectangles. - * - * Note that the pipeline will resize the image if the image resolution is too - * large to process (above 50MP). - * - * Possible errors: - * - * * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 - * characters. - * * Returns INVALID_ARGUMENT if the product does not exist. - * * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing - * compatible with the parent product's product_category is detected. - * * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the product in which to create the reference image. - * - * Format is - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. - * @param {Object} request.referenceImage - * Required. The reference image to create. - * If an image ID is specified, it is ignored. - * - * This object should have the same structure as [ReferenceImage]{@link google.cloud.vision.v1.ReferenceImage} - * @param {string} [request.referenceImageId] - * A user-supplied resource id for the ReferenceImage to be added. If set, - * the server will attempt to use this value as the resource id. If it is - * already in use, an error is returned with code ALREADY_EXISTS. Must be at - * most 128 characters long. It cannot contain the character `/`. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [ReferenceImage]{@link google.cloud.vision.v1.ReferenceImage}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ReferenceImage]{@link google.cloud.vision.v1.ReferenceImage}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedParent = client.productPath('[PROJECT]', '[LOCATION]', '[PRODUCT]'); - * const referenceImage = {}; - * const request = { - * parent: formattedParent, - * referenceImage: referenceImage, - * }; - * client.createReferenceImage(request) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - createReferenceImage(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent, - }); - - return this._innerApiCalls.createReferenceImage(request, options, callback); - } - - /** - * Permanently deletes a reference image. - * - * The image metadata will be deleted right away, but search queries - * against ProductSets containing the image may still work until all related - * caches are refreshed. - * - * The actual image files are not deleted from Google Cloud Storage. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the reference image to delete. - * - * Format is: - * - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error)} [callback] - * The function which will be called with the result of the API call. - * @returns {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedName = client.referenceImagePath('[PROJECT]', '[LOCATION]', '[PRODUCT]', '[REFERENCE_IMAGE]'); - * client.deleteReferenceImage({name: formattedName}).catch(err => { - * console.error(err); - * }); - */ - deleteReferenceImage(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name, - }); - - return this._innerApiCalls.deleteReferenceImage(request, options, callback); - } - - /** - * Lists reference images. - * - * Possible errors: - * - * * Returns NOT_FOUND if the parent product does not exist. - * * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less - * than 1. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the product containing the reference images. - * - * Format is - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. - * @param {number} [request.pageSize] - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Array, ?Object, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is Array of [ReferenceImage]{@link google.cloud.vision.v1.ReferenceImage}. - * - * When autoPaginate: false is specified through options, it contains the result - * in a single response. If the response indicates the next page exists, the third - * parameter is set to be used for the next request object. The fourth parameter keeps - * the raw response object of an object representing [ListReferenceImagesResponse]{@link google.cloud.vision.v1.ListReferenceImagesResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [ReferenceImage]{@link google.cloud.vision.v1.ReferenceImage}. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [ReferenceImage]{@link google.cloud.vision.v1.ReferenceImage} in a single response. - * The second element is the next request object if the response - * indicates the next page exists, or null. The third element is - * an object representing [ListReferenceImagesResponse]{@link google.cloud.vision.v1.ListReferenceImagesResponse}. - * - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * // Iterate over all elements. - * const formattedParent = client.productPath('[PROJECT]', '[LOCATION]', '[PRODUCT]'); - * - * client.listReferenceImages({parent: formattedParent}) - * .then(responses => { - * const resources = responses[0]; - * for (const resource of resources) { - * // doThingsWith(resource) - * } - * }) - * .catch(err => { - * console.error(err); - * }); - * - * // Or obtain the paged response. - * const formattedParent = client.productPath('[PROJECT]', '[LOCATION]', '[PRODUCT]'); - * - * - * const options = {autoPaginate: false}; - * const callback = responses => { - * // The actual resources in a response. - * const resources = responses[0]; - * // The next request if the response shows that there are more responses. - * const nextRequest = responses[1]; - * // The actual response object, if necessary. - * // const rawResponse = responses[2]; - * for (const resource of resources) { - * // doThingsWith(resource); - * } - * if (nextRequest) { - * // Fetch the next page. - * return client.listReferenceImages(nextRequest, options).then(callback); - * } - * } - * client.listReferenceImages({parent: formattedParent}, options) - * .then(callback) - * .catch(err => { - * console.error(err); - * }); - */ - listReferenceImages(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent, - }); - - return this._innerApiCalls.listReferenceImages(request, options, callback); - } - - /** - * Equivalent to {@link listReferenceImages}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link listReferenceImages} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the product containing the reference images. - * - * Format is - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. - * @param {number} [request.pageSize] - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @returns {Stream} - * An object stream which emits an object representing [ReferenceImage]{@link google.cloud.vision.v1.ReferenceImage} on 'data' event. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedParent = client.productPath('[PROJECT]', '[LOCATION]', '[PRODUCT]'); - * client.listReferenceImagesStream({parent: formattedParent}) - * .on('data', element => { - * // doThingsWith(element) - * }).on('error', err => { - * console.log(err); - * }); - */ - listReferenceImagesStream(request, options) { - options = options || {}; - - return this._descriptors.page.listReferenceImages.createStream( - this._innerApiCalls.listReferenceImages, - request, - options - ); - } - - /** - * Gets information associated with a ReferenceImage. - * - * Possible errors: - * - * * Returns NOT_FOUND if the specified image does not exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ReferenceImage to get. - * - * Format is: - * - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [ReferenceImage]{@link google.cloud.vision.v1.ReferenceImage}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ReferenceImage]{@link google.cloud.vision.v1.ReferenceImage}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedName = client.referenceImagePath('[PROJECT]', '[LOCATION]', '[PRODUCT]', '[REFERENCE_IMAGE]'); - * client.getReferenceImage({name: formattedName}) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - getReferenceImage(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name, - }); - - return this._innerApiCalls.getReferenceImage(request, options, callback); - } - - /** - * Adds a Product to the specified ProductSet. If the Product is already - * present, no change is made. - * - * One Product can be added to at most 100 ProductSets. - * - * Possible errors: - * - * * Returns NOT_FOUND if the Product or the ProductSet doesn't exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for the ProductSet to modify. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * @param {string} request.product - * Required. The resource name for the Product to be added to this ProductSet. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error)} [callback] - * The function which will be called with the result of the API call. - * @returns {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedName = client.productSetPath('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); - * const formattedProduct = client.productPath('[PROJECT]', '[LOCATION]', '[PRODUCT]'); - * const request = { - * name: formattedName, - * product: formattedProduct, - * }; - * client.addProductToProductSet(request).catch(err => { - * console.error(err); - * }); - */ - addProductToProductSet(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name, - }); - - return this._innerApiCalls.addProductToProductSet( - request, - options, - callback - ); - } - - /** - * Removes a Product from the specified ProductSet. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for the ProductSet to modify. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * @param {string} request.product - * Required. The resource name for the Product to be removed from this ProductSet. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error)} [callback] - * The function which will be called with the result of the API call. - * @returns {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedName = client.productSetPath('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); - * const formattedProduct = client.productPath('[PROJECT]', '[LOCATION]', '[PRODUCT]'); - * const request = { - * name: formattedName, - * product: formattedProduct, - * }; - * client.removeProductFromProductSet(request).catch(err => { - * console.error(err); - * }); - */ - removeProductFromProductSet(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name, - }); - - return this._innerApiCalls.removeProductFromProductSet( - request, - options, - callback - ); - } - - /** - * Lists the Products in a ProductSet, in an unspecified order. If the - * ProductSet does not exist, the products field of the response will be - * empty. - * - * Possible errors: - * - * * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The ProductSet resource for which to retrieve Products. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * @param {number} [request.pageSize] - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Array, ?Object, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is Array of [Product]{@link google.cloud.vision.v1.Product}. - * - * When autoPaginate: false is specified through options, it contains the result - * in a single response. If the response indicates the next page exists, the third - * parameter is set to be used for the next request object. The fourth parameter keeps - * the raw response object of an object representing [ListProductsInProductSetResponse]{@link google.cloud.vision.v1.ListProductsInProductSetResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Product]{@link google.cloud.vision.v1.Product}. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [Product]{@link google.cloud.vision.v1.Product} in a single response. - * The second element is the next request object if the response - * indicates the next page exists, or null. The third element is - * an object representing [ListProductsInProductSetResponse]{@link google.cloud.vision.v1.ListProductsInProductSetResponse}. - * - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * // Iterate over all elements. - * const formattedName = client.productSetPath('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); - * - * client.listProductsInProductSet({name: formattedName}) - * .then(responses => { - * const resources = responses[0]; - * for (const resource of resources) { - * // doThingsWith(resource) - * } - * }) - * .catch(err => { - * console.error(err); - * }); - * - * // Or obtain the paged response. - * const formattedName = client.productSetPath('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); - * - * - * const options = {autoPaginate: false}; - * const callback = responses => { - * // The actual resources in a response. - * const resources = responses[0]; - * // The next request if the response shows that there are more responses. - * const nextRequest = responses[1]; - * // The actual response object, if necessary. - * // const rawResponse = responses[2]; - * for (const resource of resources) { - * // doThingsWith(resource); - * } - * if (nextRequest) { - * // Fetch the next page. - * return client.listProductsInProductSet(nextRequest, options).then(callback); - * } - * } - * client.listProductsInProductSet({name: formattedName}, options) - * .then(callback) - * .catch(err => { - * console.error(err); - * }); - */ - listProductsInProductSet(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name, - }); - - return this._innerApiCalls.listProductsInProductSet( - request, - options, - callback - ); - } - - /** - * Equivalent to {@link listProductsInProductSet}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link listProductsInProductSet} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The ProductSet resource for which to retrieve Products. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * @param {number} [request.pageSize] - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @returns {Stream} - * An object stream which emits an object representing [Product]{@link google.cloud.vision.v1.Product} on 'data' event. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedName = client.productSetPath('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); - * client.listProductsInProductSetStream({name: formattedName}) - * .on('data', element => { - * // doThingsWith(element) - * }).on('error', err => { - * console.log(err); - * }); - */ - listProductsInProductSetStream(request, options) { - options = options || {}; - - return this._descriptors.page.listProductsInProductSet.createStream( - this._innerApiCalls.listProductsInProductSet, - request, - options - ); - } - - /** - * Asynchronous API that imports a list of reference images to specified - * product sets based on a list of image information. - * - * The google.longrunning.Operation API can be used to keep track of the - * progress and results of the request. - * `Operation.metadata` contains `BatchOperationMetadata`. (progress) - * `Operation.response` contains `ImportProductSetsResponse`. (results) - * - * The input source of this method is a csv file on Google Cloud Storage. - * For the format of the csv file please see - * ImportProductSetsGcsSource.csv_file_uri. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project in which the ProductSets should be imported. - * - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - * @param {Object} request.inputConfig - * Required. The input content for the list of requests. - * - * This object should have the same structure as [ImportProductSetsInputConfig]{@link google.cloud.vision.v1.ImportProductSetsInputConfig} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/classes/Operation.html} object. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/classes/Operation.html} object. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * const inputConfig = {}; - * const request = { - * parent: formattedParent, - * inputConfig: inputConfig, - * }; - * - * // Handle the operation using the promise pattern. - * client.importProductSets(request) - * .then(responses => { - * const [operation, initialApiResponse] = responses; - * - * // Operation#promise starts polling for the completion of the LRO. - * return operation.promise(); - * }) - * .then(responses => { - * const result = responses[0]; - * const metadata = responses[1]; - * const finalApiResponse = responses[2]; - * }) - * .catch(err => { - * console.error(err); - * }); - * - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * const inputConfig = {}; - * const request = { - * parent: formattedParent, - * inputConfig: inputConfig, - * }; - * - * // Handle the operation using the event emitter pattern. - * client.importProductSets(request) - * .then(responses => { - * const [operation, initialApiResponse] = responses; - * - * // Adding a listener for the "complete" event starts polling for the - * // completion of the operation. - * operation.on('complete', (result, metadata, finalApiResponse) => { - * // doSomethingWith(result); - * }); - * - * // Adding a listener for the "progress" event causes the callback to be - * // called on any change in metadata when the operation is polled. - * operation.on('progress', (metadata, apiResponse) => { - * // doSomethingWith(metadata) - * }); - * - * // Adding a listener for the "error" event handles any errors found during polling. - * operation.on('error', err => { - * // throw(err); - * }); - * }) - * .catch(err => { - * console.error(err); - * }); - * - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * const inputConfig = {}; - * const request = { - * parent: formattedParent, - * inputConfig: inputConfig, - * }; - * - * // Handle the operation using the await pattern. - * const [operation] = await client.importProductSets(request); - * - * const [response] = await operation.promise(); - */ - importProductSets(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent, - }); - - return this._innerApiCalls.importProductSets(request, options, callback); - } - - /** - * Asynchronous API to delete all Products in a ProductSet or all Products - * that are in no ProductSet. - * - * If a Product is a member of the specified ProductSet in addition to other - * ProductSets, the Product will still be deleted. - * - * It is recommended to not delete the specified ProductSet until after this - * operation has completed. It is also recommended to not add any of the - * Products involved in the batch delete to a new ProductSet while this - * operation is running because those Products may still end up deleted. - * - * It's not possible to undo the PurgeProducts operation. Therefore, it is - * recommended to keep the csv files used in ImportProductSets (if that was - * how you originally built the Product Set) before starting PurgeProducts, in - * case you need to re-import the data after deletion. - * - * If the plan is to purge all of the Products from a ProductSet and then - * re-use the empty ProductSet to re-import new Products into the empty - * ProductSet, you must wait until the PurgeProducts operation has finished - * for that ProductSet. - * - * The google.longrunning.Operation API can be used to keep track of the - * progress and results of the request. - * `Operation.metadata` contains `BatchOperationMetadata`. (progress) - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project and location in which the Products should be deleted. - * - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - * @param {Object} [request.productSetPurgeConfig] - * Specify which ProductSet contains the Products to be deleted. - * - * This object should have the same structure as [ProductSetPurgeConfig]{@link google.cloud.vision.v1.ProductSetPurgeConfig} - * @param {boolean} [request.deleteOrphanProducts] - * If delete_orphan_products is true, all Products that are not in any - * ProductSet will be deleted. - * @param {boolean} [request.force] - * The default value is false. Override this value to true to actually perform - * the purge. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/classes/Operation.html} object. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/classes/Operation.html} object. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * - * // Handle the operation using the promise pattern. - * client.purgeProducts({parent: formattedParent}) - * .then(responses => { - * const [operation, initialApiResponse] = responses; - * - * // Operation#promise starts polling for the completion of the LRO. - * return operation.promise(); - * }) - * .then(responses => { - * const result = responses[0]; - * const metadata = responses[1]; - * const finalApiResponse = responses[2]; - * }) - * .catch(err => { - * console.error(err); - * }); - * - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * - * // Handle the operation using the event emitter pattern. - * client.purgeProducts({parent: formattedParent}) - * .then(responses => { - * const [operation, initialApiResponse] = responses; - * - * // Adding a listener for the "complete" event starts polling for the - * // completion of the operation. - * operation.on('complete', (result, metadata, finalApiResponse) => { - * // doSomethingWith(result); - * }); - * - * // Adding a listener for the "progress" event causes the callback to be - * // called on any change in metadata when the operation is polled. - * operation.on('progress', (metadata, apiResponse) => { - * // doSomethingWith(metadata) - * }); - * - * // Adding a listener for the "error" event handles any errors found during polling. - * operation.on('error', err => { - * // throw(err); - * }); - * }) - * .catch(err => { - * console.error(err); - * }); - * - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * - * // Handle the operation using the await pattern. - * const [operation] = await client.purgeProducts({parent: formattedParent}); - * - * const [response] = await operation.promise(); - */ - purgeProducts(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent, - }); - - return this._innerApiCalls.purgeProducts(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified location resource name string. - * - * @param {String} project - * @param {String} location - * @returns {String} - */ - locationPath(project, location) { - return this._pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {String} project - * @param {String} location - * @param {String} product - * @returns {String} - */ - productPath(project, location, product) { - return this._pathTemplates.productPathTemplate.render({ - project: project, - location: location, - product: product, - }); - } - - /** - * Return a fully-qualified product_set resource name string. - * - * @param {String} project - * @param {String} location - * @param {String} productSet - * @returns {String} - */ - productSetPath(project, location, productSet) { - return this._pathTemplates.productSetPathTemplate.render({ - project: project, - location: location, - product_set: productSet, - }); - } - - /** - * Return a fully-qualified reference_image resource name string. - * - * @param {String} project - * @param {String} location - * @param {String} product - * @param {String} referenceImage - * @returns {String} - */ - referenceImagePath(project, location, product, referenceImage) { - return this._pathTemplates.referenceImagePathTemplate.render({ - project: project, - location: location, - product: product, - reference_image: referenceImage, - }); - } - - /** - * Parse the locationName from a location resource. - * - * @param {String} locationName - * A fully-qualified path representing a location resources. - * @returns {String} - A string representing the project. - */ - matchProjectFromLocationName(locationName) { - return this._pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the locationName from a location resource. - * - * @param {String} locationName - * A fully-qualified path representing a location resources. - * @returns {String} - A string representing the location. - */ - matchLocationFromLocationName(locationName) { - return this._pathTemplates.locationPathTemplate.match(locationName) - .location; - } - - /** - * Parse the productName from a product resource. - * - * @param {String} productName - * A fully-qualified path representing a product resources. - * @returns {String} - A string representing the project. - */ - matchProjectFromProductName(productName) { - return this._pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the productName from a product resource. - * - * @param {String} productName - * A fully-qualified path representing a product resources. - * @returns {String} - A string representing the location. - */ - matchLocationFromProductName(productName) { - return this._pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the productName from a product resource. - * - * @param {String} productName - * A fully-qualified path representing a product resources. - * @returns {String} - A string representing the product. - */ - matchProductFromProductName(productName) { - return this._pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Parse the productSetName from a product_set resource. - * - * @param {String} productSetName - * A fully-qualified path representing a product_set resources. - * @returns {String} - A string representing the project. - */ - matchProjectFromProductSetName(productSetName) { - return this._pathTemplates.productSetPathTemplate.match(productSetName) - .project; - } - - /** - * Parse the productSetName from a product_set resource. - * - * @param {String} productSetName - * A fully-qualified path representing a product_set resources. - * @returns {String} - A string representing the location. - */ - matchLocationFromProductSetName(productSetName) { - return this._pathTemplates.productSetPathTemplate.match(productSetName) - .location; - } - - /** - * Parse the productSetName from a product_set resource. - * - * @param {String} productSetName - * A fully-qualified path representing a product_set resources. - * @returns {String} - A string representing the product_set. - */ - matchProductSetFromProductSetName(productSetName) { - return this._pathTemplates.productSetPathTemplate.match(productSetName) - .product_set; - } - - /** - * Parse the referenceImageName from a reference_image resource. - * - * @param {String} referenceImageName - * A fully-qualified path representing a reference_image resources. - * @returns {String} - A string representing the project. - */ - matchProjectFromReferenceImageName(referenceImageName) { - return this._pathTemplates.referenceImagePathTemplate.match( - referenceImageName - ).project; - } - - /** - * Parse the referenceImageName from a reference_image resource. - * - * @param {String} referenceImageName - * A fully-qualified path representing a reference_image resources. - * @returns {String} - A string representing the location. - */ - matchLocationFromReferenceImageName(referenceImageName) { - return this._pathTemplates.referenceImagePathTemplate.match( - referenceImageName - ).location; - } - - /** - * Parse the referenceImageName from a reference_image resource. - * - * @param {String} referenceImageName - * A fully-qualified path representing a reference_image resources. - * @returns {String} - A string representing the product. - */ - matchProductFromReferenceImageName(referenceImageName) { - return this._pathTemplates.referenceImagePathTemplate.match( - referenceImageName - ).product; - } - - /** - * Parse the referenceImageName from a reference_image resource. - * - * @param {String} referenceImageName - * A fully-qualified path representing a reference_image resources. - * @returns {String} - A string representing the reference_image. - */ - matchReferenceImageFromReferenceImageName(referenceImageName) { - return this._pathTemplates.referenceImagePathTemplate.match( - referenceImageName - ).reference_image; - } -} - -module.exports = ProductSearchClient; diff --git a/packages/google-cloud-vision/src/v1/product_search_client.ts b/packages/google-cloud-vision/src/v1/product_search_client.ts new file mode 100644 index 00000000000..b2cc76da757 --- /dev/null +++ b/packages/google-cloud-vision/src/v1/product_search_client.ts @@ -0,0 +1,2544 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as gax from 'google-gax'; +import { + APICallback, + Callback, + CallOptions, + Descriptors, + ClientOptions, + LROperation, + PaginationCallback, + PaginationResponse, +} from 'google-gax'; +import * as path from 'path'; + +import {Transform} from 'stream'; +import * as protosTypes from '../../protos/protos'; +import * as gapicConfig from './product_search_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Manages Products and ProductSets of reference images for use in product + * search. It uses the following resource model: + * + * - The API has a collection of [ProductSet][google.cloud.vision.v1.ProductSet] resources, named + * `projects/* /locations/* /productSets/*`, which acts as a way to put different + * products into groups to limit identification. + * + * In parallel, + * + * - The API has a collection of [Product][google.cloud.vision.v1.Product] resources, named + * `projects/* /locations/* /products/*` + * + * - Each [Product][google.cloud.vision.v1.Product] has a collection of [ReferenceImage][google.cloud.vision.v1.ReferenceImage] resources, named + * `projects/* /locations/* /products/* /referenceImages/*` + * @class + * @memberof v1 + */ +export class ProductSearchClient { + private _descriptors: Descriptors = {page: {}, stream: {}, longrunning: {}}; + private _innerApiCalls: {[name: string]: Function}; + private _pathTemplates: {[name: string]: gax.PathTemplate}; + private _terminated = false; + auth: gax.GoogleAuth; + operationsClient: gax.OperationsClient; + productSearchStub: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ProductSearchClient. + * + * @param {object} [options] - The configuration object. See the subsequent + * parameters for more details. + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {function} [options.promise] - Custom promise module to use instead + * of native Promises. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + */ + + constructor(opts?: ClientOptions) { + // Ensure that options include the service address and port. + const staticMembers = this.constructor as typeof ProductSearchClient; + const servicePath = + opts && opts.servicePath + ? opts.servicePath + : opts && opts.apiEndpoint + ? opts.apiEndpoint + : staticMembers.servicePath; + const port = opts && opts.port ? opts.port : staticMembers.port; + + if (!opts) { + opts = {servicePath, port}; + } + opts.servicePath = opts.servicePath || servicePath; + opts.port = opts.port || port; + opts.clientConfig = opts.clientConfig || {}; + + const isBrowser = typeof window !== 'undefined'; + if (isBrowser) { + opts.fallback = true; + } + // If we are in browser, we are already using fallback because of the + // "browser" field in package.json. + // But if we were explicitly requested to use fallback, let's do it now. + const gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options + // sent to the client. + opts.scopes = (this.constructor as typeof ProductSearchClient).scopes; + const gaxGrpc = new gaxModule.GrpcClient(opts); + + // Save the auth object to the client, for use by other methods. + this.auth = gaxGrpc.auth as gax.GoogleAuth; + + // Determine the client header string. + const clientHeader = [`gax/${gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + const protos = gaxGrpc.loadProto( + opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this._pathTemplates = { + locationPathTemplate: new gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + productPathTemplate: new gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/products/{product}' + ), + productSetPathTemplate: new gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/productSets/{product_set}' + ), + referenceImagePathTemplate: new gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this._descriptors.page = { + listProductSets: new gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'productSets' + ), + listProducts: new gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'products' + ), + listReferenceImages: new gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'referenceImages' + ), + listProductsInProductSet: new gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'products' + ), + }; + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const protoFilesRoot = opts.fallback + ? gaxModule.protobuf.Root.fromJSON(require('../../protos/protos.json')) + : gaxModule.protobuf.loadSync(nodejsProtoPath); + + this.operationsClient = gaxModule + .lro({ + auth: this.auth, + grpc: 'grpc' in gaxGrpc ? gaxGrpc.grpc : undefined, + }) + .operationsClient(opts); + const importProductSetsResponse = protoFilesRoot.lookup( + '.google.cloud.vision.v1.ImportProductSetsResponse' + ) as gax.protobuf.Type; + const importProductSetsMetadata = protoFilesRoot.lookup( + '.google.cloud.vision.v1.BatchOperationMetadata' + ) as gax.protobuf.Type; + const purgeProductsResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const purgeProductsMetadata = protoFilesRoot.lookup( + '.google.cloud.vision.v1.BatchOperationMetadata' + ) as gax.protobuf.Type; + + this._descriptors.longrunning = { + importProductSets: new gaxModule.LongrunningDescriptor( + this.operationsClient, + importProductSetsResponse.decode.bind(importProductSetsResponse), + importProductSetsMetadata.decode.bind(importProductSetsMetadata) + ), + purgeProducts: new gaxModule.LongrunningDescriptor( + this.operationsClient, + purgeProductsResponse.decode.bind(purgeProductsResponse), + purgeProductsMetadata.decode.bind(purgeProductsMetadata) + ), + }; + + // Put together the default options sent with requests. + const defaults = gaxGrpc.constructSettings( + 'google.cloud.vision.v1.ProductSearch', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this._innerApiCalls = {}; + + // Put together the "service stub" for + // google.cloud.vision.v1.ProductSearch. + this.productSearchStub = gaxGrpc.createStub( + opts.fallback + ? (protos as protobuf.Root).lookupService( + 'google.cloud.vision.v1.ProductSearch' + ) + : // tslint:disable-next-line no-any + (protos as any).google.cloud.vision.v1.ProductSearch, + opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const productSearchStubMethods = [ + 'createProductSet', + 'listProductSets', + 'getProductSet', + 'updateProductSet', + 'deleteProductSet', + 'createProduct', + 'listProducts', + 'getProduct', + 'updateProduct', + 'deleteProduct', + 'createReferenceImage', + 'deleteReferenceImage', + 'listReferenceImages', + 'getReferenceImage', + 'addProductToProductSet', + 'removeProductFromProductSet', + 'listProductsInProductSet', + 'importProductSets', + 'purgeProducts', + ]; + + for (const methodName of productSearchStubMethods) { + const innerCallPromise = this.productSearchStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + return stub[methodName].apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const apiCall = gaxModule.createApiCall( + innerCallPromise, + defaults[methodName], + this._descriptors.page[methodName] || + this._descriptors.stream[methodName] || + this._descriptors.longrunning[methodName] + ); + + this._innerApiCalls[methodName] = ( + argument: {}, + callOptions?: CallOptions, + callback?: APICallback + ) => { + return apiCall(argument, callOptions, callback); + }; + } + } + + /** + * The DNS address for this API service. + */ + static get servicePath() { + return 'vision.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + */ + static get apiEndpoint() { + return 'vision.googleapis.com'; + } + + /** + * The port for this API service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/cloud-vision', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @param {function(Error, string)} callback - the callback to + * be called with the current project Id. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + createProductSet( + request: protosTypes.google.cloud.vision.v1.ICreateProductSetRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1.IProductSet, + protosTypes.google.cloud.vision.v1.ICreateProductSetRequest | undefined, + {} | undefined + ] + >; + createProductSet( + request: protosTypes.google.cloud.vision.v1.ICreateProductSetRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1.IProductSet, + protosTypes.google.cloud.vision.v1.ICreateProductSetRequest | undefined, + {} | undefined + > + ): void; + /** + * Creates and returns a new ProductSet resource. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if display_name is missing, or is longer than + * 4096 characters. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project in which the ProductSet should be created. + * + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @param {google.cloud.vision.v1.ProductSet} request.productSet + * Required. The ProductSet to create. + * @param {string} request.productSetId + * A user-supplied resource id for this ProductSet. If set, the server will + * attempt to use this value as the resource id. If it is already in use, an + * error is returned with code ALREADY_EXISTS. Must be at most 128 characters + * long. It cannot contain the character `/`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ProductSet]{@link google.cloud.vision.v1.ProductSet}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + createProductSet( + request: protosTypes.google.cloud.vision.v1.ICreateProductSetRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1.IProductSet, + | protosTypes.google.cloud.vision.v1.ICreateProductSetRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1.IProductSet, + protosTypes.google.cloud.vision.v1.ICreateProductSetRequest | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1.IProductSet, + protosTypes.google.cloud.vision.v1.ICreateProductSetRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.createProductSet(request, options, callback); + } + getProductSet( + request: protosTypes.google.cloud.vision.v1.IGetProductSetRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1.IProductSet, + protosTypes.google.cloud.vision.v1.IGetProductSetRequest | undefined, + {} | undefined + ] + >; + getProductSet( + request: protosTypes.google.cloud.vision.v1.IGetProductSetRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1.IProductSet, + protosTypes.google.cloud.vision.v1.IGetProductSetRequest | undefined, + {} | undefined + > + ): void; + /** + * Gets information associated with a ProductSet. + * + * Possible errors: + * + * * Returns NOT_FOUND if the ProductSet does not exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the ProductSet to get. + * + * Format is: + * `projects/PROJECT_ID/locations/LOG_ID/productSets/PRODUCT_SET_ID` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ProductSet]{@link google.cloud.vision.v1.ProductSet}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getProductSet( + request: protosTypes.google.cloud.vision.v1.IGetProductSetRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1.IProductSet, + protosTypes.google.cloud.vision.v1.IGetProductSetRequest | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1.IProductSet, + protosTypes.google.cloud.vision.v1.IGetProductSetRequest | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1.IProductSet, + protosTypes.google.cloud.vision.v1.IGetProductSetRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.getProductSet(request, options, callback); + } + updateProductSet( + request: protosTypes.google.cloud.vision.v1.IUpdateProductSetRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1.IProductSet, + protosTypes.google.cloud.vision.v1.IUpdateProductSetRequest | undefined, + {} | undefined + ] + >; + updateProductSet( + request: protosTypes.google.cloud.vision.v1.IUpdateProductSetRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1.IProductSet, + protosTypes.google.cloud.vision.v1.IUpdateProductSetRequest | undefined, + {} | undefined + > + ): void; + /** + * Makes changes to a ProductSet resource. + * Only display_name can be updated currently. + * + * Possible errors: + * + * * Returns NOT_FOUND if the ProductSet does not exist. + * * Returns INVALID_ARGUMENT if display_name is present in update_mask but + * missing from the request or longer than 4096 characters. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.vision.v1.ProductSet} request.productSet + * Required. The ProductSet resource which replaces the one on the server. + * @param {google.protobuf.FieldMask} request.updateMask + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields to + * update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask path is `display_name`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ProductSet]{@link google.cloud.vision.v1.ProductSet}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + updateProductSet( + request: protosTypes.google.cloud.vision.v1.IUpdateProductSetRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1.IProductSet, + | protosTypes.google.cloud.vision.v1.IUpdateProductSetRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1.IProductSet, + protosTypes.google.cloud.vision.v1.IUpdateProductSetRequest | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1.IProductSet, + protosTypes.google.cloud.vision.v1.IUpdateProductSetRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'product_set.name': request.productSet!.name || '', + }); + return this._innerApiCalls.updateProductSet(request, options, callback); + } + deleteProductSet( + request: protosTypes.google.cloud.vision.v1.IDeleteProductSetRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + protosTypes.google.cloud.vision.v1.IDeleteProductSetRequest | undefined, + {} | undefined + ] + >; + deleteProductSet( + request: protosTypes.google.cloud.vision.v1.IDeleteProductSetRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.protobuf.IEmpty, + protosTypes.google.cloud.vision.v1.IDeleteProductSetRequest | undefined, + {} | undefined + > + ): void; + /** + * Permanently deletes a ProductSet. Products and ReferenceImages in the + * ProductSet are not deleted. + * + * The actual image files are not deleted from Google Cloud Storage. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the ProductSet to delete. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + deleteProductSet( + request: protosTypes.google.cloud.vision.v1.IDeleteProductSetRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1.IDeleteProductSetRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.protobuf.IEmpty, + protosTypes.google.cloud.vision.v1.IDeleteProductSetRequest | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + protosTypes.google.cloud.vision.v1.IDeleteProductSetRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.deleteProductSet(request, options, callback); + } + createProduct( + request: protosTypes.google.cloud.vision.v1.ICreateProductRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1.IProduct, + protosTypes.google.cloud.vision.v1.ICreateProductRequest | undefined, + {} | undefined + ] + >; + createProduct( + request: protosTypes.google.cloud.vision.v1.ICreateProductRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1.IProduct, + protosTypes.google.cloud.vision.v1.ICreateProductRequest | undefined, + {} | undefined + > + ): void; + /** + * Creates and returns a new product resource. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 + * characters. + * * Returns INVALID_ARGUMENT if description is longer than 4096 characters. + * * Returns INVALID_ARGUMENT if product_category is missing or invalid. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project in which the Product should be created. + * + * Format is + * `projects/PROJECT_ID/locations/LOC_ID`. + * @param {google.cloud.vision.v1.Product} request.product + * Required. The product to create. + * @param {string} request.productId + * A user-supplied resource id for this Product. If set, the server will + * attempt to use this value as the resource id. If it is already in use, an + * error is returned with code ALREADY_EXISTS. Must be at most 128 characters + * long. It cannot contain the character `/`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Product]{@link google.cloud.vision.v1.Product}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + createProduct( + request: protosTypes.google.cloud.vision.v1.ICreateProductRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1.IProduct, + protosTypes.google.cloud.vision.v1.ICreateProductRequest | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1.IProduct, + protosTypes.google.cloud.vision.v1.ICreateProductRequest | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1.IProduct, + protosTypes.google.cloud.vision.v1.ICreateProductRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.createProduct(request, options, callback); + } + getProduct( + request: protosTypes.google.cloud.vision.v1.IGetProductRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1.IProduct, + protosTypes.google.cloud.vision.v1.IGetProductRequest | undefined, + {} | undefined + ] + >; + getProduct( + request: protosTypes.google.cloud.vision.v1.IGetProductRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1.IProduct, + protosTypes.google.cloud.vision.v1.IGetProductRequest | undefined, + {} | undefined + > + ): void; + /** + * Gets information associated with a Product. + * + * Possible errors: + * + * * Returns NOT_FOUND if the Product does not exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the Product to get. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Product]{@link google.cloud.vision.v1.Product}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getProduct( + request: protosTypes.google.cloud.vision.v1.IGetProductRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1.IProduct, + protosTypes.google.cloud.vision.v1.IGetProductRequest | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1.IProduct, + protosTypes.google.cloud.vision.v1.IGetProductRequest | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1.IProduct, + protosTypes.google.cloud.vision.v1.IGetProductRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.getProduct(request, options, callback); + } + updateProduct( + request: protosTypes.google.cloud.vision.v1.IUpdateProductRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1.IProduct, + protosTypes.google.cloud.vision.v1.IUpdateProductRequest | undefined, + {} | undefined + ] + >; + updateProduct( + request: protosTypes.google.cloud.vision.v1.IUpdateProductRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1.IProduct, + protosTypes.google.cloud.vision.v1.IUpdateProductRequest | undefined, + {} | undefined + > + ): void; + /** + * Makes changes to a Product resource. + * Only the `display_name`, `description`, and `labels` fields can be updated + * right now. + * + * If labels are updated, the change will not be reflected in queries until + * the next index time. + * + * Possible errors: + * + * * Returns NOT_FOUND if the Product does not exist. + * * Returns INVALID_ARGUMENT if display_name is present in update_mask but is + * missing from the request or longer than 4096 characters. + * * Returns INVALID_ARGUMENT if description is present in update_mask but is + * longer than 4096 characters. + * * Returns INVALID_ARGUMENT if product_category is present in update_mask. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.vision.v1.Product} request.product + * Required. The Product resource which replaces the one on the server. + * product.name is immutable. + * @param {google.protobuf.FieldMask} request.updateMask + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields + * to update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask paths include `product_labels`, `display_name`, and + * `description`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Product]{@link google.cloud.vision.v1.Product}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + updateProduct( + request: protosTypes.google.cloud.vision.v1.IUpdateProductRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1.IProduct, + protosTypes.google.cloud.vision.v1.IUpdateProductRequest | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1.IProduct, + protosTypes.google.cloud.vision.v1.IUpdateProductRequest | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1.IProduct, + protosTypes.google.cloud.vision.v1.IUpdateProductRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'product.name': request.product!.name || '', + }); + return this._innerApiCalls.updateProduct(request, options, callback); + } + deleteProduct( + request: protosTypes.google.cloud.vision.v1.IDeleteProductRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + protosTypes.google.cloud.vision.v1.IDeleteProductRequest | undefined, + {} | undefined + ] + >; + deleteProduct( + request: protosTypes.google.cloud.vision.v1.IDeleteProductRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.protobuf.IEmpty, + protosTypes.google.cloud.vision.v1.IDeleteProductRequest | undefined, + {} | undefined + > + ): void; + /** + * Permanently deletes a product and its reference images. + * + * Metadata of the product and all its images will be deleted right away, but + * search queries against ProductSets containing the product may still work + * until all related caches are refreshed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of product to delete. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + deleteProduct( + request: protosTypes.google.cloud.vision.v1.IDeleteProductRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.protobuf.IEmpty, + protosTypes.google.cloud.vision.v1.IDeleteProductRequest | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.protobuf.IEmpty, + protosTypes.google.cloud.vision.v1.IDeleteProductRequest | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + protosTypes.google.cloud.vision.v1.IDeleteProductRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.deleteProduct(request, options, callback); + } + createReferenceImage( + request: protosTypes.google.cloud.vision.v1.ICreateReferenceImageRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1.IReferenceImage, + ( + | protosTypes.google.cloud.vision.v1.ICreateReferenceImageRequest + | undefined + ), + {} | undefined + ] + >; + createReferenceImage( + request: protosTypes.google.cloud.vision.v1.ICreateReferenceImageRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1.IReferenceImage, + | protosTypes.google.cloud.vision.v1.ICreateReferenceImageRequest + | undefined, + {} | undefined + > + ): void; + /** + * Creates and returns a new ReferenceImage resource. + * + * The `bounding_poly` field is optional. If `bounding_poly` is not specified, + * the system will try to detect regions of interest in the image that are + * compatible with the product_category on the parent product. If it is + * specified, detection is ALWAYS skipped. The system converts polygons into + * non-rotated rectangles. + * + * Note that the pipeline will resize the image if the image resolution is too + * large to process (above 50MP). + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 + * characters. + * * Returns INVALID_ARGUMENT if the product does not exist. + * * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing + * compatible with the parent product's product_category is detected. + * * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the product in which to create the reference image. + * + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * @param {google.cloud.vision.v1.ReferenceImage} request.referenceImage + * Required. The reference image to create. + * If an image ID is specified, it is ignored. + * @param {string} request.referenceImageId + * A user-supplied resource id for the ReferenceImage to be added. If set, + * the server will attempt to use this value as the resource id. If it is + * already in use, an error is returned with code ALREADY_EXISTS. Must be at + * most 128 characters long. It cannot contain the character `/`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ReferenceImage]{@link google.cloud.vision.v1.ReferenceImage}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + createReferenceImage( + request: protosTypes.google.cloud.vision.v1.ICreateReferenceImageRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1.IReferenceImage, + | protosTypes.google.cloud.vision.v1.ICreateReferenceImageRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1.IReferenceImage, + | protosTypes.google.cloud.vision.v1.ICreateReferenceImageRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1.IReferenceImage, + ( + | protosTypes.google.cloud.vision.v1.ICreateReferenceImageRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.createReferenceImage(request, options, callback); + } + deleteReferenceImage( + request: protosTypes.google.cloud.vision.v1.IDeleteReferenceImageRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.vision.v1.IDeleteReferenceImageRequest + | undefined + ), + {} | undefined + ] + >; + deleteReferenceImage( + request: protosTypes.google.cloud.vision.v1.IDeleteReferenceImageRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1.IDeleteReferenceImageRequest + | undefined, + {} | undefined + > + ): void; + /** + * Permanently deletes a reference image. + * + * The image metadata will be deleted right away, but search queries + * against ProductSets containing the image may still work until all related + * caches are refreshed. + * + * The actual image files are not deleted from Google Cloud Storage. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the reference image to delete. + * + * Format is: + * + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + deleteReferenceImage( + request: protosTypes.google.cloud.vision.v1.IDeleteReferenceImageRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1.IDeleteReferenceImageRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1.IDeleteReferenceImageRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.vision.v1.IDeleteReferenceImageRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.deleteReferenceImage(request, options, callback); + } + getReferenceImage( + request: protosTypes.google.cloud.vision.v1.IGetReferenceImageRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1.IReferenceImage, + protosTypes.google.cloud.vision.v1.IGetReferenceImageRequest | undefined, + {} | undefined + ] + >; + getReferenceImage( + request: protosTypes.google.cloud.vision.v1.IGetReferenceImageRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1.IReferenceImage, + protosTypes.google.cloud.vision.v1.IGetReferenceImageRequest | undefined, + {} | undefined + > + ): void; + /** + * Gets information associated with a ReferenceImage. + * + * Possible errors: + * + * * Returns NOT_FOUND if the specified image does not exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ReferenceImage to get. + * + * Format is: + * + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ReferenceImage]{@link google.cloud.vision.v1.ReferenceImage}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getReferenceImage( + request: protosTypes.google.cloud.vision.v1.IGetReferenceImageRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1.IReferenceImage, + | protosTypes.google.cloud.vision.v1.IGetReferenceImageRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1.IReferenceImage, + protosTypes.google.cloud.vision.v1.IGetReferenceImageRequest | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1.IReferenceImage, + protosTypes.google.cloud.vision.v1.IGetReferenceImageRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.getReferenceImage(request, options, callback); + } + addProductToProductSet( + request: protosTypes.google.cloud.vision.v1.IAddProductToProductSetRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.vision.v1.IAddProductToProductSetRequest + | undefined + ), + {} | undefined + ] + >; + addProductToProductSet( + request: protosTypes.google.cloud.vision.v1.IAddProductToProductSetRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1.IAddProductToProductSetRequest + | undefined, + {} | undefined + > + ): void; + /** + * Adds a Product to the specified ProductSet. If the Product is already + * present, no change is made. + * + * One Product can be added to at most 100 ProductSets. + * + * Possible errors: + * + * * Returns NOT_FOUND if the Product or the ProductSet doesn't exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name for the ProductSet to modify. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param {string} request.product + * Required. The resource name for the Product to be added to this ProductSet. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + addProductToProductSet( + request: protosTypes.google.cloud.vision.v1.IAddProductToProductSetRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1.IAddProductToProductSetRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1.IAddProductToProductSetRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.vision.v1.IAddProductToProductSetRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.addProductToProductSet( + request, + options, + callback + ); + } + removeProductFromProductSet( + request: protosTypes.google.cloud.vision.v1.IRemoveProductFromProductSetRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.vision.v1.IRemoveProductFromProductSetRequest + | undefined + ), + {} | undefined + ] + >; + removeProductFromProductSet( + request: protosTypes.google.cloud.vision.v1.IRemoveProductFromProductSetRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1.IRemoveProductFromProductSetRequest + | undefined, + {} | undefined + > + ): void; + /** + * Removes a Product from the specified ProductSet. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name for the ProductSet to modify. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param {string} request.product + * Required. The resource name for the Product to be removed from this ProductSet. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + removeProductFromProductSet( + request: protosTypes.google.cloud.vision.v1.IRemoveProductFromProductSetRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1.IRemoveProductFromProductSetRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1.IRemoveProductFromProductSetRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.vision.v1.IRemoveProductFromProductSetRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.removeProductFromProductSet( + request, + options, + callback + ); + } + + importProductSets( + request: protosTypes.google.cloud.vision.v1.IImportProductSetsRequest, + options?: gax.CallOptions + ): Promise< + [ + LROperation< + protosTypes.google.cloud.vision.v1.IImportProductSetsResponse, + protosTypes.google.cloud.vision.v1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + importProductSets( + request: protosTypes.google.cloud.vision.v1.IImportProductSetsRequest, + options: gax.CallOptions, + callback: Callback< + LROperation< + protosTypes.google.cloud.vision.v1.IImportProductSetsResponse, + protosTypes.google.cloud.vision.v1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + > + ): void; + /** + * Asynchronous API that imports a list of reference images to specified + * product sets based on a list of image information. + * + * The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep track of the + * progress and results of the request. + * `Operation.metadata` contains `BatchOperationMetadata`. (progress) + * `Operation.response` contains `ImportProductSetsResponse`. (results) + * + * The input source of this method is a csv file on Google Cloud Storage. + * For the format of the csv file please see + * [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1.ImportProductSetsGcsSource.csv_file_uri]. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project in which the ProductSets should be imported. + * + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @param {google.cloud.vision.v1.ImportProductSetsInputConfig} request.inputConfig + * Required. The input content for the list of requests. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + importProductSets( + request: protosTypes.google.cloud.vision.v1.IImportProductSetsRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + LROperation< + protosTypes.google.cloud.vision.v1.IImportProductSetsResponse, + protosTypes.google.cloud.vision.v1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + >, + callback?: Callback< + LROperation< + protosTypes.google.cloud.vision.v1.IImportProductSetsResponse, + protosTypes.google.cloud.vision.v1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + > + ): Promise< + [ + LROperation< + protosTypes.google.cloud.vision.v1.IImportProductSetsResponse, + protosTypes.google.cloud.vision.v1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.importProductSets(request, options, callback); + } + purgeProducts( + request: protosTypes.google.cloud.vision.v1.IPurgeProductsRequest, + options?: gax.CallOptions + ): Promise< + [ + LROperation< + protosTypes.google.protobuf.IEmpty, + protosTypes.google.cloud.vision.v1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + purgeProducts( + request: protosTypes.google.cloud.vision.v1.IPurgeProductsRequest, + options: gax.CallOptions, + callback: Callback< + LROperation< + protosTypes.google.protobuf.IEmpty, + protosTypes.google.cloud.vision.v1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + > + ): void; + /** + * Asynchronous API to delete all Products in a ProductSet or all Products + * that are in no ProductSet. + * + * If a Product is a member of the specified ProductSet in addition to other + * ProductSets, the Product will still be deleted. + * + * It is recommended to not delete the specified ProductSet until after this + * operation has completed. It is also recommended to not add any of the + * Products involved in the batch delete to a new ProductSet while this + * operation is running because those Products may still end up deleted. + * + * It's not possible to undo the PurgeProducts operation. Therefore, it is + * recommended to keep the csv files used in ImportProductSets (if that was + * how you originally built the Product Set) before starting PurgeProducts, in + * case you need to re-import the data after deletion. + * + * If the plan is to purge all of the Products from a ProductSet and then + * re-use the empty ProductSet to re-import new Products into the empty + * ProductSet, you must wait until the PurgeProducts operation has finished + * for that ProductSet. + * + * The [google.longrunning.Operation][google.longrunning.Operation] API can be used to keep track of the + * progress and results of the request. + * `Operation.metadata` contains `BatchOperationMetadata`. (progress) + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.vision.v1.ProductSetPurgeConfig} request.productSetPurgeConfig + * Specify which ProductSet contains the Products to be deleted. + * @param {boolean} request.deleteOrphanProducts + * If delete_orphan_products is true, all Products that are not in any + * ProductSet will be deleted. + * @param {string} request.parent + * Required. The project and location in which the Products should be deleted. + * + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @param {boolean} request.force + * The default value is false. Override this value to true to actually perform + * the purge. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + purgeProducts( + request: protosTypes.google.cloud.vision.v1.IPurgeProductsRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + LROperation< + protosTypes.google.protobuf.IEmpty, + protosTypes.google.cloud.vision.v1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + >, + callback?: Callback< + LROperation< + protosTypes.google.protobuf.IEmpty, + protosTypes.google.cloud.vision.v1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + > + ): Promise< + [ + LROperation< + protosTypes.google.protobuf.IEmpty, + protosTypes.google.cloud.vision.v1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.purgeProducts(request, options, callback); + } + listProductSets( + request: protosTypes.google.cloud.vision.v1.IListProductSetsRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1.IProductSet[], + protosTypes.google.cloud.vision.v1.IListProductSetsRequest | null, + protosTypes.google.cloud.vision.v1.IListProductSetsResponse + ] + >; + listProductSets( + request: protosTypes.google.cloud.vision.v1.IListProductSetsRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1.IProductSet[], + protosTypes.google.cloud.vision.v1.IListProductSetsRequest | null, + protosTypes.google.cloud.vision.v1.IListProductSetsResponse + > + ): void; + /** + * Lists ProductSets in an unspecified order. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if page_size is greater than 100, or less + * than 1. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project from which ProductSets should be listed. + * + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @param {number} request.pageSize + * The maximum number of items to return. Default 10, maximum 100. + * @param {string} request.pageToken + * The next_page_token returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [ProductSet]{@link google.cloud.vision.v1.ProductSet}. + * The client library support auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [ProductSet]{@link google.cloud.vision.v1.ProductSet} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListProductSetsRequest]{@link google.cloud.vision.v1.ListProductSetsRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListProductSetsResponse]{@link google.cloud.vision.v1.ListProductSetsResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + listProductSets( + request: protosTypes.google.cloud.vision.v1.IListProductSetsRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1.IProductSet[], + protosTypes.google.cloud.vision.v1.IListProductSetsRequest | null, + protosTypes.google.cloud.vision.v1.IListProductSetsResponse + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1.IProductSet[], + protosTypes.google.cloud.vision.v1.IListProductSetsRequest | null, + protosTypes.google.cloud.vision.v1.IListProductSetsResponse + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1.IProductSet[], + protosTypes.google.cloud.vision.v1.IListProductSetsRequest | null, + protosTypes.google.cloud.vision.v1.IListProductSetsResponse + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.listProductSets(request, options, callback); + } + + /** + * Equivalent to {@link listProductSets}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listProductSets} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project from which ProductSets should be listed. + * + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @param {number} request.pageSize + * The maximum number of items to return. Default 10, maximum 100. + * @param {string} request.pageToken + * The next_page_token returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [ProductSet]{@link google.cloud.vision.v1.ProductSet} on 'data' event. + */ + listProductSetsStream( + request?: protosTypes.google.cloud.vision.v1.IListProductSetsRequest, + options?: gax.CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + return this._descriptors.page.listProductSets.createStream( + this._innerApiCalls.listProductSets as gax.GaxCall, + request, + callSettings + ); + } + listProducts( + request: protosTypes.google.cloud.vision.v1.IListProductsRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1.IProduct[], + protosTypes.google.cloud.vision.v1.IListProductsRequest | null, + protosTypes.google.cloud.vision.v1.IListProductsResponse + ] + >; + listProducts( + request: protosTypes.google.cloud.vision.v1.IListProductsRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1.IProduct[], + protosTypes.google.cloud.vision.v1.IListProductsRequest | null, + protosTypes.google.cloud.vision.v1.IListProductsResponse + > + ): void; + /** + * Lists products in an unspecified order. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project OR ProductSet from which Products should be listed. + * + * Format: + * `projects/PROJECT_ID/locations/LOC_ID` + * @param {number} request.pageSize + * The maximum number of items to return. Default 10, maximum 100. + * @param {string} request.pageToken + * The next_page_token returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Product]{@link google.cloud.vision.v1.Product}. + * The client library support auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [Product]{@link google.cloud.vision.v1.Product} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListProductsRequest]{@link google.cloud.vision.v1.ListProductsRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListProductsResponse]{@link google.cloud.vision.v1.ListProductsResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + listProducts( + request: protosTypes.google.cloud.vision.v1.IListProductsRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1.IProduct[], + protosTypes.google.cloud.vision.v1.IListProductsRequest | null, + protosTypes.google.cloud.vision.v1.IListProductsResponse + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1.IProduct[], + protosTypes.google.cloud.vision.v1.IListProductsRequest | null, + protosTypes.google.cloud.vision.v1.IListProductsResponse + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1.IProduct[], + protosTypes.google.cloud.vision.v1.IListProductsRequest | null, + protosTypes.google.cloud.vision.v1.IListProductsResponse + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.listProducts(request, options, callback); + } + + /** + * Equivalent to {@link listProducts}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listProducts} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project OR ProductSet from which Products should be listed. + * + * Format: + * `projects/PROJECT_ID/locations/LOC_ID` + * @param {number} request.pageSize + * The maximum number of items to return. Default 10, maximum 100. + * @param {string} request.pageToken + * The next_page_token returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Product]{@link google.cloud.vision.v1.Product} on 'data' event. + */ + listProductsStream( + request?: protosTypes.google.cloud.vision.v1.IListProductsRequest, + options?: gax.CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + return this._descriptors.page.listProducts.createStream( + this._innerApiCalls.listProducts as gax.GaxCall, + request, + callSettings + ); + } + listReferenceImages( + request: protosTypes.google.cloud.vision.v1.IListReferenceImagesRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1.IReferenceImage[], + protosTypes.google.cloud.vision.v1.IListReferenceImagesRequest | null, + protosTypes.google.cloud.vision.v1.IListReferenceImagesResponse + ] + >; + listReferenceImages( + request: protosTypes.google.cloud.vision.v1.IListReferenceImagesRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1.IReferenceImage[], + protosTypes.google.cloud.vision.v1.IListReferenceImagesRequest | null, + protosTypes.google.cloud.vision.v1.IListReferenceImagesResponse + > + ): void; + /** + * Lists reference images. + * + * Possible errors: + * + * * Returns NOT_FOUND if the parent product does not exist. + * * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less + * than 1. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the product containing the reference images. + * + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * @param {number} request.pageSize + * The maximum number of items to return. Default 10, maximum 100. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This is the value + * of `nextPageToken` returned in a previous reference image list request. + * + * Defaults to the first page if not specified. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [ReferenceImage]{@link google.cloud.vision.v1.ReferenceImage}. + * The client library support auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [ReferenceImage]{@link google.cloud.vision.v1.ReferenceImage} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListReferenceImagesRequest]{@link google.cloud.vision.v1.ListReferenceImagesRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListReferenceImagesResponse]{@link google.cloud.vision.v1.ListReferenceImagesResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + listReferenceImages( + request: protosTypes.google.cloud.vision.v1.IListReferenceImagesRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1.IReferenceImage[], + protosTypes.google.cloud.vision.v1.IListReferenceImagesRequest | null, + protosTypes.google.cloud.vision.v1.IListReferenceImagesResponse + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1.IReferenceImage[], + protosTypes.google.cloud.vision.v1.IListReferenceImagesRequest | null, + protosTypes.google.cloud.vision.v1.IListReferenceImagesResponse + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1.IReferenceImage[], + protosTypes.google.cloud.vision.v1.IListReferenceImagesRequest | null, + protosTypes.google.cloud.vision.v1.IListReferenceImagesResponse + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.listReferenceImages(request, options, callback); + } + + /** + * Equivalent to {@link listReferenceImages}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listReferenceImages} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the product containing the reference images. + * + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * @param {number} request.pageSize + * The maximum number of items to return. Default 10, maximum 100. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This is the value + * of `nextPageToken` returned in a previous reference image list request. + * + * Defaults to the first page if not specified. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [ReferenceImage]{@link google.cloud.vision.v1.ReferenceImage} on 'data' event. + */ + listReferenceImagesStream( + request?: protosTypes.google.cloud.vision.v1.IListReferenceImagesRequest, + options?: gax.CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + return this._descriptors.page.listReferenceImages.createStream( + this._innerApiCalls.listReferenceImages as gax.GaxCall, + request, + callSettings + ); + } + listProductsInProductSet( + request: protosTypes.google.cloud.vision.v1.IListProductsInProductSetRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1.IProduct[], + protosTypes.google.cloud.vision.v1.IListProductsInProductSetRequest | null, + protosTypes.google.cloud.vision.v1.IListProductsInProductSetResponse + ] + >; + listProductsInProductSet( + request: protosTypes.google.cloud.vision.v1.IListProductsInProductSetRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1.IProduct[], + protosTypes.google.cloud.vision.v1.IListProductsInProductSetRequest | null, + protosTypes.google.cloud.vision.v1.IListProductsInProductSetResponse + > + ): void; + /** + * Lists the Products in a ProductSet, in an unspecified order. If the + * ProductSet does not exist, the products field of the response will be + * empty. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The ProductSet resource for which to retrieve Products. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param {number} request.pageSize + * The maximum number of items to return. Default 10, maximum 100. + * @param {string} request.pageToken + * The next_page_token returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Product]{@link google.cloud.vision.v1.Product}. + * The client library support auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [Product]{@link google.cloud.vision.v1.Product} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListProductsInProductSetRequest]{@link google.cloud.vision.v1.ListProductsInProductSetRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListProductsInProductSetResponse]{@link google.cloud.vision.v1.ListProductsInProductSetResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + listProductsInProductSet( + request: protosTypes.google.cloud.vision.v1.IListProductsInProductSetRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1.IProduct[], + protosTypes.google.cloud.vision.v1.IListProductsInProductSetRequest | null, + protosTypes.google.cloud.vision.v1.IListProductsInProductSetResponse + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1.IProduct[], + protosTypes.google.cloud.vision.v1.IListProductsInProductSetRequest | null, + protosTypes.google.cloud.vision.v1.IListProductsInProductSetResponse + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1.IProduct[], + protosTypes.google.cloud.vision.v1.IListProductsInProductSetRequest | null, + protosTypes.google.cloud.vision.v1.IListProductsInProductSetResponse + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.listProductsInProductSet( + request, + options, + callback + ); + } + + /** + * Equivalent to {@link listProductsInProductSet}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listProductsInProductSet} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The ProductSet resource for which to retrieve Products. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param {number} request.pageSize + * The maximum number of items to return. Default 10, maximum 100. + * @param {string} request.pageToken + * The next_page_token returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Product]{@link google.cloud.vision.v1.Product} on 'data' event. + */ + listProductsInProductSetStream( + request?: protosTypes.google.cloud.vision.v1.IListProductsInProductSetRequest, + options?: gax.CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + const callSettings = new gax.CallSettings(options); + return this._descriptors.page.listProductsInProductSet.createStream( + this._innerApiCalls.listProductsInProductSet as gax.GaxCall, + request, + callSettings + ); + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project: string, location: string) { + return this._pathTemplates.locationPathTemplate.render({ + project, + location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this._pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this._pathTemplates.locationPathTemplate.match(locationName) + .location; + } + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} product + * @returns {string} Resource name string. + */ + productPath(project: string, location: string, product: string) { + return this._pathTemplates.productPathTemplate.render({ + project, + location, + product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this._pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this._pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this._pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Return a fully-qualified productSet resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} product_set + * @returns {string} Resource name string. + */ + productSetPath(project: string, location: string, productSet: string) { + return this._pathTemplates.productSetPathTemplate.render({ + project, + location, + product_set: productSet, + }); + } + + /** + * Parse the project from ProductSet resource. + * + * @param {string} productSetName + * A fully-qualified path representing ProductSet resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductSetName(productSetName: string) { + return this._pathTemplates.productSetPathTemplate.match(productSetName) + .project; + } + + /** + * Parse the location from ProductSet resource. + * + * @param {string} productSetName + * A fully-qualified path representing ProductSet resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductSetName(productSetName: string) { + return this._pathTemplates.productSetPathTemplate.match(productSetName) + .location; + } + + /** + * Parse the product_set from ProductSet resource. + * + * @param {string} productSetName + * A fully-qualified path representing ProductSet resource. + * @returns {string} A string representing the product_set. + */ + matchProductSetFromProductSetName(productSetName: string) { + return this._pathTemplates.productSetPathTemplate.match(productSetName) + .product_set; + } + + /** + * Return a fully-qualified referenceImage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} product + * @param {string} reference_image + * @returns {string} Resource name string. + */ + referenceImagePath( + project: string, + location: string, + product: string, + referenceImage: string + ) { + return this._pathTemplates.referenceImagePathTemplate.render({ + project, + location, + product, + reference_image: referenceImage, + }); + } + + /** + * Parse the project from ReferenceImage resource. + * + * @param {string} referenceImageName + * A fully-qualified path representing ReferenceImage resource. + * @returns {string} A string representing the project. + */ + matchProjectFromReferenceImageName(referenceImageName: string) { + return this._pathTemplates.referenceImagePathTemplate.match( + referenceImageName + ).project; + } + + /** + * Parse the location from ReferenceImage resource. + * + * @param {string} referenceImageName + * A fully-qualified path representing ReferenceImage resource. + * @returns {string} A string representing the location. + */ + matchLocationFromReferenceImageName(referenceImageName: string) { + return this._pathTemplates.referenceImagePathTemplate.match( + referenceImageName + ).location; + } + + /** + * Parse the product from ReferenceImage resource. + * + * @param {string} referenceImageName + * A fully-qualified path representing ReferenceImage resource. + * @returns {string} A string representing the product. + */ + matchProductFromReferenceImageName(referenceImageName: string) { + return this._pathTemplates.referenceImagePathTemplate.match( + referenceImageName + ).product; + } + + /** + * Parse the reference_image from ReferenceImage resource. + * + * @param {string} referenceImageName + * A fully-qualified path representing ReferenceImage resource. + * @returns {string} A string representing the reference_image. + */ + matchReferenceImageFromReferenceImageName(referenceImageName: string) { + return this._pathTemplates.referenceImagePathTemplate.match( + referenceImageName + ).reference_image; + } + + /** + * Terminate the GRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + */ + close(): Promise { + if (!this._terminated) { + return this.productSearchStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-vision/src/v1/product_search_client_config.json b/packages/google-cloud-vision/src/v1/product_search_client_config.json index c4147eca734..b7db1b901ac 100644 --- a/packages/google-cloud-vision/src/v1/product_search_client_config.json +++ b/packages/google-cloud-vision/src/v1/product_search_client_config.json @@ -2,11 +2,11 @@ "interfaces": { "google.cloud.vision.v1.ProductSearch": { "retry_codes": { + "non_idempotent": [], "idempotent": [ "DEADLINE_EXCEEDED", "UNAVAILABLE" - ], - "non_idempotent": [] + ] }, "retry_params": { "default": { @@ -14,104 +14,104 @@ "retry_delay_multiplier": 1.3, "max_retry_delay_millis": 60000, "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1.0, + "rpc_timeout_multiplier": 1, "max_rpc_timeout_millis": 60000, "total_timeout_millis": 600000 } }, "methods": { "CreateProductSet": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "ListProductSets": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "GetProductSet": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "UpdateProductSet": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "DeleteProductSet": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "CreateProduct": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "ListProducts": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "GetProduct": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "UpdateProduct": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "DeleteProduct": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "CreateReferenceImage": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "DeleteReferenceImage": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "ListReferenceImages": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "GetReferenceImage": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "AddProductToProductSet": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "RemoveProductFromProductSet": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "ListProductsInProductSet": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "ImportProductSets": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "PurgeProducts": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" } diff --git a/packages/google-cloud-vision/src/v1/product_search_proto_list.json b/packages/google-cloud-vision/src/v1/product_search_proto_list.json index fe01671f49f..0d468bf9c85 100644 --- a/packages/google-cloud-vision/src/v1/product_search_proto_list.json +++ b/packages/google-cloud-vision/src/v1/product_search_proto_list.json @@ -1,3 +1,8 @@ [ - "../../protos/google/cloud/vision/v1/product_search_service.proto" + "../../protos/google/cloud/vision/v1/geometry.proto", + "../../protos/google/cloud/vision/v1/image_annotator.proto", + "../../protos/google/cloud/vision/v1/product_search.proto", + "../../protos/google/cloud/vision/v1/product_search_service.proto", + "../../protos/google/cloud/vision/v1/text_annotation.proto", + "../../protos/google/cloud/vision/v1/web_detection.proto" ] diff --git a/packages/google-cloud-vision/src/v1p1beta1/doc/google/cloud/vision/v1p1beta1/doc_geometry.js b/packages/google-cloud-vision/src/v1p1beta1/doc/google/cloud/vision/v1p1beta1/doc_geometry.js deleted file mode 100644 index 2932f5eefa7..00000000000 --- a/packages/google-cloud-vision/src/v1p1beta1/doc/google/cloud/vision/v1p1beta1/doc_geometry.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * A vertex represents a 2D point in the image. - * NOTE: the vertex coordinates are in the same scale as the original image. - * - * @property {number} x - * X coordinate. - * - * @property {number} y - * Y coordinate. - * - * @typedef Vertex - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.Vertex definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/geometry.proto} - */ -const Vertex = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A bounding polygon for the detected image annotation. - * - * @property {Object[]} vertices - * The bounding polygon vertices. - * - * This object should have the same structure as [Vertex]{@link google.cloud.vision.v1p1beta1.Vertex} - * - * @typedef BoundingPoly - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.BoundingPoly definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/geometry.proto} - */ -const BoundingPoly = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A 3D position in the image, used primarily for Face detection landmarks. - * A valid Position must have both x and y coordinates. - * The position coordinates are in the same scale as the original image. - * - * @property {number} x - * X coordinate. - * - * @property {number} y - * Y coordinate. - * - * @property {number} z - * Z coordinate (or depth). - * - * @typedef Position - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.Position definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/geometry.proto} - */ -const Position = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p1beta1/doc/google/cloud/vision/v1p1beta1/doc_image_annotator.js b/packages/google-cloud-vision/src/v1p1beta1/doc/google/cloud/vision/v1p1beta1/doc_image_annotator.js deleted file mode 100644 index f5c42944278..00000000000 --- a/packages/google-cloud-vision/src/v1p1beta1/doc/google/cloud/vision/v1p1beta1/doc_image_annotator.js +++ /dev/null @@ -1,959 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * Users describe the type of Google Cloud Vision API tasks to perform over - * images by using *Feature*s. Each Feature indicates a type of image - * detection task to perform. Features encode the Cloud Vision API - * vertical to operate on and the number of top-scoring results to return. - * - * @property {number} type - * The feature type. - * - * The number should be among the values of [Type]{@link google.cloud.vision.v1p1beta1.Type} - * - * @property {number} maxResults - * Maximum number of results of this type. - * - * @property {string} model - * Model to use for the feature. - * Supported values: "builtin/stable" (the default if unset) and - * "builtin/latest". - * - * @typedef Feature - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.Feature definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/image_annotator.proto} - */ -const Feature = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Type of image feature. - * - * @enum {number} - * @memberof google.cloud.vision.v1p1beta1 - */ - Type: { - - /** - * Unspecified feature type. - */ - TYPE_UNSPECIFIED: 0, - - /** - * Run face detection. - */ - FACE_DETECTION: 1, - - /** - * Run landmark detection. - */ - LANDMARK_DETECTION: 2, - - /** - * Run logo detection. - */ - LOGO_DETECTION: 3, - - /** - * Run label detection. - */ - LABEL_DETECTION: 4, - - /** - * Run OCR. - */ - TEXT_DETECTION: 5, - - /** - * Run dense text document OCR. Takes precedence when both - * DOCUMENT_TEXT_DETECTION and TEXT_DETECTION are present. - */ - DOCUMENT_TEXT_DETECTION: 11, - - /** - * Run computer vision models to compute image safe-search properties. - */ - SAFE_SEARCH_DETECTION: 6, - - /** - * Compute a set of image properties, such as the image's dominant colors. - */ - IMAGE_PROPERTIES: 7, - - /** - * Run crop hints. - */ - CROP_HINTS: 9, - - /** - * Run web detection. - */ - WEB_DETECTION: 10 - } -}; - -/** - * External image source (Google Cloud Storage image location). - * - * @property {string} gcsImageUri - * NOTE: For new code `image_uri` below is preferred. - * Google Cloud Storage image URI, which must be in the following form: - * `gs://bucket_name/object_name` (for details, see - * [Google Cloud Storage Request - * URIs](https://cloud.google.com/storage/docs/reference-uris)). - * NOTE: Cloud Storage object versioning is not supported. - * - * @property {string} imageUri - * Image URI which supports: - * 1) Google Cloud Storage image URI, which must be in the following form: - * `gs://bucket_name/object_name` (for details, see - * [Google Cloud Storage Request - * URIs](https://cloud.google.com/storage/docs/reference-uris)). - * NOTE: Cloud Storage object versioning is not supported. - * 2) Publicly accessible image HTTP/HTTPS URL. - * This is preferred over the legacy `gcs_image_uri` above. When both - * `gcs_image_uri` and `image_uri` are specified, `image_uri` takes - * precedence. - * - * @typedef ImageSource - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.ImageSource definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/image_annotator.proto} - */ -const ImageSource = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Client image to perform Google Cloud Vision API tasks over. - * - * @property {Buffer} content - * Image content, represented as a stream of bytes. - * Note: as with all `bytes` fields, protobuffers use a pure binary - * representation, whereas JSON representations use base64. - * - * @property {Object} source - * Google Cloud Storage image location. If both `content` and `source` - * are provided for an image, `content` takes precedence and is - * used to perform the image annotation request. - * - * This object should have the same structure as [ImageSource]{@link google.cloud.vision.v1p1beta1.ImageSource} - * - * @typedef Image - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.Image definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/image_annotator.proto} - */ -const Image = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A face annotation object contains the results of face detection. - * - * @property {Object} boundingPoly - * The bounding polygon around the face. The coordinates of the bounding box - * are in the original image's scale, as returned in `ImageParams`. - * The bounding box is computed to "frame" the face in accordance with human - * expectations. It is based on the landmarker results. - * Note that one or more x and/or y coordinates may not be generated in the - * `BoundingPoly` (the polygon will be unbounded) if only a partial face - * appears in the image to be annotated. - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p1beta1.BoundingPoly} - * - * @property {Object} fdBoundingPoly - * The `fd_bounding_poly` bounding polygon is tighter than the - * `boundingPoly`, and encloses only the skin part of the face. Typically, it - * is used to eliminate the face from any image analysis that detects the - * "amount of skin" visible in an image. It is not based on the - * landmarker results, only on the initial face detection, hence - * the fd (face detection) prefix. - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p1beta1.BoundingPoly} - * - * @property {Object[]} landmarks - * Detected face landmarks. - * - * This object should have the same structure as [Landmark]{@link google.cloud.vision.v1p1beta1.Landmark} - * - * @property {number} rollAngle - * Roll angle, which indicates the amount of clockwise/anti-clockwise rotation - * of the face relative to the image vertical about the axis perpendicular to - * the face. Range [-180,180]. - * - * @property {number} panAngle - * Yaw angle, which indicates the leftward/rightward angle that the face is - * pointing relative to the vertical plane perpendicular to the image. Range - * [-180,180]. - * - * @property {number} tiltAngle - * Pitch angle, which indicates the upwards/downwards angle that the face is - * pointing relative to the image's horizontal plane. Range [-180,180]. - * - * @property {number} detectionConfidence - * Detection confidence. Range [0, 1]. - * - * @property {number} landmarkingConfidence - * Face landmarking confidence. Range [0, 1]. - * - * @property {number} joyLikelihood - * Joy likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p1beta1.Likelihood} - * - * @property {number} sorrowLikelihood - * Sorrow likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p1beta1.Likelihood} - * - * @property {number} angerLikelihood - * Anger likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p1beta1.Likelihood} - * - * @property {number} surpriseLikelihood - * Surprise likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p1beta1.Likelihood} - * - * @property {number} underExposedLikelihood - * Under-exposed likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p1beta1.Likelihood} - * - * @property {number} blurredLikelihood - * Blurred likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p1beta1.Likelihood} - * - * @property {number} headwearLikelihood - * Headwear likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p1beta1.Likelihood} - * - * @typedef FaceAnnotation - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.FaceAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/image_annotator.proto} - */ -const FaceAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * A face-specific landmark (for example, a face feature). - * - * @property {number} type - * Face landmark type. - * - * The number should be among the values of [Type]{@link google.cloud.vision.v1p1beta1.Type} - * - * @property {Object} position - * Face landmark position. - * - * This object should have the same structure as [Position]{@link google.cloud.vision.v1p1beta1.Position} - * - * @typedef Landmark - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.FaceAnnotation.Landmark definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/image_annotator.proto} - */ - Landmark: { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Face landmark (feature) type. - * Left and right are defined from the vantage of the viewer of the image - * without considering mirror projections typical of photos. So, `LEFT_EYE`, - * typically, is the person's right eye. - * - * @enum {number} - * @memberof google.cloud.vision.v1p1beta1 - */ - Type: { - - /** - * Unknown face landmark detected. Should not be filled. - */ - UNKNOWN_LANDMARK: 0, - - /** - * Left eye. - */ - LEFT_EYE: 1, - - /** - * Right eye. - */ - RIGHT_EYE: 2, - - /** - * Left of left eyebrow. - */ - LEFT_OF_LEFT_EYEBROW: 3, - - /** - * Right of left eyebrow. - */ - RIGHT_OF_LEFT_EYEBROW: 4, - - /** - * Left of right eyebrow. - */ - LEFT_OF_RIGHT_EYEBROW: 5, - - /** - * Right of right eyebrow. - */ - RIGHT_OF_RIGHT_EYEBROW: 6, - - /** - * Midpoint between eyes. - */ - MIDPOINT_BETWEEN_EYES: 7, - - /** - * Nose tip. - */ - NOSE_TIP: 8, - - /** - * Upper lip. - */ - UPPER_LIP: 9, - - /** - * Lower lip. - */ - LOWER_LIP: 10, - - /** - * Mouth left. - */ - MOUTH_LEFT: 11, - - /** - * Mouth right. - */ - MOUTH_RIGHT: 12, - - /** - * Mouth center. - */ - MOUTH_CENTER: 13, - - /** - * Nose, bottom right. - */ - NOSE_BOTTOM_RIGHT: 14, - - /** - * Nose, bottom left. - */ - NOSE_BOTTOM_LEFT: 15, - - /** - * Nose, bottom center. - */ - NOSE_BOTTOM_CENTER: 16, - - /** - * Left eye, top boundary. - */ - LEFT_EYE_TOP_BOUNDARY: 17, - - /** - * Left eye, right corner. - */ - LEFT_EYE_RIGHT_CORNER: 18, - - /** - * Left eye, bottom boundary. - */ - LEFT_EYE_BOTTOM_BOUNDARY: 19, - - /** - * Left eye, left corner. - */ - LEFT_EYE_LEFT_CORNER: 20, - - /** - * Right eye, top boundary. - */ - RIGHT_EYE_TOP_BOUNDARY: 21, - - /** - * Right eye, right corner. - */ - RIGHT_EYE_RIGHT_CORNER: 22, - - /** - * Right eye, bottom boundary. - */ - RIGHT_EYE_BOTTOM_BOUNDARY: 23, - - /** - * Right eye, left corner. - */ - RIGHT_EYE_LEFT_CORNER: 24, - - /** - * Left eyebrow, upper midpoint. - */ - LEFT_EYEBROW_UPPER_MIDPOINT: 25, - - /** - * Right eyebrow, upper midpoint. - */ - RIGHT_EYEBROW_UPPER_MIDPOINT: 26, - - /** - * Left ear tragion. - */ - LEFT_EAR_TRAGION: 27, - - /** - * Right ear tragion. - */ - RIGHT_EAR_TRAGION: 28, - - /** - * Left eye pupil. - */ - LEFT_EYE_PUPIL: 29, - - /** - * Right eye pupil. - */ - RIGHT_EYE_PUPIL: 30, - - /** - * Forehead glabella. - */ - FOREHEAD_GLABELLA: 31, - - /** - * Chin gnathion. - */ - CHIN_GNATHION: 32, - - /** - * Chin left gonion. - */ - CHIN_LEFT_GONION: 33, - - /** - * Chin right gonion. - */ - CHIN_RIGHT_GONION: 34 - } - } -}; - -/** - * Detected entity location information. - * - * @property {Object} latLng - * lat/long location coordinates. - * - * This object should have the same structure as [LatLng]{@link google.type.LatLng} - * - * @typedef LocationInfo - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.LocationInfo definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/image_annotator.proto} - */ -const LocationInfo = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A `Property` consists of a user-supplied name/value pair. - * - * @property {string} name - * Name of the property. - * - * @property {string} value - * Value of the property. - * - * @property {number} uint64Value - * Value of numeric properties. - * - * @typedef Property - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.Property definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/image_annotator.proto} - */ -const Property = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Set of detected entity features. - * - * @property {string} mid - * Opaque entity ID. Some IDs may be available in - * [Google Knowledge Graph Search - * API](https://developers.google.com/knowledge-graph/). - * - * @property {string} locale - * The language code for the locale in which the entity textual - * `description` is expressed. - * - * @property {string} description - * Entity textual description, expressed in its `locale` language. - * - * @property {number} score - * Overall score of the result. Range [0, 1]. - * - * @property {number} confidence - * The accuracy of the entity detection in an image. - * For example, for an image in which the "Eiffel Tower" entity is detected, - * this field represents the confidence that there is a tower in the query - * image. Range [0, 1]. - * - * @property {number} topicality - * The relevancy of the ICA (Image Content Annotation) label to the - * image. For example, the relevancy of "tower" is likely higher to an image - * containing the detected "Eiffel Tower" than to an image containing a - * detected distant towering building, even though the confidence that - * there is a tower in each image may be the same. Range [0, 1]. - * - * @property {Object} boundingPoly - * Image region to which this entity belongs. Not produced - * for `LABEL_DETECTION` features. - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p1beta1.BoundingPoly} - * - * @property {Object[]} locations - * The location information for the detected entity. Multiple - * `LocationInfo` elements can be present because one location may - * indicate the location of the scene in the image, and another location - * may indicate the location of the place where the image was taken. - * Location information is usually present for landmarks. - * - * This object should have the same structure as [LocationInfo]{@link google.cloud.vision.v1p1beta1.LocationInfo} - * - * @property {Object[]} properties - * Some entities may have optional user-supplied `Property` (name/value) - * fields, such a score or string that qualifies the entity. - * - * This object should have the same structure as [Property]{@link google.cloud.vision.v1p1beta1.Property} - * - * @typedef EntityAnnotation - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.EntityAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/image_annotator.proto} - */ -const EntityAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Set of features pertaining to the image, computed by computer vision - * methods over safe-search verticals (for example, adult, spoof, medical, - * violence). - * - * @property {number} adult - * Represents the adult content likelihood for the image. Adult content may - * contain elements such as nudity, pornographic images or cartoons, or - * sexual activities. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p1beta1.Likelihood} - * - * @property {number} spoof - * Spoof likelihood. The likelihood that an modification - * was made to the image's canonical version to make it appear - * funny or offensive. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p1beta1.Likelihood} - * - * @property {number} medical - * Likelihood that this is a medical image. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p1beta1.Likelihood} - * - * @property {number} violence - * Likelihood that this image contains violent content. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p1beta1.Likelihood} - * - * @property {number} racy - * Likelihood that the request image contains racy content. Racy content may - * include (but is not limited to) skimpy or sheer clothing, strategically - * covered nudity, lewd or provocative poses, or close-ups of sensitive - * body areas. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p1beta1.Likelihood} - * - * @typedef SafeSearchAnnotation - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.SafeSearchAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/image_annotator.proto} - */ -const SafeSearchAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Rectangle determined by min and max `LatLng` pairs. - * - * @property {Object} minLatLng - * Min lat/long pair. - * - * This object should have the same structure as [LatLng]{@link google.type.LatLng} - * - * @property {Object} maxLatLng - * Max lat/long pair. - * - * This object should have the same structure as [LatLng]{@link google.type.LatLng} - * - * @typedef LatLongRect - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.LatLongRect definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/image_annotator.proto} - */ -const LatLongRect = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Color information consists of RGB channels, score, and the fraction of - * the image that the color occupies in the image. - * - * @property {Object} color - * RGB components of the color. - * - * This object should have the same structure as [Color]{@link google.type.Color} - * - * @property {number} score - * Image-specific score for this color. Value in range [0, 1]. - * - * @property {number} pixelFraction - * The fraction of pixels the color occupies in the image. - * Value in range [0, 1]. - * - * @typedef ColorInfo - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.ColorInfo definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/image_annotator.proto} - */ -const ColorInfo = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Set of dominant colors and their corresponding scores. - * - * @property {Object[]} colors - * RGB color values with their score and pixel fraction. - * - * This object should have the same structure as [ColorInfo]{@link google.cloud.vision.v1p1beta1.ColorInfo} - * - * @typedef DominantColorsAnnotation - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.DominantColorsAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/image_annotator.proto} - */ -const DominantColorsAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Stores image properties, such as dominant colors. - * - * @property {Object} dominantColors - * If present, dominant colors completed successfully. - * - * This object should have the same structure as [DominantColorsAnnotation]{@link google.cloud.vision.v1p1beta1.DominantColorsAnnotation} - * - * @typedef ImageProperties - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.ImageProperties definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/image_annotator.proto} - */ -const ImageProperties = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Single crop hint that is used to generate a new crop when serving an image. - * - * @property {Object} boundingPoly - * The bounding polygon for the crop region. The coordinates of the bounding - * box are in the original image's scale, as returned in `ImageParams`. - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p1beta1.BoundingPoly} - * - * @property {number} confidence - * Confidence of this being a salient region. Range [0, 1]. - * - * @property {number} importanceFraction - * Fraction of importance of this salient region with respect to the original - * image. - * - * @typedef CropHint - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.CropHint definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/image_annotator.proto} - */ -const CropHint = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Set of crop hints that are used to generate new crops when serving images. - * - * @property {Object[]} cropHints - * Crop hint results. - * - * This object should have the same structure as [CropHint]{@link google.cloud.vision.v1p1beta1.CropHint} - * - * @typedef CropHintsAnnotation - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.CropHintsAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/image_annotator.proto} - */ -const CropHintsAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Parameters for crop hints annotation request. - * - * @property {number[]} aspectRatios - * Aspect ratios in floats, representing the ratio of the width to the height - * of the image. For example, if the desired aspect ratio is 4/3, the - * corresponding float value should be 1.33333. If not specified, the - * best possible crop is returned. The number of provided aspect ratios is - * limited to a maximum of 16; any aspect ratios provided after the 16th are - * ignored. - * - * @typedef CropHintsParams - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.CropHintsParams definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/image_annotator.proto} - */ -const CropHintsParams = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Parameters for web detection request. - * - * @property {boolean} includeGeoResults - * Whether to include results derived from the geo information in the image. - * - * @typedef WebDetectionParams - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.WebDetectionParams definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/image_annotator.proto} - */ -const WebDetectionParams = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Image context and/or feature-specific parameters. - * - * @property {Object} latLongRect - * lat/long rectangle that specifies the location of the image. - * - * This object should have the same structure as [LatLongRect]{@link google.cloud.vision.v1p1beta1.LatLongRect} - * - * @property {string[]} languageHints - * List of languages to use for TEXT_DETECTION. In most cases, an empty value - * yields the best results since it enables automatic language detection. For - * languages based on the Latin alphabet, setting `language_hints` is not - * needed. In rare cases, when the language of the text in the image is known, - * setting a hint will help get better results (although it will be a - * significant hindrance if the hint is wrong). Text detection returns an - * error if one or more of the specified languages is not one of the - * [supported languages](https://cloud.google.com/vision/docs/languages). - * - * @property {Object} cropHintsParams - * Parameters for crop hints annotation request. - * - * This object should have the same structure as [CropHintsParams]{@link google.cloud.vision.v1p1beta1.CropHintsParams} - * - * @property {Object} webDetectionParams - * Parameters for web detection. - * - * This object should have the same structure as [WebDetectionParams]{@link google.cloud.vision.v1p1beta1.WebDetectionParams} - * - * @typedef ImageContext - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.ImageContext definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/image_annotator.proto} - */ -const ImageContext = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request for performing Google Cloud Vision API tasks over a user-provided - * image, with user-requested features. - * - * @property {Object} image - * The image to be processed. - * - * This object should have the same structure as [Image]{@link google.cloud.vision.v1p1beta1.Image} - * - * @property {Object[]} features - * Requested features. - * - * This object should have the same structure as [Feature]{@link google.cloud.vision.v1p1beta1.Feature} - * - * @property {Object} imageContext - * Additional context that may accompany the image. - * - * This object should have the same structure as [ImageContext]{@link google.cloud.vision.v1p1beta1.ImageContext} - * - * @typedef AnnotateImageRequest - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.AnnotateImageRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/image_annotator.proto} - */ -const AnnotateImageRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response to an image annotation request. - * - * @property {Object[]} faceAnnotations - * If present, face detection has completed successfully. - * - * This object should have the same structure as [FaceAnnotation]{@link google.cloud.vision.v1p1beta1.FaceAnnotation} - * - * @property {Object[]} landmarkAnnotations - * If present, landmark detection has completed successfully. - * - * This object should have the same structure as [EntityAnnotation]{@link google.cloud.vision.v1p1beta1.EntityAnnotation} - * - * @property {Object[]} logoAnnotations - * If present, logo detection has completed successfully. - * - * This object should have the same structure as [EntityAnnotation]{@link google.cloud.vision.v1p1beta1.EntityAnnotation} - * - * @property {Object[]} labelAnnotations - * If present, label detection has completed successfully. - * - * This object should have the same structure as [EntityAnnotation]{@link google.cloud.vision.v1p1beta1.EntityAnnotation} - * - * @property {Object[]} textAnnotations - * If present, text (OCR) detection has completed successfully. - * - * This object should have the same structure as [EntityAnnotation]{@link google.cloud.vision.v1p1beta1.EntityAnnotation} - * - * @property {Object} fullTextAnnotation - * If present, text (OCR) detection or document (OCR) text detection has - * completed successfully. - * This annotation provides the structural hierarchy for the OCR detected - * text. - * - * This object should have the same structure as [TextAnnotation]{@link google.cloud.vision.v1p1beta1.TextAnnotation} - * - * @property {Object} safeSearchAnnotation - * If present, safe-search annotation has completed successfully. - * - * This object should have the same structure as [SafeSearchAnnotation]{@link google.cloud.vision.v1p1beta1.SafeSearchAnnotation} - * - * @property {Object} imagePropertiesAnnotation - * If present, image properties were extracted successfully. - * - * This object should have the same structure as [ImageProperties]{@link google.cloud.vision.v1p1beta1.ImageProperties} - * - * @property {Object} cropHintsAnnotation - * If present, crop hints have completed successfully. - * - * This object should have the same structure as [CropHintsAnnotation]{@link google.cloud.vision.v1p1beta1.CropHintsAnnotation} - * - * @property {Object} webDetection - * If present, web detection has completed successfully. - * - * This object should have the same structure as [WebDetection]{@link google.cloud.vision.v1p1beta1.WebDetection} - * - * @property {Object} error - * If set, represents the error message for the operation. - * Note that filled-in image annotations are guaranteed to be - * correct, even when `error` is set. - * - * This object should have the same structure as [Status]{@link google.rpc.Status} - * - * @typedef AnnotateImageResponse - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.AnnotateImageResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/image_annotator.proto} - */ -const AnnotateImageResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Multiple image annotation requests are batched into a single service call. - * - * @property {Object[]} requests - * Required. Individual image annotation requests for this batch. - * - * This object should have the same structure as [AnnotateImageRequest]{@link google.cloud.vision.v1p1beta1.AnnotateImageRequest} - * - * @typedef BatchAnnotateImagesRequest - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.BatchAnnotateImagesRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/image_annotator.proto} - */ -const BatchAnnotateImagesRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response to a batch image annotation request. - * - * @property {Object[]} responses - * Individual responses to image annotation requests within the batch. - * - * This object should have the same structure as [AnnotateImageResponse]{@link google.cloud.vision.v1p1beta1.AnnotateImageResponse} - * - * @typedef BatchAnnotateImagesResponse - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/image_annotator.proto} - */ -const BatchAnnotateImagesResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A bucketized representation of likelihood, which is intended to give clients - * highly stable results across model upgrades. - * - * @enum {number} - * @memberof google.cloud.vision.v1p1beta1 - */ -const Likelihood = { - - /** - * Unknown likelihood. - */ - UNKNOWN: 0, - - /** - * It is very unlikely that the image belongs to the specified vertical. - */ - VERY_UNLIKELY: 1, - - /** - * It is unlikely that the image belongs to the specified vertical. - */ - UNLIKELY: 2, - - /** - * It is possible that the image belongs to the specified vertical. - */ - POSSIBLE: 3, - - /** - * It is likely that the image belongs to the specified vertical. - */ - LIKELY: 4, - - /** - * It is very likely that the image belongs to the specified vertical. - */ - VERY_LIKELY: 5 -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p1beta1/doc/google/cloud/vision/v1p1beta1/doc_text_annotation.js b/packages/google-cloud-vision/src/v1p1beta1/doc/google/cloud/vision/v1p1beta1/doc_text_annotation.js deleted file mode 100644 index 257b4a7cccd..00000000000 --- a/packages/google-cloud-vision/src/v1p1beta1/doc/google/cloud/vision/v1p1beta1/doc_text_annotation.js +++ /dev/null @@ -1,386 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * TextAnnotation contains a structured representation of OCR extracted text. - * The hierarchy of an OCR extracted text structure is like this: - * TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol - * Each structural component, starting from Page, may further have their own - * properties. Properties describe detected languages, breaks etc.. Please refer - * to the - * TextAnnotation.TextProperty - * message definition below for more detail. - * - * @property {Object[]} pages - * List of pages detected by OCR. - * - * This object should have the same structure as [Page]{@link google.cloud.vision.v1p1beta1.Page} - * - * @property {string} text - * UTF-8 text detected on the pages. - * - * @typedef TextAnnotation - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.TextAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/text_annotation.proto} - */ -const TextAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Detected language for a structural component. - * - * @property {string} languageCode - * The BCP-47 language code, such as "en-US" or "sr-Latn". For more - * information, see - * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. - * - * @property {number} confidence - * Confidence of detected language. Range [0, 1]. - * - * @typedef DetectedLanguage - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.TextAnnotation.DetectedLanguage definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/text_annotation.proto} - */ - DetectedLanguage: { - // This is for documentation. Actual contents will be loaded by gRPC. - }, - - /** - * Detected start or end of a structural component. - * - * @property {number} type - * Detected break type. - * - * The number should be among the values of [BreakType]{@link google.cloud.vision.v1p1beta1.BreakType} - * - * @property {boolean} isPrefix - * True if break prepends the element. - * - * @typedef DetectedBreak - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.TextAnnotation.DetectedBreak definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/text_annotation.proto} - */ - DetectedBreak: { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Enum to denote the type of break found. New line, space etc. - * - * @enum {number} - * @memberof google.cloud.vision.v1p1beta1 - */ - BreakType: { - - /** - * Unknown break label type. - */ - UNKNOWN: 0, - - /** - * Regular space. - */ - SPACE: 1, - - /** - * Sure space (very wide). - */ - SURE_SPACE: 2, - - /** - * Line-wrapping break. - */ - EOL_SURE_SPACE: 3, - - /** - * End-line hyphen that is not present in text; does not co-occur with - * `SPACE`, `LEADER_SPACE`, or `LINE_BREAK`. - */ - HYPHEN: 4, - - /** - * Line break that ends a paragraph. - */ - LINE_BREAK: 5 - } - }, - - /** - * Additional information detected on the structural component. - * - * @property {Object[]} detectedLanguages - * A list of detected languages together with confidence. - * - * This object should have the same structure as [DetectedLanguage]{@link google.cloud.vision.v1p1beta1.DetectedLanguage} - * - * @property {Object} detectedBreak - * Detected start or end of a text segment. - * - * This object should have the same structure as [DetectedBreak]{@link google.cloud.vision.v1p1beta1.DetectedBreak} - * - * @typedef TextProperty - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/text_annotation.proto} - */ - TextProperty: { - // This is for documentation. Actual contents will be loaded by gRPC. - } -}; - -/** - * Detected page from OCR. - * - * @property {Object} property - * Additional information detected on the page. - * - * This object should have the same structure as [TextProperty]{@link google.cloud.vision.v1p1beta1.TextProperty} - * - * @property {number} width - * Page width in pixels. - * - * @property {number} height - * Page height in pixels. - * - * @property {Object[]} blocks - * List of blocks of text, images etc on this page. - * - * This object should have the same structure as [Block]{@link google.cloud.vision.v1p1beta1.Block} - * - * @property {number} confidence - * Confidence of the OCR results on the page. Range [0, 1]. - * - * @typedef Page - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.Page definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/text_annotation.proto} - */ -const Page = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Logical element on the page. - * - * @property {Object} property - * Additional information detected for the block. - * - * This object should have the same structure as [TextProperty]{@link google.cloud.vision.v1p1beta1.TextProperty} - * - * @property {Object} boundingBox - * The bounding box for the block. - * The vertices are in the order of top-left, top-right, bottom-right, - * bottom-left. When a rotation of the bounding box is detected the rotation - * is represented as around the top-left corner as defined when the text is - * read in the 'natural' orientation. - * For example: - * * when the text is horizontal it might look like: - * 0----1 - * | | - * 3----2 - * * when it's rotated 180 degrees around the top-left corner it becomes: - * 2----3 - * | | - * 1----0 - * and the vertice order will still be (0, 1, 2, 3). - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p1beta1.BoundingPoly} - * - * @property {Object[]} paragraphs - * List of paragraphs in this block (if this blocks is of type text). - * - * This object should have the same structure as [Paragraph]{@link google.cloud.vision.v1p1beta1.Paragraph} - * - * @property {number} blockType - * Detected block type (text, image etc) for this block. - * - * The number should be among the values of [BlockType]{@link google.cloud.vision.v1p1beta1.BlockType} - * - * @property {number} confidence - * Confidence of the OCR results on the block. Range [0, 1]. - * - * @typedef Block - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.Block definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/text_annotation.proto} - */ -const Block = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Type of a block (text, image etc) as identified by OCR. - * - * @enum {number} - * @memberof google.cloud.vision.v1p1beta1 - */ - BlockType: { - - /** - * Unknown block type. - */ - UNKNOWN: 0, - - /** - * Regular text block. - */ - TEXT: 1, - - /** - * Table block. - */ - TABLE: 2, - - /** - * Image block. - */ - PICTURE: 3, - - /** - * Horizontal/vertical line box. - */ - RULER: 4, - - /** - * Barcode block. - */ - BARCODE: 5 - } -}; - -/** - * Structural unit of text representing a number of words in certain order. - * - * @property {Object} property - * Additional information detected for the paragraph. - * - * This object should have the same structure as [TextProperty]{@link google.cloud.vision.v1p1beta1.TextProperty} - * - * @property {Object} boundingBox - * The bounding box for the paragraph. - * The vertices are in the order of top-left, top-right, bottom-right, - * bottom-left. When a rotation of the bounding box is detected the rotation - * is represented as around the top-left corner as defined when the text is - * read in the 'natural' orientation. - * For example: - * * when the text is horizontal it might look like: - * 0----1 - * | | - * 3----2 - * * when it's rotated 180 degrees around the top-left corner it becomes: - * 2----3 - * | | - * 1----0 - * and the vertice order will still be (0, 1, 2, 3). - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p1beta1.BoundingPoly} - * - * @property {Object[]} words - * List of words in this paragraph. - * - * This object should have the same structure as [Word]{@link google.cloud.vision.v1p1beta1.Word} - * - * @property {number} confidence - * Confidence of the OCR results for the paragraph. Range [0, 1]. - * - * @typedef Paragraph - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.Paragraph definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/text_annotation.proto} - */ -const Paragraph = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A word representation. - * - * @property {Object} property - * Additional information detected for the word. - * - * This object should have the same structure as [TextProperty]{@link google.cloud.vision.v1p1beta1.TextProperty} - * - * @property {Object} boundingBox - * The bounding box for the word. - * The vertices are in the order of top-left, top-right, bottom-right, - * bottom-left. When a rotation of the bounding box is detected the rotation - * is represented as around the top-left corner as defined when the text is - * read in the 'natural' orientation. - * For example: - * * when the text is horizontal it might look like: - * 0----1 - * | | - * 3----2 - * * when it's rotated 180 degrees around the top-left corner it becomes: - * 2----3 - * | | - * 1----0 - * and the vertice order will still be (0, 1, 2, 3). - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p1beta1.BoundingPoly} - * - * @property {Object[]} symbols - * List of symbols in the word. - * The order of the symbols follows the natural reading order. - * - * This object should have the same structure as [Symbol]{@link google.cloud.vision.v1p1beta1.Symbol} - * - * @property {number} confidence - * Confidence of the OCR results for the word. Range [0, 1]. - * - * @typedef Word - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.Word definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/text_annotation.proto} - */ -const Word = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A single symbol representation. - * - * @property {Object} property - * Additional information detected for the symbol. - * - * This object should have the same structure as [TextProperty]{@link google.cloud.vision.v1p1beta1.TextProperty} - * - * @property {Object} boundingBox - * The bounding box for the symbol. - * The vertices are in the order of top-left, top-right, bottom-right, - * bottom-left. When a rotation of the bounding box is detected the rotation - * is represented as around the top-left corner as defined when the text is - * read in the 'natural' orientation. - * For example: - * * when the text is horizontal it might look like: - * 0----1 - * | | - * 3----2 - * * when it's rotated 180 degrees around the top-left corner it becomes: - * 2----3 - * | | - * 1----0 - * and the vertice order will still be (0, 1, 2, 3). - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p1beta1.BoundingPoly} - * - * @property {string} text - * The actual UTF-8 representation of the symbol. - * - * @property {number} confidence - * Confidence of the OCR results for the symbol. Range [0, 1]. - * - * @typedef Symbol - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.Symbol definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/text_annotation.proto} - */ -const Symbol = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p1beta1/doc/google/cloud/vision/v1p1beta1/doc_web_detection.js b/packages/google-cloud-vision/src/v1p1beta1/doc/google/cloud/vision/v1p1beta1/doc_web_detection.js deleted file mode 100644 index 83736d544eb..00000000000 --- a/packages/google-cloud-vision/src/v1p1beta1/doc/google/cloud/vision/v1p1beta1/doc_web_detection.js +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * Relevant information for the image from the Internet. - * - * @property {Object[]} webEntities - * Deduced entities from similar images on the Internet. - * - * This object should have the same structure as [WebEntity]{@link google.cloud.vision.v1p1beta1.WebEntity} - * - * @property {Object[]} fullMatchingImages - * Fully matching images from the Internet. - * Can include resized copies of the query image. - * - * This object should have the same structure as [WebImage]{@link google.cloud.vision.v1p1beta1.WebImage} - * - * @property {Object[]} partialMatchingImages - * Partial matching images from the Internet. - * Those images are similar enough to share some key-point features. For - * example an original image will likely have partial matching for its crops. - * - * This object should have the same structure as [WebImage]{@link google.cloud.vision.v1p1beta1.WebImage} - * - * @property {Object[]} pagesWithMatchingImages - * Web pages containing the matching images from the Internet. - * - * This object should have the same structure as [WebPage]{@link google.cloud.vision.v1p1beta1.WebPage} - * - * @property {Object[]} visuallySimilarImages - * The visually similar image results. - * - * This object should have the same structure as [WebImage]{@link google.cloud.vision.v1p1beta1.WebImage} - * - * @property {Object[]} bestGuessLabels - * Best guess text labels for the request image. - * - * This object should have the same structure as [WebLabel]{@link google.cloud.vision.v1p1beta1.WebLabel} - * - * @typedef WebDetection - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.WebDetection definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/web_detection.proto} - */ -const WebDetection = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Entity deduced from similar images on the Internet. - * - * @property {string} entityId - * Opaque entity ID. - * - * @property {number} score - * Overall relevancy score for the entity. - * Not normalized and not comparable across different image queries. - * - * @property {string} description - * Canonical description of the entity, in English. - * - * @typedef WebEntity - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.WebDetection.WebEntity definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/web_detection.proto} - */ - WebEntity: { - // This is for documentation. Actual contents will be loaded by gRPC. - }, - - /** - * Metadata for online images. - * - * @property {string} url - * The result image URL. - * - * @property {number} score - * (Deprecated) Overall relevancy score for the image. - * - * @typedef WebImage - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.WebDetection.WebImage definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/web_detection.proto} - */ - WebImage: { - // This is for documentation. Actual contents will be loaded by gRPC. - }, - - /** - * Metadata for web pages. - * - * @property {string} url - * The result web page URL. - * - * @property {number} score - * (Deprecated) Overall relevancy score for the web page. - * - * @property {string} pageTitle - * Title for the web page, may contain HTML markups. - * - * @property {Object[]} fullMatchingImages - * Fully matching images on the page. - * Can include resized copies of the query image. - * - * This object should have the same structure as [WebImage]{@link google.cloud.vision.v1p1beta1.WebImage} - * - * @property {Object[]} partialMatchingImages - * Partial matching images on the page. - * Those images are similar enough to share some key-point features. For - * example an original image will likely have partial matching for its - * crops. - * - * This object should have the same structure as [WebImage]{@link google.cloud.vision.v1p1beta1.WebImage} - * - * @typedef WebPage - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.WebDetection.WebPage definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/web_detection.proto} - */ - WebPage: { - // This is for documentation. Actual contents will be loaded by gRPC. - }, - - /** - * Label to provide extra metadata for the web detection. - * - * @property {string} label - * Label for extra metadata. - * - * @property {string} languageCode - * The BCP-47 language code for `label`, such as "en-US" or "sr-Latn". - * For more information, see - * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. - * - * @typedef WebLabel - * @memberof google.cloud.vision.v1p1beta1 - * @see [google.cloud.vision.v1p1beta1.WebDetection.WebLabel definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p1beta1/web_detection.proto} - */ - WebLabel: { - // This is for documentation. Actual contents will be loaded by gRPC. - } -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p1beta1/doc/google/protobuf/doc_any.js b/packages/google-cloud-vision/src/v1p1beta1/doc/google/protobuf/doc_any.js deleted file mode 100644 index 813682aa336..00000000000 --- a/packages/google-cloud-vision/src/v1p1beta1/doc/google/protobuf/doc_any.js +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * `Any` contains an arbitrary serialized protocol buffer message along with a - * URL that describes the type of the serialized message. - * - * Protobuf library provides support to pack/unpack Any values in the form - * of utility functions or additional generated methods of the Any type. - * - * Example 1: Pack and unpack a message in C++. - * - * Foo foo = ...; - * Any any; - * any.PackFrom(foo); - * ... - * if (any.UnpackTo(&foo)) { - * ... - * } - * - * Example 2: Pack and unpack a message in Java. - * - * Foo foo = ...; - * Any any = Any.pack(foo); - * ... - * if (any.is(Foo.class)) { - * foo = any.unpack(Foo.class); - * } - * - * Example 3: Pack and unpack a message in Python. - * - * foo = Foo(...) - * any = Any() - * any.Pack(foo) - * ... - * if any.Is(Foo.DESCRIPTOR): - * any.Unpack(foo) - * ... - * - * Example 4: Pack and unpack a message in Go - * - * foo := &pb.Foo{...} - * any, err := ptypes.MarshalAny(foo) - * ... - * foo := &pb.Foo{} - * if err := ptypes.UnmarshalAny(any, foo); err != nil { - * ... - * } - * - * The pack methods provided by protobuf library will by default use - * 'type.googleapis.com/full.type.name' as the type URL and the unpack - * methods only use the fully qualified type name after the last '/' - * in the type URL, for example "foo.bar.com/x/y.z" will yield type - * name "y.z". - * - * - * # JSON - * - * The JSON representation of an `Any` value uses the regular - * representation of the deserialized, embedded message, with an - * additional field `@type` which contains the type URL. Example: - * - * package google.profile; - * message Person { - * string first_name = 1; - * string last_name = 2; - * } - * - * { - * "@type": "type.googleapis.com/google.profile.Person", - * "firstName": , - * "lastName": - * } - * - * If the embedded message type is well-known and has a custom JSON - * representation, that representation will be embedded adding a field - * `value` which holds the custom JSON in addition to the `@type` - * field. Example (for message google.protobuf.Duration): - * - * { - * "@type": "type.googleapis.com/google.protobuf.Duration", - * "value": "1.212s" - * } - * - * @property {string} typeUrl - * A URL/resource name that uniquely identifies the type of the serialized - * protocol buffer message. This string must contain at least - * one "/" character. The last segment of the URL's path must represent - * the fully qualified name of the type (as in - * `path/google.protobuf.Duration`). The name should be in a canonical form - * (e.g., leading "." is not accepted). - * - * In practice, teams usually precompile into the binary all types that they - * expect it to use in the context of Any. However, for URLs which use the - * scheme `http`, `https`, or no scheme, one can optionally set up a type - * server that maps type URLs to message definitions as follows: - * - * * If no scheme is provided, `https` is assumed. - * * An HTTP GET on the URL must yield a google.protobuf.Type - * value in binary format, or produce an error. - * * Applications are allowed to cache lookup results based on the - * URL, or have them precompiled into a binary to avoid any - * lookup. Therefore, binary compatibility needs to be preserved - * on changes to types. (Use versioned type names to manage - * breaking changes.) - * - * Note: this functionality is not currently available in the official - * protobuf release, and it is not used for type URLs beginning with - * type.googleapis.com. - * - * Schemes other than `http`, `https` (or the empty scheme) might be - * used with implementation specific semantics. - * - * @property {Buffer} value - * Must be a valid serialized protocol buffer of the above specified type. - * - * @typedef Any - * @memberof google.protobuf - * @see [google.protobuf.Any definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/any.proto} - */ -const Any = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p1beta1/doc/google/protobuf/doc_wrappers.js b/packages/google-cloud-vision/src/v1p1beta1/doc/google/protobuf/doc_wrappers.js deleted file mode 100644 index 90e2ff4ab5a..00000000000 --- a/packages/google-cloud-vision/src/v1p1beta1/doc/google/protobuf/doc_wrappers.js +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * Wrapper message for `float`. - * - * The JSON representation for `FloatValue` is JSON number. - * - * @property {number} value - * The float value. - * - * @typedef FloatValue - * @memberof google.protobuf - * @see [google.protobuf.FloatValue definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/wrappers.proto} - */ -const FloatValue = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p1beta1/doc/google/rpc/doc_status.js b/packages/google-cloud-vision/src/v1p1beta1/doc/google/rpc/doc_status.js deleted file mode 100644 index 750e0af7689..00000000000 --- a/packages/google-cloud-vision/src/v1p1beta1/doc/google/rpc/doc_status.js +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * The `Status` type defines a logical error model that is suitable for - * different programming environments, including REST APIs and RPC APIs. It is - * used by [gRPC](https://github.com/grpc). Each `Status` message contains - * three pieces of data: error code, error message, and error details. - * - * You can find out more about this error model and how to work with it in the - * [API Design Guide](https://cloud.google.com/apis/design/errors). - * - * @property {number} code - * The status code, which should be an enum value of google.rpc.Code. - * - * @property {string} message - * A developer-facing error message, which should be in English. Any - * user-facing error message should be localized and sent in the - * google.rpc.Status.details field, or localized by the client. - * - * @property {Object[]} details - * A list of messages that carry the error details. There is a common set of - * message types for APIs to use. - * - * This object should have the same structure as [Any]{@link google.protobuf.Any} - * - * @typedef Status - * @memberof google.rpc - * @see [google.rpc.Status definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/rpc/status.proto} - */ -const Status = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p1beta1/doc/google/type/doc_color.js b/packages/google-cloud-vision/src/v1p1beta1/doc/google/type/doc_color.js deleted file mode 100644 index 9570187d502..00000000000 --- a/packages/google-cloud-vision/src/v1p1beta1/doc/google/type/doc_color.js +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * Represents a color in the RGBA color space. This representation is designed - * for simplicity of conversion to/from color representations in various - * languages over compactness; for example, the fields of this representation - * can be trivially provided to the constructor of "java.awt.Color" in Java; it - * can also be trivially provided to UIColor's "+colorWithRed:green:blue:alpha" - * method in iOS; and, with just a little work, it can be easily formatted into - * a CSS "rgba()" string in JavaScript, as well. - * - * Note: this proto does not carry information about the absolute color space - * that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, - * DCI-P3, BT.2020, etc.). By default, applications SHOULD assume the sRGB color - * space. - * - * Example (Java): - * - * import com.google.type.Color; - * - * // ... - * public static java.awt.Color fromProto(Color protocolor) { - * float alpha = protocolor.hasAlpha() - * ? protocolor.getAlpha().getValue() - * : 1.0; - * - * return new java.awt.Color( - * protocolor.getRed(), - * protocolor.getGreen(), - * protocolor.getBlue(), - * alpha); - * } - * - * public static Color toProto(java.awt.Color color) { - * float red = (float) color.getRed(); - * float green = (float) color.getGreen(); - * float blue = (float) color.getBlue(); - * float denominator = 255.0; - * Color.Builder resultBuilder = - * Color - * .newBuilder() - * .setRed(red / denominator) - * .setGreen(green / denominator) - * .setBlue(blue / denominator); - * int alpha = color.getAlpha(); - * if (alpha != 255) { - * result.setAlpha( - * FloatValue - * .newBuilder() - * .setValue(((float) alpha) / denominator) - * .build()); - * } - * return resultBuilder.build(); - * } - * // ... - * - * Example (iOS / Obj-C): - * - * // ... - * static UIColor* fromProto(Color* protocolor) { - * float red = [protocolor red]; - * float green = [protocolor green]; - * float blue = [protocolor blue]; - * FloatValue* alpha_wrapper = [protocolor alpha]; - * float alpha = 1.0; - * if (alpha_wrapper != nil) { - * alpha = [alpha_wrapper value]; - * } - * return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; - * } - * - * static Color* toProto(UIColor* color) { - * CGFloat red, green, blue, alpha; - * if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { - * return nil; - * } - * Color* result = [[Color alloc] init]; - * [result setRed:red]; - * [result setGreen:green]; - * [result setBlue:blue]; - * if (alpha <= 0.9999) { - * [result setAlpha:floatWrapperWithValue(alpha)]; - * } - * [result autorelease]; - * return result; - * } - * // ... - * - * Example (JavaScript): - * - * // ... - * - * var protoToCssColor = function(rgb_color) { - * var redFrac = rgb_color.red || 0.0; - * var greenFrac = rgb_color.green || 0.0; - * var blueFrac = rgb_color.blue || 0.0; - * var red = Math.floor(redFrac * 255); - * var green = Math.floor(greenFrac * 255); - * var blue = Math.floor(blueFrac * 255); - * - * if (!('alpha' in rgb_color)) { - * return rgbToCssColor_(red, green, blue); - * } - * - * var alphaFrac = rgb_color.alpha.value || 0.0; - * var rgbParams = [red, green, blue].join(','); - * return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); - * }; - * - * var rgbToCssColor_ = function(red, green, blue) { - * var rgbNumber = new Number((red << 16) | (green << 8) | blue); - * var hexString = rgbNumber.toString(16); - * var missingZeros = 6 - hexString.length; - * var resultBuilder = ['#']; - * for (var i = 0; i < missingZeros; i++) { - * resultBuilder.push('0'); - * } - * resultBuilder.push(hexString); - * return resultBuilder.join(''); - * }; - * - * // ... - * - * @property {number} red - * The amount of red in the color as a value in the interval [0, 1]. - * - * @property {number} green - * The amount of green in the color as a value in the interval [0, 1]. - * - * @property {number} blue - * The amount of blue in the color as a value in the interval [0, 1]. - * - * @property {Object} alpha - * The fraction of this color that should be applied to the pixel. That is, - * the final pixel color is defined by the equation: - * - * pixel color = alpha * (this color) + (1.0 - alpha) * (background color) - * - * This means that a value of 1.0 corresponds to a solid color, whereas - * a value of 0.0 corresponds to a completely transparent color. This - * uses a wrapper message rather than a simple float scalar so that it is - * possible to distinguish between a default value and the value being unset. - * If omitted, this color object is to be rendered as a solid color - * (as if the alpha value had been explicitly given with a value of 1.0). - * - * This object should have the same structure as [FloatValue]{@link google.protobuf.FloatValue} - * - * @typedef Color - * @memberof google.type - * @see [google.type.Color definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/type/color.proto} - */ -const Color = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p1beta1/doc/google/type/doc_latlng.js b/packages/google-cloud-vision/src/v1p1beta1/doc/google/type/doc_latlng.js deleted file mode 100644 index bacbf0e1f48..00000000000 --- a/packages/google-cloud-vision/src/v1p1beta1/doc/google/type/doc_latlng.js +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * An object representing a latitude/longitude pair. This is expressed as a pair - * of doubles representing degrees latitude and degrees longitude. Unless - * specified otherwise, this must conform to the - * WGS84 - * standard. Values must be within normalized ranges. - * - * @property {number} latitude - * The latitude in degrees. It must be in the range [-90.0, +90.0]. - * - * @property {number} longitude - * The longitude in degrees. It must be in the range [-180.0, +180.0]. - * - * @typedef LatLng - * @memberof google.type - * @see [google.type.LatLng definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/type/latlng.proto} - */ -const LatLng = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p1beta1/image_annotator_client.js b/packages/google-cloud-vision/src/v1p1beta1/image_annotator_client.ts similarity index 50% rename from packages/google-cloud-vision/src/v1p1beta1/image_annotator_client.js rename to packages/google-cloud-vision/src/v1p1beta1/image_annotator_client.ts index c9e8076f00f..32fa019b07a 100644 --- a/packages/google-cloud-vision/src/v1p1beta1/image_annotator_client.js +++ b/packages/google-cloud-vision/src/v1p1beta1/image_annotator_client.ts @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -11,24 +11,40 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** -'use strict'; +import * as gax from 'google-gax'; +import { + APICallback, + Callback, + CallOptions, + Descriptors, + ClientOptions, +} from 'google-gax'; +import * as path from 'path'; -const gapicConfig = require('./image_annotator_client_config.json'); -const gax = require('google-gax'); -const path = require('path'); +import * as protosTypes from '../../protos/protos'; +import * as gapicConfig from './image_annotator_client_config.json'; -const VERSION = require('../../package.json').version; +const version = require('../../../package.json').version; /** - * Service that performs Google Cloud Vision API detection tasks over client - * images, such as face, landmark, logo, label, and text detection. The - * ImageAnnotator service returns detected entities from the images. - * + * Service that performs Google Cloud Vision API detection tasks over client + * images, such as face, landmark, logo, label, and text detection. The + * ImageAnnotator service returns detected entities from the images. * @class * @memberof v1p1beta1 */ -class ImageAnnotatorClient { +export class ImageAnnotatorClient { + private _descriptors: Descriptors = {page: {}, stream: {}, longrunning: {}}; + private _innerApiCalls: {[name: string]: Function}; + private _terminated = false; + auth: gax.GoogleAuth; + imageAnnotatorStub: Promise<{[name: string]: Function}>; + /** * Construct an instance of ImageAnnotatorClient. * @@ -56,58 +72,55 @@ class ImageAnnotatorClient { * @param {string} [options.apiEndpoint] - The domain name of the * API remote host. */ - constructor(opts) { - opts = opts || {}; - this._descriptors = {}; - if (global.isBrowser) { - // If we're in browser, we use gRPC fallback. - opts.fallback = true; + constructor(opts?: ClientOptions) { + // Ensure that options include the service address and port. + const staticMembers = this.constructor as typeof ImageAnnotatorClient; + const servicePath = + opts && opts.servicePath + ? opts.servicePath + : opts && opts.apiEndpoint + ? opts.apiEndpoint + : staticMembers.servicePath; + const port = opts && opts.port ? opts.port : staticMembers.port; + + if (!opts) { + opts = {servicePath, port}; } + opts.servicePath = opts.servicePath || servicePath; + opts.port = opts.port || port; + opts.clientConfig = opts.clientConfig || {}; + const isBrowser = typeof window !== 'undefined'; + if (isBrowser) { + opts.fallback = true; + } // If we are in browser, we are already using fallback because of the // "browser" field in package.json. // But if we were explicitly requested to use fallback, let's do it now. - const gaxModule = !global.isBrowser && opts.fallback ? gax.fallback : gax; - - const servicePath = - opts.servicePath || opts.apiEndpoint || this.constructor.servicePath; - - // Ensure that options include the service address and port. - opts = Object.assign( - { - clientConfig: {}, - port: this.constructor.port, - servicePath, - }, - opts - ); + const gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax; // Create a `gaxGrpc` object, with any grpc-specific options // sent to the client. - opts.scopes = this.constructor.scopes; + opts.scopes = (this.constructor as typeof ImageAnnotatorClient).scopes; const gaxGrpc = new gaxModule.GrpcClient(opts); // Save the auth object to the client, for use by other methods. - this.auth = gaxGrpc.auth; + this.auth = gaxGrpc.auth as gax.GoogleAuth; // Determine the client header string. - const clientHeader = []; - + const clientHeader = [`gax/${gaxModule.version}`, `gapic/${version}`]; if (typeof process !== 'undefined' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); - } - clientHeader.push(`gax/${gaxModule.version}`); - if (opts.fallback) { - clientHeader.push(`gl-web/${gaxModule.version}`); } else { + clientHeader.push(`gl-web/${gaxModule.version}`); + } + if (!opts.fallback) { clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`); } - clientHeader.push(`gapic/${VERSION}`); if (opts.libName && opts.libVersion) { clientHeader.push(`${opts.libName}/${opts.libVersion}`); } - // Load the applicable protos. // For Node.js, pass the path to JSON proto file. // For browsers, pass the JSON content. @@ -126,8 +139,8 @@ class ImageAnnotatorClient { // Put together the default options sent with requests. const defaults = gaxGrpc.constructSettings( 'google.cloud.vision.v1p1beta1.ImageAnnotator', - gapicConfig, - opts.clientConfig, + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')} ); @@ -138,30 +151,48 @@ class ImageAnnotatorClient { // Put together the "service stub" for // google.cloud.vision.v1p1beta1.ImageAnnotator. - const imageAnnotatorStub = gaxGrpc.createStub( + this.imageAnnotatorStub = gaxGrpc.createStub( opts.fallback - ? protos.lookupService('google.cloud.vision.v1p1beta1.ImageAnnotator') - : protos.google.cloud.vision.v1p1beta1.ImageAnnotator, + ? (protos as protobuf.Root).lookupService( + 'google.cloud.vision.v1p1beta1.ImageAnnotator' + ) + : // tslint:disable-next-line no-any + (protos as any).google.cloud.vision.v1p1beta1.ImageAnnotator, opts - ); + ) as Promise<{[method: string]: Function}>; // Iterate over each of the methods that the service provides // and create an API call method for each. const imageAnnotatorStubMethods = ['batchAnnotateImages']; + for (const methodName of imageAnnotatorStubMethods) { - const innerCallPromise = imageAnnotatorStub.then( - stub => (...args) => { + const innerCallPromise = this.imageAnnotatorStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } return stub[methodName].apply(stub, args); }, - err => () => { + (err: Error | null | undefined) => () => { throw err; } ); - this._innerApiCalls[methodName] = gaxModule.createApiCall( + + const apiCall = gaxModule.createApiCall( innerCallPromise, defaults[methodName], - null + this._descriptors.page[methodName] || + this._descriptors.stream[methodName] || + this._descriptors.longrunning[methodName] ); + + this._innerApiCalls[methodName] = ( + argument: {}, + callOptions?: CallOptions, + callback?: APICallback + ) => { + return apiCall(argument, callOptions, callback); + }; } } @@ -198,67 +229,114 @@ class ImageAnnotatorClient { ]; } + getProjectId(): Promise; + getProjectId(callback: Callback): void; /** * Return the project ID used by this class. * @param {function(Error, string)} callback - the callback to * be called with the current project Id. */ - getProjectId(callback) { - return this.auth.getProjectId(callback); + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); } // ------------------- // -- Service calls -- // ------------------- - + batchAnnotateImages( + request: protosTypes.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesResponse, + ( + | protosTypes.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest + | undefined + ), + {} | undefined + ] + >; + batchAnnotateImages( + request: protosTypes.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesResponse, + | protosTypes.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest + | undefined, + {} | undefined + > + ): void; /** * Run image detection and annotation for a batch of images. * * @param {Object} request * The request object that will be sent. - * @param {Object[]} request.requests + * @param {number[]} request.requests * Required. Individual image annotation requests for this batch. - * - * This object should have the same structure as [AnnotateImageRequest]{@link google.cloud.vision.v1p1beta1.AnnotateImageRequest} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [BatchAnnotateImagesResponse]{@link google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse}. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [BatchAnnotateImagesResponse]{@link google.cloud.vision.v1p1beta1.BatchAnnotateImagesResponse}. * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1p1beta1.ImageAnnotatorClient({ - * // optional auth parameters. - * }); - * - * const requests = []; - * client.batchAnnotateImages({requests: requests}) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); */ - batchAnnotateImages(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; + batchAnnotateImages( + request: protosTypes.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesResponse, + | protosTypes.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesResponse, + | protosTypes.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesResponse, + ( + | protosTypes.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; } - request = request || {}; options = options || {}; - return this._innerApiCalls.batchAnnotateImages(request, options, callback); } -} -module.exports = ImageAnnotatorClient; + /** + * Terminate the GRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + */ + close(): Promise { + if (!this._terminated) { + return this.imageAnnotatorStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} +import {FeaturesMethod} from '../helpers'; +export interface ImageAnnotatorClient extends FeaturesMethod {} diff --git a/packages/google-cloud-vision/src/v1p1beta1/image_annotator_client_config.json b/packages/google-cloud-vision/src/v1p1beta1/image_annotator_client_config.json index 55c365e3f80..469fb95c03d 100644 --- a/packages/google-cloud-vision/src/v1p1beta1/image_annotator_client_config.json +++ b/packages/google-cloud-vision/src/v1p1beta1/image_annotator_client_config.json @@ -2,11 +2,11 @@ "interfaces": { "google.cloud.vision.v1p1beta1.ImageAnnotator": { "retry_codes": { + "non_idempotent": [], "idempotent": [ "DEADLINE_EXCEEDED", "UNAVAILABLE" - ], - "non_idempotent": [] + ] }, "retry_params": { "default": { @@ -14,14 +14,14 @@ "retry_delay_multiplier": 1.3, "max_retry_delay_millis": 60000, "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1.0, + "rpc_timeout_multiplier": 1, "max_rpc_timeout_millis": 60000, "total_timeout_millis": 600000 } }, "methods": { "BatchAnnotateImages": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" } diff --git a/packages/google-cloud-vision/src/v1p1beta1/image_annotator_proto_list.json b/packages/google-cloud-vision/src/v1p1beta1/image_annotator_proto_list.json index 75373115353..35609fc84f3 100644 --- a/packages/google-cloud-vision/src/v1p1beta1/image_annotator_proto_list.json +++ b/packages/google-cloud-vision/src/v1p1beta1/image_annotator_proto_list.json @@ -1,3 +1,6 @@ [ - "../../protos/google/cloud/vision/v1p1beta1/image_annotator.proto" + "../../protos/google/cloud/vision/v1p1beta1/geometry.proto", + "../../protos/google/cloud/vision/v1p1beta1/image_annotator.proto", + "../../protos/google/cloud/vision/v1p1beta1/text_annotation.proto", + "../../protos/google/cloud/vision/v1p1beta1/web_detection.proto" ] diff --git a/packages/google-cloud-vision/src/browser.js b/packages/google-cloud-vision/src/v1p1beta1/index.ts similarity index 65% rename from packages/google-cloud-vision/src/browser.js rename to packages/google-cloud-vision/src/v1p1beta1/index.ts index 68dc62d25d6..aed82506fff 100644 --- a/packages/google-cloud-vision/src/browser.js +++ b/packages/google-cloud-vision/src/v1p1beta1/index.ts @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -11,11 +11,9 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** -'use strict'; - -// Set a flag that we are running in a browser bundle. -global.isBrowser = true; - -// Re-export all exports from ./index.js. -module.exports = require('./index'); +export {ImageAnnotatorClient} from './image_annotator_client'; diff --git a/packages/google-cloud-vision/src/v1p2beta1/doc/google/cloud/vision/v1p2beta1/doc_geometry.js b/packages/google-cloud-vision/src/v1p2beta1/doc/google/cloud/vision/v1p2beta1/doc_geometry.js deleted file mode 100644 index a0df9692a84..00000000000 --- a/packages/google-cloud-vision/src/v1p2beta1/doc/google/cloud/vision/v1p2beta1/doc_geometry.js +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * A vertex represents a 2D point in the image. - * NOTE: the vertex coordinates are in the same scale as the original image. - * - * @property {number} x - * X coordinate. - * - * @property {number} y - * Y coordinate. - * - * @typedef Vertex - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.Vertex definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/geometry.proto} - */ -const Vertex = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A vertex represents a 2D point in the image. - * NOTE: the normalized vertex coordinates are relative to the original image - * and range from 0 to 1. - * - * @property {number} x - * X coordinate. - * - * @property {number} y - * Y coordinate. - * - * @typedef NormalizedVertex - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.NormalizedVertex definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/geometry.proto} - */ -const NormalizedVertex = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A bounding polygon for the detected image annotation. - * - * @property {Object[]} vertices - * The bounding polygon vertices. - * - * This object should have the same structure as [Vertex]{@link google.cloud.vision.v1p2beta1.Vertex} - * - * @property {Object[]} normalizedVertices - * The bounding polygon normalized vertices. - * - * This object should have the same structure as [NormalizedVertex]{@link google.cloud.vision.v1p2beta1.NormalizedVertex} - * - * @typedef BoundingPoly - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.BoundingPoly definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/geometry.proto} - */ -const BoundingPoly = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A 3D position in the image, used primarily for Face detection landmarks. - * A valid Position must have both x and y coordinates. - * The position coordinates are in the same scale as the original image. - * - * @property {number} x - * X coordinate. - * - * @property {number} y - * Y coordinate. - * - * @property {number} z - * Z coordinate (or depth). - * - * @typedef Position - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.Position definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/geometry.proto} - */ -const Position = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p2beta1/doc/google/cloud/vision/v1p2beta1/doc_image_annotator.js b/packages/google-cloud-vision/src/v1p2beta1/doc/google/cloud/vision/v1p2beta1/doc_image_annotator.js deleted file mode 100644 index 77d0a4d5506..00000000000 --- a/packages/google-cloud-vision/src/v1p2beta1/doc/google/cloud/vision/v1p2beta1/doc_image_annotator.js +++ /dev/null @@ -1,1250 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * The type of Google Cloud Vision API detection to perform, and the maximum - * number of results to return for that type. Multiple `Feature` objects can - * be specified in the `features` list. - * - * @property {number} type - * The feature type. - * - * The number should be among the values of [Type]{@link google.cloud.vision.v1p2beta1.Type} - * - * @property {number} maxResults - * Maximum number of results of this type. Does not apply to - * `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`. - * - * @property {string} model - * Model to use for the feature. - * Supported values: "builtin/stable" (the default if unset) and - * "builtin/latest". - * - * @typedef Feature - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.Feature definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const Feature = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Type of Google Cloud Vision API feature to be extracted. - * - * @enum {number} - * @memberof google.cloud.vision.v1p2beta1 - */ - Type: { - - /** - * Unspecified feature type. - */ - TYPE_UNSPECIFIED: 0, - - /** - * Run face detection. - */ - FACE_DETECTION: 1, - - /** - * Run landmark detection. - */ - LANDMARK_DETECTION: 2, - - /** - * Run logo detection. - */ - LOGO_DETECTION: 3, - - /** - * Run label detection. - */ - LABEL_DETECTION: 4, - - /** - * Run text detection / optical character recognition (OCR). Text detection - * is optimized for areas of text within a larger image; if the image is - * a document, use `DOCUMENT_TEXT_DETECTION` instead. - */ - TEXT_DETECTION: 5, - - /** - * Run dense text document OCR. Takes precedence when both - * `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` are present. - */ - DOCUMENT_TEXT_DETECTION: 11, - - /** - * Run Safe Search to detect potentially unsafe - * or undesirable content. - */ - SAFE_SEARCH_DETECTION: 6, - - /** - * Compute a set of image properties, such as the - * image's dominant colors. - */ - IMAGE_PROPERTIES: 7, - - /** - * Run crop hints. - */ - CROP_HINTS: 9, - - /** - * Run web detection. - */ - WEB_DETECTION: 10 - } -}; - -/** - * External image source (Google Cloud Storage or web URL image location). - * - * @property {string} gcsImageUri - * **Use `image_uri` instead.** - * - * The Google Cloud Storage URI of the form - * `gs://bucket_name/object_name`. Object versioning is not supported. See - * [Google Cloud Storage Request - * URIs](https://cloud.google.com/storage/docs/reference-uris) for more info. - * - * @property {string} imageUri - * The URI of the source image. Can be either: - * - * 1. A Google Cloud Storage URI of the form - * `gs://bucket_name/object_name`. Object versioning is not supported. See - * [Google Cloud Storage Request - * URIs](https://cloud.google.com/storage/docs/reference-uris) for more - * info. - * - * 2. A publicly-accessible image HTTP/HTTPS URL. When fetching images from - * HTTP/HTTPS URLs, Google cannot guarantee that the request will be - * completed. Your request may fail if the specified host denies the - * request (e.g. due to request throttling or DOS prevention), or if Google - * throttles requests to the site for abuse prevention. You should not - * depend on externally-hosted images for production applications. - * - * When both `gcs_image_uri` and `image_uri` are specified, `image_uri` takes - * precedence. - * - * @typedef ImageSource - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.ImageSource definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const ImageSource = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Client image to perform Google Cloud Vision API tasks over. - * - * @property {Buffer} content - * Image content, represented as a stream of bytes. - * Note: As with all `bytes` fields, protobuffers use a pure binary - * representation, whereas JSON representations use base64. - * - * @property {Object} source - * Google Cloud Storage image location, or publicly-accessible image - * URL. If both `content` and `source` are provided for an image, `content` - * takes precedence and is used to perform the image annotation request. - * - * This object should have the same structure as [ImageSource]{@link google.cloud.vision.v1p2beta1.ImageSource} - * - * @typedef Image - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.Image definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const Image = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A face annotation object contains the results of face detection. - * - * @property {Object} boundingPoly - * The bounding polygon around the face. The coordinates of the bounding box - * are in the original image's scale, as returned in `ImageParams`. - * The bounding box is computed to "frame" the face in accordance with human - * expectations. It is based on the landmarker results. - * Note that one or more x and/or y coordinates may not be generated in the - * `BoundingPoly` (the polygon will be unbounded) if only a partial face - * appears in the image to be annotated. - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p2beta1.BoundingPoly} - * - * @property {Object} fdBoundingPoly - * The `fd_bounding_poly` bounding polygon is tighter than the - * `boundingPoly`, and encloses only the skin part of the face. Typically, it - * is used to eliminate the face from any image analysis that detects the - * "amount of skin" visible in an image. It is not based on the - * landmarker results, only on the initial face detection, hence - * the fd (face detection) prefix. - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p2beta1.BoundingPoly} - * - * @property {Object[]} landmarks - * Detected face landmarks. - * - * This object should have the same structure as [Landmark]{@link google.cloud.vision.v1p2beta1.Landmark} - * - * @property {number} rollAngle - * Roll angle, which indicates the amount of clockwise/anti-clockwise rotation - * of the face relative to the image vertical about the axis perpendicular to - * the face. Range [-180,180]. - * - * @property {number} panAngle - * Yaw angle, which indicates the leftward/rightward angle that the face is - * pointing relative to the vertical plane perpendicular to the image. Range - * [-180,180]. - * - * @property {number} tiltAngle - * Pitch angle, which indicates the upwards/downwards angle that the face is - * pointing relative to the image's horizontal plane. Range [-180,180]. - * - * @property {number} detectionConfidence - * Detection confidence. Range [0, 1]. - * - * @property {number} landmarkingConfidence - * Face landmarking confidence. Range [0, 1]. - * - * @property {number} joyLikelihood - * Joy likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p2beta1.Likelihood} - * - * @property {number} sorrowLikelihood - * Sorrow likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p2beta1.Likelihood} - * - * @property {number} angerLikelihood - * Anger likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p2beta1.Likelihood} - * - * @property {number} surpriseLikelihood - * Surprise likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p2beta1.Likelihood} - * - * @property {number} underExposedLikelihood - * Under-exposed likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p2beta1.Likelihood} - * - * @property {number} blurredLikelihood - * Blurred likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p2beta1.Likelihood} - * - * @property {number} headwearLikelihood - * Headwear likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p2beta1.Likelihood} - * - * @typedef FaceAnnotation - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.FaceAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const FaceAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * A face-specific landmark (for example, a face feature). - * - * @property {number} type - * Face landmark type. - * - * The number should be among the values of [Type]{@link google.cloud.vision.v1p2beta1.Type} - * - * @property {Object} position - * Face landmark position. - * - * This object should have the same structure as [Position]{@link google.cloud.vision.v1p2beta1.Position} - * - * @typedef Landmark - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.FaceAnnotation.Landmark definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ - Landmark: { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Face landmark (feature) type. - * Left and right are defined from the vantage of the viewer of the image - * without considering mirror projections typical of photos. So, `LEFT_EYE`, - * typically, is the person's right eye. - * - * @enum {number} - * @memberof google.cloud.vision.v1p2beta1 - */ - Type: { - - /** - * Unknown face landmark detected. Should not be filled. - */ - UNKNOWN_LANDMARK: 0, - - /** - * Left eye. - */ - LEFT_EYE: 1, - - /** - * Right eye. - */ - RIGHT_EYE: 2, - - /** - * Left of left eyebrow. - */ - LEFT_OF_LEFT_EYEBROW: 3, - - /** - * Right of left eyebrow. - */ - RIGHT_OF_LEFT_EYEBROW: 4, - - /** - * Left of right eyebrow. - */ - LEFT_OF_RIGHT_EYEBROW: 5, - - /** - * Right of right eyebrow. - */ - RIGHT_OF_RIGHT_EYEBROW: 6, - - /** - * Midpoint between eyes. - */ - MIDPOINT_BETWEEN_EYES: 7, - - /** - * Nose tip. - */ - NOSE_TIP: 8, - - /** - * Upper lip. - */ - UPPER_LIP: 9, - - /** - * Lower lip. - */ - LOWER_LIP: 10, - - /** - * Mouth left. - */ - MOUTH_LEFT: 11, - - /** - * Mouth right. - */ - MOUTH_RIGHT: 12, - - /** - * Mouth center. - */ - MOUTH_CENTER: 13, - - /** - * Nose, bottom right. - */ - NOSE_BOTTOM_RIGHT: 14, - - /** - * Nose, bottom left. - */ - NOSE_BOTTOM_LEFT: 15, - - /** - * Nose, bottom center. - */ - NOSE_BOTTOM_CENTER: 16, - - /** - * Left eye, top boundary. - */ - LEFT_EYE_TOP_BOUNDARY: 17, - - /** - * Left eye, right corner. - */ - LEFT_EYE_RIGHT_CORNER: 18, - - /** - * Left eye, bottom boundary. - */ - LEFT_EYE_BOTTOM_BOUNDARY: 19, - - /** - * Left eye, left corner. - */ - LEFT_EYE_LEFT_CORNER: 20, - - /** - * Right eye, top boundary. - */ - RIGHT_EYE_TOP_BOUNDARY: 21, - - /** - * Right eye, right corner. - */ - RIGHT_EYE_RIGHT_CORNER: 22, - - /** - * Right eye, bottom boundary. - */ - RIGHT_EYE_BOTTOM_BOUNDARY: 23, - - /** - * Right eye, left corner. - */ - RIGHT_EYE_LEFT_CORNER: 24, - - /** - * Left eyebrow, upper midpoint. - */ - LEFT_EYEBROW_UPPER_MIDPOINT: 25, - - /** - * Right eyebrow, upper midpoint. - */ - RIGHT_EYEBROW_UPPER_MIDPOINT: 26, - - /** - * Left ear tragion. - */ - LEFT_EAR_TRAGION: 27, - - /** - * Right ear tragion. - */ - RIGHT_EAR_TRAGION: 28, - - /** - * Left eye pupil. - */ - LEFT_EYE_PUPIL: 29, - - /** - * Right eye pupil. - */ - RIGHT_EYE_PUPIL: 30, - - /** - * Forehead glabella. - */ - FOREHEAD_GLABELLA: 31, - - /** - * Chin gnathion. - */ - CHIN_GNATHION: 32, - - /** - * Chin left gonion. - */ - CHIN_LEFT_GONION: 33, - - /** - * Chin right gonion. - */ - CHIN_RIGHT_GONION: 34 - } - } -}; - -/** - * Detected entity location information. - * - * @property {Object} latLng - * lat/long location coordinates. - * - * This object should have the same structure as [LatLng]{@link google.type.LatLng} - * - * @typedef LocationInfo - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.LocationInfo definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const LocationInfo = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A `Property` consists of a user-supplied name/value pair. - * - * @property {string} name - * Name of the property. - * - * @property {string} value - * Value of the property. - * - * @property {number} uint64Value - * Value of numeric properties. - * - * @typedef Property - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.Property definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const Property = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Set of detected entity features. - * - * @property {string} mid - * Opaque entity ID. Some IDs may be available in - * [Google Knowledge Graph Search - * API](https://developers.google.com/knowledge-graph/). - * - * @property {string} locale - * The language code for the locale in which the entity textual - * `description` is expressed. - * - * @property {string} description - * Entity textual description, expressed in its `locale` language. - * - * @property {number} score - * Overall score of the result. Range [0, 1]. - * - * @property {number} confidence - * **Deprecated. Use `score` instead.** - * The accuracy of the entity detection in an image. - * For example, for an image in which the "Eiffel Tower" entity is detected, - * this field represents the confidence that there is a tower in the query - * image. Range [0, 1]. - * - * @property {number} topicality - * The relevancy of the ICA (Image Content Annotation) label to the - * image. For example, the relevancy of "tower" is likely higher to an image - * containing the detected "Eiffel Tower" than to an image containing a - * detected distant towering building, even though the confidence that - * there is a tower in each image may be the same. Range [0, 1]. - * - * @property {Object} boundingPoly - * Image region to which this entity belongs. Not produced - * for `LABEL_DETECTION` features. - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p2beta1.BoundingPoly} - * - * @property {Object[]} locations - * The location information for the detected entity. Multiple - * `LocationInfo` elements can be present because one location may - * indicate the location of the scene in the image, and another location - * may indicate the location of the place where the image was taken. - * Location information is usually present for landmarks. - * - * This object should have the same structure as [LocationInfo]{@link google.cloud.vision.v1p2beta1.LocationInfo} - * - * @property {Object[]} properties - * Some entities may have optional user-supplied `Property` (name/value) - * fields, such a score or string that qualifies the entity. - * - * This object should have the same structure as [Property]{@link google.cloud.vision.v1p2beta1.Property} - * - * @typedef EntityAnnotation - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.EntityAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const EntityAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Set of features pertaining to the image, computed by computer vision - * methods over safe-search verticals (for example, adult, spoof, medical, - * violence). - * - * @property {number} adult - * Represents the adult content likelihood for the image. Adult content may - * contain elements such as nudity, pornographic images or cartoons, or - * sexual activities. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p2beta1.Likelihood} - * - * @property {number} spoof - * Spoof likelihood. The likelihood that an modification - * was made to the image's canonical version to make it appear - * funny or offensive. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p2beta1.Likelihood} - * - * @property {number} medical - * Likelihood that this is a medical image. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p2beta1.Likelihood} - * - * @property {number} violence - * Likelihood that this image contains violent content. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p2beta1.Likelihood} - * - * @property {number} racy - * Likelihood that the request image contains racy content. Racy content may - * include (but is not limited to) skimpy or sheer clothing, strategically - * covered nudity, lewd or provocative poses, or close-ups of sensitive - * body areas. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p2beta1.Likelihood} - * - * @typedef SafeSearchAnnotation - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.SafeSearchAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const SafeSearchAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Rectangle determined by min and max `LatLng` pairs. - * - * @property {Object} minLatLng - * Min lat/long pair. - * - * This object should have the same structure as [LatLng]{@link google.type.LatLng} - * - * @property {Object} maxLatLng - * Max lat/long pair. - * - * This object should have the same structure as [LatLng]{@link google.type.LatLng} - * - * @typedef LatLongRect - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.LatLongRect definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const LatLongRect = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Color information consists of RGB channels, score, and the fraction of - * the image that the color occupies in the image. - * - * @property {Object} color - * RGB components of the color. - * - * This object should have the same structure as [Color]{@link google.type.Color} - * - * @property {number} score - * Image-specific score for this color. Value in range [0, 1]. - * - * @property {number} pixelFraction - * The fraction of pixels the color occupies in the image. - * Value in range [0, 1]. - * - * @typedef ColorInfo - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.ColorInfo definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const ColorInfo = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Set of dominant colors and their corresponding scores. - * - * @property {Object[]} colors - * RGB color values with their score and pixel fraction. - * - * This object should have the same structure as [ColorInfo]{@link google.cloud.vision.v1p2beta1.ColorInfo} - * - * @typedef DominantColorsAnnotation - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.DominantColorsAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const DominantColorsAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Stores image properties, such as dominant colors. - * - * @property {Object} dominantColors - * If present, dominant colors completed successfully. - * - * This object should have the same structure as [DominantColorsAnnotation]{@link google.cloud.vision.v1p2beta1.DominantColorsAnnotation} - * - * @typedef ImageProperties - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.ImageProperties definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const ImageProperties = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Single crop hint that is used to generate a new crop when serving an image. - * - * @property {Object} boundingPoly - * The bounding polygon for the crop region. The coordinates of the bounding - * box are in the original image's scale, as returned in `ImageParams`. - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p2beta1.BoundingPoly} - * - * @property {number} confidence - * Confidence of this being a salient region. Range [0, 1]. - * - * @property {number} importanceFraction - * Fraction of importance of this salient region with respect to the original - * image. - * - * @typedef CropHint - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.CropHint definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const CropHint = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Set of crop hints that are used to generate new crops when serving images. - * - * @property {Object[]} cropHints - * Crop hint results. - * - * This object should have the same structure as [CropHint]{@link google.cloud.vision.v1p2beta1.CropHint} - * - * @typedef CropHintsAnnotation - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.CropHintsAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const CropHintsAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Parameters for crop hints annotation request. - * - * @property {number[]} aspectRatios - * Aspect ratios in floats, representing the ratio of the width to the height - * of the image. For example, if the desired aspect ratio is 4/3, the - * corresponding float value should be 1.33333. If not specified, the - * best possible crop is returned. The number of provided aspect ratios is - * limited to a maximum of 16; any aspect ratios provided after the 16th are - * ignored. - * - * @typedef CropHintsParams - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.CropHintsParams definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const CropHintsParams = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Parameters for web detection request. - * - * @property {boolean} includeGeoResults - * Whether to include results derived from the geo information in the image. - * - * @typedef WebDetectionParams - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.WebDetectionParams definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const WebDetectionParams = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Image context and/or feature-specific parameters. - * - * @property {Object} latLongRect - * Not used. - * - * This object should have the same structure as [LatLongRect]{@link google.cloud.vision.v1p2beta1.LatLongRect} - * - * @property {string[]} languageHints - * List of languages to use for TEXT_DETECTION. In most cases, an empty value - * yields the best results since it enables automatic language detection. For - * languages based on the Latin alphabet, setting `language_hints` is not - * needed. In rare cases, when the language of the text in the image is known, - * setting a hint will help get better results (although it will be a - * significant hindrance if the hint is wrong). Text detection returns an - * error if one or more of the specified languages is not one of the - * [supported languages](https://cloud.google.com/vision/docs/languages). - * - * @property {Object} cropHintsParams - * Parameters for crop hints annotation request. - * - * This object should have the same structure as [CropHintsParams]{@link google.cloud.vision.v1p2beta1.CropHintsParams} - * - * @property {Object} webDetectionParams - * Parameters for web detection. - * - * This object should have the same structure as [WebDetectionParams]{@link google.cloud.vision.v1p2beta1.WebDetectionParams} - * - * @typedef ImageContext - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.ImageContext definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const ImageContext = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request for performing Google Cloud Vision API tasks over a user-provided - * image, with user-requested features. - * - * @property {Object} image - * The image to be processed. - * - * This object should have the same structure as [Image]{@link google.cloud.vision.v1p2beta1.Image} - * - * @property {Object[]} features - * Requested features. - * - * This object should have the same structure as [Feature]{@link google.cloud.vision.v1p2beta1.Feature} - * - * @property {Object} imageContext - * Additional context that may accompany the image. - * - * This object should have the same structure as [ImageContext]{@link google.cloud.vision.v1p2beta1.ImageContext} - * - * @typedef AnnotateImageRequest - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.AnnotateImageRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const AnnotateImageRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * If an image was produced from a file (e.g. a PDF), this message gives - * information about the source of that image. - * - * @property {string} uri - * The URI of the file used to produce the image. - * - * @property {number} pageNumber - * If the file was a PDF or TIFF, this field gives the page number within - * the file used to produce the image. - * - * @typedef ImageAnnotationContext - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.ImageAnnotationContext definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const ImageAnnotationContext = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response to an image annotation request. - * - * @property {Object[]} faceAnnotations - * If present, face detection has completed successfully. - * - * This object should have the same structure as [FaceAnnotation]{@link google.cloud.vision.v1p2beta1.FaceAnnotation} - * - * @property {Object[]} landmarkAnnotations - * If present, landmark detection has completed successfully. - * - * This object should have the same structure as [EntityAnnotation]{@link google.cloud.vision.v1p2beta1.EntityAnnotation} - * - * @property {Object[]} logoAnnotations - * If present, logo detection has completed successfully. - * - * This object should have the same structure as [EntityAnnotation]{@link google.cloud.vision.v1p2beta1.EntityAnnotation} - * - * @property {Object[]} labelAnnotations - * If present, label detection has completed successfully. - * - * This object should have the same structure as [EntityAnnotation]{@link google.cloud.vision.v1p2beta1.EntityAnnotation} - * - * @property {Object[]} textAnnotations - * If present, text (OCR) detection has completed successfully. - * - * This object should have the same structure as [EntityAnnotation]{@link google.cloud.vision.v1p2beta1.EntityAnnotation} - * - * @property {Object} fullTextAnnotation - * If present, text (OCR) detection or document (OCR) text detection has - * completed successfully. - * This annotation provides the structural hierarchy for the OCR detected - * text. - * - * This object should have the same structure as [TextAnnotation]{@link google.cloud.vision.v1p2beta1.TextAnnotation} - * - * @property {Object} safeSearchAnnotation - * If present, safe-search annotation has completed successfully. - * - * This object should have the same structure as [SafeSearchAnnotation]{@link google.cloud.vision.v1p2beta1.SafeSearchAnnotation} - * - * @property {Object} imagePropertiesAnnotation - * If present, image properties were extracted successfully. - * - * This object should have the same structure as [ImageProperties]{@link google.cloud.vision.v1p2beta1.ImageProperties} - * - * @property {Object} cropHintsAnnotation - * If present, crop hints have completed successfully. - * - * This object should have the same structure as [CropHintsAnnotation]{@link google.cloud.vision.v1p2beta1.CropHintsAnnotation} - * - * @property {Object} webDetection - * If present, web detection has completed successfully. - * - * This object should have the same structure as [WebDetection]{@link google.cloud.vision.v1p2beta1.WebDetection} - * - * @property {Object} error - * If set, represents the error message for the operation. - * Note that filled-in image annotations are guaranteed to be - * correct, even when `error` is set. - * - * This object should have the same structure as [Status]{@link google.rpc.Status} - * - * @property {Object} context - * If present, contextual information is needed to understand where this image - * comes from. - * - * This object should have the same structure as [ImageAnnotationContext]{@link google.cloud.vision.v1p2beta1.ImageAnnotationContext} - * - * @typedef AnnotateImageResponse - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.AnnotateImageResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const AnnotateImageResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response to a single file annotation request. A file may contain one or more - * images, which individually have their own responses. - * - * @property {Object} inputConfig - * Information about the file for which this response is generated. - * - * This object should have the same structure as [InputConfig]{@link google.cloud.vision.v1p2beta1.InputConfig} - * - * @property {Object[]} responses - * Individual responses to images found within the file. - * - * This object should have the same structure as [AnnotateImageResponse]{@link google.cloud.vision.v1p2beta1.AnnotateImageResponse} - * - * @typedef AnnotateFileResponse - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.AnnotateFileResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const AnnotateFileResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Multiple image annotation requests are batched into a single service call. - * - * @property {Object[]} requests - * Required. Individual image annotation requests for this batch. - * - * This object should have the same structure as [AnnotateImageRequest]{@link google.cloud.vision.v1p2beta1.AnnotateImageRequest} - * - * @typedef BatchAnnotateImagesRequest - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.BatchAnnotateImagesRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const BatchAnnotateImagesRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response to a batch image annotation request. - * - * @property {Object[]} responses - * Individual responses to image annotation requests within the batch. - * - * This object should have the same structure as [AnnotateImageResponse]{@link google.cloud.vision.v1p2beta1.AnnotateImageResponse} - * - * @typedef BatchAnnotateImagesResponse - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const BatchAnnotateImagesResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * An offline file annotation request. - * - * @property {Object} inputConfig - * Required. Information about the input file. - * - * This object should have the same structure as [InputConfig]{@link google.cloud.vision.v1p2beta1.InputConfig} - * - * @property {Object[]} features - * Required. Requested features. - * - * This object should have the same structure as [Feature]{@link google.cloud.vision.v1p2beta1.Feature} - * - * @property {Object} imageContext - * Additional context that may accompany the image(s) in the file. - * - * This object should have the same structure as [ImageContext]{@link google.cloud.vision.v1p2beta1.ImageContext} - * - * @property {Object} outputConfig - * Required. The desired output location and metadata (e.g. format). - * - * This object should have the same structure as [OutputConfig]{@link google.cloud.vision.v1p2beta1.OutputConfig} - * - * @typedef AsyncAnnotateFileRequest - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const AsyncAnnotateFileRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The response for a single offline file annotation request. - * - * @property {Object} outputConfig - * The output location and metadata from AsyncAnnotateFileRequest. - * - * This object should have the same structure as [OutputConfig]{@link google.cloud.vision.v1p2beta1.OutputConfig} - * - * @typedef AsyncAnnotateFileResponse - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const AsyncAnnotateFileResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Multiple async file annotation requests are batched into a single service - * call. - * - * @property {Object[]} requests - * Required. Individual async file annotation requests for this batch. - * - * This object should have the same structure as [AsyncAnnotateFileRequest]{@link google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest} - * - * @typedef AsyncBatchAnnotateFilesRequest - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const AsyncBatchAnnotateFilesRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response to an async batch file annotation request. - * - * @property {Object[]} responses - * The list of file annotation responses, one for each request in - * AsyncBatchAnnotateFilesRequest. - * - * This object should have the same structure as [AsyncAnnotateFileResponse]{@link google.cloud.vision.v1p2beta1.AsyncAnnotateFileResponse} - * - * @typedef AsyncBatchAnnotateFilesResponse - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const AsyncBatchAnnotateFilesResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The desired input location and metadata. - * - * @property {Object} gcsSource - * The Google Cloud Storage location to read the input from. - * - * This object should have the same structure as [GcsSource]{@link google.cloud.vision.v1p2beta1.GcsSource} - * - * @property {string} mimeType - * The type of the file. Currently only "application/pdf" and "image/tiff" - * are supported. Wildcards are not supported. - * - * @typedef InputConfig - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.InputConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const InputConfig = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The desired output location and metadata. - * - * @property {Object} gcsDestination - * The Google Cloud Storage location to write the output(s) to. - * - * This object should have the same structure as [GcsDestination]{@link google.cloud.vision.v1p2beta1.GcsDestination} - * - * @property {number} batchSize - * The max number of response protos to put into each output JSON file on GCS. - * The valid range is [1, 100]. If not specified, the default value is 20. - * - * For example, for one pdf file with 100 pages, 100 response protos will - * be generated. If `batch_size` = 20, then 5 json files each - * containing 20 response protos will be written under the prefix - * `gcs_destination`.`uri`. - * - * Currently, batch_size only applies to GcsDestination, with potential future - * support for other output configurations. - * - * @typedef OutputConfig - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.OutputConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const OutputConfig = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The Google Cloud Storage location where the input will be read from. - * - * @property {string} uri - * Google Cloud Storage URI for the input file. This must only be a GCS - * object. Wildcards are not currently supported. - * - * @typedef GcsSource - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.GcsSource definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const GcsSource = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The Google Cloud Storage location where the output will be written to. - * - * @property {string} uri - * Google Cloud Storage URI where the results will be stored. Results will - * be in JSON format and preceded by its corresponding input URI. This field - * can either represent a single file, or a prefix for multiple outputs. - * Prefixes must end in a `/`. - * - * Examples: - * - * * File: gs://bucket-name/filename.json - * * Prefix: gs://bucket-name/prefix/here/ - * * File: gs://bucket-name/prefix/here - * - * If multiple outputs, each response is still AnnotateFileResponse, each of - * which contains some subset of the full list of AnnotateImageResponse. - * Multiple outputs can happen if, for example, the output JSON is too large - * and overflows into multiple sharded files. - * - * @typedef GcsDestination - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.GcsDestination definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const GcsDestination = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Contains metadata for the BatchAnnotateImages operation. - * - * @property {number} state - * Current state of the batch operation. - * - * The number should be among the values of [State]{@link google.cloud.vision.v1p2beta1.State} - * - * @property {Object} createTime - * The time when the batch request was received. - * - * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} - * - * @property {Object} updateTime - * The time when the operation result was last updated. - * - * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} - * - * @typedef OperationMetadata - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.OperationMetadata definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/image_annotator.proto} - */ -const OperationMetadata = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Batch operation states. - * - * @enum {number} - * @memberof google.cloud.vision.v1p2beta1 - */ - State: { - - /** - * Invalid. - */ - STATE_UNSPECIFIED: 0, - - /** - * Request is received. - */ - CREATED: 1, - - /** - * Request is actively being processed. - */ - RUNNING: 2, - - /** - * The batch processing is done. - */ - DONE: 3, - - /** - * The batch processing was cancelled. - */ - CANCELLED: 4 - } -}; - -/** - * A bucketized representation of likelihood, which is intended to give clients - * highly stable results across model upgrades. - * - * @enum {number} - * @memberof google.cloud.vision.v1p2beta1 - */ -const Likelihood = { - - /** - * Unknown likelihood. - */ - UNKNOWN: 0, - - /** - * It is very unlikely that the image belongs to the specified vertical. - */ - VERY_UNLIKELY: 1, - - /** - * It is unlikely that the image belongs to the specified vertical. - */ - UNLIKELY: 2, - - /** - * It is possible that the image belongs to the specified vertical. - */ - POSSIBLE: 3, - - /** - * It is likely that the image belongs to the specified vertical. - */ - LIKELY: 4, - - /** - * It is very likely that the image belongs to the specified vertical. - */ - VERY_LIKELY: 5 -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p2beta1/doc/google/cloud/vision/v1p2beta1/doc_text_annotation.js b/packages/google-cloud-vision/src/v1p2beta1/doc/google/cloud/vision/v1p2beta1/doc_text_annotation.js deleted file mode 100644 index 1851c768b28..00000000000 --- a/packages/google-cloud-vision/src/v1p2beta1/doc/google/cloud/vision/v1p2beta1/doc_text_annotation.js +++ /dev/null @@ -1,393 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * TextAnnotation contains a structured representation of OCR extracted text. - * The hierarchy of an OCR extracted text structure is like this: - * TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol - * Each structural component, starting from Page, may further have their own - * properties. Properties describe detected languages, breaks etc.. Please refer - * to the - * TextAnnotation.TextProperty - * message definition below for more detail. - * - * @property {Object[]} pages - * List of pages detected by OCR. - * - * This object should have the same structure as [Page]{@link google.cloud.vision.v1p2beta1.Page} - * - * @property {string} text - * UTF-8 text detected on the pages. - * - * @typedef TextAnnotation - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.TextAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/text_annotation.proto} - */ -const TextAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Detected language for a structural component. - * - * @property {string} languageCode - * The BCP-47 language code, such as "en-US" or "sr-Latn". For more - * information, see - * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. - * - * @property {number} confidence - * Confidence of detected language. Range [0, 1]. - * - * @typedef DetectedLanguage - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.TextAnnotation.DetectedLanguage definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/text_annotation.proto} - */ - DetectedLanguage: { - // This is for documentation. Actual contents will be loaded by gRPC. - }, - - /** - * Detected start or end of a structural component. - * - * @property {number} type - * Detected break type. - * - * The number should be among the values of [BreakType]{@link google.cloud.vision.v1p2beta1.BreakType} - * - * @property {boolean} isPrefix - * True if break prepends the element. - * - * @typedef DetectedBreak - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.TextAnnotation.DetectedBreak definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/text_annotation.proto} - */ - DetectedBreak: { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Enum to denote the type of break found. New line, space etc. - * - * @enum {number} - * @memberof google.cloud.vision.v1p2beta1 - */ - BreakType: { - - /** - * Unknown break label type. - */ - UNKNOWN: 0, - - /** - * Regular space. - */ - SPACE: 1, - - /** - * Sure space (very wide). - */ - SURE_SPACE: 2, - - /** - * Line-wrapping break. - */ - EOL_SURE_SPACE: 3, - - /** - * End-line hyphen that is not present in text; does not co-occur with - * `SPACE`, `LEADER_SPACE`, or `LINE_BREAK`. - */ - HYPHEN: 4, - - /** - * Line break that ends a paragraph. - */ - LINE_BREAK: 5 - } - }, - - /** - * Additional information detected on the structural component. - * - * @property {Object[]} detectedLanguages - * A list of detected languages together with confidence. - * - * This object should have the same structure as [DetectedLanguage]{@link google.cloud.vision.v1p2beta1.DetectedLanguage} - * - * @property {Object} detectedBreak - * Detected start or end of a text segment. - * - * This object should have the same structure as [DetectedBreak]{@link google.cloud.vision.v1p2beta1.DetectedBreak} - * - * @typedef TextProperty - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/text_annotation.proto} - */ - TextProperty: { - // This is for documentation. Actual contents will be loaded by gRPC. - } -}; - -/** - * Detected page from OCR. - * - * @property {Object} property - * Additional information detected on the page. - * - * This object should have the same structure as [TextProperty]{@link google.cloud.vision.v1p2beta1.TextProperty} - * - * @property {number} width - * Page width. For PDFs the unit is points. For images (including - * TIFFs) the unit is pixels. - * - * @property {number} height - * Page height. For PDFs the unit is points. For images (including - * TIFFs) the unit is pixels. - * - * @property {Object[]} blocks - * List of blocks of text, images etc on this page. - * - * This object should have the same structure as [Block]{@link google.cloud.vision.v1p2beta1.Block} - * - * @property {number} confidence - * Confidence of the OCR results on the page. Range [0, 1]. - * - * @typedef Page - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.Page definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/text_annotation.proto} - */ -const Page = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Logical element on the page. - * - * @property {Object} property - * Additional information detected for the block. - * - * This object should have the same structure as [TextProperty]{@link google.cloud.vision.v1p2beta1.TextProperty} - * - * @property {Object} boundingBox - * The bounding box for the block. - * The vertices are in the order of top-left, top-right, bottom-right, - * bottom-left. When a rotation of the bounding box is detected the rotation - * is represented as around the top-left corner as defined when the text is - * read in the 'natural' orientation. - * For example: - * - * * when the text is horizontal it might look like: - * - * 0----1 - * | | - * 3----2 - * - * * when it's rotated 180 degrees around the top-left corner it becomes: - * - * 2----3 - * | | - * 1----0 - * - * and the vertice order will still be (0, 1, 2, 3). - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p2beta1.BoundingPoly} - * - * @property {Object[]} paragraphs - * List of paragraphs in this block (if this blocks is of type text). - * - * This object should have the same structure as [Paragraph]{@link google.cloud.vision.v1p2beta1.Paragraph} - * - * @property {number} blockType - * Detected block type (text, image etc) for this block. - * - * The number should be among the values of [BlockType]{@link google.cloud.vision.v1p2beta1.BlockType} - * - * @property {number} confidence - * Confidence of the OCR results on the block. Range [0, 1]. - * - * @typedef Block - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.Block definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/text_annotation.proto} - */ -const Block = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Type of a block (text, image etc) as identified by OCR. - * - * @enum {number} - * @memberof google.cloud.vision.v1p2beta1 - */ - BlockType: { - - /** - * Unknown block type. - */ - UNKNOWN: 0, - - /** - * Regular text block. - */ - TEXT: 1, - - /** - * Table block. - */ - TABLE: 2, - - /** - * Image block. - */ - PICTURE: 3, - - /** - * Horizontal/vertical line box. - */ - RULER: 4, - - /** - * Barcode block. - */ - BARCODE: 5 - } -}; - -/** - * Structural unit of text representing a number of words in certain order. - * - * @property {Object} property - * Additional information detected for the paragraph. - * - * This object should have the same structure as [TextProperty]{@link google.cloud.vision.v1p2beta1.TextProperty} - * - * @property {Object} boundingBox - * The bounding box for the paragraph. - * The vertices are in the order of top-left, top-right, bottom-right, - * bottom-left. When a rotation of the bounding box is detected the rotation - * is represented as around the top-left corner as defined when the text is - * read in the 'natural' orientation. - * For example: - * * when the text is horizontal it might look like: - * 0----1 - * | | - * 3----2 - * * when it's rotated 180 degrees around the top-left corner it becomes: - * 2----3 - * | | - * 1----0 - * and the vertice order will still be (0, 1, 2, 3). - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p2beta1.BoundingPoly} - * - * @property {Object[]} words - * List of words in this paragraph. - * - * This object should have the same structure as [Word]{@link google.cloud.vision.v1p2beta1.Word} - * - * @property {number} confidence - * Confidence of the OCR results for the paragraph. Range [0, 1]. - * - * @typedef Paragraph - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.Paragraph definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/text_annotation.proto} - */ -const Paragraph = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A word representation. - * - * @property {Object} property - * Additional information detected for the word. - * - * This object should have the same structure as [TextProperty]{@link google.cloud.vision.v1p2beta1.TextProperty} - * - * @property {Object} boundingBox - * The bounding box for the word. - * The vertices are in the order of top-left, top-right, bottom-right, - * bottom-left. When a rotation of the bounding box is detected the rotation - * is represented as around the top-left corner as defined when the text is - * read in the 'natural' orientation. - * For example: - * * when the text is horizontal it might look like: - * 0----1 - * | | - * 3----2 - * * when it's rotated 180 degrees around the top-left corner it becomes: - * 2----3 - * | | - * 1----0 - * and the vertice order will still be (0, 1, 2, 3). - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p2beta1.BoundingPoly} - * - * @property {Object[]} symbols - * List of symbols in the word. - * The order of the symbols follows the natural reading order. - * - * This object should have the same structure as [Symbol]{@link google.cloud.vision.v1p2beta1.Symbol} - * - * @property {number} confidence - * Confidence of the OCR results for the word. Range [0, 1]. - * - * @typedef Word - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.Word definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/text_annotation.proto} - */ -const Word = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A single symbol representation. - * - * @property {Object} property - * Additional information detected for the symbol. - * - * This object should have the same structure as [TextProperty]{@link google.cloud.vision.v1p2beta1.TextProperty} - * - * @property {Object} boundingBox - * The bounding box for the symbol. - * The vertices are in the order of top-left, top-right, bottom-right, - * bottom-left. When a rotation of the bounding box is detected the rotation - * is represented as around the top-left corner as defined when the text is - * read in the 'natural' orientation. - * For example: - * * when the text is horizontal it might look like: - * 0----1 - * | | - * 3----2 - * * when it's rotated 180 degrees around the top-left corner it becomes: - * 2----3 - * | | - * 1----0 - * and the vertice order will still be (0, 1, 2, 3). - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p2beta1.BoundingPoly} - * - * @property {string} text - * The actual UTF-8 representation of the symbol. - * - * @property {number} confidence - * Confidence of the OCR results for the symbol. Range [0, 1]. - * - * @typedef Symbol - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.Symbol definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/text_annotation.proto} - */ -const Symbol = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p2beta1/doc/google/cloud/vision/v1p2beta1/doc_web_detection.js b/packages/google-cloud-vision/src/v1p2beta1/doc/google/cloud/vision/v1p2beta1/doc_web_detection.js deleted file mode 100644 index 8792b8ca5c0..00000000000 --- a/packages/google-cloud-vision/src/v1p2beta1/doc/google/cloud/vision/v1p2beta1/doc_web_detection.js +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * Relevant information for the image from the Internet. - * - * @property {Object[]} webEntities - * Deduced entities from similar images on the Internet. - * - * This object should have the same structure as [WebEntity]{@link google.cloud.vision.v1p2beta1.WebEntity} - * - * @property {Object[]} fullMatchingImages - * Fully matching images from the Internet. - * Can include resized copies of the query image. - * - * This object should have the same structure as [WebImage]{@link google.cloud.vision.v1p2beta1.WebImage} - * - * @property {Object[]} partialMatchingImages - * Partial matching images from the Internet. - * Those images are similar enough to share some key-point features. For - * example an original image will likely have partial matching for its crops. - * - * This object should have the same structure as [WebImage]{@link google.cloud.vision.v1p2beta1.WebImage} - * - * @property {Object[]} pagesWithMatchingImages - * Web pages containing the matching images from the Internet. - * - * This object should have the same structure as [WebPage]{@link google.cloud.vision.v1p2beta1.WebPage} - * - * @property {Object[]} visuallySimilarImages - * The visually similar image results. - * - * This object should have the same structure as [WebImage]{@link google.cloud.vision.v1p2beta1.WebImage} - * - * @property {Object[]} bestGuessLabels - * Best guess text labels for the request image. - * - * This object should have the same structure as [WebLabel]{@link google.cloud.vision.v1p2beta1.WebLabel} - * - * @typedef WebDetection - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.WebDetection definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/web_detection.proto} - */ -const WebDetection = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Entity deduced from similar images on the Internet. - * - * @property {string} entityId - * Opaque entity ID. - * - * @property {number} score - * Overall relevancy score for the entity. - * Not normalized and not comparable across different image queries. - * - * @property {string} description - * Canonical description of the entity, in English. - * - * @typedef WebEntity - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.WebDetection.WebEntity definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/web_detection.proto} - */ - WebEntity: { - // This is for documentation. Actual contents will be loaded by gRPC. - }, - - /** - * Metadata for online images. - * - * @property {string} url - * The result image URL. - * - * @property {number} score - * (Deprecated) Overall relevancy score for the image. - * - * @typedef WebImage - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.WebDetection.WebImage definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/web_detection.proto} - */ - WebImage: { - // This is for documentation. Actual contents will be loaded by gRPC. - }, - - /** - * Metadata for web pages. - * - * @property {string} url - * The result web page URL. - * - * @property {number} score - * (Deprecated) Overall relevancy score for the web page. - * - * @property {string} pageTitle - * Title for the web page, may contain HTML markups. - * - * @property {Object[]} fullMatchingImages - * Fully matching images on the page. - * Can include resized copies of the query image. - * - * This object should have the same structure as [WebImage]{@link google.cloud.vision.v1p2beta1.WebImage} - * - * @property {Object[]} partialMatchingImages - * Partial matching images on the page. - * Those images are similar enough to share some key-point features. For - * example an original image will likely have partial matching for its - * crops. - * - * This object should have the same structure as [WebImage]{@link google.cloud.vision.v1p2beta1.WebImage} - * - * @typedef WebPage - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.WebDetection.WebPage definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/web_detection.proto} - */ - WebPage: { - // This is for documentation. Actual contents will be loaded by gRPC. - }, - - /** - * Label to provide extra metadata for the web detection. - * - * @property {string} label - * Label for extra metadata. - * - * @property {string} languageCode - * The BCP-47 language code for `label`, such as "en-US" or "sr-Latn". - * For more information, see - * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. - * - * @typedef WebLabel - * @memberof google.cloud.vision.v1p2beta1 - * @see [google.cloud.vision.v1p2beta1.WebDetection.WebLabel definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p2beta1/web_detection.proto} - */ - WebLabel: { - // This is for documentation. Actual contents will be loaded by gRPC. - } -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p2beta1/doc/google/longrunning/doc_operations.js b/packages/google-cloud-vision/src/v1p2beta1/doc/google/longrunning/doc_operations.js deleted file mode 100644 index 099e418d620..00000000000 --- a/packages/google-cloud-vision/src/v1p2beta1/doc/google/longrunning/doc_operations.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * This resource represents a long-running operation that is the result of a - * network API call. - * - * @property {string} name - * The server-assigned name, which is only unique within the same service that - * originally returns it. If you use the default HTTP mapping, the - * `name` should be a resource name ending with `operations/{unique_id}`. - * - * @property {Object} metadata - * Service-specific metadata associated with the operation. It typically - * contains progress information and common metadata such as create time. - * Some services might not provide such metadata. Any method that returns a - * long-running operation should document the metadata type, if any. - * - * This object should have the same structure as [Any]{@link google.protobuf.Any} - * - * @property {boolean} done - * If the value is `false`, it means the operation is still in progress. - * If `true`, the operation is completed, and either `error` or `response` is - * available. - * - * @property {Object} error - * The error result of the operation in case of failure or cancellation. - * - * This object should have the same structure as [Status]{@link google.rpc.Status} - * - * @property {Object} response - * The normal response of the operation in case of success. If the original - * method returns no data on success, such as `Delete`, the response is - * `google.protobuf.Empty`. If the original method is standard - * `Get`/`Create`/`Update`, the response should be the resource. For other - * methods, the response should have the type `XxxResponse`, where `Xxx` - * is the original method name. For example, if the original method name - * is `TakeSnapshot()`, the inferred response type is - * `TakeSnapshotResponse`. - * - * This object should have the same structure as [Any]{@link google.protobuf.Any} - * - * @typedef Operation - * @memberof google.longrunning - * @see [google.longrunning.Operation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/longrunning/operations.proto} - */ -const Operation = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p2beta1/doc/google/protobuf/doc_any.js b/packages/google-cloud-vision/src/v1p2beta1/doc/google/protobuf/doc_any.js deleted file mode 100644 index 813682aa336..00000000000 --- a/packages/google-cloud-vision/src/v1p2beta1/doc/google/protobuf/doc_any.js +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * `Any` contains an arbitrary serialized protocol buffer message along with a - * URL that describes the type of the serialized message. - * - * Protobuf library provides support to pack/unpack Any values in the form - * of utility functions or additional generated methods of the Any type. - * - * Example 1: Pack and unpack a message in C++. - * - * Foo foo = ...; - * Any any; - * any.PackFrom(foo); - * ... - * if (any.UnpackTo(&foo)) { - * ... - * } - * - * Example 2: Pack and unpack a message in Java. - * - * Foo foo = ...; - * Any any = Any.pack(foo); - * ... - * if (any.is(Foo.class)) { - * foo = any.unpack(Foo.class); - * } - * - * Example 3: Pack and unpack a message in Python. - * - * foo = Foo(...) - * any = Any() - * any.Pack(foo) - * ... - * if any.Is(Foo.DESCRIPTOR): - * any.Unpack(foo) - * ... - * - * Example 4: Pack and unpack a message in Go - * - * foo := &pb.Foo{...} - * any, err := ptypes.MarshalAny(foo) - * ... - * foo := &pb.Foo{} - * if err := ptypes.UnmarshalAny(any, foo); err != nil { - * ... - * } - * - * The pack methods provided by protobuf library will by default use - * 'type.googleapis.com/full.type.name' as the type URL and the unpack - * methods only use the fully qualified type name after the last '/' - * in the type URL, for example "foo.bar.com/x/y.z" will yield type - * name "y.z". - * - * - * # JSON - * - * The JSON representation of an `Any` value uses the regular - * representation of the deserialized, embedded message, with an - * additional field `@type` which contains the type URL. Example: - * - * package google.profile; - * message Person { - * string first_name = 1; - * string last_name = 2; - * } - * - * { - * "@type": "type.googleapis.com/google.profile.Person", - * "firstName": , - * "lastName": - * } - * - * If the embedded message type is well-known and has a custom JSON - * representation, that representation will be embedded adding a field - * `value` which holds the custom JSON in addition to the `@type` - * field. Example (for message google.protobuf.Duration): - * - * { - * "@type": "type.googleapis.com/google.protobuf.Duration", - * "value": "1.212s" - * } - * - * @property {string} typeUrl - * A URL/resource name that uniquely identifies the type of the serialized - * protocol buffer message. This string must contain at least - * one "/" character. The last segment of the URL's path must represent - * the fully qualified name of the type (as in - * `path/google.protobuf.Duration`). The name should be in a canonical form - * (e.g., leading "." is not accepted). - * - * In practice, teams usually precompile into the binary all types that they - * expect it to use in the context of Any. However, for URLs which use the - * scheme `http`, `https`, or no scheme, one can optionally set up a type - * server that maps type URLs to message definitions as follows: - * - * * If no scheme is provided, `https` is assumed. - * * An HTTP GET on the URL must yield a google.protobuf.Type - * value in binary format, or produce an error. - * * Applications are allowed to cache lookup results based on the - * URL, or have them precompiled into a binary to avoid any - * lookup. Therefore, binary compatibility needs to be preserved - * on changes to types. (Use versioned type names to manage - * breaking changes.) - * - * Note: this functionality is not currently available in the official - * protobuf release, and it is not used for type URLs beginning with - * type.googleapis.com. - * - * Schemes other than `http`, `https` (or the empty scheme) might be - * used with implementation specific semantics. - * - * @property {Buffer} value - * Must be a valid serialized protocol buffer of the above specified type. - * - * @typedef Any - * @memberof google.protobuf - * @see [google.protobuf.Any definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/any.proto} - */ -const Any = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p2beta1/doc/google/protobuf/doc_wrappers.js b/packages/google-cloud-vision/src/v1p2beta1/doc/google/protobuf/doc_wrappers.js deleted file mode 100644 index 90e2ff4ab5a..00000000000 --- a/packages/google-cloud-vision/src/v1p2beta1/doc/google/protobuf/doc_wrappers.js +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * Wrapper message for `float`. - * - * The JSON representation for `FloatValue` is JSON number. - * - * @property {number} value - * The float value. - * - * @typedef FloatValue - * @memberof google.protobuf - * @see [google.protobuf.FloatValue definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/wrappers.proto} - */ -const FloatValue = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p2beta1/doc/google/rpc/doc_status.js b/packages/google-cloud-vision/src/v1p2beta1/doc/google/rpc/doc_status.js deleted file mode 100644 index 750e0af7689..00000000000 --- a/packages/google-cloud-vision/src/v1p2beta1/doc/google/rpc/doc_status.js +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * The `Status` type defines a logical error model that is suitable for - * different programming environments, including REST APIs and RPC APIs. It is - * used by [gRPC](https://github.com/grpc). Each `Status` message contains - * three pieces of data: error code, error message, and error details. - * - * You can find out more about this error model and how to work with it in the - * [API Design Guide](https://cloud.google.com/apis/design/errors). - * - * @property {number} code - * The status code, which should be an enum value of google.rpc.Code. - * - * @property {string} message - * A developer-facing error message, which should be in English. Any - * user-facing error message should be localized and sent in the - * google.rpc.Status.details field, or localized by the client. - * - * @property {Object[]} details - * A list of messages that carry the error details. There is a common set of - * message types for APIs to use. - * - * This object should have the same structure as [Any]{@link google.protobuf.Any} - * - * @typedef Status - * @memberof google.rpc - * @see [google.rpc.Status definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/rpc/status.proto} - */ -const Status = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p2beta1/doc/google/type/doc_color.js b/packages/google-cloud-vision/src/v1p2beta1/doc/google/type/doc_color.js deleted file mode 100644 index 9570187d502..00000000000 --- a/packages/google-cloud-vision/src/v1p2beta1/doc/google/type/doc_color.js +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * Represents a color in the RGBA color space. This representation is designed - * for simplicity of conversion to/from color representations in various - * languages over compactness; for example, the fields of this representation - * can be trivially provided to the constructor of "java.awt.Color" in Java; it - * can also be trivially provided to UIColor's "+colorWithRed:green:blue:alpha" - * method in iOS; and, with just a little work, it can be easily formatted into - * a CSS "rgba()" string in JavaScript, as well. - * - * Note: this proto does not carry information about the absolute color space - * that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, - * DCI-P3, BT.2020, etc.). By default, applications SHOULD assume the sRGB color - * space. - * - * Example (Java): - * - * import com.google.type.Color; - * - * // ... - * public static java.awt.Color fromProto(Color protocolor) { - * float alpha = protocolor.hasAlpha() - * ? protocolor.getAlpha().getValue() - * : 1.0; - * - * return new java.awt.Color( - * protocolor.getRed(), - * protocolor.getGreen(), - * protocolor.getBlue(), - * alpha); - * } - * - * public static Color toProto(java.awt.Color color) { - * float red = (float) color.getRed(); - * float green = (float) color.getGreen(); - * float blue = (float) color.getBlue(); - * float denominator = 255.0; - * Color.Builder resultBuilder = - * Color - * .newBuilder() - * .setRed(red / denominator) - * .setGreen(green / denominator) - * .setBlue(blue / denominator); - * int alpha = color.getAlpha(); - * if (alpha != 255) { - * result.setAlpha( - * FloatValue - * .newBuilder() - * .setValue(((float) alpha) / denominator) - * .build()); - * } - * return resultBuilder.build(); - * } - * // ... - * - * Example (iOS / Obj-C): - * - * // ... - * static UIColor* fromProto(Color* protocolor) { - * float red = [protocolor red]; - * float green = [protocolor green]; - * float blue = [protocolor blue]; - * FloatValue* alpha_wrapper = [protocolor alpha]; - * float alpha = 1.0; - * if (alpha_wrapper != nil) { - * alpha = [alpha_wrapper value]; - * } - * return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; - * } - * - * static Color* toProto(UIColor* color) { - * CGFloat red, green, blue, alpha; - * if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { - * return nil; - * } - * Color* result = [[Color alloc] init]; - * [result setRed:red]; - * [result setGreen:green]; - * [result setBlue:blue]; - * if (alpha <= 0.9999) { - * [result setAlpha:floatWrapperWithValue(alpha)]; - * } - * [result autorelease]; - * return result; - * } - * // ... - * - * Example (JavaScript): - * - * // ... - * - * var protoToCssColor = function(rgb_color) { - * var redFrac = rgb_color.red || 0.0; - * var greenFrac = rgb_color.green || 0.0; - * var blueFrac = rgb_color.blue || 0.0; - * var red = Math.floor(redFrac * 255); - * var green = Math.floor(greenFrac * 255); - * var blue = Math.floor(blueFrac * 255); - * - * if (!('alpha' in rgb_color)) { - * return rgbToCssColor_(red, green, blue); - * } - * - * var alphaFrac = rgb_color.alpha.value || 0.0; - * var rgbParams = [red, green, blue].join(','); - * return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); - * }; - * - * var rgbToCssColor_ = function(red, green, blue) { - * var rgbNumber = new Number((red << 16) | (green << 8) | blue); - * var hexString = rgbNumber.toString(16); - * var missingZeros = 6 - hexString.length; - * var resultBuilder = ['#']; - * for (var i = 0; i < missingZeros; i++) { - * resultBuilder.push('0'); - * } - * resultBuilder.push(hexString); - * return resultBuilder.join(''); - * }; - * - * // ... - * - * @property {number} red - * The amount of red in the color as a value in the interval [0, 1]. - * - * @property {number} green - * The amount of green in the color as a value in the interval [0, 1]. - * - * @property {number} blue - * The amount of blue in the color as a value in the interval [0, 1]. - * - * @property {Object} alpha - * The fraction of this color that should be applied to the pixel. That is, - * the final pixel color is defined by the equation: - * - * pixel color = alpha * (this color) + (1.0 - alpha) * (background color) - * - * This means that a value of 1.0 corresponds to a solid color, whereas - * a value of 0.0 corresponds to a completely transparent color. This - * uses a wrapper message rather than a simple float scalar so that it is - * possible to distinguish between a default value and the value being unset. - * If omitted, this color object is to be rendered as a solid color - * (as if the alpha value had been explicitly given with a value of 1.0). - * - * This object should have the same structure as [FloatValue]{@link google.protobuf.FloatValue} - * - * @typedef Color - * @memberof google.type - * @see [google.type.Color definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/type/color.proto} - */ -const Color = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p2beta1/doc/google/type/doc_latlng.js b/packages/google-cloud-vision/src/v1p2beta1/doc/google/type/doc_latlng.js deleted file mode 100644 index bacbf0e1f48..00000000000 --- a/packages/google-cloud-vision/src/v1p2beta1/doc/google/type/doc_latlng.js +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * An object representing a latitude/longitude pair. This is expressed as a pair - * of doubles representing degrees latitude and degrees longitude. Unless - * specified otherwise, this must conform to the - * WGS84 - * standard. Values must be within normalized ranges. - * - * @property {number} latitude - * The latitude in degrees. It must be in the range [-90.0, +90.0]. - * - * @property {number} longitude - * The longitude in degrees. It must be in the range [-180.0, +180.0]. - * - * @typedef LatLng - * @memberof google.type - * @see [google.type.LatLng definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/type/latlng.proto} - */ -const LatLng = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p2beta1/image_annotator_client.js b/packages/google-cloud-vision/src/v1p2beta1/image_annotator_client.js deleted file mode 100644 index ea8ae60e713..00000000000 --- a/packages/google-cloud-vision/src/v1p2beta1/image_annotator_client.js +++ /dev/null @@ -1,400 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -'use strict'; - -const gapicConfig = require('./image_annotator_client_config.json'); -const gax = require('google-gax'); -const path = require('path'); - -const VERSION = require('../../package.json').version; - -/** - * Service that performs Google Cloud Vision API detection tasks over client - * images, such as face, landmark, logo, label, and text detection. The - * ImageAnnotator service returns detected entities from the images. - * - * @class - * @memberof v1p2beta1 - */ -class ImageAnnotatorClient { - /** - * Construct an instance of ImageAnnotatorClient. - * - * @param {object} [options] - The configuration object. See the subsequent - * parameters for more details. - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {function} [options.promise] - Custom promise module to use instead - * of native Promises. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - */ - constructor(opts) { - opts = opts || {}; - this._descriptors = {}; - - if (global.isBrowser) { - // If we're in browser, we use gRPC fallback. - opts.fallback = true; - } - - // If we are in browser, we are already using fallback because of the - // "browser" field in package.json. - // But if we were explicitly requested to use fallback, let's do it now. - const gaxModule = !global.isBrowser && opts.fallback ? gax.fallback : gax; - - const servicePath = - opts.servicePath || opts.apiEndpoint || this.constructor.servicePath; - - // Ensure that options include the service address and port. - opts = Object.assign( - { - clientConfig: {}, - port: this.constructor.port, - servicePath, - }, - opts - ); - - // Create a `gaxGrpc` object, with any grpc-specific options - // sent to the client. - opts.scopes = this.constructor.scopes; - const gaxGrpc = new gaxModule.GrpcClient(opts); - - // Save the auth object to the client, for use by other methods. - this.auth = gaxGrpc.auth; - - // Determine the client header string. - const clientHeader = []; - - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } - clientHeader.push(`gax/${gaxModule.version}`); - if (opts.fallback) { - clientHeader.push(`gl-web/${gaxModule.version}`); - } else { - clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`); - } - clientHeader.push(`gapic/${VERSION}`); - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - - // Load the applicable protos. - // For Node.js, pass the path to JSON proto file. - // For browsers, pass the JSON content. - - const nodejsProtoPath = path.join( - __dirname, - '..', - '..', - 'protos', - 'protos.json' - ); - const protos = gaxGrpc.loadProto( - opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath - ); - - const protoFilesRoot = opts.fallback - ? gaxModule.protobuf.Root.fromJSON(require('../../protos/protos.json')) - : gaxModule.protobuf.loadSync(nodejsProtoPath); - - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - this.operationsClient = new gaxModule.lro({ - auth: gaxGrpc.auth, - grpc: gaxGrpc.grpc, - }).operationsClient(opts); - - const asyncBatchAnnotateFilesResponse = protoFilesRoot.lookup( - 'google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse' - ); - const asyncBatchAnnotateFilesMetadata = protoFilesRoot.lookup( - 'google.cloud.vision.v1p2beta1.OperationMetadata' - ); - - this._descriptors.longrunning = { - asyncBatchAnnotateFiles: new gaxModule.LongrunningDescriptor( - this.operationsClient, - asyncBatchAnnotateFilesResponse.decode.bind( - asyncBatchAnnotateFilesResponse - ), - asyncBatchAnnotateFilesMetadata.decode.bind( - asyncBatchAnnotateFilesMetadata - ) - ), - }; - - // Put together the default options sent with requests. - const defaults = gaxGrpc.constructSettings( - 'google.cloud.vision.v1p2beta1.ImageAnnotator', - gapicConfig, - opts.clientConfig, - {'x-goog-api-client': clientHeader.join(' ')} - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this._innerApiCalls = {}; - - // Put together the "service stub" for - // google.cloud.vision.v1p2beta1.ImageAnnotator. - const imageAnnotatorStub = gaxGrpc.createStub( - opts.fallback - ? protos.lookupService('google.cloud.vision.v1p2beta1.ImageAnnotator') - : protos.google.cloud.vision.v1p2beta1.ImageAnnotator, - opts - ); - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const imageAnnotatorStubMethods = [ - 'batchAnnotateImages', - 'asyncBatchAnnotateFiles', - ]; - for (const methodName of imageAnnotatorStubMethods) { - const innerCallPromise = imageAnnotatorStub.then( - stub => (...args) => { - return stub[methodName].apply(stub, args); - }, - err => () => { - throw err; - } - ); - this._innerApiCalls[methodName] = gaxModule.createApiCall( - innerCallPromise, - defaults[methodName], - this._descriptors.longrunning[methodName] - ); - } - } - - /** - * The DNS address for this API service. - */ - static get servicePath() { - return 'vision.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - */ - static get apiEndpoint() { - return 'vision.googleapis.com'; - } - - /** - * The port for this API service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloud-vision', - ]; - } - - /** - * Return the project ID used by this class. - * @param {function(Error, string)} callback - the callback to - * be called with the current project Id. - */ - getProjectId(callback) { - return this.auth.getProjectId(callback); - } - - // ------------------- - // -- Service calls -- - // ------------------- - - /** - * Run image detection and annotation for a batch of images. - * - * @param {Object} request - * The request object that will be sent. - * @param {Object[]} request.requests - * Required. Individual image annotation requests for this batch. - * - * This object should have the same structure as [AnnotateImageRequest]{@link google.cloud.vision.v1p2beta1.AnnotateImageRequest} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [BatchAnnotateImagesResponse]{@link google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [BatchAnnotateImagesResponse]{@link google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1p2beta1.ImageAnnotatorClient({ - * // optional auth parameters. - * }); - * - * const requests = []; - * client.batchAnnotateImages({requests: requests}) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - batchAnnotateImages(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - - return this._innerApiCalls.batchAnnotateImages(request, options, callback); - } - - /** - * Run async image detection and annotation for a list of generic files (e.g. - * PDF) which may contain multiple pages and multiple images per page. - * Progress and results can be retrieved through the - * `google.longrunning.Operations` interface. - * `Operation.metadata` contains `OperationMetadata` (metadata). - * `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results). - * - * @param {Object} request - * The request object that will be sent. - * @param {Object[]} request.requests - * Required. Individual async file annotation requests for this batch. - * - * This object should have the same structure as [AsyncAnnotateFileRequest]{@link google.cloud.vision.v1p2beta1.AsyncAnnotateFileRequest} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/classes/Operation.html} object. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/classes/Operation.html} object. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1p2beta1.ImageAnnotatorClient({ - * // optional auth parameters. - * }); - * - * const requests = []; - * - * // Handle the operation using the promise pattern. - * client.asyncBatchAnnotateFiles({requests: requests}) - * .then(responses => { - * const [operation, initialApiResponse] = responses; - * - * // Operation#promise starts polling for the completion of the LRO. - * return operation.promise(); - * }) - * .then(responses => { - * const result = responses[0]; - * const metadata = responses[1]; - * const finalApiResponse = responses[2]; - * }) - * .catch(err => { - * console.error(err); - * }); - * - * const requests = []; - * - * // Handle the operation using the event emitter pattern. - * client.asyncBatchAnnotateFiles({requests: requests}) - * .then(responses => { - * const [operation, initialApiResponse] = responses; - * - * // Adding a listener for the "complete" event starts polling for the - * // completion of the operation. - * operation.on('complete', (result, metadata, finalApiResponse) => { - * // doSomethingWith(result); - * }); - * - * // Adding a listener for the "progress" event causes the callback to be - * // called on any change in metadata when the operation is polled. - * operation.on('progress', (metadata, apiResponse) => { - * // doSomethingWith(metadata) - * }); - * - * // Adding a listener for the "error" event handles any errors found during polling. - * operation.on('error', err => { - * // throw(err); - * }); - * }) - * .catch(err => { - * console.error(err); - * }); - * - * const requests = []; - * - * // Handle the operation using the await pattern. - * const [operation] = await client.asyncBatchAnnotateFiles({requests: requests}); - * - * const [response] = await operation.promise(); - */ - asyncBatchAnnotateFiles(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - - return this._innerApiCalls.asyncBatchAnnotateFiles( - request, - options, - callback - ); - } -} - -module.exports = ImageAnnotatorClient; diff --git a/packages/google-cloud-vision/src/v1p2beta1/image_annotator_client.ts b/packages/google-cloud-vision/src/v1p2beta1/image_annotator_client.ts new file mode 100644 index 00000000000..52c78f6cea4 --- /dev/null +++ b/packages/google-cloud-vision/src/v1p2beta1/image_annotator_client.ts @@ -0,0 +1,468 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as gax from 'google-gax'; +import { + APICallback, + Callback, + CallOptions, + Descriptors, + ClientOptions, + LROperation, +} from 'google-gax'; +import * as path from 'path'; + +import * as protosTypes from '../../protos/protos'; +import * as gapicConfig from './image_annotator_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service that performs Google Cloud Vision API detection tasks over client + * images, such as face, landmark, logo, label, and text detection. The + * ImageAnnotator service returns detected entities from the images. + * @class + * @memberof v1p2beta1 + */ +export class ImageAnnotatorClient { + private _descriptors: Descriptors = {page: {}, stream: {}, longrunning: {}}; + private _innerApiCalls: {[name: string]: Function}; + private _terminated = false; + auth: gax.GoogleAuth; + operationsClient: gax.OperationsClient; + imageAnnotatorStub: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ImageAnnotatorClient. + * + * @param {object} [options] - The configuration object. See the subsequent + * parameters for more details. + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {function} [options.promise] - Custom promise module to use instead + * of native Promises. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + */ + + constructor(opts?: ClientOptions) { + // Ensure that options include the service address and port. + const staticMembers = this.constructor as typeof ImageAnnotatorClient; + const servicePath = + opts && opts.servicePath + ? opts.servicePath + : opts && opts.apiEndpoint + ? opts.apiEndpoint + : staticMembers.servicePath; + const port = opts && opts.port ? opts.port : staticMembers.port; + + if (!opts) { + opts = {servicePath, port}; + } + opts.servicePath = opts.servicePath || servicePath; + opts.port = opts.port || port; + opts.clientConfig = opts.clientConfig || {}; + + const isBrowser = typeof window !== 'undefined'; + if (isBrowser) { + opts.fallback = true; + } + // If we are in browser, we are already using fallback because of the + // "browser" field in package.json. + // But if we were explicitly requested to use fallback, let's do it now. + const gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options + // sent to the client. + opts.scopes = (this.constructor as typeof ImageAnnotatorClient).scopes; + const gaxGrpc = new gaxModule.GrpcClient(opts); + + // Save the auth object to the client, for use by other methods. + this.auth = gaxGrpc.auth as gax.GoogleAuth; + + // Determine the client header string. + const clientHeader = [`gax/${gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + const protos = gaxGrpc.loadProto( + opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath + ); + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const protoFilesRoot = opts.fallback + ? gaxModule.protobuf.Root.fromJSON(require('../../protos/protos.json')) + : gaxModule.protobuf.loadSync(nodejsProtoPath); + + this.operationsClient = gaxModule + .lro({ + auth: this.auth, + grpc: 'grpc' in gaxGrpc ? gaxGrpc.grpc : undefined, + }) + .operationsClient(opts); + const asyncBatchAnnotateFilesResponse = protoFilesRoot.lookup( + '.google.cloud.vision.v1p2beta1.AsyncBatchAnnotateFilesResponse' + ) as gax.protobuf.Type; + const asyncBatchAnnotateFilesMetadata = protoFilesRoot.lookup( + '.google.cloud.vision.v1p2beta1.OperationMetadata' + ) as gax.protobuf.Type; + + this._descriptors.longrunning = { + asyncBatchAnnotateFiles: new gaxModule.LongrunningDescriptor( + this.operationsClient, + asyncBatchAnnotateFilesResponse.decode.bind( + asyncBatchAnnotateFilesResponse + ), + asyncBatchAnnotateFilesMetadata.decode.bind( + asyncBatchAnnotateFilesMetadata + ) + ), + }; + + // Put together the default options sent with requests. + const defaults = gaxGrpc.constructSettings( + 'google.cloud.vision.v1p2beta1.ImageAnnotator', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this._innerApiCalls = {}; + + // Put together the "service stub" for + // google.cloud.vision.v1p2beta1.ImageAnnotator. + this.imageAnnotatorStub = gaxGrpc.createStub( + opts.fallback + ? (protos as protobuf.Root).lookupService( + 'google.cloud.vision.v1p2beta1.ImageAnnotator' + ) + : // tslint:disable-next-line no-any + (protos as any).google.cloud.vision.v1p2beta1.ImageAnnotator, + opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const imageAnnotatorStubMethods = [ + 'batchAnnotateImages', + 'asyncBatchAnnotateFiles', + ]; + + for (const methodName of imageAnnotatorStubMethods) { + const innerCallPromise = this.imageAnnotatorStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + return stub[methodName].apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const apiCall = gaxModule.createApiCall( + innerCallPromise, + defaults[methodName], + this._descriptors.page[methodName] || + this._descriptors.stream[methodName] || + this._descriptors.longrunning[methodName] + ); + + this._innerApiCalls[methodName] = ( + argument: {}, + callOptions?: CallOptions, + callback?: APICallback + ) => { + return apiCall(argument, callOptions, callback); + }; + } + } + + /** + * The DNS address for this API service. + */ + static get servicePath() { + return 'vision.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + */ + static get apiEndpoint() { + return 'vision.googleapis.com'; + } + + /** + * The port for this API service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/cloud-vision', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @param {function(Error, string)} callback - the callback to + * be called with the current project Id. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + batchAnnotateImages( + request: protosTypes.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesResponse, + ( + | protosTypes.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest + | undefined + ), + {} | undefined + ] + >; + batchAnnotateImages( + request: protosTypes.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesResponse, + | protosTypes.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest + | undefined, + {} | undefined + > + ): void; + /** + * Run image detection and annotation for a batch of images. + * + * @param {Object} request + * The request object that will be sent. + * @param {number[]} request.requests + * Required. Individual image annotation requests for this batch. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [BatchAnnotateImagesResponse]{@link google.cloud.vision.v1p2beta1.BatchAnnotateImagesResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + batchAnnotateImages( + request: protosTypes.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesResponse, + | protosTypes.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesResponse, + | protosTypes.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesResponse, + ( + | protosTypes.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + return this._innerApiCalls.batchAnnotateImages(request, options, callback); + } + + asyncBatchAnnotateFiles( + request: protosTypes.google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesRequest, + options?: gax.CallOptions + ): Promise< + [ + LROperation< + protosTypes.google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesResponse, + protosTypes.google.cloud.vision.v1p2beta1.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + asyncBatchAnnotateFiles( + request: protosTypes.google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesRequest, + options: gax.CallOptions, + callback: Callback< + LROperation< + protosTypes.google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesResponse, + protosTypes.google.cloud.vision.v1p2beta1.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + > + ): void; + /** + * Run async image detection and annotation for a list of generic files (e.g. + * PDF) which may contain multiple pages and multiple images per page. + * Progress and results can be retrieved through the + * `google.longrunning.Operations` interface. + * `Operation.metadata` contains `OperationMetadata` (metadata). + * `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results). + * + * @param {Object} request + * The request object that will be sent. + * @param {number[]} request.requests + * Required. Individual async file annotation requests for this batch. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + asyncBatchAnnotateFiles( + request: protosTypes.google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + LROperation< + protosTypes.google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesResponse, + protosTypes.google.cloud.vision.v1p2beta1.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + >, + callback?: Callback< + LROperation< + protosTypes.google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesResponse, + protosTypes.google.cloud.vision.v1p2beta1.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + > + ): Promise< + [ + LROperation< + protosTypes.google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesResponse, + protosTypes.google.cloud.vision.v1p2beta1.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + return this._innerApiCalls.asyncBatchAnnotateFiles( + request, + options, + callback + ); + } + + /** + * Terminate the GRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + */ + close(): Promise { + if (!this._terminated) { + return this.imageAnnotatorStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} +import {FeaturesMethod} from '../helpers'; +export interface ImageAnnotatorClient extends FeaturesMethod {} diff --git a/packages/google-cloud-vision/src/v1p2beta1/image_annotator_client_config.json b/packages/google-cloud-vision/src/v1p2beta1/image_annotator_client_config.json index 72dc25aa596..367627eb782 100644 --- a/packages/google-cloud-vision/src/v1p2beta1/image_annotator_client_config.json +++ b/packages/google-cloud-vision/src/v1p2beta1/image_annotator_client_config.json @@ -2,11 +2,11 @@ "interfaces": { "google.cloud.vision.v1p2beta1.ImageAnnotator": { "retry_codes": { + "non_idempotent": [], "idempotent": [ "DEADLINE_EXCEEDED", "UNAVAILABLE" - ], - "non_idempotent": [] + ] }, "retry_params": { "default": { @@ -14,19 +14,19 @@ "retry_delay_multiplier": 1.3, "max_retry_delay_millis": 60000, "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1.0, + "rpc_timeout_multiplier": 1, "max_rpc_timeout_millis": 60000, "total_timeout_millis": 600000 } }, "methods": { "BatchAnnotateImages": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "AsyncBatchAnnotateFiles": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" } diff --git a/packages/google-cloud-vision/src/v1p2beta1/image_annotator_proto_list.json b/packages/google-cloud-vision/src/v1p2beta1/image_annotator_proto_list.json index 63dc03daac1..2b5904f9adb 100644 --- a/packages/google-cloud-vision/src/v1p2beta1/image_annotator_proto_list.json +++ b/packages/google-cloud-vision/src/v1p2beta1/image_annotator_proto_list.json @@ -1,3 +1,6 @@ [ - "../../protos/google/cloud/vision/v1p2beta1/image_annotator.proto" + "../../protos/google/cloud/vision/v1p2beta1/geometry.proto", + "../../protos/google/cloud/vision/v1p2beta1/image_annotator.proto", + "../../protos/google/cloud/vision/v1p2beta1/text_annotation.proto", + "../../protos/google/cloud/vision/v1p2beta1/web_detection.proto" ] diff --git a/packages/google-cloud-vision/src/v1p1beta1/index.js b/packages/google-cloud-vision/src/v1p2beta1/index.ts similarity index 65% rename from packages/google-cloud-vision/src/v1p1beta1/index.js rename to packages/google-cloud-vision/src/v1p2beta1/index.ts index 0ab93eefeb8..aed82506fff 100644 --- a/packages/google-cloud-vision/src/v1p1beta1/index.js +++ b/packages/google-cloud-vision/src/v1p2beta1/index.ts @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -11,9 +11,9 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** -'use strict'; - -const ImageAnnotatorClient = require('./image_annotator_client'); - -module.exports.ImageAnnotatorClient = ImageAnnotatorClient; +export {ImageAnnotatorClient} from './image_annotator_client'; diff --git a/packages/google-cloud-vision/src/v1p3beta1/doc/google/cloud/vision/v1p3beta1/doc_geometry.js b/packages/google-cloud-vision/src/v1p3beta1/doc/google/cloud/vision/v1p3beta1/doc_geometry.js deleted file mode 100644 index c5bb831526f..00000000000 --- a/packages/google-cloud-vision/src/v1p3beta1/doc/google/cloud/vision/v1p3beta1/doc_geometry.js +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * A vertex represents a 2D point in the image. - * NOTE: the vertex coordinates are in the same scale as the original image. - * - * @property {number} x - * X coordinate. - * - * @property {number} y - * Y coordinate. - * - * @typedef Vertex - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.Vertex definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/geometry.proto} - */ -const Vertex = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A vertex represents a 2D point in the image. - * NOTE: the normalized vertex coordinates are relative to the original image - * and range from 0 to 1. - * - * @property {number} x - * X coordinate. - * - * @property {number} y - * Y coordinate. - * - * @typedef NormalizedVertex - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.NormalizedVertex definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/geometry.proto} - */ -const NormalizedVertex = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A bounding polygon for the detected image annotation. - * - * @property {Object[]} vertices - * The bounding polygon vertices. - * - * This object should have the same structure as [Vertex]{@link google.cloud.vision.v1p3beta1.Vertex} - * - * @property {Object[]} normalizedVertices - * The bounding polygon normalized vertices. - * - * This object should have the same structure as [NormalizedVertex]{@link google.cloud.vision.v1p3beta1.NormalizedVertex} - * - * @typedef BoundingPoly - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.BoundingPoly definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/geometry.proto} - */ -const BoundingPoly = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A normalized bounding polygon around a portion of an image. - * - * @property {Object[]} vertices - * Normalized vertices of the bounding polygon. - * - * This object should have the same structure as [NormalizedVertex]{@link google.cloud.vision.v1p3beta1.NormalizedVertex} - * - * @typedef NormalizedBoundingPoly - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.NormalizedBoundingPoly definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/geometry.proto} - */ -const NormalizedBoundingPoly = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A 3D position in the image, used primarily for Face detection landmarks. - * A valid Position must have both x and y coordinates. - * The position coordinates are in the same scale as the original image. - * - * @property {number} x - * X coordinate. - * - * @property {number} y - * Y coordinate. - * - * @property {number} z - * Z coordinate (or depth). - * - * @typedef Position - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.Position definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/geometry.proto} - */ -const Position = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p3beta1/doc/google/cloud/vision/v1p3beta1/doc_image_annotator.js b/packages/google-cloud-vision/src/v1p3beta1/doc/google/cloud/vision/v1p3beta1/doc_image_annotator.js deleted file mode 100644 index 08573fcf34a..00000000000 --- a/packages/google-cloud-vision/src/v1p3beta1/doc/google/cloud/vision/v1p3beta1/doc_image_annotator.js +++ /dev/null @@ -1,1307 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * The type of Google Cloud Vision API detection to perform, and the maximum - * number of results to return for that type. Multiple `Feature` objects can - * be specified in the `features` list. - * - * @property {number} type - * The feature type. - * - * The number should be among the values of [Type]{@link google.cloud.vision.v1p3beta1.Type} - * - * @property {number} maxResults - * Maximum number of results of this type. Does not apply to - * `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`. - * - * @property {string} model - * Model to use for the feature. - * Supported values: "builtin/stable" (the default if unset) and - * "builtin/latest". - * - * @typedef Feature - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.Feature definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const Feature = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Type of Google Cloud Vision API feature to be extracted. - * - * @enum {number} - * @memberof google.cloud.vision.v1p3beta1 - */ - Type: { - - /** - * Unspecified feature type. - */ - TYPE_UNSPECIFIED: 0, - - /** - * Run face detection. - */ - FACE_DETECTION: 1, - - /** - * Run landmark detection. - */ - LANDMARK_DETECTION: 2, - - /** - * Run logo detection. - */ - LOGO_DETECTION: 3, - - /** - * Run label detection. - */ - LABEL_DETECTION: 4, - - /** - * Run text detection / optical character recognition (OCR). Text detection - * is optimized for areas of text within a larger image; if the image is - * a document, use `DOCUMENT_TEXT_DETECTION` instead. - */ - TEXT_DETECTION: 5, - - /** - * Run dense text document OCR. Takes precedence when both - * `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` are present. - */ - DOCUMENT_TEXT_DETECTION: 11, - - /** - * Run Safe Search to detect potentially unsafe - * or undesirable content. - */ - SAFE_SEARCH_DETECTION: 6, - - /** - * Compute a set of image properties, such as the - * image's dominant colors. - */ - IMAGE_PROPERTIES: 7, - - /** - * Run crop hints. - */ - CROP_HINTS: 9, - - /** - * Run web detection. - */ - WEB_DETECTION: 10, - - /** - * Run Product Search. - */ - PRODUCT_SEARCH: 12, - - /** - * Run localizer for object detection. - */ - OBJECT_LOCALIZATION: 19 - } -}; - -/** - * External image source (Google Cloud Storage or web URL image location). - * - * @property {string} gcsImageUri - * **Use `image_uri` instead.** - * - * The Google Cloud Storage URI of the form - * `gs://bucket_name/object_name`. Object versioning is not supported. See - * [Google Cloud Storage Request - * URIs](https://cloud.google.com/storage/docs/reference-uris) for more info. - * - * @property {string} imageUri - * The URI of the source image. Can be either: - * - * 1. A Google Cloud Storage URI of the form - * `gs://bucket_name/object_name`. Object versioning is not supported. See - * [Google Cloud Storage Request - * URIs](https://cloud.google.com/storage/docs/reference-uris) for more - * info. - * - * 2. A publicly-accessible image HTTP/HTTPS URL. When fetching images from - * HTTP/HTTPS URLs, Google cannot guarantee that the request will be - * completed. Your request may fail if the specified host denies the - * request (e.g. due to request throttling or DOS prevention), or if Google - * throttles requests to the site for abuse prevention. You should not - * depend on externally-hosted images for production applications. - * - * When both `gcs_image_uri` and `image_uri` are specified, `image_uri` takes - * precedence. - * - * @typedef ImageSource - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.ImageSource definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const ImageSource = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Client image to perform Google Cloud Vision API tasks over. - * - * @property {Buffer} content - * Image content, represented as a stream of bytes. - * Note: As with all `bytes` fields, protobuffers use a pure binary - * representation, whereas JSON representations use base64. - * - * @property {Object} source - * Google Cloud Storage image location, or publicly-accessible image - * URL. If both `content` and `source` are provided for an image, `content` - * takes precedence and is used to perform the image annotation request. - * - * This object should have the same structure as [ImageSource]{@link google.cloud.vision.v1p3beta1.ImageSource} - * - * @typedef Image - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.Image definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const Image = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A face annotation object contains the results of face detection. - * - * @property {Object} boundingPoly - * The bounding polygon around the face. The coordinates of the bounding box - * are in the original image's scale, as returned in `ImageParams`. - * The bounding box is computed to "frame" the face in accordance with human - * expectations. It is based on the landmarker results. - * Note that one or more x and/or y coordinates may not be generated in the - * `BoundingPoly` (the polygon will be unbounded) if only a partial face - * appears in the image to be annotated. - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p3beta1.BoundingPoly} - * - * @property {Object} fdBoundingPoly - * The `fd_bounding_poly` bounding polygon is tighter than the - * `boundingPoly`, and encloses only the skin part of the face. Typically, it - * is used to eliminate the face from any image analysis that detects the - * "amount of skin" visible in an image. It is not based on the - * landmarker results, only on the initial face detection, hence - * the fd (face detection) prefix. - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p3beta1.BoundingPoly} - * - * @property {Object[]} landmarks - * Detected face landmarks. - * - * This object should have the same structure as [Landmark]{@link google.cloud.vision.v1p3beta1.Landmark} - * - * @property {number} rollAngle - * Roll angle, which indicates the amount of clockwise/anti-clockwise rotation - * of the face relative to the image vertical about the axis perpendicular to - * the face. Range [-180,180]. - * - * @property {number} panAngle - * Yaw angle, which indicates the leftward/rightward angle that the face is - * pointing relative to the vertical plane perpendicular to the image. Range - * [-180,180]. - * - * @property {number} tiltAngle - * Pitch angle, which indicates the upwards/downwards angle that the face is - * pointing relative to the image's horizontal plane. Range [-180,180]. - * - * @property {number} detectionConfidence - * Detection confidence. Range [0, 1]. - * - * @property {number} landmarkingConfidence - * Face landmarking confidence. Range [0, 1]. - * - * @property {number} joyLikelihood - * Joy likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p3beta1.Likelihood} - * - * @property {number} sorrowLikelihood - * Sorrow likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p3beta1.Likelihood} - * - * @property {number} angerLikelihood - * Anger likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p3beta1.Likelihood} - * - * @property {number} surpriseLikelihood - * Surprise likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p3beta1.Likelihood} - * - * @property {number} underExposedLikelihood - * Under-exposed likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p3beta1.Likelihood} - * - * @property {number} blurredLikelihood - * Blurred likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p3beta1.Likelihood} - * - * @property {number} headwearLikelihood - * Headwear likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p3beta1.Likelihood} - * - * @typedef FaceAnnotation - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.FaceAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const FaceAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * A face-specific landmark (for example, a face feature). - * - * @property {number} type - * Face landmark type. - * - * The number should be among the values of [Type]{@link google.cloud.vision.v1p3beta1.Type} - * - * @property {Object} position - * Face landmark position. - * - * This object should have the same structure as [Position]{@link google.cloud.vision.v1p3beta1.Position} - * - * @typedef Landmark - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.FaceAnnotation.Landmark definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ - Landmark: { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Face landmark (feature) type. - * Left and right are defined from the vantage of the viewer of the image - * without considering mirror projections typical of photos. So, `LEFT_EYE`, - * typically, is the person's right eye. - * - * @enum {number} - * @memberof google.cloud.vision.v1p3beta1 - */ - Type: { - - /** - * Unknown face landmark detected. Should not be filled. - */ - UNKNOWN_LANDMARK: 0, - - /** - * Left eye. - */ - LEFT_EYE: 1, - - /** - * Right eye. - */ - RIGHT_EYE: 2, - - /** - * Left of left eyebrow. - */ - LEFT_OF_LEFT_EYEBROW: 3, - - /** - * Right of left eyebrow. - */ - RIGHT_OF_LEFT_EYEBROW: 4, - - /** - * Left of right eyebrow. - */ - LEFT_OF_RIGHT_EYEBROW: 5, - - /** - * Right of right eyebrow. - */ - RIGHT_OF_RIGHT_EYEBROW: 6, - - /** - * Midpoint between eyes. - */ - MIDPOINT_BETWEEN_EYES: 7, - - /** - * Nose tip. - */ - NOSE_TIP: 8, - - /** - * Upper lip. - */ - UPPER_LIP: 9, - - /** - * Lower lip. - */ - LOWER_LIP: 10, - - /** - * Mouth left. - */ - MOUTH_LEFT: 11, - - /** - * Mouth right. - */ - MOUTH_RIGHT: 12, - - /** - * Mouth center. - */ - MOUTH_CENTER: 13, - - /** - * Nose, bottom right. - */ - NOSE_BOTTOM_RIGHT: 14, - - /** - * Nose, bottom left. - */ - NOSE_BOTTOM_LEFT: 15, - - /** - * Nose, bottom center. - */ - NOSE_BOTTOM_CENTER: 16, - - /** - * Left eye, top boundary. - */ - LEFT_EYE_TOP_BOUNDARY: 17, - - /** - * Left eye, right corner. - */ - LEFT_EYE_RIGHT_CORNER: 18, - - /** - * Left eye, bottom boundary. - */ - LEFT_EYE_BOTTOM_BOUNDARY: 19, - - /** - * Left eye, left corner. - */ - LEFT_EYE_LEFT_CORNER: 20, - - /** - * Right eye, top boundary. - */ - RIGHT_EYE_TOP_BOUNDARY: 21, - - /** - * Right eye, right corner. - */ - RIGHT_EYE_RIGHT_CORNER: 22, - - /** - * Right eye, bottom boundary. - */ - RIGHT_EYE_BOTTOM_BOUNDARY: 23, - - /** - * Right eye, left corner. - */ - RIGHT_EYE_LEFT_CORNER: 24, - - /** - * Left eyebrow, upper midpoint. - */ - LEFT_EYEBROW_UPPER_MIDPOINT: 25, - - /** - * Right eyebrow, upper midpoint. - */ - RIGHT_EYEBROW_UPPER_MIDPOINT: 26, - - /** - * Left ear tragion. - */ - LEFT_EAR_TRAGION: 27, - - /** - * Right ear tragion. - */ - RIGHT_EAR_TRAGION: 28, - - /** - * Left eye pupil. - */ - LEFT_EYE_PUPIL: 29, - - /** - * Right eye pupil. - */ - RIGHT_EYE_PUPIL: 30, - - /** - * Forehead glabella. - */ - FOREHEAD_GLABELLA: 31, - - /** - * Chin gnathion. - */ - CHIN_GNATHION: 32, - - /** - * Chin left gonion. - */ - CHIN_LEFT_GONION: 33, - - /** - * Chin right gonion. - */ - CHIN_RIGHT_GONION: 34 - } - } -}; - -/** - * Detected entity location information. - * - * @property {Object} latLng - * lat/long location coordinates. - * - * This object should have the same structure as [LatLng]{@link google.type.LatLng} - * - * @typedef LocationInfo - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.LocationInfo definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const LocationInfo = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A `Property` consists of a user-supplied name/value pair. - * - * @property {string} name - * Name of the property. - * - * @property {string} value - * Value of the property. - * - * @property {number} uint64Value - * Value of numeric properties. - * - * @typedef Property - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.Property definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const Property = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Set of detected entity features. - * - * @property {string} mid - * Opaque entity ID. Some IDs may be available in - * [Google Knowledge Graph Search - * API](https://developers.google.com/knowledge-graph/). - * - * @property {string} locale - * The language code for the locale in which the entity textual - * `description` is expressed. - * - * @property {string} description - * Entity textual description, expressed in its `locale` language. - * - * @property {number} score - * Overall score of the result. Range [0, 1]. - * - * @property {number} confidence - * **Deprecated. Use `score` instead.** - * The accuracy of the entity detection in an image. - * For example, for an image in which the "Eiffel Tower" entity is detected, - * this field represents the confidence that there is a tower in the query - * image. Range [0, 1]. - * - * @property {number} topicality - * The relevancy of the ICA (Image Content Annotation) label to the - * image. For example, the relevancy of "tower" is likely higher to an image - * containing the detected "Eiffel Tower" than to an image containing a - * detected distant towering building, even though the confidence that - * there is a tower in each image may be the same. Range [0, 1]. - * - * @property {Object} boundingPoly - * Image region to which this entity belongs. Not produced - * for `LABEL_DETECTION` features. - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p3beta1.BoundingPoly} - * - * @property {Object[]} locations - * The location information for the detected entity. Multiple - * `LocationInfo` elements can be present because one location may - * indicate the location of the scene in the image, and another location - * may indicate the location of the place where the image was taken. - * Location information is usually present for landmarks. - * - * This object should have the same structure as [LocationInfo]{@link google.cloud.vision.v1p3beta1.LocationInfo} - * - * @property {Object[]} properties - * Some entities may have optional user-supplied `Property` (name/value) - * fields, such a score or string that qualifies the entity. - * - * This object should have the same structure as [Property]{@link google.cloud.vision.v1p3beta1.Property} - * - * @typedef EntityAnnotation - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.EntityAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const EntityAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Set of detected objects with bounding boxes. - * - * @property {string} mid - * Object ID that should align with EntityAnnotation mid. - * - * @property {string} languageCode - * The BCP-47 language code, such as "en-US" or "sr-Latn". For more - * information, see - * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. - * - * @property {string} name - * Object name, expressed in its `language_code` language. - * - * @property {number} score - * Score of the result. Range [0, 1]. - * - * @property {Object} boundingPoly - * Image region to which this object belongs. This must be populated. - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p3beta1.BoundingPoly} - * - * @typedef LocalizedObjectAnnotation - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const LocalizedObjectAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Set of features pertaining to the image, computed by computer vision - * methods over safe-search verticals (for example, adult, spoof, medical, - * violence). - * - * @property {number} adult - * Represents the adult content likelihood for the image. Adult content may - * contain elements such as nudity, pornographic images or cartoons, or - * sexual activities. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p3beta1.Likelihood} - * - * @property {number} spoof - * Spoof likelihood. The likelihood that an modification - * was made to the image's canonical version to make it appear - * funny or offensive. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p3beta1.Likelihood} - * - * @property {number} medical - * Likelihood that this is a medical image. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p3beta1.Likelihood} - * - * @property {number} violence - * Likelihood that this image contains violent content. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p3beta1.Likelihood} - * - * @property {number} racy - * Likelihood that the request image contains racy content. Racy content may - * include (but is not limited to) skimpy or sheer clothing, strategically - * covered nudity, lewd or provocative poses, or close-ups of sensitive - * body areas. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p3beta1.Likelihood} - * - * @typedef SafeSearchAnnotation - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.SafeSearchAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const SafeSearchAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Rectangle determined by min and max `LatLng` pairs. - * - * @property {Object} minLatLng - * Min lat/long pair. - * - * This object should have the same structure as [LatLng]{@link google.type.LatLng} - * - * @property {Object} maxLatLng - * Max lat/long pair. - * - * This object should have the same structure as [LatLng]{@link google.type.LatLng} - * - * @typedef LatLongRect - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.LatLongRect definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const LatLongRect = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Color information consists of RGB channels, score, and the fraction of - * the image that the color occupies in the image. - * - * @property {Object} color - * RGB components of the color. - * - * This object should have the same structure as [Color]{@link google.type.Color} - * - * @property {number} score - * Image-specific score for this color. Value in range [0, 1]. - * - * @property {number} pixelFraction - * The fraction of pixels the color occupies in the image. - * Value in range [0, 1]. - * - * @typedef ColorInfo - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.ColorInfo definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const ColorInfo = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Set of dominant colors and their corresponding scores. - * - * @property {Object[]} colors - * RGB color values with their score and pixel fraction. - * - * This object should have the same structure as [ColorInfo]{@link google.cloud.vision.v1p3beta1.ColorInfo} - * - * @typedef DominantColorsAnnotation - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.DominantColorsAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const DominantColorsAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Stores image properties, such as dominant colors. - * - * @property {Object} dominantColors - * If present, dominant colors completed successfully. - * - * This object should have the same structure as [DominantColorsAnnotation]{@link google.cloud.vision.v1p3beta1.DominantColorsAnnotation} - * - * @typedef ImageProperties - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.ImageProperties definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const ImageProperties = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Single crop hint that is used to generate a new crop when serving an image. - * - * @property {Object} boundingPoly - * The bounding polygon for the crop region. The coordinates of the bounding - * box are in the original image's scale, as returned in `ImageParams`. - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p3beta1.BoundingPoly} - * - * @property {number} confidence - * Confidence of this being a salient region. Range [0, 1]. - * - * @property {number} importanceFraction - * Fraction of importance of this salient region with respect to the original - * image. - * - * @typedef CropHint - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.CropHint definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const CropHint = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Set of crop hints that are used to generate new crops when serving images. - * - * @property {Object[]} cropHints - * Crop hint results. - * - * This object should have the same structure as [CropHint]{@link google.cloud.vision.v1p3beta1.CropHint} - * - * @typedef CropHintsAnnotation - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.CropHintsAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const CropHintsAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Parameters for crop hints annotation request. - * - * @property {number[]} aspectRatios - * Aspect ratios in floats, representing the ratio of the width to the height - * of the image. For example, if the desired aspect ratio is 4/3, the - * corresponding float value should be 1.33333. If not specified, the - * best possible crop is returned. The number of provided aspect ratios is - * limited to a maximum of 16; any aspect ratios provided after the 16th are - * ignored. - * - * @typedef CropHintsParams - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.CropHintsParams definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const CropHintsParams = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Parameters for web detection request. - * - * @property {boolean} includeGeoResults - * Whether to include results derived from the geo information in the image. - * - * @typedef WebDetectionParams - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.WebDetectionParams definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const WebDetectionParams = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Image context and/or feature-specific parameters. - * - * @property {Object} latLongRect - * Not used. - * - * This object should have the same structure as [LatLongRect]{@link google.cloud.vision.v1p3beta1.LatLongRect} - * - * @property {string[]} languageHints - * List of languages to use for TEXT_DETECTION. In most cases, an empty value - * yields the best results since it enables automatic language detection. For - * languages based on the Latin alphabet, setting `language_hints` is not - * needed. In rare cases, when the language of the text in the image is known, - * setting a hint will help get better results (although it will be a - * significant hindrance if the hint is wrong). Text detection returns an - * error if one or more of the specified languages is not one of the - * [supported languages](https://cloud.google.com/vision/docs/languages). - * - * @property {Object} cropHintsParams - * Parameters for crop hints annotation request. - * - * This object should have the same structure as [CropHintsParams]{@link google.cloud.vision.v1p3beta1.CropHintsParams} - * - * @property {Object} productSearchParams - * Parameters for product search. - * - * This object should have the same structure as [ProductSearchParams]{@link google.cloud.vision.v1p3beta1.ProductSearchParams} - * - * @property {Object} webDetectionParams - * Parameters for web detection. - * - * This object should have the same structure as [WebDetectionParams]{@link google.cloud.vision.v1p3beta1.WebDetectionParams} - * - * @typedef ImageContext - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.ImageContext definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const ImageContext = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request for performing Google Cloud Vision API tasks over a user-provided - * image, with user-requested features. - * - * @property {Object} image - * The image to be processed. - * - * This object should have the same structure as [Image]{@link google.cloud.vision.v1p3beta1.Image} - * - * @property {Object[]} features - * Requested features. - * - * This object should have the same structure as [Feature]{@link google.cloud.vision.v1p3beta1.Feature} - * - * @property {Object} imageContext - * Additional context that may accompany the image. - * - * This object should have the same structure as [ImageContext]{@link google.cloud.vision.v1p3beta1.ImageContext} - * - * @typedef AnnotateImageRequest - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.AnnotateImageRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const AnnotateImageRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * If an image was produced from a file (e.g. a PDF), this message gives - * information about the source of that image. - * - * @property {string} uri - * The URI of the file used to produce the image. - * - * @property {number} pageNumber - * If the file was a PDF or TIFF, this field gives the page number within - * the file used to produce the image. - * - * @typedef ImageAnnotationContext - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.ImageAnnotationContext definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const ImageAnnotationContext = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response to an image annotation request. - * - * @property {Object[]} faceAnnotations - * If present, face detection has completed successfully. - * - * This object should have the same structure as [FaceAnnotation]{@link google.cloud.vision.v1p3beta1.FaceAnnotation} - * - * @property {Object[]} landmarkAnnotations - * If present, landmark detection has completed successfully. - * - * This object should have the same structure as [EntityAnnotation]{@link google.cloud.vision.v1p3beta1.EntityAnnotation} - * - * @property {Object[]} logoAnnotations - * If present, logo detection has completed successfully. - * - * This object should have the same structure as [EntityAnnotation]{@link google.cloud.vision.v1p3beta1.EntityAnnotation} - * - * @property {Object[]} labelAnnotations - * If present, label detection has completed successfully. - * - * This object should have the same structure as [EntityAnnotation]{@link google.cloud.vision.v1p3beta1.EntityAnnotation} - * - * @property {Object[]} localizedObjectAnnotations - * If present, localized object detection has completed successfully. - * This will be sorted descending by confidence score. - * - * This object should have the same structure as [LocalizedObjectAnnotation]{@link google.cloud.vision.v1p3beta1.LocalizedObjectAnnotation} - * - * @property {Object[]} textAnnotations - * If present, text (OCR) detection has completed successfully. - * - * This object should have the same structure as [EntityAnnotation]{@link google.cloud.vision.v1p3beta1.EntityAnnotation} - * - * @property {Object} fullTextAnnotation - * If present, text (OCR) detection or document (OCR) text detection has - * completed successfully. - * This annotation provides the structural hierarchy for the OCR detected - * text. - * - * This object should have the same structure as [TextAnnotation]{@link google.cloud.vision.v1p3beta1.TextAnnotation} - * - * @property {Object} safeSearchAnnotation - * If present, safe-search annotation has completed successfully. - * - * This object should have the same structure as [SafeSearchAnnotation]{@link google.cloud.vision.v1p3beta1.SafeSearchAnnotation} - * - * @property {Object} imagePropertiesAnnotation - * If present, image properties were extracted successfully. - * - * This object should have the same structure as [ImageProperties]{@link google.cloud.vision.v1p3beta1.ImageProperties} - * - * @property {Object} cropHintsAnnotation - * If present, crop hints have completed successfully. - * - * This object should have the same structure as [CropHintsAnnotation]{@link google.cloud.vision.v1p3beta1.CropHintsAnnotation} - * - * @property {Object} webDetection - * If present, web detection has completed successfully. - * - * This object should have the same structure as [WebDetection]{@link google.cloud.vision.v1p3beta1.WebDetection} - * - * @property {Object} productSearchResults - * If present, product search has completed successfully. - * - * This object should have the same structure as [ProductSearchResults]{@link google.cloud.vision.v1p3beta1.ProductSearchResults} - * - * @property {Object} error - * If set, represents the error message for the operation. - * Note that filled-in image annotations are guaranteed to be - * correct, even when `error` is set. - * - * This object should have the same structure as [Status]{@link google.rpc.Status} - * - * @property {Object} context - * If present, contextual information is needed to understand where this image - * comes from. - * - * This object should have the same structure as [ImageAnnotationContext]{@link google.cloud.vision.v1p3beta1.ImageAnnotationContext} - * - * @typedef AnnotateImageResponse - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.AnnotateImageResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const AnnotateImageResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response to a single file annotation request. A file may contain one or more - * images, which individually have their own responses. - * - * @property {Object} inputConfig - * Information about the file for which this response is generated. - * - * This object should have the same structure as [InputConfig]{@link google.cloud.vision.v1p3beta1.InputConfig} - * - * @property {Object[]} responses - * Individual responses to images found within the file. - * - * This object should have the same structure as [AnnotateImageResponse]{@link google.cloud.vision.v1p3beta1.AnnotateImageResponse} - * - * @typedef AnnotateFileResponse - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.AnnotateFileResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const AnnotateFileResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Multiple image annotation requests are batched into a single service call. - * - * @property {Object[]} requests - * Individual image annotation requests for this batch. - * - * This object should have the same structure as [AnnotateImageRequest]{@link google.cloud.vision.v1p3beta1.AnnotateImageRequest} - * - * @typedef BatchAnnotateImagesRequest - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.BatchAnnotateImagesRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const BatchAnnotateImagesRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response to a batch image annotation request. - * - * @property {Object[]} responses - * Individual responses to image annotation requests within the batch. - * - * This object should have the same structure as [AnnotateImageResponse]{@link google.cloud.vision.v1p3beta1.AnnotateImageResponse} - * - * @typedef BatchAnnotateImagesResponse - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const BatchAnnotateImagesResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * An offline file annotation request. - * - * @property {Object} inputConfig - * Required. Information about the input file. - * - * This object should have the same structure as [InputConfig]{@link google.cloud.vision.v1p3beta1.InputConfig} - * - * @property {Object[]} features - * Required. Requested features. - * - * This object should have the same structure as [Feature]{@link google.cloud.vision.v1p3beta1.Feature} - * - * @property {Object} imageContext - * Additional context that may accompany the image(s) in the file. - * - * This object should have the same structure as [ImageContext]{@link google.cloud.vision.v1p3beta1.ImageContext} - * - * @property {Object} outputConfig - * Required. The desired output location and metadata (e.g. format). - * - * This object should have the same structure as [OutputConfig]{@link google.cloud.vision.v1p3beta1.OutputConfig} - * - * @typedef AsyncAnnotateFileRequest - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const AsyncAnnotateFileRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The response for a single offline file annotation request. - * - * @property {Object} outputConfig - * The output location and metadata from AsyncAnnotateFileRequest. - * - * This object should have the same structure as [OutputConfig]{@link google.cloud.vision.v1p3beta1.OutputConfig} - * - * @typedef AsyncAnnotateFileResponse - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const AsyncAnnotateFileResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Multiple async file annotation requests are batched into a single service - * call. - * - * @property {Object[]} requests - * Required. Individual async file annotation requests for this batch. - * - * This object should have the same structure as [AsyncAnnotateFileRequest]{@link google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest} - * - * @typedef AsyncBatchAnnotateFilesRequest - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const AsyncBatchAnnotateFilesRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response to an async batch file annotation request. - * - * @property {Object[]} responses - * The list of file annotation responses, one for each request in - * AsyncBatchAnnotateFilesRequest. - * - * This object should have the same structure as [AsyncAnnotateFileResponse]{@link google.cloud.vision.v1p3beta1.AsyncAnnotateFileResponse} - * - * @typedef AsyncBatchAnnotateFilesResponse - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const AsyncBatchAnnotateFilesResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The desired input location and metadata. - * - * @property {Object} gcsSource - * The Google Cloud Storage location to read the input from. - * - * This object should have the same structure as [GcsSource]{@link google.cloud.vision.v1p3beta1.GcsSource} - * - * @property {string} mimeType - * The type of the file. Currently only "application/pdf" and "image/tiff" - * are supported. Wildcards are not supported. - * - * @typedef InputConfig - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.InputConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const InputConfig = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The desired output location and metadata. - * - * @property {Object} gcsDestination - * The Google Cloud Storage location to write the output(s) to. - * - * This object should have the same structure as [GcsDestination]{@link google.cloud.vision.v1p3beta1.GcsDestination} - * - * @property {number} batchSize - * The max number of response protos to put into each output JSON file on - * Google Cloud Storage. - * The valid range is [1, 100]. If not specified, the default value is 20. - * - * For example, for one pdf file with 100 pages, 100 response protos will - * be generated. If `batch_size` = 20, then 5 json files each - * containing 20 response protos will be written under the prefix - * `gcs_destination`.`uri`. - * - * Currently, batch_size only applies to GcsDestination, with potential future - * support for other output configurations. - * - * @typedef OutputConfig - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.OutputConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const OutputConfig = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The Google Cloud Storage location where the input will be read from. - * - * @property {string} uri - * Google Cloud Storage URI for the input file. This must only be a - * Google Cloud Storage object. Wildcards are not currently supported. - * - * @typedef GcsSource - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.GcsSource definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const GcsSource = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The Google Cloud Storage location where the output will be written to. - * - * @property {string} uri - * Google Cloud Storage URI where the results will be stored. Results will - * be in JSON format and preceded by its corresponding input URI. This field - * can either represent a single file, or a prefix for multiple outputs. - * Prefixes must end in a `/`. - * - * Examples: - * - * * File: gs://bucket-name/filename.json - * * Prefix: gs://bucket-name/prefix/here/ - * * File: gs://bucket-name/prefix/here - * - * If multiple outputs, each response is still AnnotateFileResponse, each of - * which contains some subset of the full list of AnnotateImageResponse. - * Multiple outputs can happen if, for example, the output JSON is too large - * and overflows into multiple sharded files. - * - * @typedef GcsDestination - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.GcsDestination definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const GcsDestination = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Contains metadata for the BatchAnnotateImages operation. - * - * @property {number} state - * Current state of the batch operation. - * - * The number should be among the values of [State]{@link google.cloud.vision.v1p3beta1.State} - * - * @property {Object} createTime - * The time when the batch request was received. - * - * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} - * - * @property {Object} updateTime - * The time when the operation result was last updated. - * - * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} - * - * @typedef OperationMetadata - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.OperationMetadata definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/image_annotator.proto} - */ -const OperationMetadata = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Batch operation states. - * - * @enum {number} - * @memberof google.cloud.vision.v1p3beta1 - */ - State: { - - /** - * Invalid. - */ - STATE_UNSPECIFIED: 0, - - /** - * Request is received. - */ - CREATED: 1, - - /** - * Request is actively being processed. - */ - RUNNING: 2, - - /** - * The batch processing is done. - */ - DONE: 3, - - /** - * The batch processing was cancelled. - */ - CANCELLED: 4 - } -}; - -/** - * A bucketized representation of likelihood, which is intended to give clients - * highly stable results across model upgrades. - * - * @enum {number} - * @memberof google.cloud.vision.v1p3beta1 - */ -const Likelihood = { - - /** - * Unknown likelihood. - */ - UNKNOWN: 0, - - /** - * It is very unlikely that the image belongs to the specified vertical. - */ - VERY_UNLIKELY: 1, - - /** - * It is unlikely that the image belongs to the specified vertical. - */ - UNLIKELY: 2, - - /** - * It is possible that the image belongs to the specified vertical. - */ - POSSIBLE: 3, - - /** - * It is likely that the image belongs to the specified vertical. - */ - LIKELY: 4, - - /** - * It is very likely that the image belongs to the specified vertical. - */ - VERY_LIKELY: 5 -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p3beta1/doc/google/cloud/vision/v1p3beta1/doc_product_search.js b/packages/google-cloud-vision/src/v1p3beta1/doc/google/cloud/vision/v1p3beta1/doc_product_search.js deleted file mode 100644 index 4acc3b302c7..00000000000 --- a/packages/google-cloud-vision/src/v1p3beta1/doc/google/cloud/vision/v1p3beta1/doc_product_search.js +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * Parameters for a product search request. - * - * @property {string} catalogName - * The resource name of the catalog to search. - * - * Format is: `productSearch/catalogs/CATALOG_NAME`. - * - * @property {number} category - * The category to search in. - * Optional. It is inferred by the system if it is not specified. - * [Deprecated] Use `product_category`. - * - * The number should be among the values of [ProductSearchCategory]{@link google.cloud.vision.v1p3beta1.ProductSearchCategory} - * - * @property {string} productCategory - * The product category to search in. - * Optional. It is inferred by the system if it is not specified. - * Supported values are `bag`, `shoe`, `sunglasses`, `dress`, `outerwear`, - * `skirt`, `top`, `shorts`, and `pants`. - * - * @property {Object} normalizedBoundingPoly - * The bounding polygon around the area of interest in the image. - * Optional. If it is not specified, system discretion will be applied. - * [Deprecated] Use `bounding_poly`. - * - * This object should have the same structure as [NormalizedBoundingPoly]{@link google.cloud.vision.v1p3beta1.NormalizedBoundingPoly} - * - * @property {Object} boundingPoly - * The bounding polygon around the area of interest in the image. - * Optional. If it is not specified, system discretion will be applied. - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p3beta1.BoundingPoly} - * - * @property {number} view - * Specifies the verbosity of the product search results. - * Optional. Defaults to `BASIC`. - * - * The number should be among the values of [ProductSearchResultsView]{@link google.cloud.vision.v1p3beta1.ProductSearchResultsView} - * - * @property {string} productSet - * The resource name of a - * ProductSet to be searched for - * similar images. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. - * - * @property {string[]} productCategories - * The list of product categories to search in. Currently, we only consider - * the first category, and either "homegoods" or "apparel" should be - * specified. - * - * @property {string} filter - * The filtering expression. This can be used to restrict search results based - * on Product labels. We currently support an AND of OR of key-value - * expressions, where each expression within an OR must have the same key. - * - * For example, "(color = red OR color = blue) AND brand = Google" is - * acceptable, but not "(color = red OR brand = Google)" or "color: red". - * - * @typedef ProductSearchParams - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.ProductSearchParams definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search.proto} - */ -const ProductSearchParams = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Results for a product search request. - * - * @property {number} category - * Product category. - * [Deprecated] Use `product_category`. - * - * The number should be among the values of [ProductSearchCategory]{@link google.cloud.vision.v1p3beta1.ProductSearchCategory} - * - * @property {string} productCategory - * Product category. - * Supported values are `bag` and `shoe`. - * [Deprecated] `product_category` is provided in each Product. - * - * @property {Object} indexTime - * Timestamp of the index which provided these results. Changes made after - * this time are not reflected in the current results. - * - * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} - * - * @property {Object[]} products - * List of detected products. - * - * This object should have the same structure as [ProductInfo]{@link google.cloud.vision.v1p3beta1.ProductInfo} - * - * @property {Object[]} results - * List of results, one for each product match. - * - * This object should have the same structure as [Result]{@link google.cloud.vision.v1p3beta1.Result} - * - * @typedef ProductSearchResults - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.ProductSearchResults definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search.proto} - */ -const ProductSearchResults = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Information about a product. - * - * @property {string} productId - * Product ID. - * - * @property {string} imageUri - * The URI of the image which matched the query image. - * - * This field is returned only if `view` is set to `FULL` in - * the request. - * - * @property {number} score - * A confidence level on the match, ranging from 0 (no confidence) to - * 1 (full confidence). - * - * This field is returned only if `view` is set to `FULL` in - * the request. - * - * @typedef ProductInfo - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.ProductSearchResults.ProductInfo definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search.proto} - */ - ProductInfo: { - // This is for documentation. Actual contents will be loaded by gRPC. - }, - - /** - * Information about a product. - * - * @property {Object} product - * The Product. - * - * This object should have the same structure as [Product]{@link google.cloud.vision.v1p3beta1.Product} - * - * @property {number} score - * A confidence level on the match, ranging from 0 (no confidence) to - * 1 (full confidence). - * - * This field is returned only if `view` is set to `FULL` in - * the request. - * - * @property {string} image - * The resource name of the image from the product that is the closest match - * to the query. - * - * @typedef Result - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.ProductSearchResults.Result definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search.proto} - */ - Result: { - // This is for documentation. Actual contents will be loaded by gRPC. - } -}; - -/** - * Supported product search categories. - * - * @enum {number} - * @memberof google.cloud.vision.v1p3beta1 - */ -const ProductSearchCategory = { - - /** - * Default value used when a category is not specified. - */ - PRODUCT_SEARCH_CATEGORY_UNSPECIFIED: 0, - - /** - * Shoes category. - */ - SHOES: 1, - - /** - * Bags category. - */ - BAGS: 2 -}; - -/** - * Specifies the fields to include in product search results. - * - * @enum {number} - * @memberof google.cloud.vision.v1p3beta1 - */ -const ProductSearchResultsView = { - - /** - * Product search results contain only `product_category` and `product_id`. - * Default value. - */ - BASIC: 0, - - /** - * Product search results contain `product_category`, `product_id`, - * `image_uri`, and `score`. - */ - FULL: 1 -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p3beta1/doc/google/cloud/vision/v1p3beta1/doc_product_search_service.js b/packages/google-cloud-vision/src/v1p3beta1/doc/google/cloud/vision/v1p3beta1/doc_product_search_service.js deleted file mode 100644 index ed5f0fad601..00000000000 --- a/packages/google-cloud-vision/src/v1p3beta1/doc/google/cloud/vision/v1p3beta1/doc_product_search_service.js +++ /dev/null @@ -1,830 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * A Product contains ReferenceImages. - * - * @property {string} name - * The resource name of the product. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. - * - * This field is ignored when creating a product. - * - * @property {string} displayName - * The user-provided name for this Product. Must not be empty. Must be at most - * 4096 characters long. - * - * @property {string} description - * User-provided metadata to be stored with this product. Must be at most 4096 - * characters long. - * - * @property {string} productCategory - * Immutable. The category for the product identified by the reference image. This should - * be either "homegoods-v2", "apparel-v2", or "toys-v2". The legacy categories - * "homegoods", "apparel", and "toys" are still supported, but these should - * not be used for new products. - * - * @property {Object[]} productLabels - * Key-value pairs that can be attached to a product. At query time, - * constraints can be specified based on the product_labels. - * - * Note that integer values can be provided as strings, e.g. "1199". Only - * strings with integer values can match a range-based restriction which is - * to be supported soon. - * - * Multiple values can be assigned to the same key. One product may have up to - * 100 product_labels. - * - * This object should have the same structure as [KeyValue]{@link google.cloud.vision.v1p3beta1.KeyValue} - * - * @typedef Product - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.Product definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search_service.proto} - */ -const Product = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * A product label represented as a key-value pair. - * - * @property {string} key - * The key of the label attached to the product. Cannot be empty and cannot - * exceed 128 bytes. - * - * @property {string} value - * The value of the label attached to the product. Cannot be empty and - * cannot exceed 128 bytes. - * - * @typedef KeyValue - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.Product.KeyValue definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search_service.proto} - */ - KeyValue: { - // This is for documentation. Actual contents will be loaded by gRPC. - } -}; - -/** - * A ProductSet contains Products. A ProductSet can contain a maximum of 1 - * million reference images. If the limit is exceeded, periodic indexing will - * fail. - * - * @property {string} name - * The resource name of the ProductSet. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. - * - * This field is ignored when creating a ProductSet. - * - * @property {string} displayName - * The user-provided name for this ProductSet. Must not be empty. Must be at - * most 4096 characters long. - * - * @property {Object} indexTime - * Output only. The time at which this ProductSet was last indexed. Query - * results will reflect all updates before this time. If this ProductSet has - * never been indexed, this field is 0. - * - * This field is ignored when creating a ProductSet. - * - * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} - * - * @property {Object} indexError - * Output only. If there was an error with indexing the product set, the field - * is populated. - * - * This field is ignored when creating a ProductSet. - * - * This object should have the same structure as [Status]{@link google.rpc.Status} - * - * @typedef ProductSet - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.ProductSet definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search_service.proto} - */ -const ProductSet = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A `ReferenceImage` represents a product image and its associated metadata, - * such as bounding boxes. - * - * @property {string} name - * The resource name of the reference image. - * - * Format is: - * - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. - * - * This field is ignored when creating a reference image. - * - * @property {string} uri - * Required. The Google Cloud Storage URI of the reference image. - * - * The URI must start with `gs://`. - * - * @property {Object[]} boundingPolys - * Optional. Bounding polygons around the areas of interest in the reference image. - * If this field is empty, the system will try to detect regions of - * interest. At most 10 bounding polygons will be used. - * - * The provided shape is converted into a non-rotated rectangle. Once - * converted, the small edge of the rectangle must be greater than or equal - * to 300 pixels. The aspect ratio must be 1:4 or less (i.e. 1:3 is ok; 1:5 - * is not). - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p3beta1.BoundingPoly} - * - * @typedef ReferenceImage - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.ReferenceImage definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search_service.proto} - */ -const ReferenceImage = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `CreateProduct` method. - * - * @property {string} parent - * Required. The project in which the Product should be created. - * - * Format is - * `projects/PROJECT_ID/locations/LOC_ID`. - * - * @property {Object} product - * Required. The product to create. - * - * This object should have the same structure as [Product]{@link google.cloud.vision.v1p3beta1.Product} - * - * @property {string} productId - * A user-supplied resource id for this Product. If set, the server will - * attempt to use this value as the resource id. If it is already in use, an - * error is returned with code ALREADY_EXISTS. Must be at most 128 characters - * long. It cannot contain the character `/`. - * - * @typedef CreateProductRequest - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.CreateProductRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search_service.proto} - */ -const CreateProductRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `ListProducts` method. - * - * @property {string} parent - * Required. The project OR ProductSet from which Products should be listed. - * - * Format: - * `projects/PROJECT_ID/locations/LOC_ID` - * - * @property {number} pageSize - * The maximum number of items to return. Default 10, maximum 100. - * - * @property {string} pageToken - * The next_page_token returned from a previous List request, if any. - * - * @typedef ListProductsRequest - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.ListProductsRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search_service.proto} - */ -const ListProductsRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response message for the `ListProducts` method. - * - * @property {Object[]} products - * List of products. - * - * This object should have the same structure as [Product]{@link google.cloud.vision.v1p3beta1.Product} - * - * @property {string} nextPageToken - * Token to retrieve the next page of results, or empty if there are no more - * results in the list. - * - * @typedef ListProductsResponse - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.ListProductsResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search_service.proto} - */ -const ListProductsResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `GetProduct` method. - * - * @property {string} name - * Required. Resource name of the Product to get. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - * - * @typedef GetProductRequest - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.GetProductRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search_service.proto} - */ -const GetProductRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `UpdateProduct` method. - * - * @property {Object} product - * Required. The Product resource which replaces the one on the server. - * product.name is immutable. - * - * This object should have the same structure as [Product]{@link google.cloud.vision.v1p3beta1.Product} - * - * @property {Object} updateMask - * The FieldMask that specifies which fields - * to update. - * If update_mask isn't specified, all mutable fields are to be updated. - * Valid mask paths include `product_labels`, `display_name`, and - * `description`. - * - * This object should have the same structure as [FieldMask]{@link google.protobuf.FieldMask} - * - * @typedef UpdateProductRequest - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.UpdateProductRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search_service.proto} - */ -const UpdateProductRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `DeleteProduct` method. - * - * @property {string} name - * Required. Resource name of product to delete. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - * - * @typedef DeleteProductRequest - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.DeleteProductRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search_service.proto} - */ -const DeleteProductRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `CreateProductSet` method. - * - * @property {string} parent - * Required. The project in which the ProductSet should be created. - * - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - * - * @property {Object} productSet - * Required. The ProductSet to create. - * - * This object should have the same structure as [ProductSet]{@link google.cloud.vision.v1p3beta1.ProductSet} - * - * @property {string} productSetId - * A user-supplied resource id for this ProductSet. If set, the server will - * attempt to use this value as the resource id. If it is already in use, an - * error is returned with code ALREADY_EXISTS. Must be at most 128 characters - * long. It cannot contain the character `/`. - * - * @typedef CreateProductSetRequest - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.CreateProductSetRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search_service.proto} - */ -const CreateProductSetRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `ListProductSets` method. - * - * @property {string} parent - * Required. The project from which ProductSets should be listed. - * - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - * - * @property {number} pageSize - * The maximum number of items to return. Default 10, maximum 100. - * - * @property {string} pageToken - * The next_page_token returned from a previous List request, if any. - * - * @typedef ListProductSetsRequest - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.ListProductSetsRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search_service.proto} - */ -const ListProductSetsRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response message for the `ListProductSets` method. - * - * @property {Object[]} productSets - * List of ProductSets. - * - * This object should have the same structure as [ProductSet]{@link google.cloud.vision.v1p3beta1.ProductSet} - * - * @property {string} nextPageToken - * Token to retrieve the next page of results, or empty if there are no more - * results in the list. - * - * @typedef ListProductSetsResponse - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.ListProductSetsResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search_service.proto} - */ -const ListProductSetsResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `GetProductSet` method. - * - * @property {string} name - * Required. Resource name of the ProductSet to get. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * - * @typedef GetProductSetRequest - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.GetProductSetRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search_service.proto} - */ -const GetProductSetRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `UpdateProductSet` method. - * - * @property {Object} productSet - * Required. The ProductSet resource which replaces the one on the server. - * - * This object should have the same structure as [ProductSet]{@link google.cloud.vision.v1p3beta1.ProductSet} - * - * @property {Object} updateMask - * The FieldMask that specifies which fields to - * update. - * If update_mask isn't specified, all mutable fields are to be updated. - * Valid mask path is `display_name`. - * - * This object should have the same structure as [FieldMask]{@link google.protobuf.FieldMask} - * - * @typedef UpdateProductSetRequest - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.UpdateProductSetRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search_service.proto} - */ -const UpdateProductSetRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `DeleteProductSet` method. - * - * @property {string} name - * Required. Resource name of the ProductSet to delete. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * - * @typedef DeleteProductSetRequest - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.DeleteProductSetRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search_service.proto} - */ -const DeleteProductSetRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `CreateReferenceImage` method. - * - * @property {string} parent - * Required. Resource name of the product in which to create the reference image. - * - * Format is - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. - * - * @property {Object} referenceImage - * Required. The reference image to create. - * If an image ID is specified, it is ignored. - * - * This object should have the same structure as [ReferenceImage]{@link google.cloud.vision.v1p3beta1.ReferenceImage} - * - * @property {string} referenceImageId - * A user-supplied resource id for the ReferenceImage to be added. If set, - * the server will attempt to use this value as the resource id. If it is - * already in use, an error is returned with code ALREADY_EXISTS. Must be at - * most 128 characters long. It cannot contain the character `/`. - * - * @typedef CreateReferenceImageRequest - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.CreateReferenceImageRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search_service.proto} - */ -const CreateReferenceImageRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `ListReferenceImages` method. - * - * @property {string} parent - * Required. Resource name of the product containing the reference images. - * - * Format is - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. - * - * @property {number} pageSize - * The maximum number of items to return. Default 10, maximum 100. - * - * @property {string} pageToken - * A token identifying a page of results to be returned. This is the value - * of `nextPageToken` returned in a previous reference image list request. - * - * Defaults to the first page if not specified. - * - * @typedef ListReferenceImagesRequest - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.ListReferenceImagesRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search_service.proto} - */ -const ListReferenceImagesRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response message for the `ListReferenceImages` method. - * - * @property {Object[]} referenceImages - * The list of reference images. - * - * This object should have the same structure as [ReferenceImage]{@link google.cloud.vision.v1p3beta1.ReferenceImage} - * - * @property {number} pageSize - * The maximum number of items to return. Default 10, maximum 100. - * - * @property {string} nextPageToken - * The next_page_token returned from a previous List request, if any. - * - * @typedef ListReferenceImagesResponse - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.ListReferenceImagesResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search_service.proto} - */ -const ListReferenceImagesResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `GetReferenceImage` method. - * - * @property {string} name - * Required. The resource name of the ReferenceImage to get. - * - * Format is: - * - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. - * - * @typedef GetReferenceImageRequest - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.GetReferenceImageRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search_service.proto} - */ -const GetReferenceImageRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `DeleteReferenceImage` method. - * - * @property {string} name - * Required. The resource name of the reference image to delete. - * - * Format is: - * - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` - * - * @typedef DeleteReferenceImageRequest - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.DeleteReferenceImageRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search_service.proto} - */ -const DeleteReferenceImageRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `AddProductToProductSet` method. - * - * @property {string} name - * Required. The resource name for the ProductSet to modify. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * - * @property {string} product - * Required. The resource name for the Product to be added to this ProductSet. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - * - * @typedef AddProductToProductSetRequest - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.AddProductToProductSetRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search_service.proto} - */ -const AddProductToProductSetRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `RemoveProductFromProductSet` method. - * - * @property {string} name - * Required. The resource name for the ProductSet to modify. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * - * @property {string} product - * Required. The resource name for the Product to be removed from this ProductSet. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - * - * @typedef RemoveProductFromProductSetRequest - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.RemoveProductFromProductSetRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search_service.proto} - */ -const RemoveProductFromProductSetRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `ListProductsInProductSet` method. - * - * @property {string} name - * Required. The ProductSet resource for which to retrieve Products. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * - * @property {number} pageSize - * The maximum number of items to return. Default 10, maximum 100. - * - * @property {string} pageToken - * The next_page_token returned from a previous List request, if any. - * - * @typedef ListProductsInProductSetRequest - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search_service.proto} - */ -const ListProductsInProductSetRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response message for the `ListProductsInProductSet` method. - * - * @property {Object[]} products - * The list of Products. - * - * This object should have the same structure as [Product]{@link google.cloud.vision.v1p3beta1.Product} - * - * @property {string} nextPageToken - * Token to retrieve the next page of results, or empty if there are no more - * results in the list. - * - * @typedef ListProductsInProductSetResponse - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search_service.proto} - */ -const ListProductsInProductSetResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The Google Cloud Storage location for a csv file which preserves a list of - * ImportProductSetRequests in each line. - * - * @property {string} csvFileUri - * The Google Cloud Storage URI of the input csv file. - * - * The URI must start with `gs://`. - * - * The format of the input csv file should be one image per line. - * In each line, there are 6 columns. - * 1. image_uri - * 2, image_id - * 3. product_set_id - * 4. product_id - * 5, product_category - * 6, product_display_name - * 7, labels - * 8. bounding_poly - * - * Columns 1, 3, 4, and 5 are required, other columns are optional. A new - * ProductSet/Product with the same id will be created on the fly - * if the ProductSet/Product specified by product_set_id/product_id does not - * exist. - * - * The image_id field is optional but has to be unique if provided. If it is - * empty, we will automatically assign an unique id to the image. - * - * The product_display_name field is optional. If it is empty, a space (" ") - * is used as the place holder for the product display_name, which can - * be updated later through the realtime API. - * - * If the Product with product_id already exists, the fields - * product_display_name, product_category and labels are ignored. - * - * If a Product doesn't exist and needs to be created on the fly, the - * product_display_name field refers to - * Product.display_name, - * the product_category field refers to - * Product.product_category, - * and the labels field refers to Product.labels. - * - * Labels (optional) should be a line containing a list of comma-separated - * key-value pairs, with the format - * "key_1=value_1,key_2=value_2,...,key_n=value_n". - * - * The bounding_poly (optional) field is used to identify one region of - * interest from the image in the same manner as CreateReferenceImage. If no - * bounding_poly is specified, the system will try to detect regions of - * interest automatically. - * - * Note that the pipeline will resize the image if the image resolution is too - * large to process (above 20MP). - * - * Also note that at most one bounding_poly is allowed per line. If the image - * contains multiple regions of interest, the csv should contain one line per - * region of interest. - * - * The bounding_poly column should contain an even number of comma-separated - * numbers, with the format "p1_x,p1_y,p2_x,p2_y,...,pn_x,pn_y". Nonnegative - * integers should be used for absolute bounding polygons, and float values - * in [0, 1] should be used for normalized bounding polygons. - * - * @typedef ImportProductSetsGcsSource - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search_service.proto} - */ -const ImportProductSetsGcsSource = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The input content for the `ImportProductSets` method. - * - * @property {Object} gcsSource - * The Google Cloud Storage location for a csv file which preserves a list - * of ImportProductSetRequests in each line. - * - * This object should have the same structure as [ImportProductSetsGcsSource]{@link google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource} - * - * @typedef ImportProductSetsInputConfig - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search_service.proto} - */ -const ImportProductSetsInputConfig = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `ImportProductSets` method. - * - * @property {string} parent - * Required. The project in which the ProductSets should be imported. - * - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - * - * @property {Object} inputConfig - * Required. The input content for the list of requests. - * - * This object should have the same structure as [ImportProductSetsInputConfig]{@link google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig} - * - * @typedef ImportProductSetsRequest - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.ImportProductSetsRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search_service.proto} - */ -const ImportProductSetsRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response message for the `ImportProductSets` method. - * - * This message is returned by the - * google.longrunning.Operations.GetOperation - * method in the returned - * google.longrunning.Operation.response - * field. - * - * @property {Object[]} referenceImages - * The list of reference_images that are imported successfully. - * - * This object should have the same structure as [ReferenceImage]{@link google.cloud.vision.v1p3beta1.ReferenceImage} - * - * @property {Object[]} statuses - * The rpc status for each ImportProductSet request, including both successes - * and errors. - * - * The number of statuses here matches the number of lines in the csv file, - * and statuses[i] stores the success or failure status of processing the i-th - * line of the csv, starting from line 0. - * - * This object should have the same structure as [Status]{@link google.rpc.Status} - * - * @typedef ImportProductSetsResponse - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.ImportProductSetsResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search_service.proto} - */ -const ImportProductSetsResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Metadata for the batch operations such as the current state. - * - * This is included in the `metadata` field of the `Operation` returned by the - * `GetOperation` call of the `google::longrunning::Operations` service. - * - * @property {number} state - * The current state of the batch operation. - * - * The number should be among the values of [State]{@link google.cloud.vision.v1p3beta1.State} - * - * @property {Object} submitTime - * The time when the batch request was submitted to the server. - * - * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} - * - * @property {Object} endTime - * The time when the batch request is finished and - * google.longrunning.Operation.done is - * set to true. - * - * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} - * - * @typedef BatchOperationMetadata - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.BatchOperationMetadata definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/product_search_service.proto} - */ -const BatchOperationMetadata = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Enumerates the possible states that the batch request can be in. - * - * @enum {number} - * @memberof google.cloud.vision.v1p3beta1 - */ - State: { - - /** - * Invalid. - */ - STATE_UNSPECIFIED: 0, - - /** - * Request is actively being processed. - */ - PROCESSING: 1, - - /** - * The request is done and at least one item has been successfully - * processed. - */ - SUCCESSFUL: 2, - - /** - * The request is done and no item has been successfully processed. - */ - FAILED: 3, - - /** - * The request is done after the longrunning.Operations.CancelOperation has - * been called by the user. Any records that were processed before the - * cancel command are output as specified in the request. - */ - CANCELLED: 4 - } -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p3beta1/doc/google/cloud/vision/v1p3beta1/doc_text_annotation.js b/packages/google-cloud-vision/src/v1p3beta1/doc/google/cloud/vision/v1p3beta1/doc_text_annotation.js deleted file mode 100644 index dc9fcb2e02e..00000000000 --- a/packages/google-cloud-vision/src/v1p3beta1/doc/google/cloud/vision/v1p3beta1/doc_text_annotation.js +++ /dev/null @@ -1,393 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * TextAnnotation contains a structured representation of OCR extracted text. - * The hierarchy of an OCR extracted text structure is like this: - * TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol - * Each structural component, starting from Page, may further have their own - * properties. Properties describe detected languages, breaks etc.. Please refer - * to the - * TextAnnotation.TextProperty - * message definition below for more detail. - * - * @property {Object[]} pages - * List of pages detected by OCR. - * - * This object should have the same structure as [Page]{@link google.cloud.vision.v1p3beta1.Page} - * - * @property {string} text - * UTF-8 text detected on the pages. - * - * @typedef TextAnnotation - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.TextAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/text_annotation.proto} - */ -const TextAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Detected language for a structural component. - * - * @property {string} languageCode - * The BCP-47 language code, such as "en-US" or "sr-Latn". For more - * information, see - * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. - * - * @property {number} confidence - * Confidence of detected language. Range [0, 1]. - * - * @typedef DetectedLanguage - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.TextAnnotation.DetectedLanguage definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/text_annotation.proto} - */ - DetectedLanguage: { - // This is for documentation. Actual contents will be loaded by gRPC. - }, - - /** - * Detected start or end of a structural component. - * - * @property {number} type - * Detected break type. - * - * The number should be among the values of [BreakType]{@link google.cloud.vision.v1p3beta1.BreakType} - * - * @property {boolean} isPrefix - * True if break prepends the element. - * - * @typedef DetectedBreak - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.TextAnnotation.DetectedBreak definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/text_annotation.proto} - */ - DetectedBreak: { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Enum to denote the type of break found. New line, space etc. - * - * @enum {number} - * @memberof google.cloud.vision.v1p3beta1 - */ - BreakType: { - - /** - * Unknown break label type. - */ - UNKNOWN: 0, - - /** - * Regular space. - */ - SPACE: 1, - - /** - * Sure space (very wide). - */ - SURE_SPACE: 2, - - /** - * Line-wrapping break. - */ - EOL_SURE_SPACE: 3, - - /** - * End-line hyphen that is not present in text; does not co-occur with - * `SPACE`, `LEADER_SPACE`, or `LINE_BREAK`. - */ - HYPHEN: 4, - - /** - * Line break that ends a paragraph. - */ - LINE_BREAK: 5 - } - }, - - /** - * Additional information detected on the structural component. - * - * @property {Object[]} detectedLanguages - * A list of detected languages together with confidence. - * - * This object should have the same structure as [DetectedLanguage]{@link google.cloud.vision.v1p3beta1.DetectedLanguage} - * - * @property {Object} detectedBreak - * Detected start or end of a text segment. - * - * This object should have the same structure as [DetectedBreak]{@link google.cloud.vision.v1p3beta1.DetectedBreak} - * - * @typedef TextProperty - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/text_annotation.proto} - */ - TextProperty: { - // This is for documentation. Actual contents will be loaded by gRPC. - } -}; - -/** - * Detected page from OCR. - * - * @property {Object} property - * Additional information detected on the page. - * - * This object should have the same structure as [TextProperty]{@link google.cloud.vision.v1p3beta1.TextProperty} - * - * @property {number} width - * Page width. For PDFs the unit is points. For images (including - * TIFFs) the unit is pixels. - * - * @property {number} height - * Page height. For PDFs the unit is points. For images (including - * TIFFs) the unit is pixels. - * - * @property {Object[]} blocks - * List of blocks of text, images etc on this page. - * - * This object should have the same structure as [Block]{@link google.cloud.vision.v1p3beta1.Block} - * - * @property {number} confidence - * Confidence of the OCR results on the page. Range [0, 1]. - * - * @typedef Page - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.Page definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/text_annotation.proto} - */ -const Page = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Logical element on the page. - * - * @property {Object} property - * Additional information detected for the block. - * - * This object should have the same structure as [TextProperty]{@link google.cloud.vision.v1p3beta1.TextProperty} - * - * @property {Object} boundingBox - * The bounding box for the block. - * The vertices are in the order of top-left, top-right, bottom-right, - * bottom-left. When a rotation of the bounding box is detected the rotation - * is represented as around the top-left corner as defined when the text is - * read in the 'natural' orientation. - * For example: - * - * * when the text is horizontal it might look like: - * - * 0----1 - * | | - * 3----2 - * - * * when it's rotated 180 degrees around the top-left corner it becomes: - * - * 2----3 - * | | - * 1----0 - * - * and the vertice order will still be (0, 1, 2, 3). - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p3beta1.BoundingPoly} - * - * @property {Object[]} paragraphs - * List of paragraphs in this block (if this blocks is of type text). - * - * This object should have the same structure as [Paragraph]{@link google.cloud.vision.v1p3beta1.Paragraph} - * - * @property {number} blockType - * Detected block type (text, image etc) for this block. - * - * The number should be among the values of [BlockType]{@link google.cloud.vision.v1p3beta1.BlockType} - * - * @property {number} confidence - * Confidence of the OCR results on the block. Range [0, 1]. - * - * @typedef Block - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.Block definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/text_annotation.proto} - */ -const Block = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Type of a block (text, image etc) as identified by OCR. - * - * @enum {number} - * @memberof google.cloud.vision.v1p3beta1 - */ - BlockType: { - - /** - * Unknown block type. - */ - UNKNOWN: 0, - - /** - * Regular text block. - */ - TEXT: 1, - - /** - * Table block. - */ - TABLE: 2, - - /** - * Image block. - */ - PICTURE: 3, - - /** - * Horizontal/vertical line box. - */ - RULER: 4, - - /** - * Barcode block. - */ - BARCODE: 5 - } -}; - -/** - * Structural unit of text representing a number of words in certain order. - * - * @property {Object} property - * Additional information detected for the paragraph. - * - * This object should have the same structure as [TextProperty]{@link google.cloud.vision.v1p3beta1.TextProperty} - * - * @property {Object} boundingBox - * The bounding box for the paragraph. - * The vertices are in the order of top-left, top-right, bottom-right, - * bottom-left. When a rotation of the bounding box is detected the rotation - * is represented as around the top-left corner as defined when the text is - * read in the 'natural' orientation. - * For example: - * * when the text is horizontal it might look like: - * 0----1 - * | | - * 3----2 - * * when it's rotated 180 degrees around the top-left corner it becomes: - * 2----3 - * | | - * 1----0 - * and the vertice order will still be (0, 1, 2, 3). - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p3beta1.BoundingPoly} - * - * @property {Object[]} words - * List of words in this paragraph. - * - * This object should have the same structure as [Word]{@link google.cloud.vision.v1p3beta1.Word} - * - * @property {number} confidence - * Confidence of the OCR results for the paragraph. Range [0, 1]. - * - * @typedef Paragraph - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.Paragraph definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/text_annotation.proto} - */ -const Paragraph = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A word representation. - * - * @property {Object} property - * Additional information detected for the word. - * - * This object should have the same structure as [TextProperty]{@link google.cloud.vision.v1p3beta1.TextProperty} - * - * @property {Object} boundingBox - * The bounding box for the word. - * The vertices are in the order of top-left, top-right, bottom-right, - * bottom-left. When a rotation of the bounding box is detected the rotation - * is represented as around the top-left corner as defined when the text is - * read in the 'natural' orientation. - * For example: - * * when the text is horizontal it might look like: - * 0----1 - * | | - * 3----2 - * * when it's rotated 180 degrees around the top-left corner it becomes: - * 2----3 - * | | - * 1----0 - * and the vertice order will still be (0, 1, 2, 3). - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p3beta1.BoundingPoly} - * - * @property {Object[]} symbols - * List of symbols in the word. - * The order of the symbols follows the natural reading order. - * - * This object should have the same structure as [Symbol]{@link google.cloud.vision.v1p3beta1.Symbol} - * - * @property {number} confidence - * Confidence of the OCR results for the word. Range [0, 1]. - * - * @typedef Word - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.Word definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/text_annotation.proto} - */ -const Word = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A single symbol representation. - * - * @property {Object} property - * Additional information detected for the symbol. - * - * This object should have the same structure as [TextProperty]{@link google.cloud.vision.v1p3beta1.TextProperty} - * - * @property {Object} boundingBox - * The bounding box for the symbol. - * The vertices are in the order of top-left, top-right, bottom-right, - * bottom-left. When a rotation of the bounding box is detected the rotation - * is represented as around the top-left corner as defined when the text is - * read in the 'natural' orientation. - * For example: - * * when the text is horizontal it might look like: - * 0----1 - * | | - * 3----2 - * * when it's rotated 180 degrees around the top-left corner it becomes: - * 2----3 - * | | - * 1----0 - * and the vertice order will still be (0, 1, 2, 3). - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p3beta1.BoundingPoly} - * - * @property {string} text - * The actual UTF-8 representation of the symbol. - * - * @property {number} confidence - * Confidence of the OCR results for the symbol. Range [0, 1]. - * - * @typedef Symbol - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.Symbol definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/text_annotation.proto} - */ -const Symbol = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p3beta1/doc/google/cloud/vision/v1p3beta1/doc_web_detection.js b/packages/google-cloud-vision/src/v1p3beta1/doc/google/cloud/vision/v1p3beta1/doc_web_detection.js deleted file mode 100644 index 57e01b97ea7..00000000000 --- a/packages/google-cloud-vision/src/v1p3beta1/doc/google/cloud/vision/v1p3beta1/doc_web_detection.js +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * Relevant information for the image from the Internet. - * - * @property {Object[]} webEntities - * Deduced entities from similar images on the Internet. - * - * This object should have the same structure as [WebEntity]{@link google.cloud.vision.v1p3beta1.WebEntity} - * - * @property {Object[]} fullMatchingImages - * Fully matching images from the Internet. - * Can include resized copies of the query image. - * - * This object should have the same structure as [WebImage]{@link google.cloud.vision.v1p3beta1.WebImage} - * - * @property {Object[]} partialMatchingImages - * Partial matching images from the Internet. - * Those images are similar enough to share some key-point features. For - * example an original image will likely have partial matching for its crops. - * - * This object should have the same structure as [WebImage]{@link google.cloud.vision.v1p3beta1.WebImage} - * - * @property {Object[]} pagesWithMatchingImages - * Web pages containing the matching images from the Internet. - * - * This object should have the same structure as [WebPage]{@link google.cloud.vision.v1p3beta1.WebPage} - * - * @property {Object[]} visuallySimilarImages - * The visually similar image results. - * - * This object should have the same structure as [WebImage]{@link google.cloud.vision.v1p3beta1.WebImage} - * - * @property {Object[]} bestGuessLabels - * Best guess text labels for the request image. - * - * This object should have the same structure as [WebLabel]{@link google.cloud.vision.v1p3beta1.WebLabel} - * - * @typedef WebDetection - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.WebDetection definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/web_detection.proto} - */ -const WebDetection = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Entity deduced from similar images on the Internet. - * - * @property {string} entityId - * Opaque entity ID. - * - * @property {number} score - * Overall relevancy score for the entity. - * Not normalized and not comparable across different image queries. - * - * @property {string} description - * Canonical description of the entity, in English. - * - * @typedef WebEntity - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.WebDetection.WebEntity definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/web_detection.proto} - */ - WebEntity: { - // This is for documentation. Actual contents will be loaded by gRPC. - }, - - /** - * Metadata for online images. - * - * @property {string} url - * The result image URL. - * - * @property {number} score - * (Deprecated) Overall relevancy score for the image. - * - * @typedef WebImage - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.WebDetection.WebImage definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/web_detection.proto} - */ - WebImage: { - // This is for documentation. Actual contents will be loaded by gRPC. - }, - - /** - * Metadata for web pages. - * - * @property {string} url - * The result web page URL. - * - * @property {number} score - * (Deprecated) Overall relevancy score for the web page. - * - * @property {string} pageTitle - * Title for the web page, may contain HTML markups. - * - * @property {Object[]} fullMatchingImages - * Fully matching images on the page. - * Can include resized copies of the query image. - * - * This object should have the same structure as [WebImage]{@link google.cloud.vision.v1p3beta1.WebImage} - * - * @property {Object[]} partialMatchingImages - * Partial matching images on the page. - * Those images are similar enough to share some key-point features. For - * example an original image will likely have partial matching for its - * crops. - * - * This object should have the same structure as [WebImage]{@link google.cloud.vision.v1p3beta1.WebImage} - * - * @typedef WebPage - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.WebDetection.WebPage definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/web_detection.proto} - */ - WebPage: { - // This is for documentation. Actual contents will be loaded by gRPC. - }, - - /** - * Label to provide extra metadata for the web detection. - * - * @property {string} label - * Label for extra metadata. - * - * @property {string} languageCode - * The BCP-47 language code for `label`, such as "en-US" or "sr-Latn". - * For more information, see - * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. - * - * @typedef WebLabel - * @memberof google.cloud.vision.v1p3beta1 - * @see [google.cloud.vision.v1p3beta1.WebDetection.WebLabel definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p3beta1/web_detection.proto} - */ - WebLabel: { - // This is for documentation. Actual contents will be loaded by gRPC. - } -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p3beta1/doc/google/longrunning/doc_operations.js b/packages/google-cloud-vision/src/v1p3beta1/doc/google/longrunning/doc_operations.js deleted file mode 100644 index 099e418d620..00000000000 --- a/packages/google-cloud-vision/src/v1p3beta1/doc/google/longrunning/doc_operations.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * This resource represents a long-running operation that is the result of a - * network API call. - * - * @property {string} name - * The server-assigned name, which is only unique within the same service that - * originally returns it. If you use the default HTTP mapping, the - * `name` should be a resource name ending with `operations/{unique_id}`. - * - * @property {Object} metadata - * Service-specific metadata associated with the operation. It typically - * contains progress information and common metadata such as create time. - * Some services might not provide such metadata. Any method that returns a - * long-running operation should document the metadata type, if any. - * - * This object should have the same structure as [Any]{@link google.protobuf.Any} - * - * @property {boolean} done - * If the value is `false`, it means the operation is still in progress. - * If `true`, the operation is completed, and either `error` or `response` is - * available. - * - * @property {Object} error - * The error result of the operation in case of failure or cancellation. - * - * This object should have the same structure as [Status]{@link google.rpc.Status} - * - * @property {Object} response - * The normal response of the operation in case of success. If the original - * method returns no data on success, such as `Delete`, the response is - * `google.protobuf.Empty`. If the original method is standard - * `Get`/`Create`/`Update`, the response should be the resource. For other - * methods, the response should have the type `XxxResponse`, where `Xxx` - * is the original method name. For example, if the original method name - * is `TakeSnapshot()`, the inferred response type is - * `TakeSnapshotResponse`. - * - * This object should have the same structure as [Any]{@link google.protobuf.Any} - * - * @typedef Operation - * @memberof google.longrunning - * @see [google.longrunning.Operation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/longrunning/operations.proto} - */ -const Operation = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p3beta1/doc/google/protobuf/doc_any.js b/packages/google-cloud-vision/src/v1p3beta1/doc/google/protobuf/doc_any.js deleted file mode 100644 index 813682aa336..00000000000 --- a/packages/google-cloud-vision/src/v1p3beta1/doc/google/protobuf/doc_any.js +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * `Any` contains an arbitrary serialized protocol buffer message along with a - * URL that describes the type of the serialized message. - * - * Protobuf library provides support to pack/unpack Any values in the form - * of utility functions or additional generated methods of the Any type. - * - * Example 1: Pack and unpack a message in C++. - * - * Foo foo = ...; - * Any any; - * any.PackFrom(foo); - * ... - * if (any.UnpackTo(&foo)) { - * ... - * } - * - * Example 2: Pack and unpack a message in Java. - * - * Foo foo = ...; - * Any any = Any.pack(foo); - * ... - * if (any.is(Foo.class)) { - * foo = any.unpack(Foo.class); - * } - * - * Example 3: Pack and unpack a message in Python. - * - * foo = Foo(...) - * any = Any() - * any.Pack(foo) - * ... - * if any.Is(Foo.DESCRIPTOR): - * any.Unpack(foo) - * ... - * - * Example 4: Pack and unpack a message in Go - * - * foo := &pb.Foo{...} - * any, err := ptypes.MarshalAny(foo) - * ... - * foo := &pb.Foo{} - * if err := ptypes.UnmarshalAny(any, foo); err != nil { - * ... - * } - * - * The pack methods provided by protobuf library will by default use - * 'type.googleapis.com/full.type.name' as the type URL and the unpack - * methods only use the fully qualified type name after the last '/' - * in the type URL, for example "foo.bar.com/x/y.z" will yield type - * name "y.z". - * - * - * # JSON - * - * The JSON representation of an `Any` value uses the regular - * representation of the deserialized, embedded message, with an - * additional field `@type` which contains the type URL. Example: - * - * package google.profile; - * message Person { - * string first_name = 1; - * string last_name = 2; - * } - * - * { - * "@type": "type.googleapis.com/google.profile.Person", - * "firstName": , - * "lastName": - * } - * - * If the embedded message type is well-known and has a custom JSON - * representation, that representation will be embedded adding a field - * `value` which holds the custom JSON in addition to the `@type` - * field. Example (for message google.protobuf.Duration): - * - * { - * "@type": "type.googleapis.com/google.protobuf.Duration", - * "value": "1.212s" - * } - * - * @property {string} typeUrl - * A URL/resource name that uniquely identifies the type of the serialized - * protocol buffer message. This string must contain at least - * one "/" character. The last segment of the URL's path must represent - * the fully qualified name of the type (as in - * `path/google.protobuf.Duration`). The name should be in a canonical form - * (e.g., leading "." is not accepted). - * - * In practice, teams usually precompile into the binary all types that they - * expect it to use in the context of Any. However, for URLs which use the - * scheme `http`, `https`, or no scheme, one can optionally set up a type - * server that maps type URLs to message definitions as follows: - * - * * If no scheme is provided, `https` is assumed. - * * An HTTP GET on the URL must yield a google.protobuf.Type - * value in binary format, or produce an error. - * * Applications are allowed to cache lookup results based on the - * URL, or have them precompiled into a binary to avoid any - * lookup. Therefore, binary compatibility needs to be preserved - * on changes to types. (Use versioned type names to manage - * breaking changes.) - * - * Note: this functionality is not currently available in the official - * protobuf release, and it is not used for type URLs beginning with - * type.googleapis.com. - * - * Schemes other than `http`, `https` (or the empty scheme) might be - * used with implementation specific semantics. - * - * @property {Buffer} value - * Must be a valid serialized protocol buffer of the above specified type. - * - * @typedef Any - * @memberof google.protobuf - * @see [google.protobuf.Any definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/any.proto} - */ -const Any = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p3beta1/doc/google/protobuf/doc_empty.js b/packages/google-cloud-vision/src/v1p3beta1/doc/google/protobuf/doc_empty.js deleted file mode 100644 index 1e3961d6609..00000000000 --- a/packages/google-cloud-vision/src/v1p3beta1/doc/google/protobuf/doc_empty.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * A generic empty message that you can re-use to avoid defining duplicated - * empty messages in your APIs. A typical example is to use it as the request - * or the response type of an API method. For instance: - * - * service Foo { - * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); - * } - * - * The JSON representation for `Empty` is empty JSON object `{}`. - * @typedef Empty - * @memberof google.protobuf - * @see [google.protobuf.Empty definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/empty.proto} - */ -const Empty = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p3beta1/doc/google/protobuf/doc_field_mask.js b/packages/google-cloud-vision/src/v1p3beta1/doc/google/protobuf/doc_field_mask.js deleted file mode 100644 index 59e745f36c2..00000000000 --- a/packages/google-cloud-vision/src/v1p3beta1/doc/google/protobuf/doc_field_mask.js +++ /dev/null @@ -1,228 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * `FieldMask` represents a set of symbolic field paths, for example: - * - * paths: "f.a" - * paths: "f.b.d" - * - * Here `f` represents a field in some root message, `a` and `b` - * fields in the message found in `f`, and `d` a field found in the - * message in `f.b`. - * - * Field masks are used to specify a subset of fields that should be - * returned by a get operation or modified by an update operation. - * Field masks also have a custom JSON encoding (see below). - * - * # Field Masks in Projections - * - * When used in the context of a projection, a response message or - * sub-message is filtered by the API to only contain those fields as - * specified in the mask. For example, if the mask in the previous - * example is applied to a response message as follows: - * - * f { - * a : 22 - * b { - * d : 1 - * x : 2 - * } - * y : 13 - * } - * z: 8 - * - * The result will not contain specific values for fields x,y and z - * (their value will be set to the default, and omitted in proto text - * output): - * - * - * f { - * a : 22 - * b { - * d : 1 - * } - * } - * - * A repeated field is not allowed except at the last position of a - * paths string. - * - * If a FieldMask object is not present in a get operation, the - * operation applies to all fields (as if a FieldMask of all fields - * had been specified). - * - * Note that a field mask does not necessarily apply to the - * top-level response message. In case of a REST get operation, the - * field mask applies directly to the response, but in case of a REST - * list operation, the mask instead applies to each individual message - * in the returned resource list. In case of a REST custom method, - * other definitions may be used. Where the mask applies will be - * clearly documented together with its declaration in the API. In - * any case, the effect on the returned resource/resources is required - * behavior for APIs. - * - * # Field Masks in Update Operations - * - * A field mask in update operations specifies which fields of the - * targeted resource are going to be updated. The API is required - * to only change the values of the fields as specified in the mask - * and leave the others untouched. If a resource is passed in to - * describe the updated values, the API ignores the values of all - * fields not covered by the mask. - * - * If a repeated field is specified for an update operation, new values will - * be appended to the existing repeated field in the target resource. Note that - * a repeated field is only allowed in the last position of a `paths` string. - * - * If a sub-message is specified in the last position of the field mask for an - * update operation, then new value will be merged into the existing sub-message - * in the target resource. - * - * For example, given the target message: - * - * f { - * b { - * d: 1 - * x: 2 - * } - * c: [1] - * } - * - * And an update message: - * - * f { - * b { - * d: 10 - * } - * c: [2] - * } - * - * then if the field mask is: - * - * paths: ["f.b", "f.c"] - * - * then the result will be: - * - * f { - * b { - * d: 10 - * x: 2 - * } - * c: [1, 2] - * } - * - * An implementation may provide options to override this default behavior for - * repeated and message fields. - * - * In order to reset a field's value to the default, the field must - * be in the mask and set to the default value in the provided resource. - * Hence, in order to reset all fields of a resource, provide a default - * instance of the resource and set all fields in the mask, or do - * not provide a mask as described below. - * - * If a field mask is not present on update, the operation applies to - * all fields (as if a field mask of all fields has been specified). - * Note that in the presence of schema evolution, this may mean that - * fields the client does not know and has therefore not filled into - * the request will be reset to their default. If this is unwanted - * behavior, a specific service may require a client to always specify - * a field mask, producing an error if not. - * - * As with get operations, the location of the resource which - * describes the updated values in the request message depends on the - * operation kind. In any case, the effect of the field mask is - * required to be honored by the API. - * - * ## Considerations for HTTP REST - * - * The HTTP kind of an update operation which uses a field mask must - * be set to PATCH instead of PUT in order to satisfy HTTP semantics - * (PUT must only be used for full updates). - * - * # JSON Encoding of Field Masks - * - * In JSON, a field mask is encoded as a single string where paths are - * separated by a comma. Fields name in each path are converted - * to/from lower-camel naming conventions. - * - * As an example, consider the following message declarations: - * - * message Profile { - * User user = 1; - * Photo photo = 2; - * } - * message User { - * string display_name = 1; - * string address = 2; - * } - * - * In proto a field mask for `Profile` may look as such: - * - * mask { - * paths: "user.display_name" - * paths: "photo" - * } - * - * In JSON, the same mask is represented as below: - * - * { - * mask: "user.displayName,photo" - * } - * - * # Field Masks and Oneof Fields - * - * Field masks treat fields in oneofs just as regular fields. Consider the - * following message: - * - * message SampleMessage { - * oneof test_oneof { - * string name = 4; - * SubMessage sub_message = 9; - * } - * } - * - * The field mask can be: - * - * mask { - * paths: "name" - * } - * - * Or: - * - * mask { - * paths: "sub_message" - * } - * - * Note that oneof type names ("test_oneof" in this case) cannot be used in - * paths. - * - * ## Field Mask Verification - * - * The implementation of any API method which has a FieldMask type field in the - * request should verify the included field paths, and return an - * `INVALID_ARGUMENT` error if any path is duplicated or unmappable. - * - * @property {string[]} paths - * The set of field mask paths. - * - * @typedef FieldMask - * @memberof google.protobuf - * @see [google.protobuf.FieldMask definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/field_mask.proto} - */ -const FieldMask = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p3beta1/doc/google/protobuf/doc_timestamp.js b/packages/google-cloud-vision/src/v1p3beta1/doc/google/protobuf/doc_timestamp.js deleted file mode 100644 index ad801cc9a10..00000000000 --- a/packages/google-cloud-vision/src/v1p3beta1/doc/google/protobuf/doc_timestamp.js +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * A Timestamp represents a point in time independent of any time zone or local - * calendar, encoded as a count of seconds and fractions of seconds at - * nanosecond resolution. The count is relative to an epoch at UTC midnight on - * January 1, 1970, in the proleptic Gregorian calendar which extends the - * Gregorian calendar backwards to year one. - * - * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - * second table is needed for interpretation, using a [24-hour linear - * smear](https://developers.google.com/time/smear). - * - * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - * restricting to that range, we ensure that we can convert to and from [RFC - * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - * - * # Examples - * - * Example 1: Compute Timestamp from POSIX `time()`. - * - * Timestamp timestamp; - * timestamp.set_seconds(time(NULL)); - * timestamp.set_nanos(0); - * - * Example 2: Compute Timestamp from POSIX `gettimeofday()`. - * - * struct timeval tv; - * gettimeofday(&tv, NULL); - * - * Timestamp timestamp; - * timestamp.set_seconds(tv.tv_sec); - * timestamp.set_nanos(tv.tv_usec * 1000); - * - * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - * - * FILETIME ft; - * GetSystemTimeAsFileTime(&ft); - * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - * - * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - * Timestamp timestamp; - * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - * - * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - * - * long millis = System.currentTimeMillis(); - * - * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - * .setNanos((int) ((millis % 1000) * 1000000)).build(); - * - * - * Example 5: Compute Timestamp from current time in Python. - * - * timestamp = Timestamp() - * timestamp.GetCurrentTime() - * - * # JSON Mapping - * - * In JSON format, the Timestamp type is encoded as a string in the - * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the - * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" - * where {year} is always expressed using four digits while {month}, {day}, - * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional - * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), - * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone - * is required. A proto3 JSON serializer should always use UTC (as indicated by - * "Z") when printing the Timestamp type and a proto3 JSON parser should be - * able to accept both UTC and other timezones (as indicated by an offset). - * - * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past - * 01:30 UTC on January 15, 2017. - * - * In JavaScript, one can convert a Date object to this format using the - * standard - * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - * method. In Python, a standard `datetime.datetime` object can be converted - * to this format using - * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with - * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use - * the Joda Time's [`ISODateTimeFormat.dateTime()`](https://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D) to obtain a formatter capable of generating timestamps in this format. - * - * @property {number} seconds - * Represents seconds of UTC time since Unix epoch - * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to - * 9999-12-31T23:59:59Z inclusive. - * - * @property {number} nanos - * Non-negative fractions of a second at nanosecond resolution. Negative - * second values with fractions must still have non-negative nanos values - * that count forward in time. Must be from 0 to 999,999,999 - * inclusive. - * - * @typedef Timestamp - * @memberof google.protobuf - * @see [google.protobuf.Timestamp definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto} - */ -const Timestamp = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p3beta1/doc/google/protobuf/doc_wrappers.js b/packages/google-cloud-vision/src/v1p3beta1/doc/google/protobuf/doc_wrappers.js deleted file mode 100644 index 90e2ff4ab5a..00000000000 --- a/packages/google-cloud-vision/src/v1p3beta1/doc/google/protobuf/doc_wrappers.js +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * Wrapper message for `float`. - * - * The JSON representation for `FloatValue` is JSON number. - * - * @property {number} value - * The float value. - * - * @typedef FloatValue - * @memberof google.protobuf - * @see [google.protobuf.FloatValue definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/wrappers.proto} - */ -const FloatValue = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p3beta1/doc/google/rpc/doc_status.js b/packages/google-cloud-vision/src/v1p3beta1/doc/google/rpc/doc_status.js deleted file mode 100644 index 750e0af7689..00000000000 --- a/packages/google-cloud-vision/src/v1p3beta1/doc/google/rpc/doc_status.js +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * The `Status` type defines a logical error model that is suitable for - * different programming environments, including REST APIs and RPC APIs. It is - * used by [gRPC](https://github.com/grpc). Each `Status` message contains - * three pieces of data: error code, error message, and error details. - * - * You can find out more about this error model and how to work with it in the - * [API Design Guide](https://cloud.google.com/apis/design/errors). - * - * @property {number} code - * The status code, which should be an enum value of google.rpc.Code. - * - * @property {string} message - * A developer-facing error message, which should be in English. Any - * user-facing error message should be localized and sent in the - * google.rpc.Status.details field, or localized by the client. - * - * @property {Object[]} details - * A list of messages that carry the error details. There is a common set of - * message types for APIs to use. - * - * This object should have the same structure as [Any]{@link google.protobuf.Any} - * - * @typedef Status - * @memberof google.rpc - * @see [google.rpc.Status definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/rpc/status.proto} - */ -const Status = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p3beta1/doc/google/type/doc_color.js b/packages/google-cloud-vision/src/v1p3beta1/doc/google/type/doc_color.js deleted file mode 100644 index 9570187d502..00000000000 --- a/packages/google-cloud-vision/src/v1p3beta1/doc/google/type/doc_color.js +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * Represents a color in the RGBA color space. This representation is designed - * for simplicity of conversion to/from color representations in various - * languages over compactness; for example, the fields of this representation - * can be trivially provided to the constructor of "java.awt.Color" in Java; it - * can also be trivially provided to UIColor's "+colorWithRed:green:blue:alpha" - * method in iOS; and, with just a little work, it can be easily formatted into - * a CSS "rgba()" string in JavaScript, as well. - * - * Note: this proto does not carry information about the absolute color space - * that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, - * DCI-P3, BT.2020, etc.). By default, applications SHOULD assume the sRGB color - * space. - * - * Example (Java): - * - * import com.google.type.Color; - * - * // ... - * public static java.awt.Color fromProto(Color protocolor) { - * float alpha = protocolor.hasAlpha() - * ? protocolor.getAlpha().getValue() - * : 1.0; - * - * return new java.awt.Color( - * protocolor.getRed(), - * protocolor.getGreen(), - * protocolor.getBlue(), - * alpha); - * } - * - * public static Color toProto(java.awt.Color color) { - * float red = (float) color.getRed(); - * float green = (float) color.getGreen(); - * float blue = (float) color.getBlue(); - * float denominator = 255.0; - * Color.Builder resultBuilder = - * Color - * .newBuilder() - * .setRed(red / denominator) - * .setGreen(green / denominator) - * .setBlue(blue / denominator); - * int alpha = color.getAlpha(); - * if (alpha != 255) { - * result.setAlpha( - * FloatValue - * .newBuilder() - * .setValue(((float) alpha) / denominator) - * .build()); - * } - * return resultBuilder.build(); - * } - * // ... - * - * Example (iOS / Obj-C): - * - * // ... - * static UIColor* fromProto(Color* protocolor) { - * float red = [protocolor red]; - * float green = [protocolor green]; - * float blue = [protocolor blue]; - * FloatValue* alpha_wrapper = [protocolor alpha]; - * float alpha = 1.0; - * if (alpha_wrapper != nil) { - * alpha = [alpha_wrapper value]; - * } - * return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; - * } - * - * static Color* toProto(UIColor* color) { - * CGFloat red, green, blue, alpha; - * if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { - * return nil; - * } - * Color* result = [[Color alloc] init]; - * [result setRed:red]; - * [result setGreen:green]; - * [result setBlue:blue]; - * if (alpha <= 0.9999) { - * [result setAlpha:floatWrapperWithValue(alpha)]; - * } - * [result autorelease]; - * return result; - * } - * // ... - * - * Example (JavaScript): - * - * // ... - * - * var protoToCssColor = function(rgb_color) { - * var redFrac = rgb_color.red || 0.0; - * var greenFrac = rgb_color.green || 0.0; - * var blueFrac = rgb_color.blue || 0.0; - * var red = Math.floor(redFrac * 255); - * var green = Math.floor(greenFrac * 255); - * var blue = Math.floor(blueFrac * 255); - * - * if (!('alpha' in rgb_color)) { - * return rgbToCssColor_(red, green, blue); - * } - * - * var alphaFrac = rgb_color.alpha.value || 0.0; - * var rgbParams = [red, green, blue].join(','); - * return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); - * }; - * - * var rgbToCssColor_ = function(red, green, blue) { - * var rgbNumber = new Number((red << 16) | (green << 8) | blue); - * var hexString = rgbNumber.toString(16); - * var missingZeros = 6 - hexString.length; - * var resultBuilder = ['#']; - * for (var i = 0; i < missingZeros; i++) { - * resultBuilder.push('0'); - * } - * resultBuilder.push(hexString); - * return resultBuilder.join(''); - * }; - * - * // ... - * - * @property {number} red - * The amount of red in the color as a value in the interval [0, 1]. - * - * @property {number} green - * The amount of green in the color as a value in the interval [0, 1]. - * - * @property {number} blue - * The amount of blue in the color as a value in the interval [0, 1]. - * - * @property {Object} alpha - * The fraction of this color that should be applied to the pixel. That is, - * the final pixel color is defined by the equation: - * - * pixel color = alpha * (this color) + (1.0 - alpha) * (background color) - * - * This means that a value of 1.0 corresponds to a solid color, whereas - * a value of 0.0 corresponds to a completely transparent color. This - * uses a wrapper message rather than a simple float scalar so that it is - * possible to distinguish between a default value and the value being unset. - * If omitted, this color object is to be rendered as a solid color - * (as if the alpha value had been explicitly given with a value of 1.0). - * - * This object should have the same structure as [FloatValue]{@link google.protobuf.FloatValue} - * - * @typedef Color - * @memberof google.type - * @see [google.type.Color definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/type/color.proto} - */ -const Color = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p3beta1/doc/google/type/doc_latlng.js b/packages/google-cloud-vision/src/v1p3beta1/doc/google/type/doc_latlng.js deleted file mode 100644 index bacbf0e1f48..00000000000 --- a/packages/google-cloud-vision/src/v1p3beta1/doc/google/type/doc_latlng.js +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * An object representing a latitude/longitude pair. This is expressed as a pair - * of doubles representing degrees latitude and degrees longitude. Unless - * specified otherwise, this must conform to the - * WGS84 - * standard. Values must be within normalized ranges. - * - * @property {number} latitude - * The latitude in degrees. It must be in the range [-90.0, +90.0]. - * - * @property {number} longitude - * The longitude in degrees. It must be in the range [-180.0, +180.0]. - * - * @typedef LatLng - * @memberof google.type - * @see [google.type.LatLng definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/type/latlng.proto} - */ -const LatLng = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p3beta1/image_annotator_client.js b/packages/google-cloud-vision/src/v1p3beta1/image_annotator_client.js deleted file mode 100644 index 598c93f3c86..00000000000 --- a/packages/google-cloud-vision/src/v1p3beta1/image_annotator_client.js +++ /dev/null @@ -1,400 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -'use strict'; - -const gapicConfig = require('./image_annotator_client_config.json'); -const gax = require('google-gax'); -const path = require('path'); - -const VERSION = require('../../package.json').version; - -/** - * Service that performs Google Cloud Vision API detection tasks over client - * images, such as face, landmark, logo, label, and text detection. The - * ImageAnnotator service returns detected entities from the images. - * - * @class - * @memberof v1p3beta1 - */ -class ImageAnnotatorClient { - /** - * Construct an instance of ImageAnnotatorClient. - * - * @param {object} [options] - The configuration object. See the subsequent - * parameters for more details. - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {function} [options.promise] - Custom promise module to use instead - * of native Promises. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - */ - constructor(opts) { - opts = opts || {}; - this._descriptors = {}; - - if (global.isBrowser) { - // If we're in browser, we use gRPC fallback. - opts.fallback = true; - } - - // If we are in browser, we are already using fallback because of the - // "browser" field in package.json. - // But if we were explicitly requested to use fallback, let's do it now. - const gaxModule = !global.isBrowser && opts.fallback ? gax.fallback : gax; - - const servicePath = - opts.servicePath || opts.apiEndpoint || this.constructor.servicePath; - - // Ensure that options include the service address and port. - opts = Object.assign( - { - clientConfig: {}, - port: this.constructor.port, - servicePath, - }, - opts - ); - - // Create a `gaxGrpc` object, with any grpc-specific options - // sent to the client. - opts.scopes = this.constructor.scopes; - const gaxGrpc = new gaxModule.GrpcClient(opts); - - // Save the auth object to the client, for use by other methods. - this.auth = gaxGrpc.auth; - - // Determine the client header string. - const clientHeader = []; - - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } - clientHeader.push(`gax/${gaxModule.version}`); - if (opts.fallback) { - clientHeader.push(`gl-web/${gaxModule.version}`); - } else { - clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`); - } - clientHeader.push(`gapic/${VERSION}`); - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - - // Load the applicable protos. - // For Node.js, pass the path to JSON proto file. - // For browsers, pass the JSON content. - - const nodejsProtoPath = path.join( - __dirname, - '..', - '..', - 'protos', - 'protos.json' - ); - const protos = gaxGrpc.loadProto( - opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath - ); - - const protoFilesRoot = opts.fallback - ? gaxModule.protobuf.Root.fromJSON(require('../../protos/protos.json')) - : gaxModule.protobuf.loadSync(nodejsProtoPath); - - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - this.operationsClient = new gaxModule.lro({ - auth: gaxGrpc.auth, - grpc: gaxGrpc.grpc, - }).operationsClient(opts); - - const asyncBatchAnnotateFilesResponse = protoFilesRoot.lookup( - 'google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse' - ); - const asyncBatchAnnotateFilesMetadata = protoFilesRoot.lookup( - 'google.cloud.vision.v1p3beta1.OperationMetadata' - ); - - this._descriptors.longrunning = { - asyncBatchAnnotateFiles: new gaxModule.LongrunningDescriptor( - this.operationsClient, - asyncBatchAnnotateFilesResponse.decode.bind( - asyncBatchAnnotateFilesResponse - ), - asyncBatchAnnotateFilesMetadata.decode.bind( - asyncBatchAnnotateFilesMetadata - ) - ), - }; - - // Put together the default options sent with requests. - const defaults = gaxGrpc.constructSettings( - 'google.cloud.vision.v1p3beta1.ImageAnnotator', - gapicConfig, - opts.clientConfig, - {'x-goog-api-client': clientHeader.join(' ')} - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this._innerApiCalls = {}; - - // Put together the "service stub" for - // google.cloud.vision.v1p3beta1.ImageAnnotator. - const imageAnnotatorStub = gaxGrpc.createStub( - opts.fallback - ? protos.lookupService('google.cloud.vision.v1p3beta1.ImageAnnotator') - : protos.google.cloud.vision.v1p3beta1.ImageAnnotator, - opts - ); - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const imageAnnotatorStubMethods = [ - 'batchAnnotateImages', - 'asyncBatchAnnotateFiles', - ]; - for (const methodName of imageAnnotatorStubMethods) { - const innerCallPromise = imageAnnotatorStub.then( - stub => (...args) => { - return stub[methodName].apply(stub, args); - }, - err => () => { - throw err; - } - ); - this._innerApiCalls[methodName] = gaxModule.createApiCall( - innerCallPromise, - defaults[methodName], - this._descriptors.longrunning[methodName] - ); - } - } - - /** - * The DNS address for this API service. - */ - static get servicePath() { - return 'vision.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - */ - static get apiEndpoint() { - return 'vision.googleapis.com'; - } - - /** - * The port for this API service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloud-vision', - ]; - } - - /** - * Return the project ID used by this class. - * @param {function(Error, string)} callback - the callback to - * be called with the current project Id. - */ - getProjectId(callback) { - return this.auth.getProjectId(callback); - } - - // ------------------- - // -- Service calls -- - // ------------------- - - /** - * Run image detection and annotation for a batch of images. - * - * @param {Object} request - * The request object that will be sent. - * @param {Object[]} request.requests - * Individual image annotation requests for this batch. - * - * This object should have the same structure as [AnnotateImageRequest]{@link google.cloud.vision.v1p3beta1.AnnotateImageRequest} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [BatchAnnotateImagesResponse]{@link google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [BatchAnnotateImagesResponse]{@link google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1p3beta1.ImageAnnotatorClient({ - * // optional auth parameters. - * }); - * - * const requests = []; - * client.batchAnnotateImages({requests: requests}) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - batchAnnotateImages(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - - return this._innerApiCalls.batchAnnotateImages(request, options, callback); - } - - /** - * Run asynchronous image detection and annotation for a list of generic - * files, such as PDF files, which may contain multiple pages and multiple - * images per page. Progress and results can be retrieved through the - * `google.longrunning.Operations` interface. - * `Operation.metadata` contains `OperationMetadata` (metadata). - * `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results). - * - * @param {Object} request - * The request object that will be sent. - * @param {Object[]} request.requests - * Required. Individual async file annotation requests for this batch. - * - * This object should have the same structure as [AsyncAnnotateFileRequest]{@link google.cloud.vision.v1p3beta1.AsyncAnnotateFileRequest} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/classes/Operation.html} object. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/classes/Operation.html} object. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1p3beta1.ImageAnnotatorClient({ - * // optional auth parameters. - * }); - * - * const requests = []; - * - * // Handle the operation using the promise pattern. - * client.asyncBatchAnnotateFiles({requests: requests}) - * .then(responses => { - * const [operation, initialApiResponse] = responses; - * - * // Operation#promise starts polling for the completion of the LRO. - * return operation.promise(); - * }) - * .then(responses => { - * const result = responses[0]; - * const metadata = responses[1]; - * const finalApiResponse = responses[2]; - * }) - * .catch(err => { - * console.error(err); - * }); - * - * const requests = []; - * - * // Handle the operation using the event emitter pattern. - * client.asyncBatchAnnotateFiles({requests: requests}) - * .then(responses => { - * const [operation, initialApiResponse] = responses; - * - * // Adding a listener for the "complete" event starts polling for the - * // completion of the operation. - * operation.on('complete', (result, metadata, finalApiResponse) => { - * // doSomethingWith(result); - * }); - * - * // Adding a listener for the "progress" event causes the callback to be - * // called on any change in metadata when the operation is polled. - * operation.on('progress', (metadata, apiResponse) => { - * // doSomethingWith(metadata) - * }); - * - * // Adding a listener for the "error" event handles any errors found during polling. - * operation.on('error', err => { - * // throw(err); - * }); - * }) - * .catch(err => { - * console.error(err); - * }); - * - * const requests = []; - * - * // Handle the operation using the await pattern. - * const [operation] = await client.asyncBatchAnnotateFiles({requests: requests}); - * - * const [response] = await operation.promise(); - */ - asyncBatchAnnotateFiles(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - - return this._innerApiCalls.asyncBatchAnnotateFiles( - request, - options, - callback - ); - } -} - -module.exports = ImageAnnotatorClient; diff --git a/packages/google-cloud-vision/src/v1p3beta1/image_annotator_client.ts b/packages/google-cloud-vision/src/v1p3beta1/image_annotator_client.ts new file mode 100644 index 00000000000..506cc0878df --- /dev/null +++ b/packages/google-cloud-vision/src/v1p3beta1/image_annotator_client.ts @@ -0,0 +1,663 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as gax from 'google-gax'; +import { + APICallback, + Callback, + CallOptions, + Descriptors, + ClientOptions, + LROperation, +} from 'google-gax'; +import * as path from 'path'; + +import * as protosTypes from '../../protos/protos'; +import * as gapicConfig from './image_annotator_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service that performs Google Cloud Vision API detection tasks over client + * images, such as face, landmark, logo, label, and text detection. The + * ImageAnnotator service returns detected entities from the images. + * @class + * @memberof v1p3beta1 + */ +export class ImageAnnotatorClient { + private _descriptors: Descriptors = {page: {}, stream: {}, longrunning: {}}; + private _innerApiCalls: {[name: string]: Function}; + private _pathTemplates: {[name: string]: gax.PathTemplate}; + private _terminated = false; + auth: gax.GoogleAuth; + operationsClient: gax.OperationsClient; + imageAnnotatorStub: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ImageAnnotatorClient. + * + * @param {object} [options] - The configuration object. See the subsequent + * parameters for more details. + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {function} [options.promise] - Custom promise module to use instead + * of native Promises. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + */ + + constructor(opts?: ClientOptions) { + // Ensure that options include the service address and port. + const staticMembers = this.constructor as typeof ImageAnnotatorClient; + const servicePath = + opts && opts.servicePath + ? opts.servicePath + : opts && opts.apiEndpoint + ? opts.apiEndpoint + : staticMembers.servicePath; + const port = opts && opts.port ? opts.port : staticMembers.port; + + if (!opts) { + opts = {servicePath, port}; + } + opts.servicePath = opts.servicePath || servicePath; + opts.port = opts.port || port; + opts.clientConfig = opts.clientConfig || {}; + + const isBrowser = typeof window !== 'undefined'; + if (isBrowser) { + opts.fallback = true; + } + // If we are in browser, we are already using fallback because of the + // "browser" field in package.json. + // But if we were explicitly requested to use fallback, let's do it now. + const gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options + // sent to the client. + opts.scopes = (this.constructor as typeof ImageAnnotatorClient).scopes; + const gaxGrpc = new gaxModule.GrpcClient(opts); + + // Save the auth object to the client, for use by other methods. + this.auth = gaxGrpc.auth as gax.GoogleAuth; + + // Determine the client header string. + const clientHeader = [`gax/${gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + const protos = gaxGrpc.loadProto( + opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this._pathTemplates = { + productPathTemplate: new gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/products/{product}' + ), + productSetPathTemplate: new gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/productSets/{product_set}' + ), + referenceImagePathTemplate: new gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}' + ), + }; + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const protoFilesRoot = opts.fallback + ? gaxModule.protobuf.Root.fromJSON(require('../../protos/protos.json')) + : gaxModule.protobuf.loadSync(nodejsProtoPath); + + this.operationsClient = gaxModule + .lro({ + auth: this.auth, + grpc: 'grpc' in gaxGrpc ? gaxGrpc.grpc : undefined, + }) + .operationsClient(opts); + const asyncBatchAnnotateFilesResponse = protoFilesRoot.lookup( + '.google.cloud.vision.v1p3beta1.AsyncBatchAnnotateFilesResponse' + ) as gax.protobuf.Type; + const asyncBatchAnnotateFilesMetadata = protoFilesRoot.lookup( + '.google.cloud.vision.v1p3beta1.OperationMetadata' + ) as gax.protobuf.Type; + + this._descriptors.longrunning = { + asyncBatchAnnotateFiles: new gaxModule.LongrunningDescriptor( + this.operationsClient, + asyncBatchAnnotateFilesResponse.decode.bind( + asyncBatchAnnotateFilesResponse + ), + asyncBatchAnnotateFilesMetadata.decode.bind( + asyncBatchAnnotateFilesMetadata + ) + ), + }; + + // Put together the default options sent with requests. + const defaults = gaxGrpc.constructSettings( + 'google.cloud.vision.v1p3beta1.ImageAnnotator', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this._innerApiCalls = {}; + + // Put together the "service stub" for + // google.cloud.vision.v1p3beta1.ImageAnnotator. + this.imageAnnotatorStub = gaxGrpc.createStub( + opts.fallback + ? (protos as protobuf.Root).lookupService( + 'google.cloud.vision.v1p3beta1.ImageAnnotator' + ) + : // tslint:disable-next-line no-any + (protos as any).google.cloud.vision.v1p3beta1.ImageAnnotator, + opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const imageAnnotatorStubMethods = [ + 'batchAnnotateImages', + 'asyncBatchAnnotateFiles', + ]; + + for (const methodName of imageAnnotatorStubMethods) { + const innerCallPromise = this.imageAnnotatorStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + return stub[methodName].apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const apiCall = gaxModule.createApiCall( + innerCallPromise, + defaults[methodName], + this._descriptors.page[methodName] || + this._descriptors.stream[methodName] || + this._descriptors.longrunning[methodName] + ); + + this._innerApiCalls[methodName] = ( + argument: {}, + callOptions?: CallOptions, + callback?: APICallback + ) => { + return apiCall(argument, callOptions, callback); + }; + } + } + + /** + * The DNS address for this API service. + */ + static get servicePath() { + return 'vision.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + */ + static get apiEndpoint() { + return 'vision.googleapis.com'; + } + + /** + * The port for this API service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/cloud-vision', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @param {function(Error, string)} callback - the callback to + * be called with the current project Id. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + batchAnnotateImages( + request: protosTypes.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesResponse, + ( + | protosTypes.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest + | undefined + ), + {} | undefined + ] + >; + batchAnnotateImages( + request: protosTypes.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesResponse, + | protosTypes.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest + | undefined, + {} | undefined + > + ): void; + /** + * Run image detection and annotation for a batch of images. + * + * @param {Object} request + * The request object that will be sent. + * @param {number[]} request.requests + * Individual image annotation requests for this batch. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [BatchAnnotateImagesResponse]{@link google.cloud.vision.v1p3beta1.BatchAnnotateImagesResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + batchAnnotateImages( + request: protosTypes.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesResponse, + | protosTypes.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesResponse, + | protosTypes.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesResponse, + ( + | protosTypes.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + return this._innerApiCalls.batchAnnotateImages(request, options, callback); + } + + asyncBatchAnnotateFiles( + request: protosTypes.google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesRequest, + options?: gax.CallOptions + ): Promise< + [ + LROperation< + protosTypes.google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesResponse, + protosTypes.google.cloud.vision.v1p3beta1.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + asyncBatchAnnotateFiles( + request: protosTypes.google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesRequest, + options: gax.CallOptions, + callback: Callback< + LROperation< + protosTypes.google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesResponse, + protosTypes.google.cloud.vision.v1p3beta1.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + > + ): void; + /** + * Run asynchronous image detection and annotation for a list of generic + * files, such as PDF files, which may contain multiple pages and multiple + * images per page. Progress and results can be retrieved through the + * `google.longrunning.Operations` interface. + * `Operation.metadata` contains `OperationMetadata` (metadata). + * `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results). + * + * @param {Object} request + * The request object that will be sent. + * @param {number[]} request.requests + * Required. Individual async file annotation requests for this batch. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + asyncBatchAnnotateFiles( + request: protosTypes.google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + LROperation< + protosTypes.google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesResponse, + protosTypes.google.cloud.vision.v1p3beta1.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + >, + callback?: Callback< + LROperation< + protosTypes.google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesResponse, + protosTypes.google.cloud.vision.v1p3beta1.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + > + ): Promise< + [ + LROperation< + protosTypes.google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesResponse, + protosTypes.google.cloud.vision.v1p3beta1.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + return this._innerApiCalls.asyncBatchAnnotateFiles( + request, + options, + callback + ); + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} product + * @returns {string} Resource name string. + */ + productPath(project: string, location: string, product: string) { + return this._pathTemplates.productPathTemplate.render({ + project, + location, + product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this._pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this._pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this._pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Return a fully-qualified productSet resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} product_set + * @returns {string} Resource name string. + */ + productSetPath(project: string, location: string, productSet: string) { + return this._pathTemplates.productSetPathTemplate.render({ + project, + location, + product_set: productSet, + }); + } + + /** + * Parse the project from ProductSet resource. + * + * @param {string} productSetName + * A fully-qualified path representing ProductSet resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductSetName(productSetName: string) { + return this._pathTemplates.productSetPathTemplate.match(productSetName) + .project; + } + + /** + * Parse the location from ProductSet resource. + * + * @param {string} productSetName + * A fully-qualified path representing ProductSet resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductSetName(productSetName: string) { + return this._pathTemplates.productSetPathTemplate.match(productSetName) + .location; + } + + /** + * Parse the product_set from ProductSet resource. + * + * @param {string} productSetName + * A fully-qualified path representing ProductSet resource. + * @returns {string} A string representing the product_set. + */ + matchProductSetFromProductSetName(productSetName: string) { + return this._pathTemplates.productSetPathTemplate.match(productSetName) + .product_set; + } + + /** + * Return a fully-qualified referenceImage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} product + * @param {string} reference_image + * @returns {string} Resource name string. + */ + referenceImagePath( + project: string, + location: string, + product: string, + referenceImage: string + ) { + return this._pathTemplates.referenceImagePathTemplate.render({ + project, + location, + product, + reference_image: referenceImage, + }); + } + + /** + * Parse the project from ReferenceImage resource. + * + * @param {string} referenceImageName + * A fully-qualified path representing ReferenceImage resource. + * @returns {string} A string representing the project. + */ + matchProjectFromReferenceImageName(referenceImageName: string) { + return this._pathTemplates.referenceImagePathTemplate.match( + referenceImageName + ).project; + } + + /** + * Parse the location from ReferenceImage resource. + * + * @param {string} referenceImageName + * A fully-qualified path representing ReferenceImage resource. + * @returns {string} A string representing the location. + */ + matchLocationFromReferenceImageName(referenceImageName: string) { + return this._pathTemplates.referenceImagePathTemplate.match( + referenceImageName + ).location; + } + + /** + * Parse the product from ReferenceImage resource. + * + * @param {string} referenceImageName + * A fully-qualified path representing ReferenceImage resource. + * @returns {string} A string representing the product. + */ + matchProductFromReferenceImageName(referenceImageName: string) { + return this._pathTemplates.referenceImagePathTemplate.match( + referenceImageName + ).product; + } + + /** + * Parse the reference_image from ReferenceImage resource. + * + * @param {string} referenceImageName + * A fully-qualified path representing ReferenceImage resource. + * @returns {string} A string representing the reference_image. + */ + matchReferenceImageFromReferenceImageName(referenceImageName: string) { + return this._pathTemplates.referenceImagePathTemplate.match( + referenceImageName + ).reference_image; + } + + /** + * Terminate the GRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + */ + close(): Promise { + if (!this._terminated) { + return this.imageAnnotatorStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} +import {FeaturesMethod} from '../helpers'; +export interface ImageAnnotatorClient extends FeaturesMethod {} diff --git a/packages/google-cloud-vision/src/v1p3beta1/image_annotator_client_config.json b/packages/google-cloud-vision/src/v1p3beta1/image_annotator_client_config.json index 23e23cdf3d7..75a2b706749 100644 --- a/packages/google-cloud-vision/src/v1p3beta1/image_annotator_client_config.json +++ b/packages/google-cloud-vision/src/v1p3beta1/image_annotator_client_config.json @@ -2,11 +2,11 @@ "interfaces": { "google.cloud.vision.v1p3beta1.ImageAnnotator": { "retry_codes": { + "non_idempotent": [], "idempotent": [ "DEADLINE_EXCEEDED", "UNAVAILABLE" - ], - "non_idempotent": [] + ] }, "retry_params": { "default": { @@ -14,19 +14,19 @@ "retry_delay_multiplier": 1.3, "max_retry_delay_millis": 60000, "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1.0, + "rpc_timeout_multiplier": 1, "max_rpc_timeout_millis": 60000, "total_timeout_millis": 600000 } }, "methods": { "BatchAnnotateImages": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "AsyncBatchAnnotateFiles": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" } diff --git a/packages/google-cloud-vision/src/v1p3beta1/image_annotator_proto_list.json b/packages/google-cloud-vision/src/v1p3beta1/image_annotator_proto_list.json index afd0848ad12..f5f413b6000 100644 --- a/packages/google-cloud-vision/src/v1p3beta1/image_annotator_proto_list.json +++ b/packages/google-cloud-vision/src/v1p3beta1/image_annotator_proto_list.json @@ -1,3 +1,8 @@ [ - "../../protos/google/cloud/vision/v1p3beta1/image_annotator.proto" + "../../protos/google/cloud/vision/v1p3beta1/geometry.proto", + "../../protos/google/cloud/vision/v1p3beta1/image_annotator.proto", + "../../protos/google/cloud/vision/v1p3beta1/product_search.proto", + "../../protos/google/cloud/vision/v1p3beta1/product_search_service.proto", + "../../protos/google/cloud/vision/v1p3beta1/text_annotation.proto", + "../../protos/google/cloud/vision/v1p3beta1/web_detection.proto" ] diff --git a/packages/google-cloud-vision/src/v1/index.js b/packages/google-cloud-vision/src/v1p3beta1/index.ts similarity index 61% rename from packages/google-cloud-vision/src/v1/index.js rename to packages/google-cloud-vision/src/v1p3beta1/index.ts index 801c3946aa2..de3f335b8a0 100644 --- a/packages/google-cloud-vision/src/v1/index.js +++ b/packages/google-cloud-vision/src/v1p3beta1/index.ts @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -11,11 +11,10 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** -'use strict'; - -const ImageAnnotatorClient = require('./image_annotator_client'); -const ProductSearchClient = require('./product_search_client'); - -module.exports.ImageAnnotatorClient = ImageAnnotatorClient; -module.exports.ProductSearchClient = ProductSearchClient; +export {ImageAnnotatorClient} from './image_annotator_client'; +export {ProductSearchClient} from './product_search_client'; diff --git a/packages/google-cloud-vision/src/v1p3beta1/product_search_client.js b/packages/google-cloud-vision/src/v1p3beta1/product_search_client.js deleted file mode 100644 index 48d126cb9ef..00000000000 --- a/packages/google-cloud-vision/src/v1p3beta1/product_search_client.js +++ /dev/null @@ -1,2234 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -'use strict'; - -const gapicConfig = require('./product_search_client_config.json'); -const gax = require('google-gax'); -const path = require('path'); - -const VERSION = require('../../package.json').version; - -/** - * Manages Products and ProductSets of reference images for use in product - * search. It uses the following resource model: - * - * - The API has a collection of ProductSet resources, named - * `projects/* /locations/* /productSets/*`, which acts as a way to put different - * products into groups to limit identification. - * - * In parallel, - * - * - The API has a collection of Product resources, named - * `projects/* /locations/* /products/*` - * - * - Each Product has a collection of ReferenceImage resources, named - * `projects/* /locations/* /products/* /referenceImages/*` - * - * @class - * @memberof v1p3beta1 - */ -class ProductSearchClient { - /** - * Construct an instance of ProductSearchClient. - * - * @param {object} [options] - The configuration object. See the subsequent - * parameters for more details. - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {function} [options.promise] - Custom promise module to use instead - * of native Promises. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - */ - constructor(opts) { - opts = opts || {}; - this._descriptors = {}; - - if (global.isBrowser) { - // If we're in browser, we use gRPC fallback. - opts.fallback = true; - } - - // If we are in browser, we are already using fallback because of the - // "browser" field in package.json. - // But if we were explicitly requested to use fallback, let's do it now. - const gaxModule = !global.isBrowser && opts.fallback ? gax.fallback : gax; - - const servicePath = - opts.servicePath || opts.apiEndpoint || this.constructor.servicePath; - - // Ensure that options include the service address and port. - opts = Object.assign( - { - clientConfig: {}, - port: this.constructor.port, - servicePath, - }, - opts - ); - - // Create a `gaxGrpc` object, with any grpc-specific options - // sent to the client. - opts.scopes = this.constructor.scopes; - const gaxGrpc = new gaxModule.GrpcClient(opts); - - // Save the auth object to the client, for use by other methods. - this.auth = gaxGrpc.auth; - - // Determine the client header string. - const clientHeader = []; - - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } - clientHeader.push(`gax/${gaxModule.version}`); - if (opts.fallback) { - clientHeader.push(`gl-web/${gaxModule.version}`); - } else { - clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`); - } - clientHeader.push(`gapic/${VERSION}`); - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - - // Load the applicable protos. - // For Node.js, pass the path to JSON proto file. - // For browsers, pass the JSON content. - - const nodejsProtoPath = path.join( - __dirname, - '..', - '..', - 'protos', - 'protos.json' - ); - const protos = gaxGrpc.loadProto( - opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath - ); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this._pathTemplates = { - locationPathTemplate: new gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - productPathTemplate: new gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/products/{product}' - ), - productSetPathTemplate: new gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/productSets/{product_set}' - ), - referenceImagePathTemplate: new gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this._descriptors.page = { - listProductSets: new gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'productSets' - ), - listProducts: new gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'products' - ), - listReferenceImages: new gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'referenceImages' - ), - listProductsInProductSet: new gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'products' - ), - }; - - const protoFilesRoot = opts.fallback - ? gaxModule.protobuf.Root.fromJSON(require('../../protos/protos.json')) - : gaxModule.protobuf.loadSync(nodejsProtoPath); - - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - this.operationsClient = new gaxModule.lro({ - auth: gaxGrpc.auth, - grpc: gaxGrpc.grpc, - }).operationsClient(opts); - - const importProductSetsResponse = protoFilesRoot.lookup( - 'google.cloud.vision.v1p3beta1.ImportProductSetsResponse' - ); - const importProductSetsMetadata = protoFilesRoot.lookup( - 'google.cloud.vision.v1p3beta1.BatchOperationMetadata' - ); - - this._descriptors.longrunning = { - importProductSets: new gaxModule.LongrunningDescriptor( - this.operationsClient, - importProductSetsResponse.decode.bind(importProductSetsResponse), - importProductSetsMetadata.decode.bind(importProductSetsMetadata) - ), - }; - - // Put together the default options sent with requests. - const defaults = gaxGrpc.constructSettings( - 'google.cloud.vision.v1p3beta1.ProductSearch', - gapicConfig, - opts.clientConfig, - {'x-goog-api-client': clientHeader.join(' ')} - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this._innerApiCalls = {}; - - // Put together the "service stub" for - // google.cloud.vision.v1p3beta1.ProductSearch. - const productSearchStub = gaxGrpc.createStub( - opts.fallback - ? protos.lookupService('google.cloud.vision.v1p3beta1.ProductSearch') - : protos.google.cloud.vision.v1p3beta1.ProductSearch, - opts - ); - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const productSearchStubMethods = [ - 'createProductSet', - 'listProductSets', - 'getProductSet', - 'updateProductSet', - 'deleteProductSet', - 'createProduct', - 'listProducts', - 'getProduct', - 'updateProduct', - 'deleteProduct', - 'createReferenceImage', - 'deleteReferenceImage', - 'listReferenceImages', - 'getReferenceImage', - 'addProductToProductSet', - 'removeProductFromProductSet', - 'listProductsInProductSet', - 'importProductSets', - ]; - for (const methodName of productSearchStubMethods) { - const innerCallPromise = productSearchStub.then( - stub => (...args) => { - return stub[methodName].apply(stub, args); - }, - err => () => { - throw err; - } - ); - this._innerApiCalls[methodName] = gaxModule.createApiCall( - innerCallPromise, - defaults[methodName], - this._descriptors.page[methodName] || - this._descriptors.longrunning[methodName] - ); - } - } - - /** - * The DNS address for this API service. - */ - static get servicePath() { - return 'vision.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - */ - static get apiEndpoint() { - return 'vision.googleapis.com'; - } - - /** - * The port for this API service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloud-vision', - ]; - } - - /** - * Return the project ID used by this class. - * @param {function(Error, string)} callback - the callback to - * be called with the current project Id. - */ - getProjectId(callback) { - return this.auth.getProjectId(callback); - } - - // ------------------- - // -- Service calls -- - // ------------------- - - /** - * Creates and returns a new ProductSet resource. - * - * Possible errors: - * - * * Returns INVALID_ARGUMENT if display_name is missing, or is longer than - * 4096 characters. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project in which the ProductSet should be created. - * - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - * @param {Object} request.productSet - * Required. The ProductSet to create. - * - * This object should have the same structure as [ProductSet]{@link google.cloud.vision.v1p3beta1.ProductSet} - * @param {string} request.productSetId - * A user-supplied resource id for this ProductSet. If set, the server will - * attempt to use this value as the resource id. If it is already in use, an - * error is returned with code ALREADY_EXISTS. Must be at most 128 characters - * long. It cannot contain the character `/`. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [ProductSet]{@link google.cloud.vision.v1p3beta1.ProductSet}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ProductSet]{@link google.cloud.vision.v1p3beta1.ProductSet}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1p3beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * const productSet = {}; - * const productSetId = ''; - * const request = { - * parent: formattedParent, - * productSet: productSet, - * productSetId: productSetId, - * }; - * client.createProductSet(request) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - createProductSet(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent, - }); - - return this._innerApiCalls.createProductSet(request, options, callback); - } - - /** - * Lists ProductSets in an unspecified order. - * - * Possible errors: - * - * * Returns INVALID_ARGUMENT if page_size is greater than 100, or less - * than 1. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project from which ProductSets should be listed. - * - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - * @param {number} [request.pageSize] - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Array, ?Object, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is Array of [ProductSet]{@link google.cloud.vision.v1p3beta1.ProductSet}. - * - * When autoPaginate: false is specified through options, it contains the result - * in a single response. If the response indicates the next page exists, the third - * parameter is set to be used for the next request object. The fourth parameter keeps - * the raw response object of an object representing [ListProductSetsResponse]{@link google.cloud.vision.v1p3beta1.ListProductSetsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [ProductSet]{@link google.cloud.vision.v1p3beta1.ProductSet}. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [ProductSet]{@link google.cloud.vision.v1p3beta1.ProductSet} in a single response. - * The second element is the next request object if the response - * indicates the next page exists, or null. The third element is - * an object representing [ListProductSetsResponse]{@link google.cloud.vision.v1p3beta1.ListProductSetsResponse}. - * - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1p3beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * // Iterate over all elements. - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * - * client.listProductSets({parent: formattedParent}) - * .then(responses => { - * const resources = responses[0]; - * for (const resource of resources) { - * // doThingsWith(resource) - * } - * }) - * .catch(err => { - * console.error(err); - * }); - * - * // Or obtain the paged response. - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * - * - * const options = {autoPaginate: false}; - * const callback = responses => { - * // The actual resources in a response. - * const resources = responses[0]; - * // The next request if the response shows that there are more responses. - * const nextRequest = responses[1]; - * // The actual response object, if necessary. - * // const rawResponse = responses[2]; - * for (const resource of resources) { - * // doThingsWith(resource); - * } - * if (nextRequest) { - * // Fetch the next page. - * return client.listProductSets(nextRequest, options).then(callback); - * } - * } - * client.listProductSets({parent: formattedParent}, options) - * .then(callback) - * .catch(err => { - * console.error(err); - * }); - */ - listProductSets(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent, - }); - - return this._innerApiCalls.listProductSets(request, options, callback); - } - - /** - * Equivalent to {@link listProductSets}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link listProductSets} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project from which ProductSets should be listed. - * - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - * @param {number} [request.pageSize] - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @returns {Stream} - * An object stream which emits an object representing [ProductSet]{@link google.cloud.vision.v1p3beta1.ProductSet} on 'data' event. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1p3beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * client.listProductSetsStream({parent: formattedParent}) - * .on('data', element => { - * // doThingsWith(element) - * }).on('error', err => { - * console.log(err); - * }); - */ - listProductSetsStream(request, options) { - options = options || {}; - - return this._descriptors.page.listProductSets.createStream( - this._innerApiCalls.listProductSets, - request, - options - ); - } - - /** - * Gets information associated with a ProductSet. - * - * Possible errors: - * - * * Returns NOT_FOUND if the ProductSet does not exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the ProductSet to get. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [ProductSet]{@link google.cloud.vision.v1p3beta1.ProductSet}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ProductSet]{@link google.cloud.vision.v1p3beta1.ProductSet}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1p3beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedName = client.productSetPath('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); - * client.getProductSet({name: formattedName}) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - getProductSet(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name, - }); - - return this._innerApiCalls.getProductSet(request, options, callback); - } - - /** - * Makes changes to a ProductSet resource. - * Only display_name can be updated currently. - * - * Possible errors: - * - * * Returns NOT_FOUND if the ProductSet does not exist. - * * Returns INVALID_ARGUMENT if display_name is present in update_mask but - * missing from the request or longer than 4096 characters. - * - * @param {Object} request - * The request object that will be sent. - * @param {Object} request.productSet - * Required. The ProductSet resource which replaces the one on the server. - * - * This object should have the same structure as [ProductSet]{@link google.cloud.vision.v1p3beta1.ProductSet} - * @param {Object} request.updateMask - * The FieldMask that specifies which fields to - * update. - * If update_mask isn't specified, all mutable fields are to be updated. - * Valid mask path is `display_name`. - * - * This object should have the same structure as [FieldMask]{@link google.protobuf.FieldMask} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [ProductSet]{@link google.cloud.vision.v1p3beta1.ProductSet}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ProductSet]{@link google.cloud.vision.v1p3beta1.ProductSet}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1p3beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const productSet = {}; - * const updateMask = {}; - * const request = { - * productSet: productSet, - * updateMask: updateMask, - * }; - * client.updateProductSet(request) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - updateProductSet(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'product_set.name': request.productSet.name, - }); - - return this._innerApiCalls.updateProductSet(request, options, callback); - } - - /** - * Permanently deletes a ProductSet. All Products and ReferenceImages in the - * ProductSet will be deleted. - * - * The actual image files are not deleted from Google Cloud Storage. - * - * Possible errors: - * - * * Returns NOT_FOUND if the ProductSet does not exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the ProductSet to delete. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error)} [callback] - * The function which will be called with the result of the API call. - * @returns {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1p3beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedName = client.productSetPath('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); - * client.deleteProductSet({name: formattedName}).catch(err => { - * console.error(err); - * }); - */ - deleteProductSet(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name, - }); - - return this._innerApiCalls.deleteProductSet(request, options, callback); - } - - /** - * Creates and returns a new product resource. - * - * Possible errors: - * - * * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 - * characters. - * * Returns INVALID_ARGUMENT if description is longer than 4096 characters. - * * Returns INVALID_ARGUMENT if product_category is missing or invalid. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project in which the Product should be created. - * - * Format is - * `projects/PROJECT_ID/locations/LOC_ID`. - * @param {Object} request.product - * Required. The product to create. - * - * This object should have the same structure as [Product]{@link google.cloud.vision.v1p3beta1.Product} - * @param {string} request.productId - * A user-supplied resource id for this Product. If set, the server will - * attempt to use this value as the resource id. If it is already in use, an - * error is returned with code ALREADY_EXISTS. Must be at most 128 characters - * long. It cannot contain the character `/`. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [Product]{@link google.cloud.vision.v1p3beta1.Product}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Product]{@link google.cloud.vision.v1p3beta1.Product}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1p3beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * const product = {}; - * const productId = ''; - * const request = { - * parent: formattedParent, - * product: product, - * productId: productId, - * }; - * client.createProduct(request) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - createProduct(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent, - }); - - return this._innerApiCalls.createProduct(request, options, callback); - } - - /** - * Lists products in an unspecified order. - * - * Possible errors: - * - * * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project OR ProductSet from which Products should be listed. - * - * Format: - * `projects/PROJECT_ID/locations/LOC_ID` - * @param {number} [request.pageSize] - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Array, ?Object, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is Array of [Product]{@link google.cloud.vision.v1p3beta1.Product}. - * - * When autoPaginate: false is specified through options, it contains the result - * in a single response. If the response indicates the next page exists, the third - * parameter is set to be used for the next request object. The fourth parameter keeps - * the raw response object of an object representing [ListProductsResponse]{@link google.cloud.vision.v1p3beta1.ListProductsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Product]{@link google.cloud.vision.v1p3beta1.Product}. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [Product]{@link google.cloud.vision.v1p3beta1.Product} in a single response. - * The second element is the next request object if the response - * indicates the next page exists, or null. The third element is - * an object representing [ListProductsResponse]{@link google.cloud.vision.v1p3beta1.ListProductsResponse}. - * - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1p3beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * // Iterate over all elements. - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * - * client.listProducts({parent: formattedParent}) - * .then(responses => { - * const resources = responses[0]; - * for (const resource of resources) { - * // doThingsWith(resource) - * } - * }) - * .catch(err => { - * console.error(err); - * }); - * - * // Or obtain the paged response. - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * - * - * const options = {autoPaginate: false}; - * const callback = responses => { - * // The actual resources in a response. - * const resources = responses[0]; - * // The next request if the response shows that there are more responses. - * const nextRequest = responses[1]; - * // The actual response object, if necessary. - * // const rawResponse = responses[2]; - * for (const resource of resources) { - * // doThingsWith(resource); - * } - * if (nextRequest) { - * // Fetch the next page. - * return client.listProducts(nextRequest, options).then(callback); - * } - * } - * client.listProducts({parent: formattedParent}, options) - * .then(callback) - * .catch(err => { - * console.error(err); - * }); - */ - listProducts(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent, - }); - - return this._innerApiCalls.listProducts(request, options, callback); - } - - /** - * Equivalent to {@link listProducts}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link listProducts} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project OR ProductSet from which Products should be listed. - * - * Format: - * `projects/PROJECT_ID/locations/LOC_ID` - * @param {number} [request.pageSize] - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @returns {Stream} - * An object stream which emits an object representing [Product]{@link google.cloud.vision.v1p3beta1.Product} on 'data' event. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1p3beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * client.listProductsStream({parent: formattedParent}) - * .on('data', element => { - * // doThingsWith(element) - * }).on('error', err => { - * console.log(err); - * }); - */ - listProductsStream(request, options) { - options = options || {}; - - return this._descriptors.page.listProducts.createStream( - this._innerApiCalls.listProducts, - request, - options - ); - } - - /** - * Gets information associated with a Product. - * - * Possible errors: - * - * * Returns NOT_FOUND if the Product does not exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the Product to get. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [Product]{@link google.cloud.vision.v1p3beta1.Product}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Product]{@link google.cloud.vision.v1p3beta1.Product}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1p3beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedName = client.productPath('[PROJECT]', '[LOCATION]', '[PRODUCT]'); - * client.getProduct({name: formattedName}) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - getProduct(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name, - }); - - return this._innerApiCalls.getProduct(request, options, callback); - } - - /** - * Makes changes to a Product resource. - * Only display_name, description and labels can be updated right now. - * - * If labels are updated, the change will not be reflected in queries until - * the next index time. - * - * Possible errors: - * - * * Returns NOT_FOUND if the Product does not exist. - * * Returns INVALID_ARGUMENT if display_name is present in update_mask but is - * missing from the request or longer than 4096 characters. - * * Returns INVALID_ARGUMENT if description is present in update_mask but is - * longer than 4096 characters. - * * Returns INVALID_ARGUMENT if product_category is present in update_mask. - * - * @param {Object} request - * The request object that will be sent. - * @param {Object} request.product - * Required. The Product resource which replaces the one on the server. - * product.name is immutable. - * - * This object should have the same structure as [Product]{@link google.cloud.vision.v1p3beta1.Product} - * @param {Object} request.updateMask - * The FieldMask that specifies which fields - * to update. - * If update_mask isn't specified, all mutable fields are to be updated. - * Valid mask paths include `product_labels`, `display_name`, and - * `description`. - * - * This object should have the same structure as [FieldMask]{@link google.protobuf.FieldMask} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [Product]{@link google.cloud.vision.v1p3beta1.Product}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Product]{@link google.cloud.vision.v1p3beta1.Product}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1p3beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const product = {}; - * const updateMask = {}; - * const request = { - * product: product, - * updateMask: updateMask, - * }; - * client.updateProduct(request) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - updateProduct(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'product.name': request.product.name, - }); - - return this._innerApiCalls.updateProduct(request, options, callback); - } - - /** - * Permanently deletes a product and its reference images. - * - * Metadata of the product and all its images will be deleted right away, but - * search queries against ProductSets containing the product may still work - * until all related caches are refreshed. - * - * Possible errors: - * - * * Returns NOT_FOUND if the product does not exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of product to delete. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error)} [callback] - * The function which will be called with the result of the API call. - * @returns {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1p3beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedName = client.productPath('[PROJECT]', '[LOCATION]', '[PRODUCT]'); - * client.deleteProduct({name: formattedName}).catch(err => { - * console.error(err); - * }); - */ - deleteProduct(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name, - }); - - return this._innerApiCalls.deleteProduct(request, options, callback); - } - - /** - * Creates and returns a new ReferenceImage resource. - * - * The `bounding_poly` field is optional. If `bounding_poly` is not specified, - * the system will try to detect regions of interest in the image that are - * compatible with the product_category on the parent product. If it is - * specified, detection is ALWAYS skipped. The system converts polygons into - * non-rotated rectangles. - * - * Note that the pipeline will resize the image if the image resolution is too - * large to process (above 50MP). - * - * Possible errors: - * - * * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 - * characters. - * * Returns INVALID_ARGUMENT if the product does not exist. - * * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing - * compatible with the parent product's product_category is detected. - * * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the product in which to create the reference image. - * - * Format is - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. - * @param {Object} request.referenceImage - * Required. The reference image to create. - * If an image ID is specified, it is ignored. - * - * This object should have the same structure as [ReferenceImage]{@link google.cloud.vision.v1p3beta1.ReferenceImage} - * @param {string} request.referenceImageId - * A user-supplied resource id for the ReferenceImage to be added. If set, - * the server will attempt to use this value as the resource id. If it is - * already in use, an error is returned with code ALREADY_EXISTS. Must be at - * most 128 characters long. It cannot contain the character `/`. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [ReferenceImage]{@link google.cloud.vision.v1p3beta1.ReferenceImage}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ReferenceImage]{@link google.cloud.vision.v1p3beta1.ReferenceImage}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1p3beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedParent = client.productPath('[PROJECT]', '[LOCATION]', '[PRODUCT]'); - * const referenceImage = {}; - * const referenceImageId = ''; - * const request = { - * parent: formattedParent, - * referenceImage: referenceImage, - * referenceImageId: referenceImageId, - * }; - * client.createReferenceImage(request) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - createReferenceImage(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent, - }); - - return this._innerApiCalls.createReferenceImage(request, options, callback); - } - - /** - * Permanently deletes a reference image. - * - * The image metadata will be deleted right away, but search queries - * against ProductSets containing the image may still work until all related - * caches are refreshed. - * - * The actual image files are not deleted from Google Cloud Storage. - * - * Possible errors: - * - * * Returns NOT_FOUND if the reference image does not exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the reference image to delete. - * - * Format is: - * - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error)} [callback] - * The function which will be called with the result of the API call. - * @returns {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1p3beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedName = client.referenceImagePath('[PROJECT]', '[LOCATION]', '[PRODUCT]', '[REFERENCE_IMAGE]'); - * client.deleteReferenceImage({name: formattedName}).catch(err => { - * console.error(err); - * }); - */ - deleteReferenceImage(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name, - }); - - return this._innerApiCalls.deleteReferenceImage(request, options, callback); - } - - /** - * Lists reference images. - * - * Possible errors: - * - * * Returns NOT_FOUND if the parent product does not exist. - * * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less - * than 1. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the product containing the reference images. - * - * Format is - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. - * @param {number} [request.pageSize] - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Array, ?Object, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is Array of [ReferenceImage]{@link google.cloud.vision.v1p3beta1.ReferenceImage}. - * - * When autoPaginate: false is specified through options, it contains the result - * in a single response. If the response indicates the next page exists, the third - * parameter is set to be used for the next request object. The fourth parameter keeps - * the raw response object of an object representing [ListReferenceImagesResponse]{@link google.cloud.vision.v1p3beta1.ListReferenceImagesResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [ReferenceImage]{@link google.cloud.vision.v1p3beta1.ReferenceImage}. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [ReferenceImage]{@link google.cloud.vision.v1p3beta1.ReferenceImage} in a single response. - * The second element is the next request object if the response - * indicates the next page exists, or null. The third element is - * an object representing [ListReferenceImagesResponse]{@link google.cloud.vision.v1p3beta1.ListReferenceImagesResponse}. - * - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1p3beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * // Iterate over all elements. - * const formattedParent = client.productPath('[PROJECT]', '[LOCATION]', '[PRODUCT]'); - * - * client.listReferenceImages({parent: formattedParent}) - * .then(responses => { - * const resources = responses[0]; - * for (const resource of resources) { - * // doThingsWith(resource) - * } - * }) - * .catch(err => { - * console.error(err); - * }); - * - * // Or obtain the paged response. - * const formattedParent = client.productPath('[PROJECT]', '[LOCATION]', '[PRODUCT]'); - * - * - * const options = {autoPaginate: false}; - * const callback = responses => { - * // The actual resources in a response. - * const resources = responses[0]; - * // The next request if the response shows that there are more responses. - * const nextRequest = responses[1]; - * // The actual response object, if necessary. - * // const rawResponse = responses[2]; - * for (const resource of resources) { - * // doThingsWith(resource); - * } - * if (nextRequest) { - * // Fetch the next page. - * return client.listReferenceImages(nextRequest, options).then(callback); - * } - * } - * client.listReferenceImages({parent: formattedParent}, options) - * .then(callback) - * .catch(err => { - * console.error(err); - * }); - */ - listReferenceImages(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent, - }); - - return this._innerApiCalls.listReferenceImages(request, options, callback); - } - - /** - * Equivalent to {@link listReferenceImages}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link listReferenceImages} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the product containing the reference images. - * - * Format is - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. - * @param {number} [request.pageSize] - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @returns {Stream} - * An object stream which emits an object representing [ReferenceImage]{@link google.cloud.vision.v1p3beta1.ReferenceImage} on 'data' event. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1p3beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedParent = client.productPath('[PROJECT]', '[LOCATION]', '[PRODUCT]'); - * client.listReferenceImagesStream({parent: formattedParent}) - * .on('data', element => { - * // doThingsWith(element) - * }).on('error', err => { - * console.log(err); - * }); - */ - listReferenceImagesStream(request, options) { - options = options || {}; - - return this._descriptors.page.listReferenceImages.createStream( - this._innerApiCalls.listReferenceImages, - request, - options - ); - } - - /** - * Gets information associated with a ReferenceImage. - * - * Possible errors: - * - * * Returns NOT_FOUND if the specified image does not exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ReferenceImage to get. - * - * Format is: - * - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [ReferenceImage]{@link google.cloud.vision.v1p3beta1.ReferenceImage}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ReferenceImage]{@link google.cloud.vision.v1p3beta1.ReferenceImage}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1p3beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedName = client.referenceImagePath('[PROJECT]', '[LOCATION]', '[PRODUCT]', '[REFERENCE_IMAGE]'); - * client.getReferenceImage({name: formattedName}) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - getReferenceImage(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name, - }); - - return this._innerApiCalls.getReferenceImage(request, options, callback); - } - - /** - * Adds a Product to the specified ProductSet. If the Product is already - * present, no change is made. - * - * One Product can be added to at most 100 ProductSets. - * - * Possible errors: - * - * * Returns NOT_FOUND if the Product or the ProductSet doesn't exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for the ProductSet to modify. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * @param {string} request.product - * Required. The resource name for the Product to be added to this ProductSet. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error)} [callback] - * The function which will be called with the result of the API call. - * @returns {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1p3beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedName = client.productSetPath('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); - * const product = ''; - * const request = { - * name: formattedName, - * product: product, - * }; - * client.addProductToProductSet(request).catch(err => { - * console.error(err); - * }); - */ - addProductToProductSet(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name, - }); - - return this._innerApiCalls.addProductToProductSet( - request, - options, - callback - ); - } - - /** - * Removes a Product from the specified ProductSet. - * - * Possible errors: - * - * * Returns NOT_FOUND If the Product is not found under the ProductSet. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for the ProductSet to modify. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * @param {string} request.product - * Required. The resource name for the Product to be removed from this ProductSet. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error)} [callback] - * The function which will be called with the result of the API call. - * @returns {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1p3beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedName = client.productSetPath('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); - * const product = ''; - * const request = { - * name: formattedName, - * product: product, - * }; - * client.removeProductFromProductSet(request).catch(err => { - * console.error(err); - * }); - */ - removeProductFromProductSet(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name, - }); - - return this._innerApiCalls.removeProductFromProductSet( - request, - options, - callback - ); - } - - /** - * Lists the Products in a ProductSet, in an unspecified order. If the - * ProductSet does not exist, the products field of the response will be - * empty. - * - * Possible errors: - * - * * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The ProductSet resource for which to retrieve Products. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * @param {number} [request.pageSize] - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Array, ?Object, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is Array of [Product]{@link google.cloud.vision.v1p3beta1.Product}. - * - * When autoPaginate: false is specified through options, it contains the result - * in a single response. If the response indicates the next page exists, the third - * parameter is set to be used for the next request object. The fourth parameter keeps - * the raw response object of an object representing [ListProductsInProductSetResponse]{@link google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Product]{@link google.cloud.vision.v1p3beta1.Product}. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [Product]{@link google.cloud.vision.v1p3beta1.Product} in a single response. - * The second element is the next request object if the response - * indicates the next page exists, or null. The third element is - * an object representing [ListProductsInProductSetResponse]{@link google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse}. - * - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1p3beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * // Iterate over all elements. - * const formattedName = client.productSetPath('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); - * - * client.listProductsInProductSet({name: formattedName}) - * .then(responses => { - * const resources = responses[0]; - * for (const resource of resources) { - * // doThingsWith(resource) - * } - * }) - * .catch(err => { - * console.error(err); - * }); - * - * // Or obtain the paged response. - * const formattedName = client.productSetPath('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); - * - * - * const options = {autoPaginate: false}; - * const callback = responses => { - * // The actual resources in a response. - * const resources = responses[0]; - * // The next request if the response shows that there are more responses. - * const nextRequest = responses[1]; - * // The actual response object, if necessary. - * // const rawResponse = responses[2]; - * for (const resource of resources) { - * // doThingsWith(resource); - * } - * if (nextRequest) { - * // Fetch the next page. - * return client.listProductsInProductSet(nextRequest, options).then(callback); - * } - * } - * client.listProductsInProductSet({name: formattedName}, options) - * .then(callback) - * .catch(err => { - * console.error(err); - * }); - */ - listProductsInProductSet(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name, - }); - - return this._innerApiCalls.listProductsInProductSet( - request, - options, - callback - ); - } - - /** - * Equivalent to {@link listProductsInProductSet}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link listProductsInProductSet} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The ProductSet resource for which to retrieve Products. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * @param {number} [request.pageSize] - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @returns {Stream} - * An object stream which emits an object representing [Product]{@link google.cloud.vision.v1p3beta1.Product} on 'data' event. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1p3beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedName = client.productSetPath('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); - * client.listProductsInProductSetStream({name: formattedName}) - * .on('data', element => { - * // doThingsWith(element) - * }).on('error', err => { - * console.log(err); - * }); - */ - listProductsInProductSetStream(request, options) { - options = options || {}; - - return this._descriptors.page.listProductsInProductSet.createStream( - this._innerApiCalls.listProductsInProductSet, - request, - options - ); - } - - /** - * Asynchronous API that imports a list of reference images to specified - * product sets based on a list of image information. - * - * The google.longrunning.Operation API can be - * used to keep track of the progress and results of the request. - * `Operation.metadata` contains `BatchOperationMetadata`. (progress) - * `Operation.response` contains `ImportProductSetsResponse`. (results) - * - * The input source of this method is a csv file on Google Cloud Storage. - * For the format of the csv file please see - * ImportProductSetsGcsSource.csv_file_uri. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project in which the ProductSets should be imported. - * - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - * @param {Object} request.inputConfig - * Required. The input content for the list of requests. - * - * This object should have the same structure as [ImportProductSetsInputConfig]{@link google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/classes/Operation.html} object. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/classes/Operation.html} object. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('@google-cloud/vision'); - * - * const client = new vision.v1p3beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * const inputConfig = {}; - * const request = { - * parent: formattedParent, - * inputConfig: inputConfig, - * }; - * - * // Handle the operation using the promise pattern. - * client.importProductSets(request) - * .then(responses => { - * const [operation, initialApiResponse] = responses; - * - * // Operation#promise starts polling for the completion of the LRO. - * return operation.promise(); - * }) - * .then(responses => { - * const result = responses[0]; - * const metadata = responses[1]; - * const finalApiResponse = responses[2]; - * }) - * .catch(err => { - * console.error(err); - * }); - * - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * const inputConfig = {}; - * const request = { - * parent: formattedParent, - * inputConfig: inputConfig, - * }; - * - * // Handle the operation using the event emitter pattern. - * client.importProductSets(request) - * .then(responses => { - * const [operation, initialApiResponse] = responses; - * - * // Adding a listener for the "complete" event starts polling for the - * // completion of the operation. - * operation.on('complete', (result, metadata, finalApiResponse) => { - * // doSomethingWith(result); - * }); - * - * // Adding a listener for the "progress" event causes the callback to be - * // called on any change in metadata when the operation is polled. - * operation.on('progress', (metadata, apiResponse) => { - * // doSomethingWith(metadata) - * }); - * - * // Adding a listener for the "error" event handles any errors found during polling. - * operation.on('error', err => { - * // throw(err); - * }); - * }) - * .catch(err => { - * console.error(err); - * }); - * - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * const inputConfig = {}; - * const request = { - * parent: formattedParent, - * inputConfig: inputConfig, - * }; - * - * // Handle the operation using the await pattern. - * const [operation] = await client.importProductSets(request); - * - * const [response] = await operation.promise(); - */ - importProductSets(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent, - }); - - return this._innerApiCalls.importProductSets(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified location resource name string. - * - * @param {String} project - * @param {String} location - * @returns {String} - */ - locationPath(project, location) { - return this._pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {String} project - * @param {String} location - * @param {String} product - * @returns {String} - */ - productPath(project, location, product) { - return this._pathTemplates.productPathTemplate.render({ - project: project, - location: location, - product: product, - }); - } - - /** - * Return a fully-qualified product_set resource name string. - * - * @param {String} project - * @param {String} location - * @param {String} productSet - * @returns {String} - */ - productSetPath(project, location, productSet) { - return this._pathTemplates.productSetPathTemplate.render({ - project: project, - location: location, - product_set: productSet, - }); - } - - /** - * Return a fully-qualified reference_image resource name string. - * - * @param {String} project - * @param {String} location - * @param {String} product - * @param {String} referenceImage - * @returns {String} - */ - referenceImagePath(project, location, product, referenceImage) { - return this._pathTemplates.referenceImagePathTemplate.render({ - project: project, - location: location, - product: product, - reference_image: referenceImage, - }); - } - - /** - * Parse the locationName from a location resource. - * - * @param {String} locationName - * A fully-qualified path representing a location resources. - * @returns {String} - A string representing the project. - */ - matchProjectFromLocationName(locationName) { - return this._pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the locationName from a location resource. - * - * @param {String} locationName - * A fully-qualified path representing a location resources. - * @returns {String} - A string representing the location. - */ - matchLocationFromLocationName(locationName) { - return this._pathTemplates.locationPathTemplate.match(locationName) - .location; - } - - /** - * Parse the productName from a product resource. - * - * @param {String} productName - * A fully-qualified path representing a product resources. - * @returns {String} - A string representing the project. - */ - matchProjectFromProductName(productName) { - return this._pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the productName from a product resource. - * - * @param {String} productName - * A fully-qualified path representing a product resources. - * @returns {String} - A string representing the location. - */ - matchLocationFromProductName(productName) { - return this._pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the productName from a product resource. - * - * @param {String} productName - * A fully-qualified path representing a product resources. - * @returns {String} - A string representing the product. - */ - matchProductFromProductName(productName) { - return this._pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Parse the productSetName from a product_set resource. - * - * @param {String} productSetName - * A fully-qualified path representing a product_set resources. - * @returns {String} - A string representing the project. - */ - matchProjectFromProductSetName(productSetName) { - return this._pathTemplates.productSetPathTemplate.match(productSetName) - .project; - } - - /** - * Parse the productSetName from a product_set resource. - * - * @param {String} productSetName - * A fully-qualified path representing a product_set resources. - * @returns {String} - A string representing the location. - */ - matchLocationFromProductSetName(productSetName) { - return this._pathTemplates.productSetPathTemplate.match(productSetName) - .location; - } - - /** - * Parse the productSetName from a product_set resource. - * - * @param {String} productSetName - * A fully-qualified path representing a product_set resources. - * @returns {String} - A string representing the product_set. - */ - matchProductSetFromProductSetName(productSetName) { - return this._pathTemplates.productSetPathTemplate.match(productSetName) - .product_set; - } - - /** - * Parse the referenceImageName from a reference_image resource. - * - * @param {String} referenceImageName - * A fully-qualified path representing a reference_image resources. - * @returns {String} - A string representing the project. - */ - matchProjectFromReferenceImageName(referenceImageName) { - return this._pathTemplates.referenceImagePathTemplate.match( - referenceImageName - ).project; - } - - /** - * Parse the referenceImageName from a reference_image resource. - * - * @param {String} referenceImageName - * A fully-qualified path representing a reference_image resources. - * @returns {String} - A string representing the location. - */ - matchLocationFromReferenceImageName(referenceImageName) { - return this._pathTemplates.referenceImagePathTemplate.match( - referenceImageName - ).location; - } - - /** - * Parse the referenceImageName from a reference_image resource. - * - * @param {String} referenceImageName - * A fully-qualified path representing a reference_image resources. - * @returns {String} - A string representing the product. - */ - matchProductFromReferenceImageName(referenceImageName) { - return this._pathTemplates.referenceImagePathTemplate.match( - referenceImageName - ).product; - } - - /** - * Parse the referenceImageName from a reference_image resource. - * - * @param {String} referenceImageName - * A fully-qualified path representing a reference_image resources. - * @returns {String} - A string representing the reference_image. - */ - matchReferenceImageFromReferenceImageName(referenceImageName) { - return this._pathTemplates.referenceImagePathTemplate.match( - referenceImageName - ).reference_image; - } -} - -module.exports = ProductSearchClient; diff --git a/packages/google-cloud-vision/src/v1p3beta1/product_search_client.ts b/packages/google-cloud-vision/src/v1p3beta1/product_search_client.ts new file mode 100644 index 00000000000..df8f12b2901 --- /dev/null +++ b/packages/google-cloud-vision/src/v1p3beta1/product_search_client.ts @@ -0,0 +1,2497 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as gax from 'google-gax'; +import { + APICallback, + Callback, + CallOptions, + Descriptors, + ClientOptions, + LROperation, + PaginationCallback, + PaginationResponse, +} from 'google-gax'; +import * as path from 'path'; + +import {Transform} from 'stream'; +import * as protosTypes from '../../protos/protos'; +import * as gapicConfig from './product_search_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Manages Products and ProductSets of reference images for use in product + * search. It uses the following resource model: + * + * - The API has a collection of [ProductSet][google.cloud.vision.v1p3beta1.ProductSet] resources, named + * `projects/* /locations/* /productSets/*`, which acts as a way to put different + * products into groups to limit identification. + * + * In parallel, + * + * - The API has a collection of [Product][google.cloud.vision.v1p3beta1.Product] resources, named + * `projects/* /locations/* /products/*` + * + * - Each [Product][google.cloud.vision.v1p3beta1.Product] has a collection of [ReferenceImage][google.cloud.vision.v1p3beta1.ReferenceImage] resources, named + * `projects/* /locations/* /products/* /referenceImages/*` + * @class + * @memberof v1p3beta1 + */ +export class ProductSearchClient { + private _descriptors: Descriptors = {page: {}, stream: {}, longrunning: {}}; + private _innerApiCalls: {[name: string]: Function}; + private _pathTemplates: {[name: string]: gax.PathTemplate}; + private _terminated = false; + auth: gax.GoogleAuth; + operationsClient: gax.OperationsClient; + productSearchStub: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ProductSearchClient. + * + * @param {object} [options] - The configuration object. See the subsequent + * parameters for more details. + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {function} [options.promise] - Custom promise module to use instead + * of native Promises. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + */ + + constructor(opts?: ClientOptions) { + // Ensure that options include the service address and port. + const staticMembers = this.constructor as typeof ProductSearchClient; + const servicePath = + opts && opts.servicePath + ? opts.servicePath + : opts && opts.apiEndpoint + ? opts.apiEndpoint + : staticMembers.servicePath; + const port = opts && opts.port ? opts.port : staticMembers.port; + + if (!opts) { + opts = {servicePath, port}; + } + opts.servicePath = opts.servicePath || servicePath; + opts.port = opts.port || port; + opts.clientConfig = opts.clientConfig || {}; + + const isBrowser = typeof window !== 'undefined'; + if (isBrowser) { + opts.fallback = true; + } + // If we are in browser, we are already using fallback because of the + // "browser" field in package.json. + // But if we were explicitly requested to use fallback, let's do it now. + const gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options + // sent to the client. + opts.scopes = (this.constructor as typeof ProductSearchClient).scopes; + const gaxGrpc = new gaxModule.GrpcClient(opts); + + // Save the auth object to the client, for use by other methods. + this.auth = gaxGrpc.auth as gax.GoogleAuth; + + // Determine the client header string. + const clientHeader = [`gax/${gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + const protos = gaxGrpc.loadProto( + opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this._pathTemplates = { + locationPathTemplate: new gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + productPathTemplate: new gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/products/{product}' + ), + productSetPathTemplate: new gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/productSets/{product_set}' + ), + referenceImagePathTemplate: new gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this._descriptors.page = { + listProductSets: new gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'productSets' + ), + listProducts: new gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'products' + ), + listReferenceImages: new gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'referenceImages' + ), + listProductsInProductSet: new gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'products' + ), + }; + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const protoFilesRoot = opts.fallback + ? gaxModule.protobuf.Root.fromJSON(require('../../protos/protos.json')) + : gaxModule.protobuf.loadSync(nodejsProtoPath); + + this.operationsClient = gaxModule + .lro({ + auth: this.auth, + grpc: 'grpc' in gaxGrpc ? gaxGrpc.grpc : undefined, + }) + .operationsClient(opts); + const importProductSetsResponse = protoFilesRoot.lookup( + '.google.cloud.vision.v1p3beta1.ImportProductSetsResponse' + ) as gax.protobuf.Type; + const importProductSetsMetadata = protoFilesRoot.lookup( + '.google.cloud.vision.v1p3beta1.BatchOperationMetadata' + ) as gax.protobuf.Type; + + this._descriptors.longrunning = { + importProductSets: new gaxModule.LongrunningDescriptor( + this.operationsClient, + importProductSetsResponse.decode.bind(importProductSetsResponse), + importProductSetsMetadata.decode.bind(importProductSetsMetadata) + ), + }; + + // Put together the default options sent with requests. + const defaults = gaxGrpc.constructSettings( + 'google.cloud.vision.v1p3beta1.ProductSearch', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this._innerApiCalls = {}; + + // Put together the "service stub" for + // google.cloud.vision.v1p3beta1.ProductSearch. + this.productSearchStub = gaxGrpc.createStub( + opts.fallback + ? (protos as protobuf.Root).lookupService( + 'google.cloud.vision.v1p3beta1.ProductSearch' + ) + : // tslint:disable-next-line no-any + (protos as any).google.cloud.vision.v1p3beta1.ProductSearch, + opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const productSearchStubMethods = [ + 'createProductSet', + 'listProductSets', + 'getProductSet', + 'updateProductSet', + 'deleteProductSet', + 'createProduct', + 'listProducts', + 'getProduct', + 'updateProduct', + 'deleteProduct', + 'createReferenceImage', + 'deleteReferenceImage', + 'listReferenceImages', + 'getReferenceImage', + 'addProductToProductSet', + 'removeProductFromProductSet', + 'listProductsInProductSet', + 'importProductSets', + ]; + + for (const methodName of productSearchStubMethods) { + const innerCallPromise = this.productSearchStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + return stub[methodName].apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const apiCall = gaxModule.createApiCall( + innerCallPromise, + defaults[methodName], + this._descriptors.page[methodName] || + this._descriptors.stream[methodName] || + this._descriptors.longrunning[methodName] + ); + + this._innerApiCalls[methodName] = ( + argument: {}, + callOptions?: CallOptions, + callback?: APICallback + ) => { + return apiCall(argument, callOptions, callback); + }; + } + } + + /** + * The DNS address for this API service. + */ + static get servicePath() { + return 'vision.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + */ + static get apiEndpoint() { + return 'vision.googleapis.com'; + } + + /** + * The port for this API service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/cloud-vision', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @param {function(Error, string)} callback - the callback to + * be called with the current project Id. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + createProductSet( + request: protosTypes.google.cloud.vision.v1p3beta1.ICreateProductSetRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1p3beta1.IProductSet, + ( + | protosTypes.google.cloud.vision.v1p3beta1.ICreateProductSetRequest + | undefined + ), + {} | undefined + ] + >; + createProductSet( + request: protosTypes.google.cloud.vision.v1p3beta1.ICreateProductSetRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1p3beta1.IProductSet, + | protosTypes.google.cloud.vision.v1p3beta1.ICreateProductSetRequest + | undefined, + {} | undefined + > + ): void; + /** + * Creates and returns a new ProductSet resource. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if display_name is missing, or is longer than + * 4096 characters. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project in which the ProductSet should be created. + * + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @param {google.cloud.vision.v1p3beta1.ProductSet} request.productSet + * Required. The ProductSet to create. + * @param {string} request.productSetId + * A user-supplied resource id for this ProductSet. If set, the server will + * attempt to use this value as the resource id. If it is already in use, an + * error is returned with code ALREADY_EXISTS. Must be at most 128 characters + * long. It cannot contain the character `/`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ProductSet]{@link google.cloud.vision.v1p3beta1.ProductSet}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + createProductSet( + request: protosTypes.google.cloud.vision.v1p3beta1.ICreateProductSetRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1p3beta1.IProductSet, + | protosTypes.google.cloud.vision.v1p3beta1.ICreateProductSetRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1p3beta1.IProductSet, + | protosTypes.google.cloud.vision.v1p3beta1.ICreateProductSetRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1p3beta1.IProductSet, + ( + | protosTypes.google.cloud.vision.v1p3beta1.ICreateProductSetRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.createProductSet(request, options, callback); + } + getProductSet( + request: protosTypes.google.cloud.vision.v1p3beta1.IGetProductSetRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1p3beta1.IProductSet, + ( + | protosTypes.google.cloud.vision.v1p3beta1.IGetProductSetRequest + | undefined + ), + {} | undefined + ] + >; + getProductSet( + request: protosTypes.google.cloud.vision.v1p3beta1.IGetProductSetRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1p3beta1.IProductSet, + | protosTypes.google.cloud.vision.v1p3beta1.IGetProductSetRequest + | undefined, + {} | undefined + > + ): void; + /** + * Gets information associated with a ProductSet. + * + * Possible errors: + * + * * Returns NOT_FOUND if the ProductSet does not exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the ProductSet to get. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ProductSet]{@link google.cloud.vision.v1p3beta1.ProductSet}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getProductSet( + request: protosTypes.google.cloud.vision.v1p3beta1.IGetProductSetRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1p3beta1.IProductSet, + | protosTypes.google.cloud.vision.v1p3beta1.IGetProductSetRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1p3beta1.IProductSet, + | protosTypes.google.cloud.vision.v1p3beta1.IGetProductSetRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1p3beta1.IProductSet, + ( + | protosTypes.google.cloud.vision.v1p3beta1.IGetProductSetRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.getProductSet(request, options, callback); + } + updateProductSet( + request: protosTypes.google.cloud.vision.v1p3beta1.IUpdateProductSetRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1p3beta1.IProductSet, + ( + | protosTypes.google.cloud.vision.v1p3beta1.IUpdateProductSetRequest + | undefined + ), + {} | undefined + ] + >; + updateProductSet( + request: protosTypes.google.cloud.vision.v1p3beta1.IUpdateProductSetRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1p3beta1.IProductSet, + | protosTypes.google.cloud.vision.v1p3beta1.IUpdateProductSetRequest + | undefined, + {} | undefined + > + ): void; + /** + * Makes changes to a ProductSet resource. + * Only display_name can be updated currently. + * + * Possible errors: + * + * * Returns NOT_FOUND if the ProductSet does not exist. + * * Returns INVALID_ARGUMENT if display_name is present in update_mask but + * missing from the request or longer than 4096 characters. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.vision.v1p3beta1.ProductSet} request.productSet + * Required. The ProductSet resource which replaces the one on the server. + * @param {google.protobuf.FieldMask} request.updateMask + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields to + * update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask path is `display_name`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ProductSet]{@link google.cloud.vision.v1p3beta1.ProductSet}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + updateProductSet( + request: protosTypes.google.cloud.vision.v1p3beta1.IUpdateProductSetRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1p3beta1.IProductSet, + | protosTypes.google.cloud.vision.v1p3beta1.IUpdateProductSetRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1p3beta1.IProductSet, + | protosTypes.google.cloud.vision.v1p3beta1.IUpdateProductSetRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1p3beta1.IProductSet, + ( + | protosTypes.google.cloud.vision.v1p3beta1.IUpdateProductSetRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'product_set.name': request.productSet!.name || '', + }); + return this._innerApiCalls.updateProductSet(request, options, callback); + } + deleteProductSet( + request: protosTypes.google.cloud.vision.v1p3beta1.IDeleteProductSetRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.vision.v1p3beta1.IDeleteProductSetRequest + | undefined + ), + {} | undefined + ] + >; + deleteProductSet( + request: protosTypes.google.cloud.vision.v1p3beta1.IDeleteProductSetRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1p3beta1.IDeleteProductSetRequest + | undefined, + {} | undefined + > + ): void; + /** + * Permanently deletes a ProductSet. All Products and ReferenceImages in the + * ProductSet will be deleted. + * + * The actual image files are not deleted from Google Cloud Storage. + * + * Possible errors: + * + * * Returns NOT_FOUND if the ProductSet does not exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the ProductSet to delete. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + deleteProductSet( + request: protosTypes.google.cloud.vision.v1p3beta1.IDeleteProductSetRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1p3beta1.IDeleteProductSetRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1p3beta1.IDeleteProductSetRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.vision.v1p3beta1.IDeleteProductSetRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.deleteProductSet(request, options, callback); + } + createProduct( + request: protosTypes.google.cloud.vision.v1p3beta1.ICreateProductRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1p3beta1.IProduct, + ( + | protosTypes.google.cloud.vision.v1p3beta1.ICreateProductRequest + | undefined + ), + {} | undefined + ] + >; + createProduct( + request: protosTypes.google.cloud.vision.v1p3beta1.ICreateProductRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1p3beta1.IProduct, + | protosTypes.google.cloud.vision.v1p3beta1.ICreateProductRequest + | undefined, + {} | undefined + > + ): void; + /** + * Creates and returns a new product resource. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 + * characters. + * * Returns INVALID_ARGUMENT if description is longer than 4096 characters. + * * Returns INVALID_ARGUMENT if product_category is missing or invalid. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project in which the Product should be created. + * + * Format is + * `projects/PROJECT_ID/locations/LOC_ID`. + * @param {google.cloud.vision.v1p3beta1.Product} request.product + * Required. The product to create. + * @param {string} request.productId + * A user-supplied resource id for this Product. If set, the server will + * attempt to use this value as the resource id. If it is already in use, an + * error is returned with code ALREADY_EXISTS. Must be at most 128 characters + * long. It cannot contain the character `/`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Product]{@link google.cloud.vision.v1p3beta1.Product}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + createProduct( + request: protosTypes.google.cloud.vision.v1p3beta1.ICreateProductRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1p3beta1.IProduct, + | protosTypes.google.cloud.vision.v1p3beta1.ICreateProductRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1p3beta1.IProduct, + | protosTypes.google.cloud.vision.v1p3beta1.ICreateProductRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1p3beta1.IProduct, + ( + | protosTypes.google.cloud.vision.v1p3beta1.ICreateProductRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.createProduct(request, options, callback); + } + getProduct( + request: protosTypes.google.cloud.vision.v1p3beta1.IGetProductRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1p3beta1.IProduct, + protosTypes.google.cloud.vision.v1p3beta1.IGetProductRequest | undefined, + {} | undefined + ] + >; + getProduct( + request: protosTypes.google.cloud.vision.v1p3beta1.IGetProductRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1p3beta1.IProduct, + protosTypes.google.cloud.vision.v1p3beta1.IGetProductRequest | undefined, + {} | undefined + > + ): void; + /** + * Gets information associated with a Product. + * + * Possible errors: + * + * * Returns NOT_FOUND if the Product does not exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the Product to get. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Product]{@link google.cloud.vision.v1p3beta1.Product}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getProduct( + request: protosTypes.google.cloud.vision.v1p3beta1.IGetProductRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1p3beta1.IProduct, + | protosTypes.google.cloud.vision.v1p3beta1.IGetProductRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1p3beta1.IProduct, + protosTypes.google.cloud.vision.v1p3beta1.IGetProductRequest | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1p3beta1.IProduct, + protosTypes.google.cloud.vision.v1p3beta1.IGetProductRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.getProduct(request, options, callback); + } + updateProduct( + request: protosTypes.google.cloud.vision.v1p3beta1.IUpdateProductRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1p3beta1.IProduct, + ( + | protosTypes.google.cloud.vision.v1p3beta1.IUpdateProductRequest + | undefined + ), + {} | undefined + ] + >; + updateProduct( + request: protosTypes.google.cloud.vision.v1p3beta1.IUpdateProductRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1p3beta1.IProduct, + | protosTypes.google.cloud.vision.v1p3beta1.IUpdateProductRequest + | undefined, + {} | undefined + > + ): void; + /** + * Makes changes to a Product resource. + * Only display_name, description and labels can be updated right now. + * + * If labels are updated, the change will not be reflected in queries until + * the next index time. + * + * Possible errors: + * + * * Returns NOT_FOUND if the Product does not exist. + * * Returns INVALID_ARGUMENT if display_name is present in update_mask but is + * missing from the request or longer than 4096 characters. + * * Returns INVALID_ARGUMENT if description is present in update_mask but is + * longer than 4096 characters. + * * Returns INVALID_ARGUMENT if product_category is present in update_mask. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.vision.v1p3beta1.Product} request.product + * Required. The Product resource which replaces the one on the server. + * product.name is immutable. + * @param {google.protobuf.FieldMask} request.updateMask + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields + * to update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask paths include `product_labels`, `display_name`, and + * `description`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Product]{@link google.cloud.vision.v1p3beta1.Product}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + updateProduct( + request: protosTypes.google.cloud.vision.v1p3beta1.IUpdateProductRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1p3beta1.IProduct, + | protosTypes.google.cloud.vision.v1p3beta1.IUpdateProductRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1p3beta1.IProduct, + | protosTypes.google.cloud.vision.v1p3beta1.IUpdateProductRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1p3beta1.IProduct, + ( + | protosTypes.google.cloud.vision.v1p3beta1.IUpdateProductRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'product.name': request.product!.name || '', + }); + return this._innerApiCalls.updateProduct(request, options, callback); + } + deleteProduct( + request: protosTypes.google.cloud.vision.v1p3beta1.IDeleteProductRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.vision.v1p3beta1.IDeleteProductRequest + | undefined + ), + {} | undefined + ] + >; + deleteProduct( + request: protosTypes.google.cloud.vision.v1p3beta1.IDeleteProductRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1p3beta1.IDeleteProductRequest + | undefined, + {} | undefined + > + ): void; + /** + * Permanently deletes a product and its reference images. + * + * Metadata of the product and all its images will be deleted right away, but + * search queries against ProductSets containing the product may still work + * until all related caches are refreshed. + * + * Possible errors: + * + * * Returns NOT_FOUND if the product does not exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of product to delete. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + deleteProduct( + request: protosTypes.google.cloud.vision.v1p3beta1.IDeleteProductRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1p3beta1.IDeleteProductRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1p3beta1.IDeleteProductRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.vision.v1p3beta1.IDeleteProductRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.deleteProduct(request, options, callback); + } + createReferenceImage( + request: protosTypes.google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1p3beta1.IReferenceImage, + ( + | protosTypes.google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest + | undefined + ), + {} | undefined + ] + >; + createReferenceImage( + request: protosTypes.google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1p3beta1.IReferenceImage, + | protosTypes.google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest + | undefined, + {} | undefined + > + ): void; + /** + * Creates and returns a new ReferenceImage resource. + * + * The `bounding_poly` field is optional. If `bounding_poly` is not specified, + * the system will try to detect regions of interest in the image that are + * compatible with the product_category on the parent product. If it is + * specified, detection is ALWAYS skipped. The system converts polygons into + * non-rotated rectangles. + * + * Note that the pipeline will resize the image if the image resolution is too + * large to process (above 50MP). + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 + * characters. + * * Returns INVALID_ARGUMENT if the product does not exist. + * * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing + * compatible with the parent product's product_category is detected. + * * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the product in which to create the reference image. + * + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * @param {google.cloud.vision.v1p3beta1.ReferenceImage} request.referenceImage + * Required. The reference image to create. + * If an image ID is specified, it is ignored. + * @param {string} request.referenceImageId + * A user-supplied resource id for the ReferenceImage to be added. If set, + * the server will attempt to use this value as the resource id. If it is + * already in use, an error is returned with code ALREADY_EXISTS. Must be at + * most 128 characters long. It cannot contain the character `/`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ReferenceImage]{@link google.cloud.vision.v1p3beta1.ReferenceImage}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + createReferenceImage( + request: protosTypes.google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1p3beta1.IReferenceImage, + | protosTypes.google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1p3beta1.IReferenceImage, + | protosTypes.google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1p3beta1.IReferenceImage, + ( + | protosTypes.google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.createReferenceImage(request, options, callback); + } + deleteReferenceImage( + request: protosTypes.google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest + | undefined + ), + {} | undefined + ] + >; + deleteReferenceImage( + request: protosTypes.google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest + | undefined, + {} | undefined + > + ): void; + /** + * Permanently deletes a reference image. + * + * The image metadata will be deleted right away, but search queries + * against ProductSets containing the image may still work until all related + * caches are refreshed. + * + * The actual image files are not deleted from Google Cloud Storage. + * + * Possible errors: + * + * * Returns NOT_FOUND if the reference image does not exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the reference image to delete. + * + * Format is: + * + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + deleteReferenceImage( + request: protosTypes.google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.deleteReferenceImage(request, options, callback); + } + getReferenceImage( + request: protosTypes.google.cloud.vision.v1p3beta1.IGetReferenceImageRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1p3beta1.IReferenceImage, + ( + | protosTypes.google.cloud.vision.v1p3beta1.IGetReferenceImageRequest + | undefined + ), + {} | undefined + ] + >; + getReferenceImage( + request: protosTypes.google.cloud.vision.v1p3beta1.IGetReferenceImageRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1p3beta1.IReferenceImage, + | protosTypes.google.cloud.vision.v1p3beta1.IGetReferenceImageRequest + | undefined, + {} | undefined + > + ): void; + /** + * Gets information associated with a ReferenceImage. + * + * Possible errors: + * + * * Returns NOT_FOUND if the specified image does not exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ReferenceImage to get. + * + * Format is: + * + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ReferenceImage]{@link google.cloud.vision.v1p3beta1.ReferenceImage}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getReferenceImage( + request: protosTypes.google.cloud.vision.v1p3beta1.IGetReferenceImageRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1p3beta1.IReferenceImage, + | protosTypes.google.cloud.vision.v1p3beta1.IGetReferenceImageRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1p3beta1.IReferenceImage, + | protosTypes.google.cloud.vision.v1p3beta1.IGetReferenceImageRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1p3beta1.IReferenceImage, + ( + | protosTypes.google.cloud.vision.v1p3beta1.IGetReferenceImageRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.getReferenceImage(request, options, callback); + } + addProductToProductSet( + request: protosTypes.google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest + | undefined + ), + {} | undefined + ] + >; + addProductToProductSet( + request: protosTypes.google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest + | undefined, + {} | undefined + > + ): void; + /** + * Adds a Product to the specified ProductSet. If the Product is already + * present, no change is made. + * + * One Product can be added to at most 100 ProductSets. + * + * Possible errors: + * + * * Returns NOT_FOUND if the Product or the ProductSet doesn't exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name for the ProductSet to modify. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param {string} request.product + * Required. The resource name for the Product to be added to this ProductSet. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + addProductToProductSet( + request: protosTypes.google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.addProductToProductSet( + request, + options, + callback + ); + } + removeProductFromProductSet( + request: protosTypes.google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest + | undefined + ), + {} | undefined + ] + >; + removeProductFromProductSet( + request: protosTypes.google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest + | undefined, + {} | undefined + > + ): void; + /** + * Removes a Product from the specified ProductSet. + * + * Possible errors: + * + * * Returns NOT_FOUND If the Product is not found under the ProductSet. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name for the ProductSet to modify. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param {string} request.product + * Required. The resource name for the Product to be removed from this ProductSet. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + removeProductFromProductSet( + request: protosTypes.google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.removeProductFromProductSet( + request, + options, + callback + ); + } + + importProductSets( + request: protosTypes.google.cloud.vision.v1p3beta1.IImportProductSetsRequest, + options?: gax.CallOptions + ): Promise< + [ + LROperation< + protosTypes.google.cloud.vision.v1p3beta1.IImportProductSetsResponse, + protosTypes.google.cloud.vision.v1p3beta1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + importProductSets( + request: protosTypes.google.cloud.vision.v1p3beta1.IImportProductSetsRequest, + options: gax.CallOptions, + callback: Callback< + LROperation< + protosTypes.google.cloud.vision.v1p3beta1.IImportProductSetsResponse, + protosTypes.google.cloud.vision.v1p3beta1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + > + ): void; + /** + * Asynchronous API that imports a list of reference images to specified + * product sets based on a list of image information. + * + * The [google.longrunning.Operation][google.longrunning.Operation] API can be + * used to keep track of the progress and results of the request. + * `Operation.metadata` contains `BatchOperationMetadata`. (progress) + * `Operation.response` contains `ImportProductSetsResponse`. (results) + * + * The input source of this method is a csv file on Google Cloud Storage. + * For the format of the csv file please see + * [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource.csv_file_uri]. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project in which the ProductSets should be imported. + * + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @param {google.cloud.vision.v1p3beta1.ImportProductSetsInputConfig} request.inputConfig + * Required. The input content for the list of requests. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + importProductSets( + request: protosTypes.google.cloud.vision.v1p3beta1.IImportProductSetsRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + LROperation< + protosTypes.google.cloud.vision.v1p3beta1.IImportProductSetsResponse, + protosTypes.google.cloud.vision.v1p3beta1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + >, + callback?: Callback< + LROperation< + protosTypes.google.cloud.vision.v1p3beta1.IImportProductSetsResponse, + protosTypes.google.cloud.vision.v1p3beta1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + > + ): Promise< + [ + LROperation< + protosTypes.google.cloud.vision.v1p3beta1.IImportProductSetsResponse, + protosTypes.google.cloud.vision.v1p3beta1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.importProductSets(request, options, callback); + } + listProductSets( + request: protosTypes.google.cloud.vision.v1p3beta1.IListProductSetsRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1p3beta1.IProductSet[], + protosTypes.google.cloud.vision.v1p3beta1.IListProductSetsRequest | null, + protosTypes.google.cloud.vision.v1p3beta1.IListProductSetsResponse + ] + >; + listProductSets( + request: protosTypes.google.cloud.vision.v1p3beta1.IListProductSetsRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1p3beta1.IProductSet[], + protosTypes.google.cloud.vision.v1p3beta1.IListProductSetsRequest | null, + protosTypes.google.cloud.vision.v1p3beta1.IListProductSetsResponse + > + ): void; + /** + * Lists ProductSets in an unspecified order. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if page_size is greater than 100, or less + * than 1. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project from which ProductSets should be listed. + * + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @param {number} request.pageSize + * The maximum number of items to return. Default 10, maximum 100. + * @param {string} request.pageToken + * The next_page_token returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [ProductSet]{@link google.cloud.vision.v1p3beta1.ProductSet}. + * The client library support auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [ProductSet]{@link google.cloud.vision.v1p3beta1.ProductSet} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListProductSetsRequest]{@link google.cloud.vision.v1p3beta1.ListProductSetsRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListProductSetsResponse]{@link google.cloud.vision.v1p3beta1.ListProductSetsResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + listProductSets( + request: protosTypes.google.cloud.vision.v1p3beta1.IListProductSetsRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1p3beta1.IProductSet[], + protosTypes.google.cloud.vision.v1p3beta1.IListProductSetsRequest | null, + protosTypes.google.cloud.vision.v1p3beta1.IListProductSetsResponse + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1p3beta1.IProductSet[], + protosTypes.google.cloud.vision.v1p3beta1.IListProductSetsRequest | null, + protosTypes.google.cloud.vision.v1p3beta1.IListProductSetsResponse + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1p3beta1.IProductSet[], + protosTypes.google.cloud.vision.v1p3beta1.IListProductSetsRequest | null, + protosTypes.google.cloud.vision.v1p3beta1.IListProductSetsResponse + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.listProductSets(request, options, callback); + } + + /** + * Equivalent to {@link listProductSets}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listProductSets} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project from which ProductSets should be listed. + * + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @param {number} request.pageSize + * The maximum number of items to return. Default 10, maximum 100. + * @param {string} request.pageToken + * The next_page_token returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [ProductSet]{@link google.cloud.vision.v1p3beta1.ProductSet} on 'data' event. + */ + listProductSetsStream( + request?: protosTypes.google.cloud.vision.v1p3beta1.IListProductSetsRequest, + options?: gax.CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + return this._descriptors.page.listProductSets.createStream( + this._innerApiCalls.listProductSets as gax.GaxCall, + request, + callSettings + ); + } + listProducts( + request: protosTypes.google.cloud.vision.v1p3beta1.IListProductsRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1p3beta1.IProduct[], + protosTypes.google.cloud.vision.v1p3beta1.IListProductsRequest | null, + protosTypes.google.cloud.vision.v1p3beta1.IListProductsResponse + ] + >; + listProducts( + request: protosTypes.google.cloud.vision.v1p3beta1.IListProductsRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1p3beta1.IProduct[], + protosTypes.google.cloud.vision.v1p3beta1.IListProductsRequest | null, + protosTypes.google.cloud.vision.v1p3beta1.IListProductsResponse + > + ): void; + /** + * Lists products in an unspecified order. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project OR ProductSet from which Products should be listed. + * + * Format: + * `projects/PROJECT_ID/locations/LOC_ID` + * @param {number} request.pageSize + * The maximum number of items to return. Default 10, maximum 100. + * @param {string} request.pageToken + * The next_page_token returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Product]{@link google.cloud.vision.v1p3beta1.Product}. + * The client library support auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [Product]{@link google.cloud.vision.v1p3beta1.Product} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListProductsRequest]{@link google.cloud.vision.v1p3beta1.ListProductsRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListProductsResponse]{@link google.cloud.vision.v1p3beta1.ListProductsResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + listProducts( + request: protosTypes.google.cloud.vision.v1p3beta1.IListProductsRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1p3beta1.IProduct[], + protosTypes.google.cloud.vision.v1p3beta1.IListProductsRequest | null, + protosTypes.google.cloud.vision.v1p3beta1.IListProductsResponse + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1p3beta1.IProduct[], + protosTypes.google.cloud.vision.v1p3beta1.IListProductsRequest | null, + protosTypes.google.cloud.vision.v1p3beta1.IListProductsResponse + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1p3beta1.IProduct[], + protosTypes.google.cloud.vision.v1p3beta1.IListProductsRequest | null, + protosTypes.google.cloud.vision.v1p3beta1.IListProductsResponse + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.listProducts(request, options, callback); + } + + /** + * Equivalent to {@link listProducts}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listProducts} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project OR ProductSet from which Products should be listed. + * + * Format: + * `projects/PROJECT_ID/locations/LOC_ID` + * @param {number} request.pageSize + * The maximum number of items to return. Default 10, maximum 100. + * @param {string} request.pageToken + * The next_page_token returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Product]{@link google.cloud.vision.v1p3beta1.Product} on 'data' event. + */ + listProductsStream( + request?: protosTypes.google.cloud.vision.v1p3beta1.IListProductsRequest, + options?: gax.CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + return this._descriptors.page.listProducts.createStream( + this._innerApiCalls.listProducts as gax.GaxCall, + request, + callSettings + ); + } + listReferenceImages( + request: protosTypes.google.cloud.vision.v1p3beta1.IListReferenceImagesRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1p3beta1.IReferenceImage[], + protosTypes.google.cloud.vision.v1p3beta1.IListReferenceImagesRequest | null, + protosTypes.google.cloud.vision.v1p3beta1.IListReferenceImagesResponse + ] + >; + listReferenceImages( + request: protosTypes.google.cloud.vision.v1p3beta1.IListReferenceImagesRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1p3beta1.IReferenceImage[], + protosTypes.google.cloud.vision.v1p3beta1.IListReferenceImagesRequest | null, + protosTypes.google.cloud.vision.v1p3beta1.IListReferenceImagesResponse + > + ): void; + /** + * Lists reference images. + * + * Possible errors: + * + * * Returns NOT_FOUND if the parent product does not exist. + * * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less + * than 1. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the product containing the reference images. + * + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * @param {number} request.pageSize + * The maximum number of items to return. Default 10, maximum 100. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This is the value + * of `nextPageToken` returned in a previous reference image list request. + * + * Defaults to the first page if not specified. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [ReferenceImage]{@link google.cloud.vision.v1p3beta1.ReferenceImage}. + * The client library support auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [ReferenceImage]{@link google.cloud.vision.v1p3beta1.ReferenceImage} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListReferenceImagesRequest]{@link google.cloud.vision.v1p3beta1.ListReferenceImagesRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListReferenceImagesResponse]{@link google.cloud.vision.v1p3beta1.ListReferenceImagesResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + listReferenceImages( + request: protosTypes.google.cloud.vision.v1p3beta1.IListReferenceImagesRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1p3beta1.IReferenceImage[], + protosTypes.google.cloud.vision.v1p3beta1.IListReferenceImagesRequest | null, + protosTypes.google.cloud.vision.v1p3beta1.IListReferenceImagesResponse + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1p3beta1.IReferenceImage[], + protosTypes.google.cloud.vision.v1p3beta1.IListReferenceImagesRequest | null, + protosTypes.google.cloud.vision.v1p3beta1.IListReferenceImagesResponse + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1p3beta1.IReferenceImage[], + protosTypes.google.cloud.vision.v1p3beta1.IListReferenceImagesRequest | null, + protosTypes.google.cloud.vision.v1p3beta1.IListReferenceImagesResponse + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.listReferenceImages(request, options, callback); + } + + /** + * Equivalent to {@link listReferenceImages}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listReferenceImages} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the product containing the reference images. + * + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * @param {number} request.pageSize + * The maximum number of items to return. Default 10, maximum 100. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This is the value + * of `nextPageToken` returned in a previous reference image list request. + * + * Defaults to the first page if not specified. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [ReferenceImage]{@link google.cloud.vision.v1p3beta1.ReferenceImage} on 'data' event. + */ + listReferenceImagesStream( + request?: protosTypes.google.cloud.vision.v1p3beta1.IListReferenceImagesRequest, + options?: gax.CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + return this._descriptors.page.listReferenceImages.createStream( + this._innerApiCalls.listReferenceImages as gax.GaxCall, + request, + callSettings + ); + } + listProductsInProductSet( + request: protosTypes.google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1p3beta1.IProduct[], + protosTypes.google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest | null, + protosTypes.google.cloud.vision.v1p3beta1.IListProductsInProductSetResponse + ] + >; + listProductsInProductSet( + request: protosTypes.google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1p3beta1.IProduct[], + protosTypes.google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest | null, + protosTypes.google.cloud.vision.v1p3beta1.IListProductsInProductSetResponse + > + ): void; + /** + * Lists the Products in a ProductSet, in an unspecified order. If the + * ProductSet does not exist, the products field of the response will be + * empty. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The ProductSet resource for which to retrieve Products. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param {number} request.pageSize + * The maximum number of items to return. Default 10, maximum 100. + * @param {string} request.pageToken + * The next_page_token returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Product]{@link google.cloud.vision.v1p3beta1.Product}. + * The client library support auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [Product]{@link google.cloud.vision.v1p3beta1.Product} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListProductsInProductSetRequest]{@link google.cloud.vision.v1p3beta1.ListProductsInProductSetRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListProductsInProductSetResponse]{@link google.cloud.vision.v1p3beta1.ListProductsInProductSetResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + listProductsInProductSet( + request: protosTypes.google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1p3beta1.IProduct[], + protosTypes.google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest | null, + protosTypes.google.cloud.vision.v1p3beta1.IListProductsInProductSetResponse + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1p3beta1.IProduct[], + protosTypes.google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest | null, + protosTypes.google.cloud.vision.v1p3beta1.IListProductsInProductSetResponse + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1p3beta1.IProduct[], + protosTypes.google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest | null, + protosTypes.google.cloud.vision.v1p3beta1.IListProductsInProductSetResponse + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.listProductsInProductSet( + request, + options, + callback + ); + } + + /** + * Equivalent to {@link listProductsInProductSet}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listProductsInProductSet} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The ProductSet resource for which to retrieve Products. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param {number} request.pageSize + * The maximum number of items to return. Default 10, maximum 100. + * @param {string} request.pageToken + * The next_page_token returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Product]{@link google.cloud.vision.v1p3beta1.Product} on 'data' event. + */ + listProductsInProductSetStream( + request?: protosTypes.google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest, + options?: gax.CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + const callSettings = new gax.CallSettings(options); + return this._descriptors.page.listProductsInProductSet.createStream( + this._innerApiCalls.listProductsInProductSet as gax.GaxCall, + request, + callSettings + ); + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project: string, location: string) { + return this._pathTemplates.locationPathTemplate.render({ + project, + location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this._pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this._pathTemplates.locationPathTemplate.match(locationName) + .location; + } + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} product + * @returns {string} Resource name string. + */ + productPath(project: string, location: string, product: string) { + return this._pathTemplates.productPathTemplate.render({ + project, + location, + product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this._pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this._pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this._pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Return a fully-qualified productSet resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} product_set + * @returns {string} Resource name string. + */ + productSetPath(project: string, location: string, productSet: string) { + return this._pathTemplates.productSetPathTemplate.render({ + project, + location, + product_set: productSet, + }); + } + + /** + * Parse the project from ProductSet resource. + * + * @param {string} productSetName + * A fully-qualified path representing ProductSet resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductSetName(productSetName: string) { + return this._pathTemplates.productSetPathTemplate.match(productSetName) + .project; + } + + /** + * Parse the location from ProductSet resource. + * + * @param {string} productSetName + * A fully-qualified path representing ProductSet resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductSetName(productSetName: string) { + return this._pathTemplates.productSetPathTemplate.match(productSetName) + .location; + } + + /** + * Parse the product_set from ProductSet resource. + * + * @param {string} productSetName + * A fully-qualified path representing ProductSet resource. + * @returns {string} A string representing the product_set. + */ + matchProductSetFromProductSetName(productSetName: string) { + return this._pathTemplates.productSetPathTemplate.match(productSetName) + .product_set; + } + + /** + * Return a fully-qualified referenceImage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} product + * @param {string} reference_image + * @returns {string} Resource name string. + */ + referenceImagePath( + project: string, + location: string, + product: string, + referenceImage: string + ) { + return this._pathTemplates.referenceImagePathTemplate.render({ + project, + location, + product, + reference_image: referenceImage, + }); + } + + /** + * Parse the project from ReferenceImage resource. + * + * @param {string} referenceImageName + * A fully-qualified path representing ReferenceImage resource. + * @returns {string} A string representing the project. + */ + matchProjectFromReferenceImageName(referenceImageName: string) { + return this._pathTemplates.referenceImagePathTemplate.match( + referenceImageName + ).project; + } + + /** + * Parse the location from ReferenceImage resource. + * + * @param {string} referenceImageName + * A fully-qualified path representing ReferenceImage resource. + * @returns {string} A string representing the location. + */ + matchLocationFromReferenceImageName(referenceImageName: string) { + return this._pathTemplates.referenceImagePathTemplate.match( + referenceImageName + ).location; + } + + /** + * Parse the product from ReferenceImage resource. + * + * @param {string} referenceImageName + * A fully-qualified path representing ReferenceImage resource. + * @returns {string} A string representing the product. + */ + matchProductFromReferenceImageName(referenceImageName: string) { + return this._pathTemplates.referenceImagePathTemplate.match( + referenceImageName + ).product; + } + + /** + * Parse the reference_image from ReferenceImage resource. + * + * @param {string} referenceImageName + * A fully-qualified path representing ReferenceImage resource. + * @returns {string} A string representing the reference_image. + */ + matchReferenceImageFromReferenceImageName(referenceImageName: string) { + return this._pathTemplates.referenceImagePathTemplate.match( + referenceImageName + ).reference_image; + } + + /** + * Terminate the GRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + */ + close(): Promise { + if (!this._terminated) { + return this.productSearchStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-vision/src/v1p3beta1/product_search_client_config.json b/packages/google-cloud-vision/src/v1p3beta1/product_search_client_config.json index 03793ddd14c..ddc1e9adf79 100644 --- a/packages/google-cloud-vision/src/v1p3beta1/product_search_client_config.json +++ b/packages/google-cloud-vision/src/v1p3beta1/product_search_client_config.json @@ -2,111 +2,111 @@ "interfaces": { "google.cloud.vision.v1p3beta1.ProductSearch": { "retry_codes": { + "non_idempotent": [], "idempotent": [ "DEADLINE_EXCEEDED", "UNAVAILABLE" - ], - "non_idempotent": [] + ] }, "retry_params": { "default": { "initial_retry_delay_millis": 100, "retry_delay_multiplier": 1.3, "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 20000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 20000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, "total_timeout_millis": 600000 } }, "methods": { "CreateProductSet": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "ListProductSets": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "GetProductSet": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "UpdateProductSet": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "DeleteProductSet": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "CreateProduct": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "ListProducts": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "GetProduct": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "UpdateProduct": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "DeleteProduct": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "CreateReferenceImage": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "DeleteReferenceImage": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "ListReferenceImages": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "GetReferenceImage": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "AddProductToProductSet": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "RemoveProductFromProductSet": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "ListProductsInProductSet": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "ImportProductSets": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" } diff --git a/packages/google-cloud-vision/src/v1p3beta1/product_search_proto_list.json b/packages/google-cloud-vision/src/v1p3beta1/product_search_proto_list.json index ab47bf6eaf1..f5f413b6000 100644 --- a/packages/google-cloud-vision/src/v1p3beta1/product_search_proto_list.json +++ b/packages/google-cloud-vision/src/v1p3beta1/product_search_proto_list.json @@ -1,3 +1,8 @@ [ - "../../protos/google/cloud/vision/v1p3beta1/product_search_service.proto" + "../../protos/google/cloud/vision/v1p3beta1/geometry.proto", + "../../protos/google/cloud/vision/v1p3beta1/image_annotator.proto", + "../../protos/google/cloud/vision/v1p3beta1/product_search.proto", + "../../protos/google/cloud/vision/v1p3beta1/product_search_service.proto", + "../../protos/google/cloud/vision/v1p3beta1/text_annotation.proto", + "../../protos/google/cloud/vision/v1p3beta1/web_detection.proto" ] diff --git a/packages/google-cloud-vision/src/v1p4beta1/doc/google/cloud/vision/v1p4beta1/doc_face.js b/packages/google-cloud-vision/src/v1p4beta1/doc/google/cloud/vision/v1p4beta1/doc_face.js deleted file mode 100644 index d3442409587..00000000000 --- a/packages/google-cloud-vision/src/v1p4beta1/doc/google/cloud/vision/v1p4beta1/doc_face.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * Parameters for a celebrity recognition request. - * - * @property {string[]} celebritySet - * The resource names for one or more - * CelebritySets. A celebrity - * set is preloaded and can be specified as "builtin/default". If this is - * specified, the algorithm will try to match the faces detected in the input - * image to the Celebrities in the CelebritySets. - * - * @typedef FaceRecognitionParams - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.FaceRecognitionParams definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/face.proto} - */ -const FaceRecognitionParams = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A Celebrity is a group of Faces with an identity. - * - * @property {string} name - * The resource name of the preloaded Celebrity. Has the format - * `builtin/{mid}`. - * - * @property {string} displayName - * The Celebrity's display name. - * - * @property {string} description - * The Celebrity's description. - * - * @typedef Celebrity - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.Celebrity definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/face.proto} - */ -const Celebrity = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Information about a face's identity. - * - * @property {Object} celebrity - * The Celebrity that this face was - * matched to. - * - * This object should have the same structure as [Celebrity]{@link google.cloud.vision.v1p4beta1.Celebrity} - * - * @property {number} confidence - * Recognition confidence. Range [0, 1]. - * - * @typedef FaceRecognitionResult - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.FaceRecognitionResult definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/face.proto} - */ -const FaceRecognitionResult = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p4beta1/doc/google/cloud/vision/v1p4beta1/doc_geometry.js b/packages/google-cloud-vision/src/v1p4beta1/doc/google/cloud/vision/v1p4beta1/doc_geometry.js deleted file mode 100644 index 164e0945fa0..00000000000 --- a/packages/google-cloud-vision/src/v1p4beta1/doc/google/cloud/vision/v1p4beta1/doc_geometry.js +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * A vertex represents a 2D point in the image. - * NOTE: the vertex coordinates are in the same scale as the original image. - * - * @property {number} x - * X coordinate. - * - * @property {number} y - * Y coordinate. - * - * @typedef Vertex - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.Vertex definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/geometry.proto} - */ -const Vertex = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A vertex represents a 2D point in the image. - * NOTE: the normalized vertex coordinates are relative to the original image - * and range from 0 to 1. - * - * @property {number} x - * X coordinate. - * - * @property {number} y - * Y coordinate. - * - * @typedef NormalizedVertex - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.NormalizedVertex definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/geometry.proto} - */ -const NormalizedVertex = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A bounding polygon for the detected image annotation. - * - * @property {Object[]} vertices - * The bounding polygon vertices. - * - * This object should have the same structure as [Vertex]{@link google.cloud.vision.v1p4beta1.Vertex} - * - * @property {Object[]} normalizedVertices - * The bounding polygon normalized vertices. - * - * This object should have the same structure as [NormalizedVertex]{@link google.cloud.vision.v1p4beta1.NormalizedVertex} - * - * @typedef BoundingPoly - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.BoundingPoly definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/geometry.proto} - */ -const BoundingPoly = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A 3D position in the image, used primarily for Face detection landmarks. - * A valid Position must have both x and y coordinates. - * The position coordinates are in the same scale as the original image. - * - * @property {number} x - * X coordinate. - * - * @property {number} y - * Y coordinate. - * - * @property {number} z - * Z coordinate (or depth). - * - * @typedef Position - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.Position definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/geometry.proto} - */ -const Position = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p4beta1/doc/google/cloud/vision/v1p4beta1/doc_image_annotator.js b/packages/google-cloud-vision/src/v1p4beta1/doc/google/cloud/vision/v1p4beta1/doc_image_annotator.js deleted file mode 100644 index 204b82c7bcf..00000000000 --- a/packages/google-cloud-vision/src/v1p4beta1/doc/google/cloud/vision/v1p4beta1/doc_image_annotator.js +++ /dev/null @@ -1,1459 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * The type of Google Cloud Vision API detection to perform, and the maximum - * number of results to return for that type. Multiple `Feature` objects can - * be specified in the `features` list. - * - * @property {number} type - * The feature type. - * - * The number should be among the values of [Type]{@link google.cloud.vision.v1p4beta1.Type} - * - * @property {number} maxResults - * Maximum number of results of this type. Does not apply to - * `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`. - * - * @property {string} model - * Model to use for the feature. - * Supported values: "builtin/stable" (the default if unset) and - * "builtin/latest". - * - * @typedef Feature - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.Feature definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const Feature = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Type of Google Cloud Vision API feature to be extracted. - * - * @enum {number} - * @memberof google.cloud.vision.v1p4beta1 - */ - Type: { - - /** - * Unspecified feature type. - */ - TYPE_UNSPECIFIED: 0, - - /** - * Run face detection. - */ - FACE_DETECTION: 1, - - /** - * Run landmark detection. - */ - LANDMARK_DETECTION: 2, - - /** - * Run logo detection. - */ - LOGO_DETECTION: 3, - - /** - * Run label detection. - */ - LABEL_DETECTION: 4, - - /** - * Run text detection / optical character recognition (OCR). Text detection - * is optimized for areas of text within a larger image; if the image is - * a document, use `DOCUMENT_TEXT_DETECTION` instead. - */ - TEXT_DETECTION: 5, - - /** - * Run dense text document OCR. Takes precedence when both - * `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` are present. - */ - DOCUMENT_TEXT_DETECTION: 11, - - /** - * Run Safe Search to detect potentially unsafe - * or undesirable content. - */ - SAFE_SEARCH_DETECTION: 6, - - /** - * Compute a set of image properties, such as the - * image's dominant colors. - */ - IMAGE_PROPERTIES: 7, - - /** - * Run crop hints. - */ - CROP_HINTS: 9, - - /** - * Run web detection. - */ - WEB_DETECTION: 10, - - /** - * Run Product Search. - */ - PRODUCT_SEARCH: 12, - - /** - * Run localizer for object detection. - */ - OBJECT_LOCALIZATION: 19 - } -}; - -/** - * External image source (Google Cloud Storage or web URL image location). - * - * @property {string} gcsImageUri - * **Use `image_uri` instead.** - * - * The Google Cloud Storage URI of the form - * `gs://bucket_name/object_name`. Object versioning is not supported. See - * [Google Cloud Storage Request - * URIs](https://cloud.google.com/storage/docs/reference-uris) for more info. - * - * @property {string} imageUri - * The URI of the source image. Can be either: - * - * 1. A Google Cloud Storage URI of the form - * `gs://bucket_name/object_name`. Object versioning is not supported. See - * [Google Cloud Storage Request - * URIs](https://cloud.google.com/storage/docs/reference-uris) for more - * info. - * - * 2. A publicly-accessible image HTTP/HTTPS URL. When fetching images from - * HTTP/HTTPS URLs, Google cannot guarantee that the request will be - * completed. Your request may fail if the specified host denies the - * request (e.g. due to request throttling or DOS prevention), or if Google - * throttles requests to the site for abuse prevention. You should not - * depend on externally-hosted images for production applications. - * - * When both `gcs_image_uri` and `image_uri` are specified, `image_uri` takes - * precedence. - * - * @typedef ImageSource - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.ImageSource definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const ImageSource = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Client image to perform Google Cloud Vision API tasks over. - * - * @property {Buffer} content - * Image content, represented as a stream of bytes. - * Note: As with all `bytes` fields, protobuffers use a pure binary - * representation, whereas JSON representations use base64. - * - * @property {Object} source - * Google Cloud Storage image location, or publicly-accessible image - * URL. If both `content` and `source` are provided for an image, `content` - * takes precedence and is used to perform the image annotation request. - * - * This object should have the same structure as [ImageSource]{@link google.cloud.vision.v1p4beta1.ImageSource} - * - * @typedef Image - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.Image definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const Image = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A face annotation object contains the results of face detection. - * - * @property {Object} boundingPoly - * The bounding polygon around the face. The coordinates of the bounding box - * are in the original image's scale. - * The bounding box is computed to "frame" the face in accordance with human - * expectations. It is based on the landmarker results. - * Note that one or more x and/or y coordinates may not be generated in the - * `BoundingPoly` (the polygon will be unbounded) if only a partial face - * appears in the image to be annotated. - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p4beta1.BoundingPoly} - * - * @property {Object} fdBoundingPoly - * The `fd_bounding_poly` bounding polygon is tighter than the - * `boundingPoly`, and encloses only the skin part of the face. Typically, it - * is used to eliminate the face from any image analysis that detects the - * "amount of skin" visible in an image. It is not based on the - * landmarker results, only on the initial face detection, hence - * the fd (face detection) prefix. - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p4beta1.BoundingPoly} - * - * @property {Object[]} landmarks - * Detected face landmarks. - * - * This object should have the same structure as [Landmark]{@link google.cloud.vision.v1p4beta1.Landmark} - * - * @property {number} rollAngle - * Roll angle, which indicates the amount of clockwise/anti-clockwise rotation - * of the face relative to the image vertical about the axis perpendicular to - * the face. Range [-180,180]. - * - * @property {number} panAngle - * Yaw angle, which indicates the leftward/rightward angle that the face is - * pointing relative to the vertical plane perpendicular to the image. Range - * [-180,180]. - * - * @property {number} tiltAngle - * Pitch angle, which indicates the upwards/downwards angle that the face is - * pointing relative to the image's horizontal plane. Range [-180,180]. - * - * @property {number} detectionConfidence - * Detection confidence. Range [0, 1]. - * - * @property {number} landmarkingConfidence - * Face landmarking confidence. Range [0, 1]. - * - * @property {number} joyLikelihood - * Joy likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p4beta1.Likelihood} - * - * @property {number} sorrowLikelihood - * Sorrow likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p4beta1.Likelihood} - * - * @property {number} angerLikelihood - * Anger likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p4beta1.Likelihood} - * - * @property {number} surpriseLikelihood - * Surprise likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p4beta1.Likelihood} - * - * @property {number} underExposedLikelihood - * Under-exposed likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p4beta1.Likelihood} - * - * @property {number} blurredLikelihood - * Blurred likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p4beta1.Likelihood} - * - * @property {number} headwearLikelihood - * Headwear likelihood. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p4beta1.Likelihood} - * - * @property {Object[]} recognitionResult - * Additional recognition information. Only computed if - * image_context.face_recognition_params is provided, **and** a match is found - * to a Celebrity in the input - * CelebritySet. This field is - * sorted in order of decreasing confidence values. - * - * This object should have the same structure as [FaceRecognitionResult]{@link google.cloud.vision.v1p4beta1.FaceRecognitionResult} - * - * @typedef FaceAnnotation - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.FaceAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const FaceAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * A face-specific landmark (for example, a face feature). - * - * @property {number} type - * Face landmark type. - * - * The number should be among the values of [Type]{@link google.cloud.vision.v1p4beta1.Type} - * - * @property {Object} position - * Face landmark position. - * - * This object should have the same structure as [Position]{@link google.cloud.vision.v1p4beta1.Position} - * - * @typedef Landmark - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.FaceAnnotation.Landmark definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ - Landmark: { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Face landmark (feature) type. - * Left and right are defined from the vantage of the viewer of the image - * without considering mirror projections typical of photos. So, `LEFT_EYE`, - * typically, is the person's right eye. - * - * @enum {number} - * @memberof google.cloud.vision.v1p4beta1 - */ - Type: { - - /** - * Unknown face landmark detected. Should not be filled. - */ - UNKNOWN_LANDMARK: 0, - - /** - * Left eye. - */ - LEFT_EYE: 1, - - /** - * Right eye. - */ - RIGHT_EYE: 2, - - /** - * Left of left eyebrow. - */ - LEFT_OF_LEFT_EYEBROW: 3, - - /** - * Right of left eyebrow. - */ - RIGHT_OF_LEFT_EYEBROW: 4, - - /** - * Left of right eyebrow. - */ - LEFT_OF_RIGHT_EYEBROW: 5, - - /** - * Right of right eyebrow. - */ - RIGHT_OF_RIGHT_EYEBROW: 6, - - /** - * Midpoint between eyes. - */ - MIDPOINT_BETWEEN_EYES: 7, - - /** - * Nose tip. - */ - NOSE_TIP: 8, - - /** - * Upper lip. - */ - UPPER_LIP: 9, - - /** - * Lower lip. - */ - LOWER_LIP: 10, - - /** - * Mouth left. - */ - MOUTH_LEFT: 11, - - /** - * Mouth right. - */ - MOUTH_RIGHT: 12, - - /** - * Mouth center. - */ - MOUTH_CENTER: 13, - - /** - * Nose, bottom right. - */ - NOSE_BOTTOM_RIGHT: 14, - - /** - * Nose, bottom left. - */ - NOSE_BOTTOM_LEFT: 15, - - /** - * Nose, bottom center. - */ - NOSE_BOTTOM_CENTER: 16, - - /** - * Left eye, top boundary. - */ - LEFT_EYE_TOP_BOUNDARY: 17, - - /** - * Left eye, right corner. - */ - LEFT_EYE_RIGHT_CORNER: 18, - - /** - * Left eye, bottom boundary. - */ - LEFT_EYE_BOTTOM_BOUNDARY: 19, - - /** - * Left eye, left corner. - */ - LEFT_EYE_LEFT_CORNER: 20, - - /** - * Right eye, top boundary. - */ - RIGHT_EYE_TOP_BOUNDARY: 21, - - /** - * Right eye, right corner. - */ - RIGHT_EYE_RIGHT_CORNER: 22, - - /** - * Right eye, bottom boundary. - */ - RIGHT_EYE_BOTTOM_BOUNDARY: 23, - - /** - * Right eye, left corner. - */ - RIGHT_EYE_LEFT_CORNER: 24, - - /** - * Left eyebrow, upper midpoint. - */ - LEFT_EYEBROW_UPPER_MIDPOINT: 25, - - /** - * Right eyebrow, upper midpoint. - */ - RIGHT_EYEBROW_UPPER_MIDPOINT: 26, - - /** - * Left ear tragion. - */ - LEFT_EAR_TRAGION: 27, - - /** - * Right ear tragion. - */ - RIGHT_EAR_TRAGION: 28, - - /** - * Left eye pupil. - */ - LEFT_EYE_PUPIL: 29, - - /** - * Right eye pupil. - */ - RIGHT_EYE_PUPIL: 30, - - /** - * Forehead glabella. - */ - FOREHEAD_GLABELLA: 31, - - /** - * Chin gnathion. - */ - CHIN_GNATHION: 32, - - /** - * Chin left gonion. - */ - CHIN_LEFT_GONION: 33, - - /** - * Chin right gonion. - */ - CHIN_RIGHT_GONION: 34 - } - } -}; - -/** - * Detected entity location information. - * - * @property {Object} latLng - * lat/long location coordinates. - * - * This object should have the same structure as [LatLng]{@link google.type.LatLng} - * - * @typedef LocationInfo - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.LocationInfo definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const LocationInfo = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A `Property` consists of a user-supplied name/value pair. - * - * @property {string} name - * Name of the property. - * - * @property {string} value - * Value of the property. - * - * @property {number} uint64Value - * Value of numeric properties. - * - * @typedef Property - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.Property definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const Property = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Set of detected entity features. - * - * @property {string} mid - * Opaque entity ID. Some IDs may be available in - * [Google Knowledge Graph Search - * API](https://developers.google.com/knowledge-graph/). - * - * @property {string} locale - * The language code for the locale in which the entity textual - * `description` is expressed. - * - * @property {string} description - * Entity textual description, expressed in its `locale` language. - * - * @property {number} score - * Overall score of the result. Range [0, 1]. - * - * @property {number} confidence - * **Deprecated. Use `score` instead.** - * The accuracy of the entity detection in an image. - * For example, for an image in which the "Eiffel Tower" entity is detected, - * this field represents the confidence that there is a tower in the query - * image. Range [0, 1]. - * - * @property {number} topicality - * The relevancy of the ICA (Image Content Annotation) label to the - * image. For example, the relevancy of "tower" is likely higher to an image - * containing the detected "Eiffel Tower" than to an image containing a - * detected distant towering building, even though the confidence that - * there is a tower in each image may be the same. Range [0, 1]. - * - * @property {Object} boundingPoly - * Image region to which this entity belongs. Not produced - * for `LABEL_DETECTION` features. - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p4beta1.BoundingPoly} - * - * @property {Object[]} locations - * The location information for the detected entity. Multiple - * `LocationInfo` elements can be present because one location may - * indicate the location of the scene in the image, and another location - * may indicate the location of the place where the image was taken. - * Location information is usually present for landmarks. - * - * This object should have the same structure as [LocationInfo]{@link google.cloud.vision.v1p4beta1.LocationInfo} - * - * @property {Object[]} properties - * Some entities may have optional user-supplied `Property` (name/value) - * fields, such a score or string that qualifies the entity. - * - * This object should have the same structure as [Property]{@link google.cloud.vision.v1p4beta1.Property} - * - * @typedef EntityAnnotation - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.EntityAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const EntityAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Set of detected objects with bounding boxes. - * - * @property {string} mid - * Object ID that should align with EntityAnnotation mid. - * - * @property {string} languageCode - * The BCP-47 language code, such as "en-US" or "sr-Latn". For more - * information, see - * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. - * - * @property {string} name - * Object name, expressed in its `language_code` language. - * - * @property {number} score - * Score of the result. Range [0, 1]. - * - * @property {Object} boundingPoly - * Image region to which this object belongs. This must be populated. - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p4beta1.BoundingPoly} - * - * @typedef LocalizedObjectAnnotation - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const LocalizedObjectAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Set of features pertaining to the image, computed by computer vision - * methods over safe-search verticals (for example, adult, spoof, medical, - * violence). - * - * @property {number} adult - * Represents the adult content likelihood for the image. Adult content may - * contain elements such as nudity, pornographic images or cartoons, or - * sexual activities. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p4beta1.Likelihood} - * - * @property {number} spoof - * Spoof likelihood. The likelihood that an modification - * was made to the image's canonical version to make it appear - * funny or offensive. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p4beta1.Likelihood} - * - * @property {number} medical - * Likelihood that this is a medical image. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p4beta1.Likelihood} - * - * @property {number} violence - * Likelihood that this image contains violent content. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p4beta1.Likelihood} - * - * @property {number} racy - * Likelihood that the request image contains racy content. Racy content may - * include (but is not limited to) skimpy or sheer clothing, strategically - * covered nudity, lewd or provocative poses, or close-ups of sensitive - * body areas. - * - * The number should be among the values of [Likelihood]{@link google.cloud.vision.v1p4beta1.Likelihood} - * - * @typedef SafeSearchAnnotation - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.SafeSearchAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const SafeSearchAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Rectangle determined by min and max `LatLng` pairs. - * - * @property {Object} minLatLng - * Min lat/long pair. - * - * This object should have the same structure as [LatLng]{@link google.type.LatLng} - * - * @property {Object} maxLatLng - * Max lat/long pair. - * - * This object should have the same structure as [LatLng]{@link google.type.LatLng} - * - * @typedef LatLongRect - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.LatLongRect definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const LatLongRect = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Color information consists of RGB channels, score, and the fraction of - * the image that the color occupies in the image. - * - * @property {Object} color - * RGB components of the color. - * - * This object should have the same structure as [Color]{@link google.type.Color} - * - * @property {number} score - * Image-specific score for this color. Value in range [0, 1]. - * - * @property {number} pixelFraction - * The fraction of pixels the color occupies in the image. - * Value in range [0, 1]. - * - * @typedef ColorInfo - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.ColorInfo definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const ColorInfo = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Set of dominant colors and their corresponding scores. - * - * @property {Object[]} colors - * RGB color values with their score and pixel fraction. - * - * This object should have the same structure as [ColorInfo]{@link google.cloud.vision.v1p4beta1.ColorInfo} - * - * @typedef DominantColorsAnnotation - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.DominantColorsAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const DominantColorsAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Stores image properties, such as dominant colors. - * - * @property {Object} dominantColors - * If present, dominant colors completed successfully. - * - * This object should have the same structure as [DominantColorsAnnotation]{@link google.cloud.vision.v1p4beta1.DominantColorsAnnotation} - * - * @typedef ImageProperties - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.ImageProperties definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const ImageProperties = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Single crop hint that is used to generate a new crop when serving an image. - * - * @property {Object} boundingPoly - * The bounding polygon for the crop region. The coordinates of the bounding - * box are in the original image's scale. - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p4beta1.BoundingPoly} - * - * @property {number} confidence - * Confidence of this being a salient region. Range [0, 1]. - * - * @property {number} importanceFraction - * Fraction of importance of this salient region with respect to the original - * image. - * - * @typedef CropHint - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.CropHint definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const CropHint = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Set of crop hints that are used to generate new crops when serving images. - * - * @property {Object[]} cropHints - * Crop hint results. - * - * This object should have the same structure as [CropHint]{@link google.cloud.vision.v1p4beta1.CropHint} - * - * @typedef CropHintsAnnotation - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.CropHintsAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const CropHintsAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Parameters for crop hints annotation request. - * - * @property {number[]} aspectRatios - * Aspect ratios in floats, representing the ratio of the width to the height - * of the image. For example, if the desired aspect ratio is 4/3, the - * corresponding float value should be 1.33333. If not specified, the - * best possible crop is returned. The number of provided aspect ratios is - * limited to a maximum of 16; any aspect ratios provided after the 16th are - * ignored. - * - * @typedef CropHintsParams - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.CropHintsParams definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const CropHintsParams = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Parameters for web detection request. - * - * @property {boolean} includeGeoResults - * Whether to include results derived from the geo information in the image. - * - * @typedef WebDetectionParams - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.WebDetectionParams definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const WebDetectionParams = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Image context and/or feature-specific parameters. - * - * @property {Object} latLongRect - * Not used. - * - * This object should have the same structure as [LatLongRect]{@link google.cloud.vision.v1p4beta1.LatLongRect} - * - * @property {string[]} languageHints - * List of languages to use for TEXT_DETECTION. In most cases, an empty value - * yields the best results since it enables automatic language detection. For - * languages based on the Latin alphabet, setting `language_hints` is not - * needed. In rare cases, when the language of the text in the image is known, - * setting a hint will help get better results (although it will be a - * significant hindrance if the hint is wrong). Text detection returns an - * error if one or more of the specified languages is not one of the - * [supported languages](https://cloud.google.com/vision/docs/languages). - * - * @property {Object} cropHintsParams - * Parameters for crop hints annotation request. - * - * This object should have the same structure as [CropHintsParams]{@link google.cloud.vision.v1p4beta1.CropHintsParams} - * - * @property {Object} faceRecognitionParams - * Parameters for face recognition. - * - * This object should have the same structure as [FaceRecognitionParams]{@link google.cloud.vision.v1p4beta1.FaceRecognitionParams} - * - * @property {Object} productSearchParams - * Parameters for product search. - * - * This object should have the same structure as [ProductSearchParams]{@link google.cloud.vision.v1p4beta1.ProductSearchParams} - * - * @property {Object} webDetectionParams - * Parameters for web detection. - * - * This object should have the same structure as [WebDetectionParams]{@link google.cloud.vision.v1p4beta1.WebDetectionParams} - * - * @typedef ImageContext - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.ImageContext definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const ImageContext = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request for performing Google Cloud Vision API tasks over a user-provided - * image, with user-requested features, and with context information. - * - * @property {Object} image - * The image to be processed. - * - * This object should have the same structure as [Image]{@link google.cloud.vision.v1p4beta1.Image} - * - * @property {Object[]} features - * Requested features. - * - * This object should have the same structure as [Feature]{@link google.cloud.vision.v1p4beta1.Feature} - * - * @property {Object} imageContext - * Additional context that may accompany the image. - * - * This object should have the same structure as [ImageContext]{@link google.cloud.vision.v1p4beta1.ImageContext} - * - * @typedef AnnotateImageRequest - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.AnnotateImageRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const AnnotateImageRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * If an image was produced from a file (e.g. a PDF), this message gives - * information about the source of that image. - * - * @property {string} uri - * The URI of the file used to produce the image. - * - * @property {number} pageNumber - * If the file was a PDF or TIFF, this field gives the page number within - * the file used to produce the image. - * - * @typedef ImageAnnotationContext - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.ImageAnnotationContext definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const ImageAnnotationContext = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response to an image annotation request. - * - * @property {Object[]} faceAnnotations - * If present, face detection has completed successfully. - * - * This object should have the same structure as [FaceAnnotation]{@link google.cloud.vision.v1p4beta1.FaceAnnotation} - * - * @property {Object[]} landmarkAnnotations - * If present, landmark detection has completed successfully. - * - * This object should have the same structure as [EntityAnnotation]{@link google.cloud.vision.v1p4beta1.EntityAnnotation} - * - * @property {Object[]} logoAnnotations - * If present, logo detection has completed successfully. - * - * This object should have the same structure as [EntityAnnotation]{@link google.cloud.vision.v1p4beta1.EntityAnnotation} - * - * @property {Object[]} labelAnnotations - * If present, label detection has completed successfully. - * - * This object should have the same structure as [EntityAnnotation]{@link google.cloud.vision.v1p4beta1.EntityAnnotation} - * - * @property {Object[]} localizedObjectAnnotations - * If present, localized object detection has completed successfully. - * This will be sorted descending by confidence score. - * - * This object should have the same structure as [LocalizedObjectAnnotation]{@link google.cloud.vision.v1p4beta1.LocalizedObjectAnnotation} - * - * @property {Object[]} textAnnotations - * If present, text (OCR) detection has completed successfully. - * - * This object should have the same structure as [EntityAnnotation]{@link google.cloud.vision.v1p4beta1.EntityAnnotation} - * - * @property {Object} fullTextAnnotation - * If present, text (OCR) detection or document (OCR) text detection has - * completed successfully. - * This annotation provides the structural hierarchy for the OCR detected - * text. - * - * This object should have the same structure as [TextAnnotation]{@link google.cloud.vision.v1p4beta1.TextAnnotation} - * - * @property {Object} safeSearchAnnotation - * If present, safe-search annotation has completed successfully. - * - * This object should have the same structure as [SafeSearchAnnotation]{@link google.cloud.vision.v1p4beta1.SafeSearchAnnotation} - * - * @property {Object} imagePropertiesAnnotation - * If present, image properties were extracted successfully. - * - * This object should have the same structure as [ImageProperties]{@link google.cloud.vision.v1p4beta1.ImageProperties} - * - * @property {Object} cropHintsAnnotation - * If present, crop hints have completed successfully. - * - * This object should have the same structure as [CropHintsAnnotation]{@link google.cloud.vision.v1p4beta1.CropHintsAnnotation} - * - * @property {Object} webDetection - * If present, web detection has completed successfully. - * - * This object should have the same structure as [WebDetection]{@link google.cloud.vision.v1p4beta1.WebDetection} - * - * @property {Object} productSearchResults - * If present, product search has completed successfully. - * - * This object should have the same structure as [ProductSearchResults]{@link google.cloud.vision.v1p4beta1.ProductSearchResults} - * - * @property {Object} error - * If set, represents the error message for the operation. - * Note that filled-in image annotations are guaranteed to be - * correct, even when `error` is set. - * - * This object should have the same structure as [Status]{@link google.rpc.Status} - * - * @property {Object} context - * If present, contextual information is needed to understand where this image - * comes from. - * - * This object should have the same structure as [ImageAnnotationContext]{@link google.cloud.vision.v1p4beta1.ImageAnnotationContext} - * - * @typedef AnnotateImageResponse - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.AnnotateImageResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const AnnotateImageResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Multiple image annotation requests are batched into a single service call. - * - * @property {Object[]} requests - * Required. Individual image annotation requests for this batch. - * - * This object should have the same structure as [AnnotateImageRequest]{@link google.cloud.vision.v1p4beta1.AnnotateImageRequest} - * - * @typedef BatchAnnotateImagesRequest - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.BatchAnnotateImagesRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const BatchAnnotateImagesRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response to a batch image annotation request. - * - * @property {Object[]} responses - * Individual responses to image annotation requests within the batch. - * - * This object should have the same structure as [AnnotateImageResponse]{@link google.cloud.vision.v1p4beta1.AnnotateImageResponse} - * - * @typedef BatchAnnotateImagesResponse - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const BatchAnnotateImagesResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A request to annotate one single file, e.g. a PDF, TIFF or GIF file. - * - * @property {Object} inputConfig - * Required. Information about the input file. - * - * This object should have the same structure as [InputConfig]{@link google.cloud.vision.v1p4beta1.InputConfig} - * - * @property {Object[]} features - * Required. Requested features. - * - * This object should have the same structure as [Feature]{@link google.cloud.vision.v1p4beta1.Feature} - * - * @property {Object} imageContext - * Additional context that may accompany the image(s) in the file. - * - * This object should have the same structure as [ImageContext]{@link google.cloud.vision.v1p4beta1.ImageContext} - * - * @property {number[]} pages - * Pages of the file to perform image annotation. - * - * Pages starts from 1, we assume the first page of the file is page 1. - * At most 5 pages are supported per request. Pages can be negative. - * - * Page 1 means the first page. - * Page 2 means the second page. - * Page -1 means the last page. - * Page -2 means the second to the last page. - * - * If the file is GIF instead of PDF or TIFF, page refers to GIF frames. - * - * If this field is empty, by default the service performs image annotation - * for the first 5 pages of the file. - * - * @typedef AnnotateFileRequest - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.AnnotateFileRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const AnnotateFileRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response to a single file annotation request. A file may contain one or more - * images, which individually have their own responses. - * - * @property {Object} inputConfig - * Information about the file for which this response is generated. - * - * This object should have the same structure as [InputConfig]{@link google.cloud.vision.v1p4beta1.InputConfig} - * - * @property {Object[]} responses - * Individual responses to images found within the file. This field will be - * empty if the `error` field is set. - * - * This object should have the same structure as [AnnotateImageResponse]{@link google.cloud.vision.v1p4beta1.AnnotateImageResponse} - * - * @property {number} totalPages - * This field gives the total number of pages in the file. - * - * @property {Object} error - * If set, represents the error message for the failed request. The - * `responses` field will not be set in this case. - * - * This object should have the same structure as [Status]{@link google.rpc.Status} - * - * @typedef AnnotateFileResponse - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.AnnotateFileResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const AnnotateFileResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A list of requests to annotate files using the BatchAnnotateFiles API. - * - * @property {Object[]} requests - * Required. The list of file annotation requests. Right now we support only - * one AnnotateFileRequest in BatchAnnotateFilesRequest. - * - * This object should have the same structure as [AnnotateFileRequest]{@link google.cloud.vision.v1p4beta1.AnnotateFileRequest} - * - * @typedef BatchAnnotateFilesRequest - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.BatchAnnotateFilesRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const BatchAnnotateFilesRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A list of file annotation responses. - * - * @property {Object[]} responses - * The list of file annotation responses, each response corresponding to each - * AnnotateFileRequest in BatchAnnotateFilesRequest. - * - * This object should have the same structure as [AnnotateFileResponse]{@link google.cloud.vision.v1p4beta1.AnnotateFileResponse} - * - * @typedef BatchAnnotateFilesResponse - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const BatchAnnotateFilesResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * An offline file annotation request. - * - * @property {Object} inputConfig - * Required. Information about the input file. - * - * This object should have the same structure as [InputConfig]{@link google.cloud.vision.v1p4beta1.InputConfig} - * - * @property {Object[]} features - * Required. Requested features. - * - * This object should have the same structure as [Feature]{@link google.cloud.vision.v1p4beta1.Feature} - * - * @property {Object} imageContext - * Additional context that may accompany the image(s) in the file. - * - * This object should have the same structure as [ImageContext]{@link google.cloud.vision.v1p4beta1.ImageContext} - * - * @property {Object} outputConfig - * Required. The desired output location and metadata (e.g. format). - * - * This object should have the same structure as [OutputConfig]{@link google.cloud.vision.v1p4beta1.OutputConfig} - * - * @typedef AsyncAnnotateFileRequest - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const AsyncAnnotateFileRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The response for a single offline file annotation request. - * - * @property {Object} outputConfig - * The output location and metadata from AsyncAnnotateFileRequest. - * - * This object should have the same structure as [OutputConfig]{@link google.cloud.vision.v1p4beta1.OutputConfig} - * - * @typedef AsyncAnnotateFileResponse - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const AsyncAnnotateFileResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request for async image annotation for a list of images. - * - * @property {Object[]} requests - * Required. Individual image annotation requests for this batch. - * - * This object should have the same structure as [AnnotateImageRequest]{@link google.cloud.vision.v1p4beta1.AnnotateImageRequest} - * - * @property {Object} outputConfig - * Required. The desired output location and metadata (e.g. format). - * - * This object should have the same structure as [OutputConfig]{@link google.cloud.vision.v1p4beta1.OutputConfig} - * - * @typedef AsyncBatchAnnotateImagesRequest - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const AsyncBatchAnnotateImagesRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response to an async batch image annotation request. - * - * @property {Object} outputConfig - * The output location and metadata from AsyncBatchAnnotateImagesRequest. - * - * This object should have the same structure as [OutputConfig]{@link google.cloud.vision.v1p4beta1.OutputConfig} - * - * @typedef AsyncBatchAnnotateImagesResponse - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const AsyncBatchAnnotateImagesResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Multiple async file annotation requests are batched into a single service - * call. - * - * @property {Object[]} requests - * Required. Individual async file annotation requests for this batch. - * - * This object should have the same structure as [AsyncAnnotateFileRequest]{@link google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest} - * - * @typedef AsyncBatchAnnotateFilesRequest - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const AsyncBatchAnnotateFilesRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response to an async batch file annotation request. - * - * @property {Object[]} responses - * The list of file annotation responses, one for each request in - * AsyncBatchAnnotateFilesRequest. - * - * This object should have the same structure as [AsyncAnnotateFileResponse]{@link google.cloud.vision.v1p4beta1.AsyncAnnotateFileResponse} - * - * @typedef AsyncBatchAnnotateFilesResponse - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const AsyncBatchAnnotateFilesResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The desired input location and metadata. - * - * @property {Object} gcsSource - * The Google Cloud Storage location to read the input from. - * - * This object should have the same structure as [GcsSource]{@link google.cloud.vision.v1p4beta1.GcsSource} - * - * @property {Buffer} content - * File content, represented as a stream of bytes. - * Note: As with all `bytes` fields, protobuffers use a pure binary - * representation, whereas JSON representations use base64. - * - * Currently, this field only works for BatchAnnotateFiles requests. It does - * not work for AsyncBatchAnnotateFiles requests. - * - * @property {string} mimeType - * The type of the file. Currently only "application/pdf", "image/tiff" and - * "image/gif" are supported. Wildcards are not supported. - * - * @typedef InputConfig - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.InputConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const InputConfig = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The desired output location and metadata. - * - * @property {Object} gcsDestination - * The Google Cloud Storage location to write the output(s) to. - * - * This object should have the same structure as [GcsDestination]{@link google.cloud.vision.v1p4beta1.GcsDestination} - * - * @property {number} batchSize - * The max number of response protos to put into each output JSON file on - * Google Cloud Storage. - * The valid range is [1, 100]. If not specified, the default value is 20. - * - * For example, for one pdf file with 100 pages, 100 response protos will - * be generated. If `batch_size` = 20, then 5 json files each - * containing 20 response protos will be written under the prefix - * `gcs_destination`.`uri`. - * - * Currently, batch_size only applies to GcsDestination, with potential future - * support for other output configurations. - * - * @typedef OutputConfig - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.OutputConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const OutputConfig = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The Google Cloud Storage location where the input will be read from. - * - * @property {string} uri - * Google Cloud Storage URI for the input file. This must only be a - * Google Cloud Storage object. Wildcards are not currently supported. - * - * @typedef GcsSource - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.GcsSource definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const GcsSource = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The Google Cloud Storage location where the output will be written to. - * - * @property {string} uri - * Google Cloud Storage URI prefix where the results will be stored. Results - * will be in JSON format and preceded by its corresponding input URI prefix. - * This field can either represent a gcs file prefix or gcs directory. In - * either case, the uri should be unique because in order to get all of the - * output files, you will need to do a wildcard gcs search on the uri prefix - * you provide. - * - * Examples: - * - * * File Prefix: gs://bucket-name/here/filenameprefix The output files - * will be created in gs://bucket-name/here/ and the names of the - * output files will begin with "filenameprefix". - * - * * Directory Prefix: gs://bucket-name/some/location/ The output files - * will be created in gs://bucket-name/some/location/ and the names of the - * output files could be anything because there was no filename prefix - * specified. - * - * If multiple outputs, each response is still AnnotateFileResponse, each of - * which contains some subset of the full list of AnnotateImageResponse. - * Multiple outputs can happen if, for example, the output JSON is too large - * and overflows into multiple sharded files. - * - * @typedef GcsDestination - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.GcsDestination definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const GcsDestination = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Contains metadata for the BatchAnnotateImages operation. - * - * @property {number} state - * Current state of the batch operation. - * - * The number should be among the values of [State]{@link google.cloud.vision.v1p4beta1.State} - * - * @property {Object} createTime - * The time when the batch request was received. - * - * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} - * - * @property {Object} updateTime - * The time when the operation result was last updated. - * - * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} - * - * @typedef OperationMetadata - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.OperationMetadata definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/image_annotator.proto} - */ -const OperationMetadata = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Batch operation states. - * - * @enum {number} - * @memberof google.cloud.vision.v1p4beta1 - */ - State: { - - /** - * Invalid. - */ - STATE_UNSPECIFIED: 0, - - /** - * Request is received. - */ - CREATED: 1, - - /** - * Request is actively being processed. - */ - RUNNING: 2, - - /** - * The batch processing is done. - */ - DONE: 3, - - /** - * The batch processing was cancelled. - */ - CANCELLED: 4 - } -}; - -/** - * A bucketized representation of likelihood, which is intended to give clients - * highly stable results across model upgrades. - * - * @enum {number} - * @memberof google.cloud.vision.v1p4beta1 - */ -const Likelihood = { - - /** - * Unknown likelihood. - */ - UNKNOWN: 0, - - /** - * It is very unlikely. - */ - VERY_UNLIKELY: 1, - - /** - * It is unlikely. - */ - UNLIKELY: 2, - - /** - * It is possible. - */ - POSSIBLE: 3, - - /** - * It is likely. - */ - LIKELY: 4, - - /** - * It is very likely. - */ - VERY_LIKELY: 5 -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p4beta1/doc/google/cloud/vision/v1p4beta1/doc_product_search.js b/packages/google-cloud-vision/src/v1p4beta1/doc/google/cloud/vision/v1p4beta1/doc_product_search.js deleted file mode 100644 index 07b90589cf8..00000000000 --- a/packages/google-cloud-vision/src/v1p4beta1/doc/google/cloud/vision/v1p4beta1/doc_product_search.js +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * Parameters for a product search request. - * - * @property {Object} boundingPoly - * The bounding polygon around the area of interest in the image. - * If it is not specified, system discretion will be applied. - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p4beta1.BoundingPoly} - * - * @property {string} productSet - * The resource name of a - * ProductSet to be searched for - * similar images. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. - * - * @property {string[]} productCategories - * The list of product categories to search in. Currently, we only consider - * the first category, and either "homegoods-v2", "apparel-v2", "toys-v2", - * "packagedgoods-v1", or "general-v1" should be specified. The legacy - * categories "homegoods", "apparel", and "toys" are still supported but will - * be deprecated. For new products, please use "homegoods-v2", "apparel-v2", - * or "toys-v2" for better product search accuracy. It is recommended to - * migrate existing products to these categories as well. - * - * @property {string} filter - * The filtering expression. This can be used to restrict search results based - * on Product labels. We currently support an AND of OR of key-value - * expressions, where each expression within an OR must have the same key. An - * '=' should be used to connect the key and value. - * - * For example, "(color = red OR color = blue) AND brand = Google" is - * acceptable, but "(color = red OR brand = Google)" is not acceptable. - * "color: red" is not acceptable because it uses a ':' instead of an '='. - * - * @typedef ProductSearchParams - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.ProductSearchParams definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search.proto} - */ -const ProductSearchParams = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Results for a product search request. - * - * @property {Object} indexTime - * Timestamp of the index which provided these results. Products added to the - * product set and products removed from the product set after this time are - * not reflected in the current results. - * - * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} - * - * @property {Object[]} results - * List of results, one for each product match. - * - * This object should have the same structure as [Result]{@link google.cloud.vision.v1p4beta1.Result} - * - * @property {Object[]} productGroupedResults - * List of results grouped by products detected in the query image. Each entry - * corresponds to one bounding polygon in the query image, and contains the - * matching products specific to that region. There may be duplicate product - * matches in the union of all the per-product results. - * - * This object should have the same structure as [GroupedResult]{@link google.cloud.vision.v1p4beta1.GroupedResult} - * - * @typedef ProductSearchResults - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.ProductSearchResults definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search.proto} - */ -const ProductSearchResults = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Information about a product. - * - * @property {Object} product - * The Product. - * - * This object should have the same structure as [Product]{@link google.cloud.vision.v1p4beta1.Product} - * - * @property {number} score - * A confidence level on the match, ranging from 0 (no confidence) to - * 1 (full confidence). - * - * @property {string} image - * The resource name of the image from the product that is the closest match - * to the query. - * - * @typedef Result - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.ProductSearchResults.Result definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search.proto} - */ - Result: { - // This is for documentation. Actual contents will be loaded by gRPC. - }, - - /** - * Prediction for what the object in the bounding box is. - * - * @property {string} mid - * Object ID that should align with EntityAnnotation mid. - * - * @property {string} languageCode - * The BCP-47 language code, such as "en-US" or "sr-Latn". For more - * information, see - * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. - * - * @property {string} name - * Object name, expressed in its `language_code` language. - * - * @property {number} score - * Score of the result. Range [0, 1]. - * - * @typedef ObjectAnnotation - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.ProductSearchResults.ObjectAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search.proto} - */ - ObjectAnnotation: { - // This is for documentation. Actual contents will be loaded by gRPC. - }, - - /** - * Information about the products similar to a single product in a query - * image. - * - * @property {Object} boundingPoly - * The bounding polygon around the product detected in the query image. - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p4beta1.BoundingPoly} - * - * @property {Object[]} results - * List of results, one for each product match. - * - * This object should have the same structure as [Result]{@link google.cloud.vision.v1p4beta1.Result} - * - * @property {Object[]} objectAnnotations - * List of generic predictions for the object in the bounding box. - * - * This object should have the same structure as [ObjectAnnotation]{@link google.cloud.vision.v1p4beta1.ObjectAnnotation} - * - * @typedef GroupedResult - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.ProductSearchResults.GroupedResult definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search.proto} - */ - GroupedResult: { - // This is for documentation. Actual contents will be loaded by gRPC. - } -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p4beta1/doc/google/cloud/vision/v1p4beta1/doc_product_search_service.js b/packages/google-cloud-vision/src/v1p4beta1/doc/google/cloud/vision/v1p4beta1/doc_product_search_service.js deleted file mode 100644 index 0f4e9f933e5..00000000000 --- a/packages/google-cloud-vision/src/v1p4beta1/doc/google/cloud/vision/v1p4beta1/doc_product_search_service.js +++ /dev/null @@ -1,888 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * A Product contains ReferenceImages. - * - * @property {string} name - * The resource name of the product. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. - * - * This field is ignored when creating a product. - * - * @property {string} displayName - * The user-provided name for this Product. Must not be empty. Must be at most - * 4096 characters long. - * - * @property {string} description - * User-provided metadata to be stored with this product. Must be at most 4096 - * characters long. - * - * @property {string} productCategory - * Immutable. The category for the product identified by the reference image. - * This should be either "homegoods-v2", "apparel-v2", or "toys-v2". The - * legacy categories "homegoods", "apparel", and "toys" are still supported, - * but these should not be used for new products. - * - * @property {Object[]} productLabels - * Key-value pairs that can be attached to a product. At query time, - * constraints can be specified based on the product_labels. - * - * Note that integer values can be provided as strings, e.g. "1199". Only - * strings with integer values can match a range-based restriction which is - * to be supported soon. - * - * Multiple values can be assigned to the same key. One product may have up to - * 500 product_labels. - * - * Notice that the total number of distinct product_labels over all products - * in one ProductSet cannot exceed 1M, otherwise the product search pipeline - * will refuse to work for that ProductSet. - * - * This object should have the same structure as [KeyValue]{@link google.cloud.vision.v1p4beta1.KeyValue} - * - * @typedef Product - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.Product definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const Product = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * A product label represented as a key-value pair. - * - * @property {string} key - * The key of the label attached to the product. Cannot be empty and cannot - * exceed 128 bytes. - * - * @property {string} value - * The value of the label attached to the product. Cannot be empty and - * cannot exceed 128 bytes. - * - * @typedef KeyValue - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.Product.KeyValue definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ - KeyValue: { - // This is for documentation. Actual contents will be loaded by gRPC. - } -}; - -/** - * A ProductSet contains Products. A ProductSet can contain a maximum of 1 - * million reference images. If the limit is exceeded, periodic indexing will - * fail. - * - * @property {string} name - * The resource name of the ProductSet. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`. - * - * This field is ignored when creating a ProductSet. - * - * @property {string} displayName - * The user-provided name for this ProductSet. Must not be empty. Must be at - * most 4096 characters long. - * - * @property {Object} indexTime - * Output only. The time at which this ProductSet was last indexed. Query - * results will reflect all updates before this time. If this ProductSet has - * never been indexed, this timestamp is the default value - * "1970-01-01T00:00:00Z". - * - * This field is ignored when creating a ProductSet. - * - * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} - * - * @property {Object} indexError - * Output only. If there was an error with indexing the product set, the field - * is populated. - * - * This field is ignored when creating a ProductSet. - * - * This object should have the same structure as [Status]{@link google.rpc.Status} - * - * @typedef ProductSet - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.ProductSet definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const ProductSet = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A `ReferenceImage` represents a product image and its associated metadata, - * such as bounding boxes. - * - * @property {string} name - * The resource name of the reference image. - * - * Format is: - * - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. - * - * This field is ignored when creating a reference image. - * - * @property {string} uri - * Required. The Google Cloud Storage URI of the reference image. - * - * The URI must start with `gs://`. - * - * @property {Object[]} boundingPolys - * Optional. Bounding polygons around the areas of interest in the reference - * image. If this field is empty, the system will try to detect regions of - * interest. At most 10 bounding polygons will be used. - * - * The provided shape is converted into a non-rotated rectangle. Once - * converted, the small edge of the rectangle must be greater than or equal - * to 300 pixels. The aspect ratio must be 1:4 or less (i.e. 1:3 is ok; 1:5 - * is not). - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p4beta1.BoundingPoly} - * - * @typedef ReferenceImage - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.ReferenceImage definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const ReferenceImage = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `CreateProduct` method. - * - * @property {string} parent - * Required. The project in which the Product should be created. - * - * Format is - * `projects/PROJECT_ID/locations/LOC_ID`. - * - * @property {Object} product - * Required. The product to create. - * - * This object should have the same structure as [Product]{@link google.cloud.vision.v1p4beta1.Product} - * - * @property {string} productId - * A user-supplied resource id for this Product. If set, the server will - * attempt to use this value as the resource id. If it is already in use, an - * error is returned with code ALREADY_EXISTS. Must be at most 128 characters - * long. It cannot contain the character `/`. - * - * @typedef CreateProductRequest - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.CreateProductRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const CreateProductRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `ListProducts` method. - * - * @property {string} parent - * Required. The project OR ProductSet from which Products should be listed. - * - * Format: - * `projects/PROJECT_ID/locations/LOC_ID` - * - * @property {number} pageSize - * The maximum number of items to return. Default 10, maximum 100. - * - * @property {string} pageToken - * The next_page_token returned from a previous List request, if any. - * - * @typedef ListProductsRequest - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.ListProductsRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const ListProductsRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response message for the `ListProducts` method. - * - * @property {Object[]} products - * List of products. - * - * This object should have the same structure as [Product]{@link google.cloud.vision.v1p4beta1.Product} - * - * @property {string} nextPageToken - * Token to retrieve the next page of results, or empty if there are no more - * results in the list. - * - * @typedef ListProductsResponse - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.ListProductsResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const ListProductsResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `GetProduct` method. - * - * @property {string} name - * Required. Resource name of the Product to get. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - * - * @typedef GetProductRequest - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.GetProductRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const GetProductRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `UpdateProduct` method. - * - * @property {Object} product - * Required. The Product resource which replaces the one on the server. - * product.name is immutable. - * - * This object should have the same structure as [Product]{@link google.cloud.vision.v1p4beta1.Product} - * - * @property {Object} updateMask - * The FieldMask that specifies which fields - * to update. - * If update_mask isn't specified, all mutable fields are to be updated. - * Valid mask paths include `product_labels`, `display_name`, and - * `description`. - * - * This object should have the same structure as [FieldMask]{@link google.protobuf.FieldMask} - * - * @typedef UpdateProductRequest - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.UpdateProductRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const UpdateProductRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `DeleteProduct` method. - * - * @property {string} name - * Required. Resource name of product to delete. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - * - * @typedef DeleteProductRequest - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.DeleteProductRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const DeleteProductRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `CreateProductSet` method. - * - * @property {string} parent - * Required. The project in which the ProductSet should be created. - * - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - * - * @property {Object} productSet - * Required. The ProductSet to create. - * - * This object should have the same structure as [ProductSet]{@link google.cloud.vision.v1p4beta1.ProductSet} - * - * @property {string} productSetId - * A user-supplied resource id for this ProductSet. If set, the server will - * attempt to use this value as the resource id. If it is already in use, an - * error is returned with code ALREADY_EXISTS. Must be at most 128 characters - * long. It cannot contain the character `/`. - * - * @typedef CreateProductSetRequest - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.CreateProductSetRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const CreateProductSetRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `ListProductSets` method. - * - * @property {string} parent - * Required. The project from which ProductSets should be listed. - * - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - * - * @property {number} pageSize - * The maximum number of items to return. Default 10, maximum 100. - * - * @property {string} pageToken - * The next_page_token returned from a previous List request, if any. - * - * @typedef ListProductSetsRequest - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.ListProductSetsRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const ListProductSetsRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response message for the `ListProductSets` method. - * - * @property {Object[]} productSets - * List of ProductSets. - * - * This object should have the same structure as [ProductSet]{@link google.cloud.vision.v1p4beta1.ProductSet} - * - * @property {string} nextPageToken - * Token to retrieve the next page of results, or empty if there are no more - * results in the list. - * - * @typedef ListProductSetsResponse - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.ListProductSetsResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const ListProductSetsResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `GetProductSet` method. - * - * @property {string} name - * Required. Resource name of the ProductSet to get. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * - * @typedef GetProductSetRequest - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.GetProductSetRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const GetProductSetRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `UpdateProductSet` method. - * - * @property {Object} productSet - * Required. The ProductSet resource which replaces the one on the server. - * - * This object should have the same structure as [ProductSet]{@link google.cloud.vision.v1p4beta1.ProductSet} - * - * @property {Object} updateMask - * The FieldMask that specifies which fields to - * update. - * If update_mask isn't specified, all mutable fields are to be updated. - * Valid mask path is `display_name`. - * - * This object should have the same structure as [FieldMask]{@link google.protobuf.FieldMask} - * - * @typedef UpdateProductSetRequest - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.UpdateProductSetRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const UpdateProductSetRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `DeleteProductSet` method. - * - * @property {string} name - * Required. Resource name of the ProductSet to delete. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * - * @typedef DeleteProductSetRequest - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.DeleteProductSetRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const DeleteProductSetRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `CreateReferenceImage` method. - * - * @property {string} parent - * Required. Resource name of the product in which to create the reference - * image. - * - * Format is - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. - * - * @property {Object} referenceImage - * Required. The reference image to create. - * If an image ID is specified, it is ignored. - * - * This object should have the same structure as [ReferenceImage]{@link google.cloud.vision.v1p4beta1.ReferenceImage} - * - * @property {string} referenceImageId - * A user-supplied resource id for the ReferenceImage to be added. If set, - * the server will attempt to use this value as the resource id. If it is - * already in use, an error is returned with code ALREADY_EXISTS. Must be at - * most 128 characters long. It cannot contain the character `/`. - * - * @typedef CreateReferenceImageRequest - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.CreateReferenceImageRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const CreateReferenceImageRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `ListReferenceImages` method. - * - * @property {string} parent - * Required. Resource name of the product containing the reference images. - * - * Format is - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. - * - * @property {number} pageSize - * The maximum number of items to return. Default 10, maximum 100. - * - * @property {string} pageToken - * A token identifying a page of results to be returned. This is the value - * of `nextPageToken` returned in a previous reference image list request. - * - * Defaults to the first page if not specified. - * - * @typedef ListReferenceImagesRequest - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.ListReferenceImagesRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const ListReferenceImagesRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response message for the `ListReferenceImages` method. - * - * @property {Object[]} referenceImages - * The list of reference images. - * - * This object should have the same structure as [ReferenceImage]{@link google.cloud.vision.v1p4beta1.ReferenceImage} - * - * @property {number} pageSize - * The maximum number of items to return. Default 10, maximum 100. - * - * @property {string} nextPageToken - * The next_page_token returned from a previous List request, if any. - * - * @typedef ListReferenceImagesResponse - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.ListReferenceImagesResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const ListReferenceImagesResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `GetReferenceImage` method. - * - * @property {string} name - * Required. The resource name of the ReferenceImage to get. - * - * Format is: - * - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. - * - * @typedef GetReferenceImageRequest - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.GetReferenceImageRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const GetReferenceImageRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `DeleteReferenceImage` method. - * - * @property {string} name - * Required. The resource name of the reference image to delete. - * - * Format is: - * - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` - * - * @typedef DeleteReferenceImageRequest - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.DeleteReferenceImageRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const DeleteReferenceImageRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `AddProductToProductSet` method. - * - * @property {string} name - * Required. The resource name for the ProductSet to modify. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * - * @property {string} product - * Required. The resource name for the Product to be added to this ProductSet. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - * - * @typedef AddProductToProductSetRequest - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.AddProductToProductSetRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const AddProductToProductSetRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `RemoveProductFromProductSet` method. - * - * @property {string} name - * Required. The resource name for the ProductSet to modify. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * - * @property {string} product - * Required. The resource name for the Product to be removed from this - * ProductSet. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - * - * @typedef RemoveProductFromProductSetRequest - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.RemoveProductFromProductSetRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const RemoveProductFromProductSetRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `ListProductsInProductSet` method. - * - * @property {string} name - * Required. The ProductSet resource for which to retrieve Products. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * - * @property {number} pageSize - * The maximum number of items to return. Default 10, maximum 100. - * - * @property {string} pageToken - * The next_page_token returned from a previous List request, if any. - * - * @typedef ListProductsInProductSetRequest - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const ListProductsInProductSetRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response message for the `ListProductsInProductSet` method. - * - * @property {Object[]} products - * The list of Products. - * - * This object should have the same structure as [Product]{@link google.cloud.vision.v1p4beta1.Product} - * - * @property {string} nextPageToken - * Token to retrieve the next page of results, or empty if there are no more - * results in the list. - * - * @typedef ListProductsInProductSetResponse - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const ListProductsInProductSetResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The Google Cloud Storage location for a csv file which preserves a list of - * ImportProductSetRequests in each line. - * - * @property {string} csvFileUri - * The Google Cloud Storage URI of the input csv file. - * - * The URI must start with `gs://`. - * - * The format of the input csv file should be one image per line. - * In each line, there are 8 columns. - * - * 1. image-uri - * 2. image-id - * 3. product-set-id - * 4. product-id - * 5. product-category - * 6. product-display-name - * 7. labels - * 8. bounding-poly - * - * The `image-uri`, `product-set-id`, `product-id`, and `product-category` - * columns are required. All other columns are optional. - * - * If the `ProductSet` or `Product` specified by the `product-set-id` and - * `product-id` values does not exist, then the system will create a new - * `ProductSet` or `Product` for the image. In this case, the - * `product-display-name` column refers to - * display_name, the - * `product-category` column refers to - * product_category, - * and the `labels` column refers to - * product_labels. - * - * The `image-id` column is optional but must be unique if provided. If it is - * empty, the system will automatically assign a unique id to the image. - * - * The `product-display-name` column is optional. If it is empty, the system - * sets the display_name - * field for the product to a space (" "). You can update the `display_name` - * later by using the API. - * - * If a `Product` with the specified `product-id` already exists, then the - * system ignores the `product-display-name`, `product-category`, and `labels` - * columns. - * - * The `labels` column (optional) is a line containing a list of - * comma-separated key-value pairs, in the following format: - * - * "key_1=value_1,key_2=value_2,...,key_n=value_n" - * - * The `bounding-poly` column (optional) identifies one region of - * interest from the image in the same manner as `CreateReferenceImage`. If - * you do not specify the `bounding-poly` column, then the system will try to - * detect regions of interest automatically. - * - * At most one `bounding-poly` column is allowed per line. If the image - * contains multiple regions of interest, add a line to the CSV file that - * includes the same product information, and the `bounding-poly` values for - * each region of interest. - * - * The `bounding-poly` column must contain an even number of comma-separated - * numbers, in the format "p1_x,p1_y,p2_x,p2_y,...,pn_x,pn_y". Use - * non-negative integers for absolute bounding polygons, and float values - * in [0, 1] for normalized bounding polygons. - * - * The system will resize the image if the image resolution is too - * large to process (larger than 20MP). - * - * @typedef ImportProductSetsGcsSource - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const ImportProductSetsGcsSource = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * The input content for the `ImportProductSets` method. - * - * @property {Object} gcsSource - * The Google Cloud Storage location for a csv file which preserves a list - * of ImportProductSetRequests in each line. - * - * This object should have the same structure as [ImportProductSetsGcsSource]{@link google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource} - * - * @typedef ImportProductSetsInputConfig - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const ImportProductSetsInputConfig = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `ImportProductSets` method. - * - * @property {string} parent - * Required. The project in which the ProductSets should be imported. - * - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - * - * @property {Object} inputConfig - * Required. The input content for the list of requests. - * - * This object should have the same structure as [ImportProductSetsInputConfig]{@link google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig} - * - * @typedef ImportProductSetsRequest - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.ImportProductSetsRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const ImportProductSetsRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Response message for the `ImportProductSets` method. - * - * This message is returned by the - * google.longrunning.Operations.GetOperation - * method in the returned - * google.longrunning.Operation.response - * field. - * - * @property {Object[]} referenceImages - * The list of reference_images that are imported successfully. - * - * This object should have the same structure as [ReferenceImage]{@link google.cloud.vision.v1p4beta1.ReferenceImage} - * - * @property {Object[]} statuses - * The rpc status for each ImportProductSet request, including both successes - * and errors. - * - * The number of statuses here matches the number of lines in the csv file, - * and statuses[i] stores the success or failure status of processing the i-th - * line of the csv, starting from line 0. - * - * This object should have the same structure as [Status]{@link google.rpc.Status} - * - * @typedef ImportProductSetsResponse - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.ImportProductSetsResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const ImportProductSetsResponse = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Metadata for the batch operations such as the current state. - * - * This is included in the `metadata` field of the `Operation` returned by the - * `GetOperation` call of the `google::longrunning::Operations` service. - * - * @property {number} state - * The current state of the batch operation. - * - * The number should be among the values of [State]{@link google.cloud.vision.v1p4beta1.State} - * - * @property {Object} submitTime - * The time when the batch request was submitted to the server. - * - * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} - * - * @property {Object} endTime - * The time when the batch request is finished and - * google.longrunning.Operation.done is - * set to true. - * - * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} - * - * @typedef BatchOperationMetadata - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.BatchOperationMetadata definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const BatchOperationMetadata = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Enumerates the possible states that the batch request can be in. - * - * @enum {number} - * @memberof google.cloud.vision.v1p4beta1 - */ - State: { - - /** - * Invalid. - */ - STATE_UNSPECIFIED: 0, - - /** - * Request is actively being processed. - */ - PROCESSING: 1, - - /** - * The request is done and at least one item has been successfully - * processed. - */ - SUCCESSFUL: 2, - - /** - * The request is done and no item has been successfully processed. - */ - FAILED: 3, - - /** - * The request is done after the longrunning.Operations.CancelOperation has - * been called by the user. Any records that were processed before the - * cancel command are output as specified in the request. - */ - CANCELLED: 4 - } -}; - -/** - * Config to control which ProductSet contains the Products to be deleted. - * - * @property {string} productSetId - * The ProductSet that contains the Products to delete. If a Product is a - * member of product_set_id in addition to other ProductSets, the Product will - * still be deleted. - * - * @typedef ProductSetPurgeConfig - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.ProductSetPurgeConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const ProductSetPurgeConfig = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Request message for the `PurgeProducts` method. - * - * @property {Object} productSetPurgeConfig - * Specify which ProductSet contains the Products to be deleted. - * - * This object should have the same structure as [ProductSetPurgeConfig]{@link google.cloud.vision.v1p4beta1.ProductSetPurgeConfig} - * - * @property {boolean} deleteOrphanProducts - * If delete_orphan_products is true, all Products that are not in any - * ProductSet will be deleted. - * - * @property {string} parent - * Required. The project and location in which the Products should be deleted. - * - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - * - * @property {boolean} force - * The default value is false. Override this value to true to actually perform - * the purge. - * - * @typedef PurgeProductsRequest - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.PurgeProductsRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/product_search_service.proto} - */ -const PurgeProductsRequest = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p4beta1/doc/google/cloud/vision/v1p4beta1/doc_text_annotation.js b/packages/google-cloud-vision/src/v1p4beta1/doc/google/cloud/vision/v1p4beta1/doc_text_annotation.js deleted file mode 100644 index 37e9eddea9b..00000000000 --- a/packages/google-cloud-vision/src/v1p4beta1/doc/google/cloud/vision/v1p4beta1/doc_text_annotation.js +++ /dev/null @@ -1,393 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * TextAnnotation contains a structured representation of OCR extracted text. - * The hierarchy of an OCR extracted text structure is like this: - * TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol - * Each structural component, starting from Page, may further have their own - * properties. Properties describe detected languages, breaks etc.. Please refer - * to the - * TextAnnotation.TextProperty - * message definition below for more detail. - * - * @property {Object[]} pages - * List of pages detected by OCR. - * - * This object should have the same structure as [Page]{@link google.cloud.vision.v1p4beta1.Page} - * - * @property {string} text - * UTF-8 text detected on the pages. - * - * @typedef TextAnnotation - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.TextAnnotation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/text_annotation.proto} - */ -const TextAnnotation = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Detected language for a structural component. - * - * @property {string} languageCode - * The BCP-47 language code, such as "en-US" or "sr-Latn". For more - * information, see - * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. - * - * @property {number} confidence - * Confidence of detected language. Range [0, 1]. - * - * @typedef DetectedLanguage - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.TextAnnotation.DetectedLanguage definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/text_annotation.proto} - */ - DetectedLanguage: { - // This is for documentation. Actual contents will be loaded by gRPC. - }, - - /** - * Detected start or end of a structural component. - * - * @property {number} type - * Detected break type. - * - * The number should be among the values of [BreakType]{@link google.cloud.vision.v1p4beta1.BreakType} - * - * @property {boolean} isPrefix - * True if break prepends the element. - * - * @typedef DetectedBreak - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.TextAnnotation.DetectedBreak definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/text_annotation.proto} - */ - DetectedBreak: { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Enum to denote the type of break found. New line, space etc. - * - * @enum {number} - * @memberof google.cloud.vision.v1p4beta1 - */ - BreakType: { - - /** - * Unknown break label type. - */ - UNKNOWN: 0, - - /** - * Regular space. - */ - SPACE: 1, - - /** - * Sure space (very wide). - */ - SURE_SPACE: 2, - - /** - * Line-wrapping break. - */ - EOL_SURE_SPACE: 3, - - /** - * End-line hyphen that is not present in text; does not co-occur with - * `SPACE`, `LEADER_SPACE`, or `LINE_BREAK`. - */ - HYPHEN: 4, - - /** - * Line break that ends a paragraph. - */ - LINE_BREAK: 5 - } - }, - - /** - * Additional information detected on the structural component. - * - * @property {Object[]} detectedLanguages - * A list of detected languages together with confidence. - * - * This object should have the same structure as [DetectedLanguage]{@link google.cloud.vision.v1p4beta1.DetectedLanguage} - * - * @property {Object} detectedBreak - * Detected start or end of a text segment. - * - * This object should have the same structure as [DetectedBreak]{@link google.cloud.vision.v1p4beta1.DetectedBreak} - * - * @typedef TextProperty - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/text_annotation.proto} - */ - TextProperty: { - // This is for documentation. Actual contents will be loaded by gRPC. - } -}; - -/** - * Detected page from OCR. - * - * @property {Object} property - * Additional information detected on the page. - * - * This object should have the same structure as [TextProperty]{@link google.cloud.vision.v1p4beta1.TextProperty} - * - * @property {number} width - * Page width. For PDFs the unit is points. For images (including - * TIFFs) the unit is pixels. - * - * @property {number} height - * Page height. For PDFs the unit is points. For images (including - * TIFFs) the unit is pixels. - * - * @property {Object[]} blocks - * List of blocks of text, images etc on this page. - * - * This object should have the same structure as [Block]{@link google.cloud.vision.v1p4beta1.Block} - * - * @property {number} confidence - * Confidence of the OCR results on the page. Range [0, 1]. - * - * @typedef Page - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.Page definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/text_annotation.proto} - */ -const Page = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * Logical element on the page. - * - * @property {Object} property - * Additional information detected for the block. - * - * This object should have the same structure as [TextProperty]{@link google.cloud.vision.v1p4beta1.TextProperty} - * - * @property {Object} boundingBox - * The bounding box for the block. - * The vertices are in the order of top-left, top-right, bottom-right, - * bottom-left. When a rotation of the bounding box is detected the rotation - * is represented as around the top-left corner as defined when the text is - * read in the 'natural' orientation. - * For example: - * - * * when the text is horizontal it might look like: - * - * 0----1 - * | | - * 3----2 - * - * * when it's rotated 180 degrees around the top-left corner it becomes: - * - * 2----3 - * | | - * 1----0 - * - * and the vertex order will still be (0, 1, 2, 3). - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p4beta1.BoundingPoly} - * - * @property {Object[]} paragraphs - * List of paragraphs in this block (if this blocks is of type text). - * - * This object should have the same structure as [Paragraph]{@link google.cloud.vision.v1p4beta1.Paragraph} - * - * @property {number} blockType - * Detected block type (text, image etc) for this block. - * - * The number should be among the values of [BlockType]{@link google.cloud.vision.v1p4beta1.BlockType} - * - * @property {number} confidence - * Confidence of the OCR results on the block. Range [0, 1]. - * - * @typedef Block - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.Block definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/text_annotation.proto} - */ -const Block = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Type of a block (text, image etc) as identified by OCR. - * - * @enum {number} - * @memberof google.cloud.vision.v1p4beta1 - */ - BlockType: { - - /** - * Unknown block type. - */ - UNKNOWN: 0, - - /** - * Regular text block. - */ - TEXT: 1, - - /** - * Table block. - */ - TABLE: 2, - - /** - * Image block. - */ - PICTURE: 3, - - /** - * Horizontal/vertical line box. - */ - RULER: 4, - - /** - * Barcode block. - */ - BARCODE: 5 - } -}; - -/** - * Structural unit of text representing a number of words in certain order. - * - * @property {Object} property - * Additional information detected for the paragraph. - * - * This object should have the same structure as [TextProperty]{@link google.cloud.vision.v1p4beta1.TextProperty} - * - * @property {Object} boundingBox - * The bounding box for the paragraph. - * The vertices are in the order of top-left, top-right, bottom-right, - * bottom-left. When a rotation of the bounding box is detected the rotation - * is represented as around the top-left corner as defined when the text is - * read in the 'natural' orientation. - * For example: - * * when the text is horizontal it might look like: - * 0----1 - * | | - * 3----2 - * * when it's rotated 180 degrees around the top-left corner it becomes: - * 2----3 - * | | - * 1----0 - * and the vertex order will still be (0, 1, 2, 3). - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p4beta1.BoundingPoly} - * - * @property {Object[]} words - * List of all words in this paragraph. - * - * This object should have the same structure as [Word]{@link google.cloud.vision.v1p4beta1.Word} - * - * @property {number} confidence - * Confidence of the OCR results for the paragraph. Range [0, 1]. - * - * @typedef Paragraph - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.Paragraph definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/text_annotation.proto} - */ -const Paragraph = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A word representation. - * - * @property {Object} property - * Additional information detected for the word. - * - * This object should have the same structure as [TextProperty]{@link google.cloud.vision.v1p4beta1.TextProperty} - * - * @property {Object} boundingBox - * The bounding box for the word. - * The vertices are in the order of top-left, top-right, bottom-right, - * bottom-left. When a rotation of the bounding box is detected the rotation - * is represented as around the top-left corner as defined when the text is - * read in the 'natural' orientation. - * For example: - * * when the text is horizontal it might look like: - * 0----1 - * | | - * 3----2 - * * when it's rotated 180 degrees around the top-left corner it becomes: - * 2----3 - * | | - * 1----0 - * and the vertex order will still be (0, 1, 2, 3). - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p4beta1.BoundingPoly} - * - * @property {Object[]} symbols - * List of symbols in the word. - * The order of the symbols follows the natural reading order. - * - * This object should have the same structure as [Symbol]{@link google.cloud.vision.v1p4beta1.Symbol} - * - * @property {number} confidence - * Confidence of the OCR results for the word. Range [0, 1]. - * - * @typedef Word - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.Word definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/text_annotation.proto} - */ -const Word = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; - -/** - * A single symbol representation. - * - * @property {Object} property - * Additional information detected for the symbol. - * - * This object should have the same structure as [TextProperty]{@link google.cloud.vision.v1p4beta1.TextProperty} - * - * @property {Object} boundingBox - * The bounding box for the symbol. - * The vertices are in the order of top-left, top-right, bottom-right, - * bottom-left. When a rotation of the bounding box is detected the rotation - * is represented as around the top-left corner as defined when the text is - * read in the 'natural' orientation. - * For example: - * * when the text is horizontal it might look like: - * 0----1 - * | | - * 3----2 - * * when it's rotated 180 degrees around the top-left corner it becomes: - * 2----3 - * | | - * 1----0 - * and the vertex order will still be (0, 1, 2, 3). - * - * This object should have the same structure as [BoundingPoly]{@link google.cloud.vision.v1p4beta1.BoundingPoly} - * - * @property {string} text - * The actual UTF-8 representation of the symbol. - * - * @property {number} confidence - * Confidence of the OCR results for the symbol. Range [0, 1]. - * - * @typedef Symbol - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.Symbol definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/text_annotation.proto} - */ -const Symbol = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p4beta1/doc/google/cloud/vision/v1p4beta1/doc_web_detection.js b/packages/google-cloud-vision/src/v1p4beta1/doc/google/cloud/vision/v1p4beta1/doc_web_detection.js deleted file mode 100644 index 99d6f54b913..00000000000 --- a/packages/google-cloud-vision/src/v1p4beta1/doc/google/cloud/vision/v1p4beta1/doc_web_detection.js +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * Relevant information for the image from the Internet. - * - * @property {Object[]} webEntities - * Deduced entities from similar images on the Internet. - * - * This object should have the same structure as [WebEntity]{@link google.cloud.vision.v1p4beta1.WebEntity} - * - * @property {Object[]} fullMatchingImages - * Fully matching images from the Internet. - * Can include resized copies of the query image. - * - * This object should have the same structure as [WebImage]{@link google.cloud.vision.v1p4beta1.WebImage} - * - * @property {Object[]} partialMatchingImages - * Partial matching images from the Internet. - * Those images are similar enough to share some key-point features. For - * example an original image will likely have partial matching for its crops. - * - * This object should have the same structure as [WebImage]{@link google.cloud.vision.v1p4beta1.WebImage} - * - * @property {Object[]} pagesWithMatchingImages - * Web pages containing the matching images from the Internet. - * - * This object should have the same structure as [WebPage]{@link google.cloud.vision.v1p4beta1.WebPage} - * - * @property {Object[]} visuallySimilarImages - * The visually similar image results. - * - * This object should have the same structure as [WebImage]{@link google.cloud.vision.v1p4beta1.WebImage} - * - * @property {Object[]} bestGuessLabels - * The service's best guess as to the topic of the request image. - * Inferred from similar images on the open web. - * - * This object should have the same structure as [WebLabel]{@link google.cloud.vision.v1p4beta1.WebLabel} - * - * @typedef WebDetection - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.WebDetection definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/web_detection.proto} - */ -const WebDetection = { - // This is for documentation. Actual contents will be loaded by gRPC. - - /** - * Entity deduced from similar images on the Internet. - * - * @property {string} entityId - * Opaque entity ID. - * - * @property {number} score - * Overall relevancy score for the entity. - * Not normalized and not comparable across different image queries. - * - * @property {string} description - * Canonical description of the entity, in English. - * - * @typedef WebEntity - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.WebDetection.WebEntity definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/web_detection.proto} - */ - WebEntity: { - // This is for documentation. Actual contents will be loaded by gRPC. - }, - - /** - * Metadata for online images. - * - * @property {string} url - * The result image URL. - * - * @property {number} score - * (Deprecated) Overall relevancy score for the image. - * - * @typedef WebImage - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.WebDetection.WebImage definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/web_detection.proto} - */ - WebImage: { - // This is for documentation. Actual contents will be loaded by gRPC. - }, - - /** - * Metadata for web pages. - * - * @property {string} url - * The result web page URL. - * - * @property {number} score - * (Deprecated) Overall relevancy score for the web page. - * - * @property {string} pageTitle - * Title for the web page, may contain HTML markups. - * - * @property {Object[]} fullMatchingImages - * Fully matching images on the page. - * Can include resized copies of the query image. - * - * This object should have the same structure as [WebImage]{@link google.cloud.vision.v1p4beta1.WebImage} - * - * @property {Object[]} partialMatchingImages - * Partial matching images on the page. - * Those images are similar enough to share some key-point features. For - * example an original image will likely have partial matching for its - * crops. - * - * This object should have the same structure as [WebImage]{@link google.cloud.vision.v1p4beta1.WebImage} - * - * @typedef WebPage - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.WebDetection.WebPage definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/web_detection.proto} - */ - WebPage: { - // This is for documentation. Actual contents will be loaded by gRPC. - }, - - /** - * Label to provide extra metadata for the web detection. - * - * @property {string} label - * Label for extra metadata. - * - * @property {string} languageCode - * The BCP-47 language code for `label`, such as "en-US" or "sr-Latn". - * For more information, see - * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. - * - * @typedef WebLabel - * @memberof google.cloud.vision.v1p4beta1 - * @see [google.cloud.vision.v1p4beta1.WebDetection.WebLabel definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/cloud/vision/v1p4beta1/web_detection.proto} - */ - WebLabel: { - // This is for documentation. Actual contents will be loaded by gRPC. - } -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p4beta1/doc/google/longrunning/doc_operations.js b/packages/google-cloud-vision/src/v1p4beta1/doc/google/longrunning/doc_operations.js deleted file mode 100644 index 099e418d620..00000000000 --- a/packages/google-cloud-vision/src/v1p4beta1/doc/google/longrunning/doc_operations.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * This resource represents a long-running operation that is the result of a - * network API call. - * - * @property {string} name - * The server-assigned name, which is only unique within the same service that - * originally returns it. If you use the default HTTP mapping, the - * `name` should be a resource name ending with `operations/{unique_id}`. - * - * @property {Object} metadata - * Service-specific metadata associated with the operation. It typically - * contains progress information and common metadata such as create time. - * Some services might not provide such metadata. Any method that returns a - * long-running operation should document the metadata type, if any. - * - * This object should have the same structure as [Any]{@link google.protobuf.Any} - * - * @property {boolean} done - * If the value is `false`, it means the operation is still in progress. - * If `true`, the operation is completed, and either `error` or `response` is - * available. - * - * @property {Object} error - * The error result of the operation in case of failure or cancellation. - * - * This object should have the same structure as [Status]{@link google.rpc.Status} - * - * @property {Object} response - * The normal response of the operation in case of success. If the original - * method returns no data on success, such as `Delete`, the response is - * `google.protobuf.Empty`. If the original method is standard - * `Get`/`Create`/`Update`, the response should be the resource. For other - * methods, the response should have the type `XxxResponse`, where `Xxx` - * is the original method name. For example, if the original method name - * is `TakeSnapshot()`, the inferred response type is - * `TakeSnapshotResponse`. - * - * This object should have the same structure as [Any]{@link google.protobuf.Any} - * - * @typedef Operation - * @memberof google.longrunning - * @see [google.longrunning.Operation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/longrunning/operations.proto} - */ -const Operation = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p4beta1/doc/google/protobuf/doc_any.js b/packages/google-cloud-vision/src/v1p4beta1/doc/google/protobuf/doc_any.js deleted file mode 100644 index 813682aa336..00000000000 --- a/packages/google-cloud-vision/src/v1p4beta1/doc/google/protobuf/doc_any.js +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * `Any` contains an arbitrary serialized protocol buffer message along with a - * URL that describes the type of the serialized message. - * - * Protobuf library provides support to pack/unpack Any values in the form - * of utility functions or additional generated methods of the Any type. - * - * Example 1: Pack and unpack a message in C++. - * - * Foo foo = ...; - * Any any; - * any.PackFrom(foo); - * ... - * if (any.UnpackTo(&foo)) { - * ... - * } - * - * Example 2: Pack and unpack a message in Java. - * - * Foo foo = ...; - * Any any = Any.pack(foo); - * ... - * if (any.is(Foo.class)) { - * foo = any.unpack(Foo.class); - * } - * - * Example 3: Pack and unpack a message in Python. - * - * foo = Foo(...) - * any = Any() - * any.Pack(foo) - * ... - * if any.Is(Foo.DESCRIPTOR): - * any.Unpack(foo) - * ... - * - * Example 4: Pack and unpack a message in Go - * - * foo := &pb.Foo{...} - * any, err := ptypes.MarshalAny(foo) - * ... - * foo := &pb.Foo{} - * if err := ptypes.UnmarshalAny(any, foo); err != nil { - * ... - * } - * - * The pack methods provided by protobuf library will by default use - * 'type.googleapis.com/full.type.name' as the type URL and the unpack - * methods only use the fully qualified type name after the last '/' - * in the type URL, for example "foo.bar.com/x/y.z" will yield type - * name "y.z". - * - * - * # JSON - * - * The JSON representation of an `Any` value uses the regular - * representation of the deserialized, embedded message, with an - * additional field `@type` which contains the type URL. Example: - * - * package google.profile; - * message Person { - * string first_name = 1; - * string last_name = 2; - * } - * - * { - * "@type": "type.googleapis.com/google.profile.Person", - * "firstName": , - * "lastName": - * } - * - * If the embedded message type is well-known and has a custom JSON - * representation, that representation will be embedded adding a field - * `value` which holds the custom JSON in addition to the `@type` - * field. Example (for message google.protobuf.Duration): - * - * { - * "@type": "type.googleapis.com/google.protobuf.Duration", - * "value": "1.212s" - * } - * - * @property {string} typeUrl - * A URL/resource name that uniquely identifies the type of the serialized - * protocol buffer message. This string must contain at least - * one "/" character. The last segment of the URL's path must represent - * the fully qualified name of the type (as in - * `path/google.protobuf.Duration`). The name should be in a canonical form - * (e.g., leading "." is not accepted). - * - * In practice, teams usually precompile into the binary all types that they - * expect it to use in the context of Any. However, for URLs which use the - * scheme `http`, `https`, or no scheme, one can optionally set up a type - * server that maps type URLs to message definitions as follows: - * - * * If no scheme is provided, `https` is assumed. - * * An HTTP GET on the URL must yield a google.protobuf.Type - * value in binary format, or produce an error. - * * Applications are allowed to cache lookup results based on the - * URL, or have them precompiled into a binary to avoid any - * lookup. Therefore, binary compatibility needs to be preserved - * on changes to types. (Use versioned type names to manage - * breaking changes.) - * - * Note: this functionality is not currently available in the official - * protobuf release, and it is not used for type URLs beginning with - * type.googleapis.com. - * - * Schemes other than `http`, `https` (or the empty scheme) might be - * used with implementation specific semantics. - * - * @property {Buffer} value - * Must be a valid serialized protocol buffer of the above specified type. - * - * @typedef Any - * @memberof google.protobuf - * @see [google.protobuf.Any definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/any.proto} - */ -const Any = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p4beta1/doc/google/protobuf/doc_empty.js b/packages/google-cloud-vision/src/v1p4beta1/doc/google/protobuf/doc_empty.js deleted file mode 100644 index 1e3961d6609..00000000000 --- a/packages/google-cloud-vision/src/v1p4beta1/doc/google/protobuf/doc_empty.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * A generic empty message that you can re-use to avoid defining duplicated - * empty messages in your APIs. A typical example is to use it as the request - * or the response type of an API method. For instance: - * - * service Foo { - * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); - * } - * - * The JSON representation for `Empty` is empty JSON object `{}`. - * @typedef Empty - * @memberof google.protobuf - * @see [google.protobuf.Empty definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/empty.proto} - */ -const Empty = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p4beta1/doc/google/protobuf/doc_field_mask.js b/packages/google-cloud-vision/src/v1p4beta1/doc/google/protobuf/doc_field_mask.js deleted file mode 100644 index 59e745f36c2..00000000000 --- a/packages/google-cloud-vision/src/v1p4beta1/doc/google/protobuf/doc_field_mask.js +++ /dev/null @@ -1,228 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * `FieldMask` represents a set of symbolic field paths, for example: - * - * paths: "f.a" - * paths: "f.b.d" - * - * Here `f` represents a field in some root message, `a` and `b` - * fields in the message found in `f`, and `d` a field found in the - * message in `f.b`. - * - * Field masks are used to specify a subset of fields that should be - * returned by a get operation or modified by an update operation. - * Field masks also have a custom JSON encoding (see below). - * - * # Field Masks in Projections - * - * When used in the context of a projection, a response message or - * sub-message is filtered by the API to only contain those fields as - * specified in the mask. For example, if the mask in the previous - * example is applied to a response message as follows: - * - * f { - * a : 22 - * b { - * d : 1 - * x : 2 - * } - * y : 13 - * } - * z: 8 - * - * The result will not contain specific values for fields x,y and z - * (their value will be set to the default, and omitted in proto text - * output): - * - * - * f { - * a : 22 - * b { - * d : 1 - * } - * } - * - * A repeated field is not allowed except at the last position of a - * paths string. - * - * If a FieldMask object is not present in a get operation, the - * operation applies to all fields (as if a FieldMask of all fields - * had been specified). - * - * Note that a field mask does not necessarily apply to the - * top-level response message. In case of a REST get operation, the - * field mask applies directly to the response, but in case of a REST - * list operation, the mask instead applies to each individual message - * in the returned resource list. In case of a REST custom method, - * other definitions may be used. Where the mask applies will be - * clearly documented together with its declaration in the API. In - * any case, the effect on the returned resource/resources is required - * behavior for APIs. - * - * # Field Masks in Update Operations - * - * A field mask in update operations specifies which fields of the - * targeted resource are going to be updated. The API is required - * to only change the values of the fields as specified in the mask - * and leave the others untouched. If a resource is passed in to - * describe the updated values, the API ignores the values of all - * fields not covered by the mask. - * - * If a repeated field is specified for an update operation, new values will - * be appended to the existing repeated field in the target resource. Note that - * a repeated field is only allowed in the last position of a `paths` string. - * - * If a sub-message is specified in the last position of the field mask for an - * update operation, then new value will be merged into the existing sub-message - * in the target resource. - * - * For example, given the target message: - * - * f { - * b { - * d: 1 - * x: 2 - * } - * c: [1] - * } - * - * And an update message: - * - * f { - * b { - * d: 10 - * } - * c: [2] - * } - * - * then if the field mask is: - * - * paths: ["f.b", "f.c"] - * - * then the result will be: - * - * f { - * b { - * d: 10 - * x: 2 - * } - * c: [1, 2] - * } - * - * An implementation may provide options to override this default behavior for - * repeated and message fields. - * - * In order to reset a field's value to the default, the field must - * be in the mask and set to the default value in the provided resource. - * Hence, in order to reset all fields of a resource, provide a default - * instance of the resource and set all fields in the mask, or do - * not provide a mask as described below. - * - * If a field mask is not present on update, the operation applies to - * all fields (as if a field mask of all fields has been specified). - * Note that in the presence of schema evolution, this may mean that - * fields the client does not know and has therefore not filled into - * the request will be reset to their default. If this is unwanted - * behavior, a specific service may require a client to always specify - * a field mask, producing an error if not. - * - * As with get operations, the location of the resource which - * describes the updated values in the request message depends on the - * operation kind. In any case, the effect of the field mask is - * required to be honored by the API. - * - * ## Considerations for HTTP REST - * - * The HTTP kind of an update operation which uses a field mask must - * be set to PATCH instead of PUT in order to satisfy HTTP semantics - * (PUT must only be used for full updates). - * - * # JSON Encoding of Field Masks - * - * In JSON, a field mask is encoded as a single string where paths are - * separated by a comma. Fields name in each path are converted - * to/from lower-camel naming conventions. - * - * As an example, consider the following message declarations: - * - * message Profile { - * User user = 1; - * Photo photo = 2; - * } - * message User { - * string display_name = 1; - * string address = 2; - * } - * - * In proto a field mask for `Profile` may look as such: - * - * mask { - * paths: "user.display_name" - * paths: "photo" - * } - * - * In JSON, the same mask is represented as below: - * - * { - * mask: "user.displayName,photo" - * } - * - * # Field Masks and Oneof Fields - * - * Field masks treat fields in oneofs just as regular fields. Consider the - * following message: - * - * message SampleMessage { - * oneof test_oneof { - * string name = 4; - * SubMessage sub_message = 9; - * } - * } - * - * The field mask can be: - * - * mask { - * paths: "name" - * } - * - * Or: - * - * mask { - * paths: "sub_message" - * } - * - * Note that oneof type names ("test_oneof" in this case) cannot be used in - * paths. - * - * ## Field Mask Verification - * - * The implementation of any API method which has a FieldMask type field in the - * request should verify the included field paths, and return an - * `INVALID_ARGUMENT` error if any path is duplicated or unmappable. - * - * @property {string[]} paths - * The set of field mask paths. - * - * @typedef FieldMask - * @memberof google.protobuf - * @see [google.protobuf.FieldMask definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/field_mask.proto} - */ -const FieldMask = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p4beta1/doc/google/protobuf/doc_timestamp.js b/packages/google-cloud-vision/src/v1p4beta1/doc/google/protobuf/doc_timestamp.js deleted file mode 100644 index ad801cc9a10..00000000000 --- a/packages/google-cloud-vision/src/v1p4beta1/doc/google/protobuf/doc_timestamp.js +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * A Timestamp represents a point in time independent of any time zone or local - * calendar, encoded as a count of seconds and fractions of seconds at - * nanosecond resolution. The count is relative to an epoch at UTC midnight on - * January 1, 1970, in the proleptic Gregorian calendar which extends the - * Gregorian calendar backwards to year one. - * - * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - * second table is needed for interpretation, using a [24-hour linear - * smear](https://developers.google.com/time/smear). - * - * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - * restricting to that range, we ensure that we can convert to and from [RFC - * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - * - * # Examples - * - * Example 1: Compute Timestamp from POSIX `time()`. - * - * Timestamp timestamp; - * timestamp.set_seconds(time(NULL)); - * timestamp.set_nanos(0); - * - * Example 2: Compute Timestamp from POSIX `gettimeofday()`. - * - * struct timeval tv; - * gettimeofday(&tv, NULL); - * - * Timestamp timestamp; - * timestamp.set_seconds(tv.tv_sec); - * timestamp.set_nanos(tv.tv_usec * 1000); - * - * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - * - * FILETIME ft; - * GetSystemTimeAsFileTime(&ft); - * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - * - * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - * Timestamp timestamp; - * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - * - * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - * - * long millis = System.currentTimeMillis(); - * - * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - * .setNanos((int) ((millis % 1000) * 1000000)).build(); - * - * - * Example 5: Compute Timestamp from current time in Python. - * - * timestamp = Timestamp() - * timestamp.GetCurrentTime() - * - * # JSON Mapping - * - * In JSON format, the Timestamp type is encoded as a string in the - * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the - * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" - * where {year} is always expressed using four digits while {month}, {day}, - * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional - * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), - * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone - * is required. A proto3 JSON serializer should always use UTC (as indicated by - * "Z") when printing the Timestamp type and a proto3 JSON parser should be - * able to accept both UTC and other timezones (as indicated by an offset). - * - * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past - * 01:30 UTC on January 15, 2017. - * - * In JavaScript, one can convert a Date object to this format using the - * standard - * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - * method. In Python, a standard `datetime.datetime` object can be converted - * to this format using - * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with - * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use - * the Joda Time's [`ISODateTimeFormat.dateTime()`](https://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D) to obtain a formatter capable of generating timestamps in this format. - * - * @property {number} seconds - * Represents seconds of UTC time since Unix epoch - * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to - * 9999-12-31T23:59:59Z inclusive. - * - * @property {number} nanos - * Non-negative fractions of a second at nanosecond resolution. Negative - * second values with fractions must still have non-negative nanos values - * that count forward in time. Must be from 0 to 999,999,999 - * inclusive. - * - * @typedef Timestamp - * @memberof google.protobuf - * @see [google.protobuf.Timestamp definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto} - */ -const Timestamp = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p4beta1/doc/google/protobuf/doc_wrappers.js b/packages/google-cloud-vision/src/v1p4beta1/doc/google/protobuf/doc_wrappers.js deleted file mode 100644 index 90e2ff4ab5a..00000000000 --- a/packages/google-cloud-vision/src/v1p4beta1/doc/google/protobuf/doc_wrappers.js +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * Wrapper message for `float`. - * - * The JSON representation for `FloatValue` is JSON number. - * - * @property {number} value - * The float value. - * - * @typedef FloatValue - * @memberof google.protobuf - * @see [google.protobuf.FloatValue definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/wrappers.proto} - */ -const FloatValue = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p4beta1/doc/google/rpc/doc_status.js b/packages/google-cloud-vision/src/v1p4beta1/doc/google/rpc/doc_status.js deleted file mode 100644 index 750e0af7689..00000000000 --- a/packages/google-cloud-vision/src/v1p4beta1/doc/google/rpc/doc_status.js +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * The `Status` type defines a logical error model that is suitable for - * different programming environments, including REST APIs and RPC APIs. It is - * used by [gRPC](https://github.com/grpc). Each `Status` message contains - * three pieces of data: error code, error message, and error details. - * - * You can find out more about this error model and how to work with it in the - * [API Design Guide](https://cloud.google.com/apis/design/errors). - * - * @property {number} code - * The status code, which should be an enum value of google.rpc.Code. - * - * @property {string} message - * A developer-facing error message, which should be in English. Any - * user-facing error message should be localized and sent in the - * google.rpc.Status.details field, or localized by the client. - * - * @property {Object[]} details - * A list of messages that carry the error details. There is a common set of - * message types for APIs to use. - * - * This object should have the same structure as [Any]{@link google.protobuf.Any} - * - * @typedef Status - * @memberof google.rpc - * @see [google.rpc.Status definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/rpc/status.proto} - */ -const Status = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p4beta1/doc/google/type/doc_color.js b/packages/google-cloud-vision/src/v1p4beta1/doc/google/type/doc_color.js deleted file mode 100644 index 9570187d502..00000000000 --- a/packages/google-cloud-vision/src/v1p4beta1/doc/google/type/doc_color.js +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * Represents a color in the RGBA color space. This representation is designed - * for simplicity of conversion to/from color representations in various - * languages over compactness; for example, the fields of this representation - * can be trivially provided to the constructor of "java.awt.Color" in Java; it - * can also be trivially provided to UIColor's "+colorWithRed:green:blue:alpha" - * method in iOS; and, with just a little work, it can be easily formatted into - * a CSS "rgba()" string in JavaScript, as well. - * - * Note: this proto does not carry information about the absolute color space - * that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, - * DCI-P3, BT.2020, etc.). By default, applications SHOULD assume the sRGB color - * space. - * - * Example (Java): - * - * import com.google.type.Color; - * - * // ... - * public static java.awt.Color fromProto(Color protocolor) { - * float alpha = protocolor.hasAlpha() - * ? protocolor.getAlpha().getValue() - * : 1.0; - * - * return new java.awt.Color( - * protocolor.getRed(), - * protocolor.getGreen(), - * protocolor.getBlue(), - * alpha); - * } - * - * public static Color toProto(java.awt.Color color) { - * float red = (float) color.getRed(); - * float green = (float) color.getGreen(); - * float blue = (float) color.getBlue(); - * float denominator = 255.0; - * Color.Builder resultBuilder = - * Color - * .newBuilder() - * .setRed(red / denominator) - * .setGreen(green / denominator) - * .setBlue(blue / denominator); - * int alpha = color.getAlpha(); - * if (alpha != 255) { - * result.setAlpha( - * FloatValue - * .newBuilder() - * .setValue(((float) alpha) / denominator) - * .build()); - * } - * return resultBuilder.build(); - * } - * // ... - * - * Example (iOS / Obj-C): - * - * // ... - * static UIColor* fromProto(Color* protocolor) { - * float red = [protocolor red]; - * float green = [protocolor green]; - * float blue = [protocolor blue]; - * FloatValue* alpha_wrapper = [protocolor alpha]; - * float alpha = 1.0; - * if (alpha_wrapper != nil) { - * alpha = [alpha_wrapper value]; - * } - * return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; - * } - * - * static Color* toProto(UIColor* color) { - * CGFloat red, green, blue, alpha; - * if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { - * return nil; - * } - * Color* result = [[Color alloc] init]; - * [result setRed:red]; - * [result setGreen:green]; - * [result setBlue:blue]; - * if (alpha <= 0.9999) { - * [result setAlpha:floatWrapperWithValue(alpha)]; - * } - * [result autorelease]; - * return result; - * } - * // ... - * - * Example (JavaScript): - * - * // ... - * - * var protoToCssColor = function(rgb_color) { - * var redFrac = rgb_color.red || 0.0; - * var greenFrac = rgb_color.green || 0.0; - * var blueFrac = rgb_color.blue || 0.0; - * var red = Math.floor(redFrac * 255); - * var green = Math.floor(greenFrac * 255); - * var blue = Math.floor(blueFrac * 255); - * - * if (!('alpha' in rgb_color)) { - * return rgbToCssColor_(red, green, blue); - * } - * - * var alphaFrac = rgb_color.alpha.value || 0.0; - * var rgbParams = [red, green, blue].join(','); - * return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); - * }; - * - * var rgbToCssColor_ = function(red, green, blue) { - * var rgbNumber = new Number((red << 16) | (green << 8) | blue); - * var hexString = rgbNumber.toString(16); - * var missingZeros = 6 - hexString.length; - * var resultBuilder = ['#']; - * for (var i = 0; i < missingZeros; i++) { - * resultBuilder.push('0'); - * } - * resultBuilder.push(hexString); - * return resultBuilder.join(''); - * }; - * - * // ... - * - * @property {number} red - * The amount of red in the color as a value in the interval [0, 1]. - * - * @property {number} green - * The amount of green in the color as a value in the interval [0, 1]. - * - * @property {number} blue - * The amount of blue in the color as a value in the interval [0, 1]. - * - * @property {Object} alpha - * The fraction of this color that should be applied to the pixel. That is, - * the final pixel color is defined by the equation: - * - * pixel color = alpha * (this color) + (1.0 - alpha) * (background color) - * - * This means that a value of 1.0 corresponds to a solid color, whereas - * a value of 0.0 corresponds to a completely transparent color. This - * uses a wrapper message rather than a simple float scalar so that it is - * possible to distinguish between a default value and the value being unset. - * If omitted, this color object is to be rendered as a solid color - * (as if the alpha value had been explicitly given with a value of 1.0). - * - * This object should have the same structure as [FloatValue]{@link google.protobuf.FloatValue} - * - * @typedef Color - * @memberof google.type - * @see [google.type.Color definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/type/color.proto} - */ -const Color = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p4beta1/doc/google/type/doc_latlng.js b/packages/google-cloud-vision/src/v1p4beta1/doc/google/type/doc_latlng.js deleted file mode 100644 index bacbf0e1f48..00000000000 --- a/packages/google-cloud-vision/src/v1p4beta1/doc/google/type/doc_latlng.js +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Note: this file is purely for documentation. Any contents are not expected -// to be loaded as the JS file. - -/** - * An object representing a latitude/longitude pair. This is expressed as a pair - * of doubles representing degrees latitude and degrees longitude. Unless - * specified otherwise, this must conform to the - * WGS84 - * standard. Values must be within normalized ranges. - * - * @property {number} latitude - * The latitude in degrees. It must be in the range [-90.0, +90.0]. - * - * @property {number} longitude - * The longitude in degrees. It must be in the range [-180.0, +180.0]. - * - * @typedef LatLng - * @memberof google.type - * @see [google.type.LatLng definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/type/latlng.proto} - */ -const LatLng = { - // This is for documentation. Actual contents will be loaded by gRPC. -}; \ No newline at end of file diff --git a/packages/google-cloud-vision/src/v1p4beta1/image_annotator_client.js b/packages/google-cloud-vision/src/v1p4beta1/image_annotator_client.js deleted file mode 100644 index bbede6ae7a8..00000000000 --- a/packages/google-cloud-vision/src/v1p4beta1/image_annotator_client.js +++ /dev/null @@ -1,597 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -'use strict'; - -const gapicConfig = require('./image_annotator_client_config.json'); -const gax = require('google-gax'); -const path = require('path'); - -const VERSION = require('../../package.json').version; - -/** - * Service that performs Google Cloud Vision API detection tasks over client - * images, such as face, landmark, logo, label, and text detection. The - * ImageAnnotator service returns detected entities from the images. - * - * @class - * @memberof v1p4beta1 - */ -class ImageAnnotatorClient { - /** - * Construct an instance of ImageAnnotatorClient. - * - * @param {object} [options] - The configuration object. See the subsequent - * parameters for more details. - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {function} [options.promise] - Custom promise module to use instead - * of native Promises. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - */ - constructor(opts) { - opts = opts || {}; - this._descriptors = {}; - - if (global.isBrowser) { - // If we're in browser, we use gRPC fallback. - opts.fallback = true; - } - - // If we are in browser, we are already using fallback because of the - // "browser" field in package.json. - // But if we were explicitly requested to use fallback, let's do it now. - const gaxModule = !global.isBrowser && opts.fallback ? gax.fallback : gax; - - const servicePath = - opts.servicePath || opts.apiEndpoint || this.constructor.servicePath; - - // Ensure that options include the service address and port. - opts = Object.assign( - { - clientConfig: {}, - port: this.constructor.port, - servicePath, - }, - opts - ); - - // Create a `gaxGrpc` object, with any grpc-specific options - // sent to the client. - opts.scopes = this.constructor.scopes; - const gaxGrpc = new gaxModule.GrpcClient(opts); - - // Save the auth object to the client, for use by other methods. - this.auth = gaxGrpc.auth; - - // Determine the client header string. - const clientHeader = []; - - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } - clientHeader.push(`gax/${gaxModule.version}`); - if (opts.fallback) { - clientHeader.push(`gl-web/${gaxModule.version}`); - } else { - clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`); - } - clientHeader.push(`gapic/${VERSION}`); - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - - // Load the applicable protos. - // For Node.js, pass the path to JSON proto file. - // For browsers, pass the JSON content. - - const nodejsProtoPath = path.join( - __dirname, - '..', - '..', - 'protos', - 'protos.json' - ); - const protos = gaxGrpc.loadProto( - opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath - ); - - const protoFilesRoot = opts.fallback - ? gaxModule.protobuf.Root.fromJSON(require('../../protos/protos.json')) - : gaxModule.protobuf.loadSync(nodejsProtoPath); - - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - this.operationsClient = new gaxModule.lro({ - auth: gaxGrpc.auth, - grpc: gaxGrpc.grpc, - }).operationsClient(opts); - - const asyncBatchAnnotateImagesResponse = protoFilesRoot.lookup( - 'google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse' - ); - const asyncBatchAnnotateImagesMetadata = protoFilesRoot.lookup( - 'google.cloud.vision.v1p4beta1.OperationMetadata' - ); - const asyncBatchAnnotateFilesResponse = protoFilesRoot.lookup( - 'google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse' - ); - const asyncBatchAnnotateFilesMetadata = protoFilesRoot.lookup( - 'google.cloud.vision.v1p4beta1.OperationMetadata' - ); - - this._descriptors.longrunning = { - asyncBatchAnnotateImages: new gaxModule.LongrunningDescriptor( - this.operationsClient, - asyncBatchAnnotateImagesResponse.decode.bind( - asyncBatchAnnotateImagesResponse - ), - asyncBatchAnnotateImagesMetadata.decode.bind( - asyncBatchAnnotateImagesMetadata - ) - ), - asyncBatchAnnotateFiles: new gaxModule.LongrunningDescriptor( - this.operationsClient, - asyncBatchAnnotateFilesResponse.decode.bind( - asyncBatchAnnotateFilesResponse - ), - asyncBatchAnnotateFilesMetadata.decode.bind( - asyncBatchAnnotateFilesMetadata - ) - ), - }; - - // Put together the default options sent with requests. - const defaults = gaxGrpc.constructSettings( - 'google.cloud.vision.v1p4beta1.ImageAnnotator', - gapicConfig, - opts.clientConfig, - {'x-goog-api-client': clientHeader.join(' ')} - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this._innerApiCalls = {}; - - // Put together the "service stub" for - // google.cloud.vision.v1p4beta1.ImageAnnotator. - const imageAnnotatorStub = gaxGrpc.createStub( - opts.fallback - ? protos.lookupService('google.cloud.vision.v1p4beta1.ImageAnnotator') - : protos.google.cloud.vision.v1p4beta1.ImageAnnotator, - opts - ); - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const imageAnnotatorStubMethods = [ - 'batchAnnotateImages', - 'batchAnnotateFiles', - 'asyncBatchAnnotateImages', - 'asyncBatchAnnotateFiles', - ]; - for (const methodName of imageAnnotatorStubMethods) { - const innerCallPromise = imageAnnotatorStub.then( - stub => (...args) => { - return stub[methodName].apply(stub, args); - }, - err => () => { - throw err; - } - ); - this._innerApiCalls[methodName] = gaxModule.createApiCall( - innerCallPromise, - defaults[methodName], - this._descriptors.longrunning[methodName] - ); - } - } - - /** - * The DNS address for this API service. - */ - static get servicePath() { - return 'vision.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - */ - static get apiEndpoint() { - return 'vision.googleapis.com'; - } - - /** - * The port for this API service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloud-vision', - ]; - } - - /** - * Return the project ID used by this class. - * @param {function(Error, string)} callback - the callback to - * be called with the current project Id. - */ - getProjectId(callback) { - return this.auth.getProjectId(callback); - } - - // ------------------- - // -- Service calls -- - // ------------------- - - /** - * Run image detection and annotation for a batch of images. - * - * @param {Object} request - * The request object that will be sent. - * @param {Object[]} request.requests - * Required. Individual image annotation requests for this batch. - * - * This object should have the same structure as [AnnotateImageRequest]{@link google.cloud.vision.v1p4beta1.AnnotateImageRequest} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [BatchAnnotateImagesResponse]{@link google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [BatchAnnotateImagesResponse]{@link google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('vision.v1p4beta1'); - * - * const client = new vision.v1p4beta1.ImageAnnotatorClient({ - * // optional auth parameters. - * }); - * - * const requests = []; - * client.batchAnnotateImages({requests: requests}) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - batchAnnotateImages(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - - return this._innerApiCalls.batchAnnotateImages(request, options, callback); - } - - /** - * Service that performs image detection and annotation for a batch of files. - * Now only "application/pdf", "image/tiff" and "image/gif" are supported. - * - * This service will extract at most 5 (customers can specify which 5 in - * AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each - * file provided and perform detection and annotation for each image - * extracted. - * - * @param {Object} request - * The request object that will be sent. - * @param {Object[]} request.requests - * Required. The list of file annotation requests. Right now we support only - * one AnnotateFileRequest in BatchAnnotateFilesRequest. - * - * This object should have the same structure as [AnnotateFileRequest]{@link google.cloud.vision.v1p4beta1.AnnotateFileRequest} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [BatchAnnotateFilesResponse]{@link google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [BatchAnnotateFilesResponse]{@link google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('vision.v1p4beta1'); - * - * const client = new vision.v1p4beta1.ImageAnnotatorClient({ - * // optional auth parameters. - * }); - * - * const requests = []; - * client.batchAnnotateFiles({requests: requests}) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - batchAnnotateFiles(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - - return this._innerApiCalls.batchAnnotateFiles(request, options, callback); - } - - /** - * Run asynchronous image detection and annotation for a list of images. - * - * Progress and results can be retrieved through the - * `google.longrunning.Operations` interface. - * `Operation.metadata` contains `OperationMetadata` (metadata). - * `Operation.response` contains `AsyncBatchAnnotateImagesResponse` (results). - * - * This service will write image annotation outputs to json files in customer - * GCS bucket, each json file containing BatchAnnotateImagesResponse proto. - * - * @param {Object} request - * The request object that will be sent. - * @param {Object[]} request.requests - * Required. Individual image annotation requests for this batch. - * - * This object should have the same structure as [AnnotateImageRequest]{@link google.cloud.vision.v1p4beta1.AnnotateImageRequest} - * @param {Object} request.outputConfig - * Required. The desired output location and metadata (e.g. format). - * - * This object should have the same structure as [OutputConfig]{@link google.cloud.vision.v1p4beta1.OutputConfig} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/classes/Operation.html} object. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/classes/Operation.html} object. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('vision.v1p4beta1'); - * - * const client = new vision.v1p4beta1.ImageAnnotatorClient({ - * // optional auth parameters. - * }); - * - * const requests = []; - * const outputConfig = {}; - * const request = { - * requests: requests, - * outputConfig: outputConfig, - * }; - * - * // Handle the operation using the promise pattern. - * client.asyncBatchAnnotateImages(request) - * .then(responses => { - * const [operation, initialApiResponse] = responses; - * - * // Operation#promise starts polling for the completion of the LRO. - * return operation.promise(); - * }) - * .then(responses => { - * const result = responses[0]; - * const metadata = responses[1]; - * const finalApiResponse = responses[2]; - * }) - * .catch(err => { - * console.error(err); - * }); - * - * const requests = []; - * const outputConfig = {}; - * const request = { - * requests: requests, - * outputConfig: outputConfig, - * }; - * - * // Handle the operation using the event emitter pattern. - * client.asyncBatchAnnotateImages(request) - * .then(responses => { - * const [operation, initialApiResponse] = responses; - * - * // Adding a listener for the "complete" event starts polling for the - * // completion of the operation. - * operation.on('complete', (result, metadata, finalApiResponse) => { - * // doSomethingWith(result); - * }); - * - * // Adding a listener for the "progress" event causes the callback to be - * // called on any change in metadata when the operation is polled. - * operation.on('progress', (metadata, apiResponse) => { - * // doSomethingWith(metadata) - * }); - * - * // Adding a listener for the "error" event handles any errors found during polling. - * operation.on('error', err => { - * // throw(err); - * }); - * }) - * .catch(err => { - * console.error(err); - * }); - * - * const requests = []; - * const outputConfig = {}; - * const request = { - * requests: requests, - * outputConfig: outputConfig, - * }; - * - * // Handle the operation using the await pattern. - * const [operation] = await client.asyncBatchAnnotateImages(request); - * - * const [response] = await operation.promise(); - */ - asyncBatchAnnotateImages(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - - return this._innerApiCalls.asyncBatchAnnotateImages( - request, - options, - callback - ); - } - - /** - * Run asynchronous image detection and annotation for a list of generic - * files, such as PDF files, which may contain multiple pages and multiple - * images per page. Progress and results can be retrieved through the - * `google.longrunning.Operations` interface. - * `Operation.metadata` contains `OperationMetadata` (metadata). - * `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results). - * - * @param {Object} request - * The request object that will be sent. - * @param {Object[]} request.requests - * Required. Individual async file annotation requests for this batch. - * - * This object should have the same structure as [AsyncAnnotateFileRequest]{@link google.cloud.vision.v1p4beta1.AsyncAnnotateFileRequest} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/classes/Operation.html} object. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/classes/Operation.html} object. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('vision.v1p4beta1'); - * - * const client = new vision.v1p4beta1.ImageAnnotatorClient({ - * // optional auth parameters. - * }); - * - * const requests = []; - * - * // Handle the operation using the promise pattern. - * client.asyncBatchAnnotateFiles({requests: requests}) - * .then(responses => { - * const [operation, initialApiResponse] = responses; - * - * // Operation#promise starts polling for the completion of the LRO. - * return operation.promise(); - * }) - * .then(responses => { - * const result = responses[0]; - * const metadata = responses[1]; - * const finalApiResponse = responses[2]; - * }) - * .catch(err => { - * console.error(err); - * }); - * - * const requests = []; - * - * // Handle the operation using the event emitter pattern. - * client.asyncBatchAnnotateFiles({requests: requests}) - * .then(responses => { - * const [operation, initialApiResponse] = responses; - * - * // Adding a listener for the "complete" event starts polling for the - * // completion of the operation. - * operation.on('complete', (result, metadata, finalApiResponse) => { - * // doSomethingWith(result); - * }); - * - * // Adding a listener for the "progress" event causes the callback to be - * // called on any change in metadata when the operation is polled. - * operation.on('progress', (metadata, apiResponse) => { - * // doSomethingWith(metadata) - * }); - * - * // Adding a listener for the "error" event handles any errors found during polling. - * operation.on('error', err => { - * // throw(err); - * }); - * }) - * .catch(err => { - * console.error(err); - * }); - * - * const requests = []; - * - * // Handle the operation using the await pattern. - * const [operation] = await client.asyncBatchAnnotateFiles({requests: requests}); - * - * const [response] = await operation.promise(); - */ - asyncBatchAnnotateFiles(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - - return this._innerApiCalls.asyncBatchAnnotateFiles( - request, - options, - callback - ); - } -} - -module.exports = ImageAnnotatorClient; diff --git a/packages/google-cloud-vision/src/v1p4beta1/image_annotator_client.ts b/packages/google-cloud-vision/src/v1p4beta1/image_annotator_client.ts new file mode 100644 index 00000000000..c2463925e0d --- /dev/null +++ b/packages/google-cloud-vision/src/v1p4beta1/image_annotator_client.ts @@ -0,0 +1,853 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as gax from 'google-gax'; +import { + APICallback, + Callback, + CallOptions, + Descriptors, + ClientOptions, + LROperation, +} from 'google-gax'; +import * as path from 'path'; + +import * as protosTypes from '../../protos/protos'; +import * as gapicConfig from './image_annotator_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Service that performs Google Cloud Vision API detection tasks over client + * images, such as face, landmark, logo, label, and text detection. The + * ImageAnnotator service returns detected entities from the images. + * @class + * @memberof v1p4beta1 + */ +export class ImageAnnotatorClient { + private _descriptors: Descriptors = {page: {}, stream: {}, longrunning: {}}; + private _innerApiCalls: {[name: string]: Function}; + private _pathTemplates: {[name: string]: gax.PathTemplate}; + private _terminated = false; + auth: gax.GoogleAuth; + operationsClient: gax.OperationsClient; + imageAnnotatorStub: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ImageAnnotatorClient. + * + * @param {object} [options] - The configuration object. See the subsequent + * parameters for more details. + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {function} [options.promise] - Custom promise module to use instead + * of native Promises. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + */ + + constructor(opts?: ClientOptions) { + // Ensure that options include the service address and port. + const staticMembers = this.constructor as typeof ImageAnnotatorClient; + const servicePath = + opts && opts.servicePath + ? opts.servicePath + : opts && opts.apiEndpoint + ? opts.apiEndpoint + : staticMembers.servicePath; + const port = opts && opts.port ? opts.port : staticMembers.port; + + if (!opts) { + opts = {servicePath, port}; + } + opts.servicePath = opts.servicePath || servicePath; + opts.port = opts.port || port; + opts.clientConfig = opts.clientConfig || {}; + + const isBrowser = typeof window !== 'undefined'; + if (isBrowser) { + opts.fallback = true; + } + // If we are in browser, we are already using fallback because of the + // "browser" field in package.json. + // But if we were explicitly requested to use fallback, let's do it now. + const gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options + // sent to the client. + opts.scopes = (this.constructor as typeof ImageAnnotatorClient).scopes; + const gaxGrpc = new gaxModule.GrpcClient(opts); + + // Save the auth object to the client, for use by other methods. + this.auth = gaxGrpc.auth as gax.GoogleAuth; + + // Determine the client header string. + const clientHeader = [`gax/${gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + const protos = gaxGrpc.loadProto( + opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this._pathTemplates = { + productPathTemplate: new gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/products/{product}' + ), + productSetPathTemplate: new gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/productSets/{product_set}' + ), + referenceImagePathTemplate: new gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}' + ), + }; + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const protoFilesRoot = opts.fallback + ? gaxModule.protobuf.Root.fromJSON(require('../../protos/protos.json')) + : gaxModule.protobuf.loadSync(nodejsProtoPath); + + this.operationsClient = gaxModule + .lro({ + auth: this.auth, + grpc: 'grpc' in gaxGrpc ? gaxGrpc.grpc : undefined, + }) + .operationsClient(opts); + const asyncBatchAnnotateImagesResponse = protoFilesRoot.lookup( + '.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateImagesResponse' + ) as gax.protobuf.Type; + const asyncBatchAnnotateImagesMetadata = protoFilesRoot.lookup( + '.google.cloud.vision.v1p4beta1.OperationMetadata' + ) as gax.protobuf.Type; + const asyncBatchAnnotateFilesResponse = protoFilesRoot.lookup( + '.google.cloud.vision.v1p4beta1.AsyncBatchAnnotateFilesResponse' + ) as gax.protobuf.Type; + const asyncBatchAnnotateFilesMetadata = protoFilesRoot.lookup( + '.google.cloud.vision.v1p4beta1.OperationMetadata' + ) as gax.protobuf.Type; + + this._descriptors.longrunning = { + asyncBatchAnnotateImages: new gaxModule.LongrunningDescriptor( + this.operationsClient, + asyncBatchAnnotateImagesResponse.decode.bind( + asyncBatchAnnotateImagesResponse + ), + asyncBatchAnnotateImagesMetadata.decode.bind( + asyncBatchAnnotateImagesMetadata + ) + ), + asyncBatchAnnotateFiles: new gaxModule.LongrunningDescriptor( + this.operationsClient, + asyncBatchAnnotateFilesResponse.decode.bind( + asyncBatchAnnotateFilesResponse + ), + asyncBatchAnnotateFilesMetadata.decode.bind( + asyncBatchAnnotateFilesMetadata + ) + ), + }; + + // Put together the default options sent with requests. + const defaults = gaxGrpc.constructSettings( + 'google.cloud.vision.v1p4beta1.ImageAnnotator', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this._innerApiCalls = {}; + + // Put together the "service stub" for + // google.cloud.vision.v1p4beta1.ImageAnnotator. + this.imageAnnotatorStub = gaxGrpc.createStub( + opts.fallback + ? (protos as protobuf.Root).lookupService( + 'google.cloud.vision.v1p4beta1.ImageAnnotator' + ) + : // tslint:disable-next-line no-any + (protos as any).google.cloud.vision.v1p4beta1.ImageAnnotator, + opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const imageAnnotatorStubMethods = [ + 'batchAnnotateImages', + 'batchAnnotateFiles', + 'asyncBatchAnnotateImages', + 'asyncBatchAnnotateFiles', + ]; + + for (const methodName of imageAnnotatorStubMethods) { + const innerCallPromise = this.imageAnnotatorStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + return stub[methodName].apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const apiCall = gaxModule.createApiCall( + innerCallPromise, + defaults[methodName], + this._descriptors.page[methodName] || + this._descriptors.stream[methodName] || + this._descriptors.longrunning[methodName] + ); + + this._innerApiCalls[methodName] = ( + argument: {}, + callOptions?: CallOptions, + callback?: APICallback + ) => { + return apiCall(argument, callOptions, callback); + }; + } + } + + /** + * The DNS address for this API service. + */ + static get servicePath() { + return 'vision.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + */ + static get apiEndpoint() { + return 'vision.googleapis.com'; + } + + /** + * The port for this API service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/cloud-vision', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @param {function(Error, string)} callback - the callback to + * be called with the current project Id. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + batchAnnotateImages( + request: protosTypes.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse, + ( + | protosTypes.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest + | undefined + ), + {} | undefined + ] + >; + batchAnnotateImages( + request: protosTypes.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse, + | protosTypes.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest + | undefined, + {} | undefined + > + ): void; + /** + * Run image detection and annotation for a batch of images. + * + * @param {Object} request + * The request object that will be sent. + * @param {number[]} request.requests + * Required. Individual image annotation requests for this batch. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [BatchAnnotateImagesResponse]{@link google.cloud.vision.v1p4beta1.BatchAnnotateImagesResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + batchAnnotateImages( + request: protosTypes.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse, + | protosTypes.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse, + | protosTypes.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesResponse, + ( + | protosTypes.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + return this._innerApiCalls.batchAnnotateImages(request, options, callback); + } + batchAnnotateFiles( + request: protosTypes.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse, + ( + | protosTypes.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest + | undefined + ), + {} | undefined + ] + >; + batchAnnotateFiles( + request: protosTypes.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse, + | protosTypes.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest + | undefined, + {} | undefined + > + ): void; + /** + * Service that performs image detection and annotation for a batch of files. + * Now only "application/pdf", "image/tiff" and "image/gif" are supported. + * + * This service will extract at most 5 (customers can specify which 5 in + * AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each + * file provided and perform detection and annotation for each image + * extracted. + * + * @param {Object} request + * The request object that will be sent. + * @param {number[]} request.requests + * Required. The list of file annotation requests. Right now we support only + * one AnnotateFileRequest in BatchAnnotateFilesRequest. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [BatchAnnotateFilesResponse]{@link google.cloud.vision.v1p4beta1.BatchAnnotateFilesResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + batchAnnotateFiles( + request: protosTypes.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse, + | protosTypes.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse, + | protosTypes.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesResponse, + ( + | protosTypes.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + return this._innerApiCalls.batchAnnotateFiles(request, options, callback); + } + + asyncBatchAnnotateImages( + request: protosTypes.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest, + options?: gax.CallOptions + ): Promise< + [ + LROperation< + protosTypes.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse, + protosTypes.google.cloud.vision.v1p4beta1.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + asyncBatchAnnotateImages( + request: protosTypes.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest, + options: gax.CallOptions, + callback: Callback< + LROperation< + protosTypes.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse, + protosTypes.google.cloud.vision.v1p4beta1.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + > + ): void; + /** + * Run asynchronous image detection and annotation for a list of images. + * + * Progress and results can be retrieved through the + * `google.longrunning.Operations` interface. + * `Operation.metadata` contains `OperationMetadata` (metadata). + * `Operation.response` contains `AsyncBatchAnnotateImagesResponse` (results). + * + * This service will write image annotation outputs to json files in customer + * GCS bucket, each json file containing BatchAnnotateImagesResponse proto. + * + * @param {Object} request + * The request object that will be sent. + * @param {number[]} request.requests + * Required. Individual image annotation requests for this batch. + * @param {google.cloud.vision.v1p4beta1.OutputConfig} request.outputConfig + * Required. The desired output location and metadata (e.g. format). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + asyncBatchAnnotateImages( + request: protosTypes.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + LROperation< + protosTypes.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse, + protosTypes.google.cloud.vision.v1p4beta1.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + >, + callback?: Callback< + LROperation< + protosTypes.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse, + protosTypes.google.cloud.vision.v1p4beta1.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + > + ): Promise< + [ + LROperation< + protosTypes.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesResponse, + protosTypes.google.cloud.vision.v1p4beta1.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + return this._innerApiCalls.asyncBatchAnnotateImages( + request, + options, + callback + ); + } + asyncBatchAnnotateFiles( + request: protosTypes.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest, + options?: gax.CallOptions + ): Promise< + [ + LROperation< + protosTypes.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse, + protosTypes.google.cloud.vision.v1p4beta1.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + asyncBatchAnnotateFiles( + request: protosTypes.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest, + options: gax.CallOptions, + callback: Callback< + LROperation< + protosTypes.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse, + protosTypes.google.cloud.vision.v1p4beta1.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + > + ): void; + /** + * Run asynchronous image detection and annotation for a list of generic + * files, such as PDF files, which may contain multiple pages and multiple + * images per page. Progress and results can be retrieved through the + * `google.longrunning.Operations` interface. + * `Operation.metadata` contains `OperationMetadata` (metadata). + * `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results). + * + * @param {Object} request + * The request object that will be sent. + * @param {number[]} request.requests + * Required. Individual async file annotation requests for this batch. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + asyncBatchAnnotateFiles( + request: protosTypes.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + LROperation< + protosTypes.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse, + protosTypes.google.cloud.vision.v1p4beta1.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + >, + callback?: Callback< + LROperation< + protosTypes.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse, + protosTypes.google.cloud.vision.v1p4beta1.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + > + ): Promise< + [ + LROperation< + protosTypes.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesResponse, + protosTypes.google.cloud.vision.v1p4beta1.IOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + return this._innerApiCalls.asyncBatchAnnotateFiles( + request, + options, + callback + ); + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} product + * @returns {string} Resource name string. + */ + productPath(project: string, location: string, product: string) { + return this._pathTemplates.productPathTemplate.render({ + project, + location, + product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this._pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this._pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this._pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Return a fully-qualified productSet resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} product_set + * @returns {string} Resource name string. + */ + productSetPath(project: string, location: string, productSet: string) { + return this._pathTemplates.productSetPathTemplate.render({ + project, + location, + product_set: productSet, + }); + } + + /** + * Parse the project from ProductSet resource. + * + * @param {string} productSetName + * A fully-qualified path representing ProductSet resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductSetName(productSetName: string) { + return this._pathTemplates.productSetPathTemplate.match(productSetName) + .project; + } + + /** + * Parse the location from ProductSet resource. + * + * @param {string} productSetName + * A fully-qualified path representing ProductSet resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductSetName(productSetName: string) { + return this._pathTemplates.productSetPathTemplate.match(productSetName) + .location; + } + + /** + * Parse the product_set from ProductSet resource. + * + * @param {string} productSetName + * A fully-qualified path representing ProductSet resource. + * @returns {string} A string representing the product_set. + */ + matchProductSetFromProductSetName(productSetName: string) { + return this._pathTemplates.productSetPathTemplate.match(productSetName) + .product_set; + } + + /** + * Return a fully-qualified referenceImage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} product + * @param {string} reference_image + * @returns {string} Resource name string. + */ + referenceImagePath( + project: string, + location: string, + product: string, + referenceImage: string + ) { + return this._pathTemplates.referenceImagePathTemplate.render({ + project, + location, + product, + reference_image: referenceImage, + }); + } + + /** + * Parse the project from ReferenceImage resource. + * + * @param {string} referenceImageName + * A fully-qualified path representing ReferenceImage resource. + * @returns {string} A string representing the project. + */ + matchProjectFromReferenceImageName(referenceImageName: string) { + return this._pathTemplates.referenceImagePathTemplate.match( + referenceImageName + ).project; + } + + /** + * Parse the location from ReferenceImage resource. + * + * @param {string} referenceImageName + * A fully-qualified path representing ReferenceImage resource. + * @returns {string} A string representing the location. + */ + matchLocationFromReferenceImageName(referenceImageName: string) { + return this._pathTemplates.referenceImagePathTemplate.match( + referenceImageName + ).location; + } + + /** + * Parse the product from ReferenceImage resource. + * + * @param {string} referenceImageName + * A fully-qualified path representing ReferenceImage resource. + * @returns {string} A string representing the product. + */ + matchProductFromReferenceImageName(referenceImageName: string) { + return this._pathTemplates.referenceImagePathTemplate.match( + referenceImageName + ).product; + } + + /** + * Parse the reference_image from ReferenceImage resource. + * + * @param {string} referenceImageName + * A fully-qualified path representing ReferenceImage resource. + * @returns {string} A string representing the reference_image. + */ + matchReferenceImageFromReferenceImageName(referenceImageName: string) { + return this._pathTemplates.referenceImagePathTemplate.match( + referenceImageName + ).reference_image; + } + + /** + * Terminate the GRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + */ + close(): Promise { + if (!this._terminated) { + return this.imageAnnotatorStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} +import {FeaturesMethod} from '../helpers'; +export interface ImageAnnotatorClient extends FeaturesMethod {} diff --git a/packages/google-cloud-vision/src/v1p4beta1/image_annotator_client_config.json b/packages/google-cloud-vision/src/v1p4beta1/image_annotator_client_config.json index 9666bd1f923..e068ba98e78 100644 --- a/packages/google-cloud-vision/src/v1p4beta1/image_annotator_client_config.json +++ b/packages/google-cloud-vision/src/v1p4beta1/image_annotator_client_config.json @@ -2,11 +2,11 @@ "interfaces": { "google.cloud.vision.v1p4beta1.ImageAnnotator": { "retry_codes": { + "non_idempotent": [], "idempotent": [ "DEADLINE_EXCEEDED", "UNAVAILABLE" - ], - "non_idempotent": [] + ] }, "retry_params": { "default": { @@ -14,29 +14,29 @@ "retry_delay_multiplier": 1.3, "max_retry_delay_millis": 60000, "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1.0, + "rpc_timeout_multiplier": 1, "max_rpc_timeout_millis": 60000, "total_timeout_millis": 600000 } }, "methods": { "BatchAnnotateImages": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "BatchAnnotateFiles": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "AsyncBatchAnnotateImages": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "AsyncBatchAnnotateFiles": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" } diff --git a/packages/google-cloud-vision/src/v1p4beta1/image_annotator_proto_list.json b/packages/google-cloud-vision/src/v1p4beta1/image_annotator_proto_list.json index 75141cbc769..04693e0484d 100644 --- a/packages/google-cloud-vision/src/v1p4beta1/image_annotator_proto_list.json +++ b/packages/google-cloud-vision/src/v1p4beta1/image_annotator_proto_list.json @@ -1,3 +1,9 @@ [ - "../../protos/google/cloud/vision/v1p4beta1/image_annotator.proto" + "../../protos/google/cloud/vision/v1p4beta1/face.proto", + "../../protos/google/cloud/vision/v1p4beta1/geometry.proto", + "../../protos/google/cloud/vision/v1p4beta1/image_annotator.proto", + "../../protos/google/cloud/vision/v1p4beta1/product_search.proto", + "../../protos/google/cloud/vision/v1p4beta1/product_search_service.proto", + "../../protos/google/cloud/vision/v1p4beta1/text_annotation.proto", + "../../protos/google/cloud/vision/v1p4beta1/web_detection.proto" ] diff --git a/packages/google-cloud-vision/src/v1p4beta1/index.js b/packages/google-cloud-vision/src/v1p4beta1/index.js deleted file mode 100644 index d35c3834272..00000000000 --- a/packages/google-cloud-vision/src/v1p4beta1/index.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -'use strict'; - -const ProductSearchClient = require('./product_search_client'); -const ImageAnnotatorClient = require('./image_annotator_client'); - -module.exports.ProductSearchClient = ProductSearchClient; -module.exports.ImageAnnotatorClient = ImageAnnotatorClient; diff --git a/packages/google-cloud-vision/src/v1p4beta1/index.ts b/packages/google-cloud-vision/src/v1p4beta1/index.ts new file mode 100644 index 00000000000..de3f335b8a0 --- /dev/null +++ b/packages/google-cloud-vision/src/v1p4beta1/index.ts @@ -0,0 +1,20 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {ImageAnnotatorClient} from './image_annotator_client'; +export {ProductSearchClient} from './product_search_client'; diff --git a/packages/google-cloud-vision/src/v1p4beta1/product_search_client.js b/packages/google-cloud-vision/src/v1p4beta1/product_search_client.js deleted file mode 100644 index c41535db1ae..00000000000 --- a/packages/google-cloud-vision/src/v1p4beta1/product_search_client.js +++ /dev/null @@ -1,2315 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -'use strict'; - -const gapicConfig = require('./product_search_client_config.json'); -const gax = require('google-gax'); -const path = require('path'); - -const VERSION = require('../../package.json').version; - -/** - * Manages Products and ProductSets of reference images for use in product - * search. It uses the following resource model: - * - * - The API has a collection of - * ProductSet resources, named - * `projects/* /locations/* /productSets/*`, which acts as a way to put different - * products into groups to limit identification. - * - * In parallel, - * - * - The API has a collection of - * Product resources, named - * `projects/* /locations/* /products/*` - * - * - Each Product has a collection of - * ReferenceImage resources, - * named - * `projects/* /locations/* /products/* /referenceImages/*` - * - * @class - * @memberof v1p4beta1 - */ -class ProductSearchClient { - /** - * Construct an instance of ProductSearchClient. - * - * @param {object} [options] - The configuration object. See the subsequent - * parameters for more details. - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {function} [options.promise] - Custom promise module to use instead - * of native Promises. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - */ - constructor(opts) { - opts = opts || {}; - this._descriptors = {}; - - if (global.isBrowser) { - // If we're in browser, we use gRPC fallback. - opts.fallback = true; - } - - // If we are in browser, we are already using fallback because of the - // "browser" field in package.json. - // But if we were explicitly requested to use fallback, let's do it now. - const gaxModule = !global.isBrowser && opts.fallback ? gax.fallback : gax; - - const servicePath = - opts.servicePath || opts.apiEndpoint || this.constructor.servicePath; - - // Ensure that options include the service address and port. - opts = Object.assign( - { - clientConfig: {}, - port: this.constructor.port, - servicePath, - }, - opts - ); - - // Create a `gaxGrpc` object, with any grpc-specific options - // sent to the client. - opts.scopes = this.constructor.scopes; - const gaxGrpc = new gaxModule.GrpcClient(opts); - - // Save the auth object to the client, for use by other methods. - this.auth = gaxGrpc.auth; - - // Determine the client header string. - const clientHeader = []; - - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } - clientHeader.push(`gax/${gaxModule.version}`); - if (opts.fallback) { - clientHeader.push(`gl-web/${gaxModule.version}`); - } else { - clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`); - } - clientHeader.push(`gapic/${VERSION}`); - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - - // Load the applicable protos. - // For Node.js, pass the path to JSON proto file. - // For browsers, pass the JSON content. - - const nodejsProtoPath = path.join( - __dirname, - '..', - '..', - 'protos', - 'protos.json' - ); - const protos = gaxGrpc.loadProto( - opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath - ); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this._pathTemplates = { - locationPathTemplate: new gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - productPathTemplate: new gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/products/{product}' - ), - productSetPathTemplate: new gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/productSets/{product_set}' - ), - referenceImagePathTemplate: new gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this._descriptors.page = { - listProductSets: new gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'productSets' - ), - listProducts: new gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'products' - ), - listReferenceImages: new gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'referenceImages' - ), - listProductsInProductSet: new gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'products' - ), - }; - - const protoFilesRoot = opts.fallback - ? gaxModule.protobuf.Root.fromJSON(require('../../protos/protos.json')) - : gaxModule.protobuf.loadSync(nodejsProtoPath); - - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - this.operationsClient = new gaxModule.lro({ - auth: gaxGrpc.auth, - grpc: gaxGrpc.grpc, - }).operationsClient(opts); - - const importProductSetsResponse = protoFilesRoot.lookup( - 'google.cloud.vision.v1p4beta1.ImportProductSetsResponse' - ); - const importProductSetsMetadata = protoFilesRoot.lookup( - 'google.cloud.vision.v1p4beta1.BatchOperationMetadata' - ); - - this._descriptors.longrunning = { - importProductSets: new gaxModule.LongrunningDescriptor( - this.operationsClient, - importProductSetsResponse.decode.bind(importProductSetsResponse), - importProductSetsMetadata.decode.bind(importProductSetsMetadata) - ), - }; - - // Put together the default options sent with requests. - const defaults = gaxGrpc.constructSettings( - 'google.cloud.vision.v1p4beta1.ProductSearch', - gapicConfig, - opts.clientConfig, - {'x-goog-api-client': clientHeader.join(' ')} - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this._innerApiCalls = {}; - - // Put together the "service stub" for - // google.cloud.vision.v1p4beta1.ProductSearch. - const productSearchStub = gaxGrpc.createStub( - opts.fallback - ? protos.lookupService('google.cloud.vision.v1p4beta1.ProductSearch') - : protos.google.cloud.vision.v1p4beta1.ProductSearch, - opts - ); - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const productSearchStubMethods = [ - 'createProductSet', - 'listProductSets', - 'getProductSet', - 'updateProductSet', - 'deleteProductSet', - 'createProduct', - 'listProducts', - 'getProduct', - 'updateProduct', - 'deleteProduct', - 'createReferenceImage', - 'deleteReferenceImage', - 'listReferenceImages', - 'getReferenceImage', - 'addProductToProductSet', - 'removeProductFromProductSet', - 'listProductsInProductSet', - 'importProductSets', - 'purgeProducts', - ]; - for (const methodName of productSearchStubMethods) { - const innerCallPromise = productSearchStub.then( - stub => (...args) => { - return stub[methodName].apply(stub, args); - }, - err => () => { - throw err; - } - ); - this._innerApiCalls[methodName] = gaxModule.createApiCall( - innerCallPromise, - defaults[methodName], - this._descriptors.page[methodName] || - this._descriptors.longrunning[methodName] - ); - } - } - - /** - * The DNS address for this API service. - */ - static get servicePath() { - return 'vision.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath(), - * exists for compatibility reasons. - */ - static get apiEndpoint() { - return 'vision.googleapis.com'; - } - - /** - * The port for this API service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloud-vision', - ]; - } - - /** - * Return the project ID used by this class. - * @param {function(Error, string)} callback - the callback to - * be called with the current project Id. - */ - getProjectId(callback) { - return this.auth.getProjectId(callback); - } - - // ------------------- - // -- Service calls -- - // ------------------- - - /** - * Creates and returns a new ProductSet resource. - * - * Possible errors: - * - * * Returns INVALID_ARGUMENT if display_name is missing, or is longer than - * 4096 characters. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project in which the ProductSet should be created. - * - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - * @param {Object} request.productSet - * Required. The ProductSet to create. - * - * This object should have the same structure as [ProductSet]{@link google.cloud.vision.v1p4beta1.ProductSet} - * @param {string} request.productSetId - * A user-supplied resource id for this ProductSet. If set, the server will - * attempt to use this value as the resource id. If it is already in use, an - * error is returned with code ALREADY_EXISTS. Must be at most 128 characters - * long. It cannot contain the character `/`. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [ProductSet]{@link google.cloud.vision.v1p4beta1.ProductSet}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ProductSet]{@link google.cloud.vision.v1p4beta1.ProductSet}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('vision.v1p4beta1'); - * - * const client = new vision.v1p4beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * const productSet = {}; - * const productSetId = ''; - * const request = { - * parent: formattedParent, - * productSet: productSet, - * productSetId: productSetId, - * }; - * client.createProductSet(request) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - createProductSet(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent, - }); - - return this._innerApiCalls.createProductSet(request, options, callback); - } - - /** - * Lists ProductSets in an unspecified order. - * - * Possible errors: - * - * * Returns INVALID_ARGUMENT if page_size is greater than 100, or less - * than 1. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project from which ProductSets should be listed. - * - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - * @param {number} [request.pageSize] - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Array, ?Object, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is Array of [ProductSet]{@link google.cloud.vision.v1p4beta1.ProductSet}. - * - * When autoPaginate: false is specified through options, it contains the result - * in a single response. If the response indicates the next page exists, the third - * parameter is set to be used for the next request object. The fourth parameter keeps - * the raw response object of an object representing [ListProductSetsResponse]{@link google.cloud.vision.v1p4beta1.ListProductSetsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [ProductSet]{@link google.cloud.vision.v1p4beta1.ProductSet}. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [ProductSet]{@link google.cloud.vision.v1p4beta1.ProductSet} in a single response. - * The second element is the next request object if the response - * indicates the next page exists, or null. The third element is - * an object representing [ListProductSetsResponse]{@link google.cloud.vision.v1p4beta1.ListProductSetsResponse}. - * - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('vision.v1p4beta1'); - * - * const client = new vision.v1p4beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * // Iterate over all elements. - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * - * client.listProductSets({parent: formattedParent}) - * .then(responses => { - * const resources = responses[0]; - * for (const resource of resources) { - * // doThingsWith(resource) - * } - * }) - * .catch(err => { - * console.error(err); - * }); - * - * // Or obtain the paged response. - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * - * - * const options = {autoPaginate: false}; - * const callback = responses => { - * // The actual resources in a response. - * const resources = responses[0]; - * // The next request if the response shows that there are more responses. - * const nextRequest = responses[1]; - * // The actual response object, if necessary. - * // const rawResponse = responses[2]; - * for (const resource of resources) { - * // doThingsWith(resource); - * } - * if (nextRequest) { - * // Fetch the next page. - * return client.listProductSets(nextRequest, options).then(callback); - * } - * } - * client.listProductSets({parent: formattedParent}, options) - * .then(callback) - * .catch(err => { - * console.error(err); - * }); - */ - listProductSets(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent, - }); - - return this._innerApiCalls.listProductSets(request, options, callback); - } - - /** - * Equivalent to {@link listProductSets}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link listProductSets} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project from which ProductSets should be listed. - * - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - * @param {number} [request.pageSize] - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @returns {Stream} - * An object stream which emits an object representing [ProductSet]{@link google.cloud.vision.v1p4beta1.ProductSet} on 'data' event. - * - * @example - * - * const vision = require('vision.v1p4beta1'); - * - * const client = new vision.v1p4beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * client.listProductSetsStream({parent: formattedParent}) - * .on('data', element => { - * // doThingsWith(element) - * }).on('error', err => { - * console.log(err); - * }); - */ - listProductSetsStream(request, options) { - options = options || {}; - - return this._descriptors.page.listProductSets.createStream( - this._innerApiCalls.listProductSets, - request, - options - ); - } - - /** - * Gets information associated with a ProductSet. - * - * Possible errors: - * - * * Returns NOT_FOUND if the ProductSet does not exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the ProductSet to get. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [ProductSet]{@link google.cloud.vision.v1p4beta1.ProductSet}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ProductSet]{@link google.cloud.vision.v1p4beta1.ProductSet}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('vision.v1p4beta1'); - * - * const client = new vision.v1p4beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedName = client.productSetPath('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); - * client.getProductSet({name: formattedName}) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - getProductSet(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name, - }); - - return this._innerApiCalls.getProductSet(request, options, callback); - } - - /** - * Makes changes to a ProductSet resource. - * Only display_name can be updated currently. - * - * Possible errors: - * - * * Returns NOT_FOUND if the ProductSet does not exist. - * * Returns INVALID_ARGUMENT if display_name is present in update_mask but - * missing from the request or longer than 4096 characters. - * - * @param {Object} request - * The request object that will be sent. - * @param {Object} request.productSet - * Required. The ProductSet resource which replaces the one on the server. - * - * This object should have the same structure as [ProductSet]{@link google.cloud.vision.v1p4beta1.ProductSet} - * @param {Object} request.updateMask - * The FieldMask that specifies which fields to - * update. - * If update_mask isn't specified, all mutable fields are to be updated. - * Valid mask path is `display_name`. - * - * This object should have the same structure as [FieldMask]{@link google.protobuf.FieldMask} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [ProductSet]{@link google.cloud.vision.v1p4beta1.ProductSet}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ProductSet]{@link google.cloud.vision.v1p4beta1.ProductSet}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('vision.v1p4beta1'); - * - * const client = new vision.v1p4beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const productSet = {}; - * const updateMask = {}; - * const request = { - * productSet: productSet, - * updateMask: updateMask, - * }; - * client.updateProductSet(request) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - updateProductSet(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'product_set.name': request.productSet.name, - }); - - return this._innerApiCalls.updateProductSet(request, options, callback); - } - - /** - * Permanently deletes a ProductSet. Products and ReferenceImages in the - * ProductSet are not deleted. - * - * The actual image files are not deleted from Google Cloud Storage. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the ProductSet to delete. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error)} [callback] - * The function which will be called with the result of the API call. - * @returns {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('vision.v1p4beta1'); - * - * const client = new vision.v1p4beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedName = client.productSetPath('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); - * client.deleteProductSet({name: formattedName}).catch(err => { - * console.error(err); - * }); - */ - deleteProductSet(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name, - }); - - return this._innerApiCalls.deleteProductSet(request, options, callback); - } - - /** - * Creates and returns a new product resource. - * - * Possible errors: - * - * * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 - * characters. - * * Returns INVALID_ARGUMENT if description is longer than 4096 characters. - * * Returns INVALID_ARGUMENT if product_category is missing or invalid. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project in which the Product should be created. - * - * Format is - * `projects/PROJECT_ID/locations/LOC_ID`. - * @param {Object} request.product - * Required. The product to create. - * - * This object should have the same structure as [Product]{@link google.cloud.vision.v1p4beta1.Product} - * @param {string} request.productId - * A user-supplied resource id for this Product. If set, the server will - * attempt to use this value as the resource id. If it is already in use, an - * error is returned with code ALREADY_EXISTS. Must be at most 128 characters - * long. It cannot contain the character `/`. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [Product]{@link google.cloud.vision.v1p4beta1.Product}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Product]{@link google.cloud.vision.v1p4beta1.Product}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('vision.v1p4beta1'); - * - * const client = new vision.v1p4beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * const product = {}; - * const productId = ''; - * const request = { - * parent: formattedParent, - * product: product, - * productId: productId, - * }; - * client.createProduct(request) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - createProduct(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent, - }); - - return this._innerApiCalls.createProduct(request, options, callback); - } - - /** - * Lists products in an unspecified order. - * - * Possible errors: - * - * * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project OR ProductSet from which Products should be listed. - * - * Format: - * `projects/PROJECT_ID/locations/LOC_ID` - * @param {number} [request.pageSize] - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Array, ?Object, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is Array of [Product]{@link google.cloud.vision.v1p4beta1.Product}. - * - * When autoPaginate: false is specified through options, it contains the result - * in a single response. If the response indicates the next page exists, the third - * parameter is set to be used for the next request object. The fourth parameter keeps - * the raw response object of an object representing [ListProductsResponse]{@link google.cloud.vision.v1p4beta1.ListProductsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Product]{@link google.cloud.vision.v1p4beta1.Product}. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [Product]{@link google.cloud.vision.v1p4beta1.Product} in a single response. - * The second element is the next request object if the response - * indicates the next page exists, or null. The third element is - * an object representing [ListProductsResponse]{@link google.cloud.vision.v1p4beta1.ListProductsResponse}. - * - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('vision.v1p4beta1'); - * - * const client = new vision.v1p4beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * // Iterate over all elements. - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * - * client.listProducts({parent: formattedParent}) - * .then(responses => { - * const resources = responses[0]; - * for (const resource of resources) { - * // doThingsWith(resource) - * } - * }) - * .catch(err => { - * console.error(err); - * }); - * - * // Or obtain the paged response. - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * - * - * const options = {autoPaginate: false}; - * const callback = responses => { - * // The actual resources in a response. - * const resources = responses[0]; - * // The next request if the response shows that there are more responses. - * const nextRequest = responses[1]; - * // The actual response object, if necessary. - * // const rawResponse = responses[2]; - * for (const resource of resources) { - * // doThingsWith(resource); - * } - * if (nextRequest) { - * // Fetch the next page. - * return client.listProducts(nextRequest, options).then(callback); - * } - * } - * client.listProducts({parent: formattedParent}, options) - * .then(callback) - * .catch(err => { - * console.error(err); - * }); - */ - listProducts(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent, - }); - - return this._innerApiCalls.listProducts(request, options, callback); - } - - /** - * Equivalent to {@link listProducts}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link listProducts} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project OR ProductSet from which Products should be listed. - * - * Format: - * `projects/PROJECT_ID/locations/LOC_ID` - * @param {number} [request.pageSize] - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @returns {Stream} - * An object stream which emits an object representing [Product]{@link google.cloud.vision.v1p4beta1.Product} on 'data' event. - * - * @example - * - * const vision = require('vision.v1p4beta1'); - * - * const client = new vision.v1p4beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * client.listProductsStream({parent: formattedParent}) - * .on('data', element => { - * // doThingsWith(element) - * }).on('error', err => { - * console.log(err); - * }); - */ - listProductsStream(request, options) { - options = options || {}; - - return this._descriptors.page.listProducts.createStream( - this._innerApiCalls.listProducts, - request, - options - ); - } - - /** - * Gets information associated with a Product. - * - * Possible errors: - * - * * Returns NOT_FOUND if the Product does not exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the Product to get. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [Product]{@link google.cloud.vision.v1p4beta1.Product}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Product]{@link google.cloud.vision.v1p4beta1.Product}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('vision.v1p4beta1'); - * - * const client = new vision.v1p4beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedName = client.productPath('[PROJECT]', '[LOCATION]', '[PRODUCT]'); - * client.getProduct({name: formattedName}) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - getProduct(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name, - }); - - return this._innerApiCalls.getProduct(request, options, callback); - } - - /** - * Makes changes to a Product resource. - * Only the `display_name`, `description`, and `labels` fields can be updated - * right now. - * - * If labels are updated, the change will not be reflected in queries until - * the next index time. - * - * Possible errors: - * - * * Returns NOT_FOUND if the Product does not exist. - * * Returns INVALID_ARGUMENT if display_name is present in update_mask but is - * missing from the request or longer than 4096 characters. - * * Returns INVALID_ARGUMENT if description is present in update_mask but is - * longer than 4096 characters. - * * Returns INVALID_ARGUMENT if product_category is present in update_mask. - * - * @param {Object} request - * The request object that will be sent. - * @param {Object} request.product - * Required. The Product resource which replaces the one on the server. - * product.name is immutable. - * - * This object should have the same structure as [Product]{@link google.cloud.vision.v1p4beta1.Product} - * @param {Object} request.updateMask - * The FieldMask that specifies which fields - * to update. - * If update_mask isn't specified, all mutable fields are to be updated. - * Valid mask paths include `product_labels`, `display_name`, and - * `description`. - * - * This object should have the same structure as [FieldMask]{@link google.protobuf.FieldMask} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [Product]{@link google.cloud.vision.v1p4beta1.Product}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Product]{@link google.cloud.vision.v1p4beta1.Product}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('vision.v1p4beta1'); - * - * const client = new vision.v1p4beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const product = {}; - * const updateMask = {}; - * const request = { - * product: product, - * updateMask: updateMask, - * }; - * client.updateProduct(request) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - updateProduct(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'product.name': request.product.name, - }); - - return this._innerApiCalls.updateProduct(request, options, callback); - } - - /** - * Permanently deletes a product and its reference images. - * - * Metadata of the product and all its images will be deleted right away, but - * search queries against ProductSets containing the product may still work - * until all related caches are refreshed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of product to delete. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error)} [callback] - * The function which will be called with the result of the API call. - * @returns {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('vision.v1p4beta1'); - * - * const client = new vision.v1p4beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedName = client.productPath('[PROJECT]', '[LOCATION]', '[PRODUCT]'); - * client.deleteProduct({name: formattedName}).catch(err => { - * console.error(err); - * }); - */ - deleteProduct(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name, - }); - - return this._innerApiCalls.deleteProduct(request, options, callback); - } - - /** - * Creates and returns a new ReferenceImage resource. - * - * The `bounding_poly` field is optional. If `bounding_poly` is not specified, - * the system will try to detect regions of interest in the image that are - * compatible with the product_category on the parent product. If it is - * specified, detection is ALWAYS skipped. The system converts polygons into - * non-rotated rectangles. - * - * Note that the pipeline will resize the image if the image resolution is too - * large to process (above 50MP). - * - * Possible errors: - * - * * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 - * characters. - * * Returns INVALID_ARGUMENT if the product does not exist. - * * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing - * compatible with the parent product's product_category is detected. - * * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the product in which to create the reference - * image. - * - * Format is - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. - * @param {Object} request.referenceImage - * Required. The reference image to create. - * If an image ID is specified, it is ignored. - * - * This object should have the same structure as [ReferenceImage]{@link google.cloud.vision.v1p4beta1.ReferenceImage} - * @param {string} request.referenceImageId - * A user-supplied resource id for the ReferenceImage to be added. If set, - * the server will attempt to use this value as the resource id. If it is - * already in use, an error is returned with code ALREADY_EXISTS. Must be at - * most 128 characters long. It cannot contain the character `/`. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [ReferenceImage]{@link google.cloud.vision.v1p4beta1.ReferenceImage}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ReferenceImage]{@link google.cloud.vision.v1p4beta1.ReferenceImage}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('vision.v1p4beta1'); - * - * const client = new vision.v1p4beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedParent = client.productPath('[PROJECT]', '[LOCATION]', '[PRODUCT]'); - * const referenceImage = {}; - * const referenceImageId = ''; - * const request = { - * parent: formattedParent, - * referenceImage: referenceImage, - * referenceImageId: referenceImageId, - * }; - * client.createReferenceImage(request) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - createReferenceImage(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent, - }); - - return this._innerApiCalls.createReferenceImage(request, options, callback); - } - - /** - * Permanently deletes a reference image. - * - * The image metadata will be deleted right away, but search queries - * against ProductSets containing the image may still work until all related - * caches are refreshed. - * - * The actual image files are not deleted from Google Cloud Storage. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the reference image to delete. - * - * Format is: - * - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error)} [callback] - * The function which will be called with the result of the API call. - * @returns {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('vision.v1p4beta1'); - * - * const client = new vision.v1p4beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedName = client.referenceImagePath('[PROJECT]', '[LOCATION]', '[PRODUCT]', '[REFERENCE_IMAGE]'); - * client.deleteReferenceImage({name: formattedName}).catch(err => { - * console.error(err); - * }); - */ - deleteReferenceImage(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name, - }); - - return this._innerApiCalls.deleteReferenceImage(request, options, callback); - } - - /** - * Lists reference images. - * - * Possible errors: - * - * * Returns NOT_FOUND if the parent product does not exist. - * * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less - * than 1. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the product containing the reference images. - * - * Format is - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. - * @param {number} [request.pageSize] - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Array, ?Object, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is Array of [ReferenceImage]{@link google.cloud.vision.v1p4beta1.ReferenceImage}. - * - * When autoPaginate: false is specified through options, it contains the result - * in a single response. If the response indicates the next page exists, the third - * parameter is set to be used for the next request object. The fourth parameter keeps - * the raw response object of an object representing [ListReferenceImagesResponse]{@link google.cloud.vision.v1p4beta1.ListReferenceImagesResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [ReferenceImage]{@link google.cloud.vision.v1p4beta1.ReferenceImage}. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [ReferenceImage]{@link google.cloud.vision.v1p4beta1.ReferenceImage} in a single response. - * The second element is the next request object if the response - * indicates the next page exists, or null. The third element is - * an object representing [ListReferenceImagesResponse]{@link google.cloud.vision.v1p4beta1.ListReferenceImagesResponse}. - * - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('vision.v1p4beta1'); - * - * const client = new vision.v1p4beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * // Iterate over all elements. - * const formattedParent = client.productPath('[PROJECT]', '[LOCATION]', '[PRODUCT]'); - * - * client.listReferenceImages({parent: formattedParent}) - * .then(responses => { - * const resources = responses[0]; - * for (const resource of resources) { - * // doThingsWith(resource) - * } - * }) - * .catch(err => { - * console.error(err); - * }); - * - * // Or obtain the paged response. - * const formattedParent = client.productPath('[PROJECT]', '[LOCATION]', '[PRODUCT]'); - * - * - * const options = {autoPaginate: false}; - * const callback = responses => { - * // The actual resources in a response. - * const resources = responses[0]; - * // The next request if the response shows that there are more responses. - * const nextRequest = responses[1]; - * // The actual response object, if necessary. - * // const rawResponse = responses[2]; - * for (const resource of resources) { - * // doThingsWith(resource); - * } - * if (nextRequest) { - * // Fetch the next page. - * return client.listReferenceImages(nextRequest, options).then(callback); - * } - * } - * client.listReferenceImages({parent: formattedParent}, options) - * .then(callback) - * .catch(err => { - * console.error(err); - * }); - */ - listReferenceImages(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent, - }); - - return this._innerApiCalls.listReferenceImages(request, options, callback); - } - - /** - * Equivalent to {@link listReferenceImages}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link listReferenceImages} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the product containing the reference images. - * - * Format is - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. - * @param {number} [request.pageSize] - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @returns {Stream} - * An object stream which emits an object representing [ReferenceImage]{@link google.cloud.vision.v1p4beta1.ReferenceImage} on 'data' event. - * - * @example - * - * const vision = require('vision.v1p4beta1'); - * - * const client = new vision.v1p4beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedParent = client.productPath('[PROJECT]', '[LOCATION]', '[PRODUCT]'); - * client.listReferenceImagesStream({parent: formattedParent}) - * .on('data', element => { - * // doThingsWith(element) - * }).on('error', err => { - * console.log(err); - * }); - */ - listReferenceImagesStream(request, options) { - options = options || {}; - - return this._descriptors.page.listReferenceImages.createStream( - this._innerApiCalls.listReferenceImages, - request, - options - ); - } - - /** - * Gets information associated with a ReferenceImage. - * - * Possible errors: - * - * * Returns NOT_FOUND if the specified image does not exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ReferenceImage to get. - * - * Format is: - * - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [ReferenceImage]{@link google.cloud.vision.v1p4beta1.ReferenceImage}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ReferenceImage]{@link google.cloud.vision.v1p4beta1.ReferenceImage}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('vision.v1p4beta1'); - * - * const client = new vision.v1p4beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedName = client.referenceImagePath('[PROJECT]', '[LOCATION]', '[PRODUCT]', '[REFERENCE_IMAGE]'); - * client.getReferenceImage({name: formattedName}) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - getReferenceImage(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name, - }); - - return this._innerApiCalls.getReferenceImage(request, options, callback); - } - - /** - * Adds a Product to the specified ProductSet. If the Product is already - * present, no change is made. - * - * One Product can be added to at most 100 ProductSets. - * - * Possible errors: - * - * * Returns NOT_FOUND if the Product or the ProductSet doesn't exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for the ProductSet to modify. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * @param {string} request.product - * Required. The resource name for the Product to be added to this ProductSet. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error)} [callback] - * The function which will be called with the result of the API call. - * @returns {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('vision.v1p4beta1'); - * - * const client = new vision.v1p4beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedName = client.productSetPath('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); - * const product = ''; - * const request = { - * name: formattedName, - * product: product, - * }; - * client.addProductToProductSet(request).catch(err => { - * console.error(err); - * }); - */ - addProductToProductSet(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name, - }); - - return this._innerApiCalls.addProductToProductSet( - request, - options, - callback - ); - } - - /** - * Removes a Product from the specified ProductSet. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for the ProductSet to modify. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * @param {string} request.product - * Required. The resource name for the Product to be removed from this - * ProductSet. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error)} [callback] - * The function which will be called with the result of the API call. - * @returns {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('vision.v1p4beta1'); - * - * const client = new vision.v1p4beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedName = client.productSetPath('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); - * const product = ''; - * const request = { - * name: formattedName, - * product: product, - * }; - * client.removeProductFromProductSet(request).catch(err => { - * console.error(err); - * }); - */ - removeProductFromProductSet(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name, - }); - - return this._innerApiCalls.removeProductFromProductSet( - request, - options, - callback - ); - } - - /** - * Lists the Products in a ProductSet, in an unspecified order. If the - * ProductSet does not exist, the products field of the response will be - * empty. - * - * Possible errors: - * - * * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The ProductSet resource for which to retrieve Products. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * @param {number} [request.pageSize] - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Array, ?Object, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is Array of [Product]{@link google.cloud.vision.v1p4beta1.Product}. - * - * When autoPaginate: false is specified through options, it contains the result - * in a single response. If the response indicates the next page exists, the third - * parameter is set to be used for the next request object. The fourth parameter keeps - * the raw response object of an object representing [ListProductsInProductSetResponse]{@link google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of [Product]{@link google.cloud.vision.v1p4beta1.Product}. - * - * When autoPaginate: false is specified through options, the array has three elements. - * The first element is Array of [Product]{@link google.cloud.vision.v1p4beta1.Product} in a single response. - * The second element is the next request object if the response - * indicates the next page exists, or null. The third element is - * an object representing [ListProductsInProductSetResponse]{@link google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse}. - * - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('vision.v1p4beta1'); - * - * const client = new vision.v1p4beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * // Iterate over all elements. - * const formattedName = client.productSetPath('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); - * - * client.listProductsInProductSet({name: formattedName}) - * .then(responses => { - * const resources = responses[0]; - * for (const resource of resources) { - * // doThingsWith(resource) - * } - * }) - * .catch(err => { - * console.error(err); - * }); - * - * // Or obtain the paged response. - * const formattedName = client.productSetPath('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); - * - * - * const options = {autoPaginate: false}; - * const callback = responses => { - * // The actual resources in a response. - * const resources = responses[0]; - * // The next request if the response shows that there are more responses. - * const nextRequest = responses[1]; - * // The actual response object, if necessary. - * // const rawResponse = responses[2]; - * for (const resource of resources) { - * // doThingsWith(resource); - * } - * if (nextRequest) { - * // Fetch the next page. - * return client.listProductsInProductSet(nextRequest, options).then(callback); - * } - * } - * client.listProductsInProductSet({name: formattedName}, options) - * .then(callback) - * .catch(err => { - * console.error(err); - * }); - */ - listProductsInProductSet(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - name: request.name, - }); - - return this._innerApiCalls.listProductsInProductSet( - request, - options, - callback - ); - } - - /** - * Equivalent to {@link listProductsInProductSet}, but returns a NodeJS Stream object. - * - * This fetches the paged responses for {@link listProductsInProductSet} continuously - * and invokes the callback registered for 'data' event for each element in the - * responses. - * - * The returned object has 'end' method when no more elements are required. - * - * autoPaginate option will be ignored. - * - * @see {@link https://nodejs.org/api/stream.html} - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The ProductSet resource for which to retrieve Products. - * - * Format is: - * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` - * @param {number} [request.pageSize] - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @returns {Stream} - * An object stream which emits an object representing [Product]{@link google.cloud.vision.v1p4beta1.Product} on 'data' event. - * - * @example - * - * const vision = require('vision.v1p4beta1'); - * - * const client = new vision.v1p4beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedName = client.productSetPath('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]'); - * client.listProductsInProductSetStream({name: formattedName}) - * .on('data', element => { - * // doThingsWith(element) - * }).on('error', err => { - * console.log(err); - * }); - */ - listProductsInProductSetStream(request, options) { - options = options || {}; - - return this._descriptors.page.listProductsInProductSet.createStream( - this._innerApiCalls.listProductsInProductSet, - request, - options - ); - } - - /** - * Asynchronous API that imports a list of reference images to specified - * product sets based on a list of image information. - * - * The google.longrunning.Operation API can be - * used to keep track of the progress and results of the request. - * `Operation.metadata` contains `BatchOperationMetadata`. (progress) - * `Operation.response` contains `ImportProductSetsResponse`. (results) - * - * The input source of this method is a csv file on Google Cloud Storage. - * For the format of the csv file please see - * ImportProductSetsGcsSource.csv_file_uri. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project in which the ProductSets should be imported. - * - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - * @param {Object} request.inputConfig - * Required. The input content for the list of requests. - * - * This object should have the same structure as [ImportProductSetsInputConfig]{@link google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig} - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/classes/Operation.html} object. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is a [gax.Operation]{@link https://googleapis.github.io/gax-nodejs/classes/Operation.html} object. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('vision.v1p4beta1'); - * - * const client = new vision.v1p4beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * const inputConfig = {}; - * const request = { - * parent: formattedParent, - * inputConfig: inputConfig, - * }; - * - * // Handle the operation using the promise pattern. - * client.importProductSets(request) - * .then(responses => { - * const [operation, initialApiResponse] = responses; - * - * // Operation#promise starts polling for the completion of the LRO. - * return operation.promise(); - * }) - * .then(responses => { - * const result = responses[0]; - * const metadata = responses[1]; - * const finalApiResponse = responses[2]; - * }) - * .catch(err => { - * console.error(err); - * }); - * - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * const inputConfig = {}; - * const request = { - * parent: formattedParent, - * inputConfig: inputConfig, - * }; - * - * // Handle the operation using the event emitter pattern. - * client.importProductSets(request) - * .then(responses => { - * const [operation, initialApiResponse] = responses; - * - * // Adding a listener for the "complete" event starts polling for the - * // completion of the operation. - * operation.on('complete', (result, metadata, finalApiResponse) => { - * // doSomethingWith(result); - * }); - * - * // Adding a listener for the "progress" event causes the callback to be - * // called on any change in metadata when the operation is polled. - * operation.on('progress', (metadata, apiResponse) => { - * // doSomethingWith(metadata) - * }); - * - * // Adding a listener for the "error" event handles any errors found during polling. - * operation.on('error', err => { - * // throw(err); - * }); - * }) - * .catch(err => { - * console.error(err); - * }); - * - * const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - * const inputConfig = {}; - * const request = { - * parent: formattedParent, - * inputConfig: inputConfig, - * }; - * - * // Handle the operation using the await pattern. - * const [operation] = await client.importProductSets(request); - * - * const [response] = await operation.promise(); - */ - importProductSets(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent, - }); - - return this._innerApiCalls.importProductSets(request, options, callback); - } - - /** - * Asynchronous API to delete all Products in a ProductSet or all Products - * that are in no ProductSet. - * - * If a Product is a member of the specified ProductSet in addition to other - * ProductSets, the Product will still be deleted. - * - * It is recommended to not delete the specified ProductSet until after this - * operation has completed. It is also recommended to not add any of the - * Products involved in the batch delete to a new ProductSet while this - * operation is running because those Products may still end up deleted. - * - * It's not possible to undo the PurgeProducts operation. Therefore, it is - * recommended to keep the csv files used in ImportProductSets (if that was - * how you originally built the Product Set) before starting PurgeProducts, in - * case you need to re-import the data after deletion. - * - * If the plan is to purge all of the Products from a ProductSet and then - * re-use the empty ProductSet to re-import new Products into the empty - * ProductSet, you must wait until the PurgeProducts operation has finished - * for that ProductSet. - * - * The google.longrunning.Operation API can be - * used to keep track of the progress and results of the request. - * `Operation.metadata` contains `BatchOperationMetadata`. (progress) - * - * @param {Object} request - * The request object that will be sent. - * @param {Object} [request.productSetPurgeConfig] - * Specify which ProductSet contains the Products to be deleted. - * - * This object should have the same structure as [ProductSetPurgeConfig]{@link google.cloud.vision.v1p4beta1.ProductSetPurgeConfig} - * @param {boolean} [request.deleteOrphanProducts] - * If delete_orphan_products is true, all Products that are not in any - * ProductSet will be deleted. - * @param {string} [request.parent] - * Required. The project and location in which the Products should be deleted. - * - * Format is `projects/PROJECT_ID/locations/LOC_ID`. - * @param {boolean} [request.force] - * The default value is false. Override this value to true to actually perform - * the purge. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing [Operation]{@link google.longrunning.Operation}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * - * const vision = require('vision.v1p4beta1'); - * - * const client = new vision.v1p4beta1.ProductSearchClient({ - * // optional auth parameters. - * }); - * - * - * client.purgeProducts({}) - * .then(responses => { - * const response = responses[0]; - * // doThingsWith(response) - * }) - * .catch(err => { - * console.error(err); - * }); - */ - purgeProducts(request, options, callback) { - if (options instanceof Function && callback === undefined) { - callback = options; - options = {}; - } - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - parent: request.parent, - }); - - return this._innerApiCalls.purgeProducts(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified location resource name string. - * - * @param {String} project - * @param {String} location - * @returns {String} - */ - locationPath(project, location) { - return this._pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {String} project - * @param {String} location - * @param {String} product - * @returns {String} - */ - productPath(project, location, product) { - return this._pathTemplates.productPathTemplate.render({ - project: project, - location: location, - product: product, - }); - } - - /** - * Return a fully-qualified product_set resource name string. - * - * @param {String} project - * @param {String} location - * @param {String} productSet - * @returns {String} - */ - productSetPath(project, location, productSet) { - return this._pathTemplates.productSetPathTemplate.render({ - project: project, - location: location, - product_set: productSet, - }); - } - - /** - * Return a fully-qualified reference_image resource name string. - * - * @param {String} project - * @param {String} location - * @param {String} product - * @param {String} referenceImage - * @returns {String} - */ - referenceImagePath(project, location, product, referenceImage) { - return this._pathTemplates.referenceImagePathTemplate.render({ - project: project, - location: location, - product: product, - reference_image: referenceImage, - }); - } - - /** - * Parse the locationName from a location resource. - * - * @param {String} locationName - * A fully-qualified path representing a location resources. - * @returns {String} - A string representing the project. - */ - matchProjectFromLocationName(locationName) { - return this._pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the locationName from a location resource. - * - * @param {String} locationName - * A fully-qualified path representing a location resources. - * @returns {String} - A string representing the location. - */ - matchLocationFromLocationName(locationName) { - return this._pathTemplates.locationPathTemplate.match(locationName) - .location; - } - - /** - * Parse the productName from a product resource. - * - * @param {String} productName - * A fully-qualified path representing a product resources. - * @returns {String} - A string representing the project. - */ - matchProjectFromProductName(productName) { - return this._pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the productName from a product resource. - * - * @param {String} productName - * A fully-qualified path representing a product resources. - * @returns {String} - A string representing the location. - */ - matchLocationFromProductName(productName) { - return this._pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the productName from a product resource. - * - * @param {String} productName - * A fully-qualified path representing a product resources. - * @returns {String} - A string representing the product. - */ - matchProductFromProductName(productName) { - return this._pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Parse the productSetName from a product_set resource. - * - * @param {String} productSetName - * A fully-qualified path representing a product_set resources. - * @returns {String} - A string representing the project. - */ - matchProjectFromProductSetName(productSetName) { - return this._pathTemplates.productSetPathTemplate.match(productSetName) - .project; - } - - /** - * Parse the productSetName from a product_set resource. - * - * @param {String} productSetName - * A fully-qualified path representing a product_set resources. - * @returns {String} - A string representing the location. - */ - matchLocationFromProductSetName(productSetName) { - return this._pathTemplates.productSetPathTemplate.match(productSetName) - .location; - } - - /** - * Parse the productSetName from a product_set resource. - * - * @param {String} productSetName - * A fully-qualified path representing a product_set resources. - * @returns {String} - A string representing the product_set. - */ - matchProductSetFromProductSetName(productSetName) { - return this._pathTemplates.productSetPathTemplate.match(productSetName) - .product_set; - } - - /** - * Parse the referenceImageName from a reference_image resource. - * - * @param {String} referenceImageName - * A fully-qualified path representing a reference_image resources. - * @returns {String} - A string representing the project. - */ - matchProjectFromReferenceImageName(referenceImageName) { - return this._pathTemplates.referenceImagePathTemplate.match( - referenceImageName - ).project; - } - - /** - * Parse the referenceImageName from a reference_image resource. - * - * @param {String} referenceImageName - * A fully-qualified path representing a reference_image resources. - * @returns {String} - A string representing the location. - */ - matchLocationFromReferenceImageName(referenceImageName) { - return this._pathTemplates.referenceImagePathTemplate.match( - referenceImageName - ).location; - } - - /** - * Parse the referenceImageName from a reference_image resource. - * - * @param {String} referenceImageName - * A fully-qualified path representing a reference_image resources. - * @returns {String} - A string representing the product. - */ - matchProductFromReferenceImageName(referenceImageName) { - return this._pathTemplates.referenceImagePathTemplate.match( - referenceImageName - ).product; - } - - /** - * Parse the referenceImageName from a reference_image resource. - * - * @param {String} referenceImageName - * A fully-qualified path representing a reference_image resources. - * @returns {String} - A string representing the reference_image. - */ - matchReferenceImageFromReferenceImageName(referenceImageName) { - return this._pathTemplates.referenceImagePathTemplate.match( - referenceImageName - ).reference_image; - } -} - -module.exports = ProductSearchClient; diff --git a/packages/google-cloud-vision/src/v1p4beta1/product_search_client.ts b/packages/google-cloud-vision/src/v1p4beta1/product_search_client.ts new file mode 100644 index 00000000000..7f03a65d17f --- /dev/null +++ b/packages/google-cloud-vision/src/v1p4beta1/product_search_client.ts @@ -0,0 +1,2619 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as gax from 'google-gax'; +import { + APICallback, + Callback, + CallOptions, + Descriptors, + ClientOptions, + LROperation, + PaginationCallback, + PaginationResponse, +} from 'google-gax'; +import * as path from 'path'; + +import {Transform} from 'stream'; +import * as protosTypes from '../../protos/protos'; +import * as gapicConfig from './product_search_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Manages Products and ProductSets of reference images for use in product + * search. It uses the following resource model: + * + * - The API has a collection of + * [ProductSet][google.cloud.vision.v1p4beta1.ProductSet] resources, named + * `projects/* /locations/* /productSets/*`, which acts as a way to put different + * products into groups to limit identification. + * + * In parallel, + * + * - The API has a collection of + * [Product][google.cloud.vision.v1p4beta1.Product] resources, named + * `projects/* /locations/* /products/*` + * + * - Each [Product][google.cloud.vision.v1p4beta1.Product] has a collection of + * [ReferenceImage][google.cloud.vision.v1p4beta1.ReferenceImage] resources, + * named + * `projects/* /locations/* /products/* /referenceImages/*` + * @class + * @memberof v1p4beta1 + */ +export class ProductSearchClient { + private _descriptors: Descriptors = {page: {}, stream: {}, longrunning: {}}; + private _innerApiCalls: {[name: string]: Function}; + private _pathTemplates: {[name: string]: gax.PathTemplate}; + private _terminated = false; + auth: gax.GoogleAuth; + operationsClient: gax.OperationsClient; + productSearchStub: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ProductSearchClient. + * + * @param {object} [options] - The configuration object. See the subsequent + * parameters for more details. + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {function} [options.promise] - Custom promise module to use instead + * of native Promises. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + */ + + constructor(opts?: ClientOptions) { + // Ensure that options include the service address and port. + const staticMembers = this.constructor as typeof ProductSearchClient; + const servicePath = + opts && opts.servicePath + ? opts.servicePath + : opts && opts.apiEndpoint + ? opts.apiEndpoint + : staticMembers.servicePath; + const port = opts && opts.port ? opts.port : staticMembers.port; + + if (!opts) { + opts = {servicePath, port}; + } + opts.servicePath = opts.servicePath || servicePath; + opts.port = opts.port || port; + opts.clientConfig = opts.clientConfig || {}; + + const isBrowser = typeof window !== 'undefined'; + if (isBrowser) { + opts.fallback = true; + } + // If we are in browser, we are already using fallback because of the + // "browser" field in package.json. + // But if we were explicitly requested to use fallback, let's do it now. + const gaxModule = !isBrowser && opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options + // sent to the client. + opts.scopes = (this.constructor as typeof ProductSearchClient).scopes; + const gaxGrpc = new gaxModule.GrpcClient(opts); + + // Save the auth object to the client, for use by other methods. + this.auth = gaxGrpc.auth as gax.GoogleAuth; + + // Determine the client header string. + const clientHeader = [`gax/${gaxModule.version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + // For Node.js, pass the path to JSON proto file. + // For browsers, pass the JSON content. + + const nodejsProtoPath = path.join( + __dirname, + '..', + '..', + 'protos', + 'protos.json' + ); + const protos = gaxGrpc.loadProto( + opts.fallback ? require('../../protos/protos.json') : nodejsProtoPath + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this._pathTemplates = { + locationPathTemplate: new gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + productPathTemplate: new gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/products/{product}' + ), + productSetPathTemplate: new gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/productSets/{product_set}' + ), + referenceImagePathTemplate: new gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this._descriptors.page = { + listProductSets: new gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'productSets' + ), + listProducts: new gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'products' + ), + listReferenceImages: new gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'referenceImages' + ), + listProductsInProductSet: new gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'products' + ), + }; + + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const protoFilesRoot = opts.fallback + ? gaxModule.protobuf.Root.fromJSON(require('../../protos/protos.json')) + : gaxModule.protobuf.loadSync(nodejsProtoPath); + + this.operationsClient = gaxModule + .lro({ + auth: this.auth, + grpc: 'grpc' in gaxGrpc ? gaxGrpc.grpc : undefined, + }) + .operationsClient(opts); + const importProductSetsResponse = protoFilesRoot.lookup( + '.google.cloud.vision.v1p4beta1.ImportProductSetsResponse' + ) as gax.protobuf.Type; + const importProductSetsMetadata = protoFilesRoot.lookup( + '.google.cloud.vision.v1p4beta1.BatchOperationMetadata' + ) as gax.protobuf.Type; + const purgeProductsResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const purgeProductsMetadata = protoFilesRoot.lookup( + '.google.cloud.vision.v1p4beta1.BatchOperationMetadata' + ) as gax.protobuf.Type; + + this._descriptors.longrunning = { + importProductSets: new gaxModule.LongrunningDescriptor( + this.operationsClient, + importProductSetsResponse.decode.bind(importProductSetsResponse), + importProductSetsMetadata.decode.bind(importProductSetsMetadata) + ), + purgeProducts: new gaxModule.LongrunningDescriptor( + this.operationsClient, + purgeProductsResponse.decode.bind(purgeProductsResponse), + purgeProductsMetadata.decode.bind(purgeProductsMetadata) + ), + }; + + // Put together the default options sent with requests. + const defaults = gaxGrpc.constructSettings( + 'google.cloud.vision.v1p4beta1.ProductSearch', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this._innerApiCalls = {}; + + // Put together the "service stub" for + // google.cloud.vision.v1p4beta1.ProductSearch. + this.productSearchStub = gaxGrpc.createStub( + opts.fallback + ? (protos as protobuf.Root).lookupService( + 'google.cloud.vision.v1p4beta1.ProductSearch' + ) + : // tslint:disable-next-line no-any + (protos as any).google.cloud.vision.v1p4beta1.ProductSearch, + opts + ) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const productSearchStubMethods = [ + 'createProductSet', + 'listProductSets', + 'getProductSet', + 'updateProductSet', + 'deleteProductSet', + 'createProduct', + 'listProducts', + 'getProduct', + 'updateProduct', + 'deleteProduct', + 'createReferenceImage', + 'deleteReferenceImage', + 'listReferenceImages', + 'getReferenceImage', + 'addProductToProductSet', + 'removeProductFromProductSet', + 'listProductsInProductSet', + 'importProductSets', + 'purgeProducts', + ]; + + for (const methodName of productSearchStubMethods) { + const innerCallPromise = this.productSearchStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + return stub[methodName].apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + } + ); + + const apiCall = gaxModule.createApiCall( + innerCallPromise, + defaults[methodName], + this._descriptors.page[methodName] || + this._descriptors.stream[methodName] || + this._descriptors.longrunning[methodName] + ); + + this._innerApiCalls[methodName] = ( + argument: {}, + callOptions?: CallOptions, + callback?: APICallback + ) => { + return apiCall(argument, callOptions, callback); + }; + } + } + + /** + * The DNS address for this API service. + */ + static get servicePath() { + return 'vision.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + */ + static get apiEndpoint() { + return 'vision.googleapis.com'; + } + + /** + * The port for this API service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/cloud-vision', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @param {function(Error, string)} callback - the callback to + * be called with the current project Id. + */ + getProjectId( + callback?: Callback + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + createProductSet( + request: protosTypes.google.cloud.vision.v1p4beta1.ICreateProductSetRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1p4beta1.IProductSet, + ( + | protosTypes.google.cloud.vision.v1p4beta1.ICreateProductSetRequest + | undefined + ), + {} | undefined + ] + >; + createProductSet( + request: protosTypes.google.cloud.vision.v1p4beta1.ICreateProductSetRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1p4beta1.IProductSet, + | protosTypes.google.cloud.vision.v1p4beta1.ICreateProductSetRequest + | undefined, + {} | undefined + > + ): void; + /** + * Creates and returns a new ProductSet resource. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if display_name is missing, or is longer than + * 4096 characters. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project in which the ProductSet should be created. + * + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @param {google.cloud.vision.v1p4beta1.ProductSet} request.productSet + * Required. The ProductSet to create. + * @param {string} request.productSetId + * A user-supplied resource id for this ProductSet. If set, the server will + * attempt to use this value as the resource id. If it is already in use, an + * error is returned with code ALREADY_EXISTS. Must be at most 128 characters + * long. It cannot contain the character `/`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ProductSet]{@link google.cloud.vision.v1p4beta1.ProductSet}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + createProductSet( + request: protosTypes.google.cloud.vision.v1p4beta1.ICreateProductSetRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1p4beta1.IProductSet, + | protosTypes.google.cloud.vision.v1p4beta1.ICreateProductSetRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1p4beta1.IProductSet, + | protosTypes.google.cloud.vision.v1p4beta1.ICreateProductSetRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1p4beta1.IProductSet, + ( + | protosTypes.google.cloud.vision.v1p4beta1.ICreateProductSetRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.createProductSet(request, options, callback); + } + getProductSet( + request: protosTypes.google.cloud.vision.v1p4beta1.IGetProductSetRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1p4beta1.IProductSet, + ( + | protosTypes.google.cloud.vision.v1p4beta1.IGetProductSetRequest + | undefined + ), + {} | undefined + ] + >; + getProductSet( + request: protosTypes.google.cloud.vision.v1p4beta1.IGetProductSetRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1p4beta1.IProductSet, + | protosTypes.google.cloud.vision.v1p4beta1.IGetProductSetRequest + | undefined, + {} | undefined + > + ): void; + /** + * Gets information associated with a ProductSet. + * + * Possible errors: + * + * * Returns NOT_FOUND if the ProductSet does not exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the ProductSet to get. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ProductSet]{@link google.cloud.vision.v1p4beta1.ProductSet}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getProductSet( + request: protosTypes.google.cloud.vision.v1p4beta1.IGetProductSetRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1p4beta1.IProductSet, + | protosTypes.google.cloud.vision.v1p4beta1.IGetProductSetRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1p4beta1.IProductSet, + | protosTypes.google.cloud.vision.v1p4beta1.IGetProductSetRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1p4beta1.IProductSet, + ( + | protosTypes.google.cloud.vision.v1p4beta1.IGetProductSetRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.getProductSet(request, options, callback); + } + updateProductSet( + request: protosTypes.google.cloud.vision.v1p4beta1.IUpdateProductSetRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1p4beta1.IProductSet, + ( + | protosTypes.google.cloud.vision.v1p4beta1.IUpdateProductSetRequest + | undefined + ), + {} | undefined + ] + >; + updateProductSet( + request: protosTypes.google.cloud.vision.v1p4beta1.IUpdateProductSetRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1p4beta1.IProductSet, + | protosTypes.google.cloud.vision.v1p4beta1.IUpdateProductSetRequest + | undefined, + {} | undefined + > + ): void; + /** + * Makes changes to a ProductSet resource. + * Only display_name can be updated currently. + * + * Possible errors: + * + * * Returns NOT_FOUND if the ProductSet does not exist. + * * Returns INVALID_ARGUMENT if display_name is present in update_mask but + * missing from the request or longer than 4096 characters. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.vision.v1p4beta1.ProductSet} request.productSet + * Required. The ProductSet resource which replaces the one on the server. + * @param {google.protobuf.FieldMask} request.updateMask + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields to + * update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask path is `display_name`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ProductSet]{@link google.cloud.vision.v1p4beta1.ProductSet}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + updateProductSet( + request: protosTypes.google.cloud.vision.v1p4beta1.IUpdateProductSetRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1p4beta1.IProductSet, + | protosTypes.google.cloud.vision.v1p4beta1.IUpdateProductSetRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1p4beta1.IProductSet, + | protosTypes.google.cloud.vision.v1p4beta1.IUpdateProductSetRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1p4beta1.IProductSet, + ( + | protosTypes.google.cloud.vision.v1p4beta1.IUpdateProductSetRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'product_set.name': request.productSet!.name || '', + }); + return this._innerApiCalls.updateProductSet(request, options, callback); + } + deleteProductSet( + request: protosTypes.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest + | undefined + ), + {} | undefined + ] + >; + deleteProductSet( + request: protosTypes.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest + | undefined, + {} | undefined + > + ): void; + /** + * Permanently deletes a ProductSet. Products and ReferenceImages in the + * ProductSet are not deleted. + * + * The actual image files are not deleted from Google Cloud Storage. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the ProductSet to delete. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + deleteProductSet( + request: protosTypes.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.deleteProductSet(request, options, callback); + } + createProduct( + request: protosTypes.google.cloud.vision.v1p4beta1.ICreateProductRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1p4beta1.IProduct, + ( + | protosTypes.google.cloud.vision.v1p4beta1.ICreateProductRequest + | undefined + ), + {} | undefined + ] + >; + createProduct( + request: protosTypes.google.cloud.vision.v1p4beta1.ICreateProductRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1p4beta1.IProduct, + | protosTypes.google.cloud.vision.v1p4beta1.ICreateProductRequest + | undefined, + {} | undefined + > + ): void; + /** + * Creates and returns a new product resource. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 + * characters. + * * Returns INVALID_ARGUMENT if description is longer than 4096 characters. + * * Returns INVALID_ARGUMENT if product_category is missing or invalid. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project in which the Product should be created. + * + * Format is + * `projects/PROJECT_ID/locations/LOC_ID`. + * @param {google.cloud.vision.v1p4beta1.Product} request.product + * Required. The product to create. + * @param {string} request.productId + * A user-supplied resource id for this Product. If set, the server will + * attempt to use this value as the resource id. If it is already in use, an + * error is returned with code ALREADY_EXISTS. Must be at most 128 characters + * long. It cannot contain the character `/`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Product]{@link google.cloud.vision.v1p4beta1.Product}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + createProduct( + request: protosTypes.google.cloud.vision.v1p4beta1.ICreateProductRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1p4beta1.IProduct, + | protosTypes.google.cloud.vision.v1p4beta1.ICreateProductRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1p4beta1.IProduct, + | protosTypes.google.cloud.vision.v1p4beta1.ICreateProductRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1p4beta1.IProduct, + ( + | protosTypes.google.cloud.vision.v1p4beta1.ICreateProductRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.createProduct(request, options, callback); + } + getProduct( + request: protosTypes.google.cloud.vision.v1p4beta1.IGetProductRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1p4beta1.IProduct, + protosTypes.google.cloud.vision.v1p4beta1.IGetProductRequest | undefined, + {} | undefined + ] + >; + getProduct( + request: protosTypes.google.cloud.vision.v1p4beta1.IGetProductRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1p4beta1.IProduct, + protosTypes.google.cloud.vision.v1p4beta1.IGetProductRequest | undefined, + {} | undefined + > + ): void; + /** + * Gets information associated with a Product. + * + * Possible errors: + * + * * Returns NOT_FOUND if the Product does not exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of the Product to get. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Product]{@link google.cloud.vision.v1p4beta1.Product}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getProduct( + request: protosTypes.google.cloud.vision.v1p4beta1.IGetProductRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1p4beta1.IProduct, + | protosTypes.google.cloud.vision.v1p4beta1.IGetProductRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1p4beta1.IProduct, + protosTypes.google.cloud.vision.v1p4beta1.IGetProductRequest | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1p4beta1.IProduct, + protosTypes.google.cloud.vision.v1p4beta1.IGetProductRequest | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.getProduct(request, options, callback); + } + updateProduct( + request: protosTypes.google.cloud.vision.v1p4beta1.IUpdateProductRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1p4beta1.IProduct, + ( + | protosTypes.google.cloud.vision.v1p4beta1.IUpdateProductRequest + | undefined + ), + {} | undefined + ] + >; + updateProduct( + request: protosTypes.google.cloud.vision.v1p4beta1.IUpdateProductRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1p4beta1.IProduct, + | protosTypes.google.cloud.vision.v1p4beta1.IUpdateProductRequest + | undefined, + {} | undefined + > + ): void; + /** + * Makes changes to a Product resource. + * Only the `display_name`, `description`, and `labels` fields can be updated + * right now. + * + * If labels are updated, the change will not be reflected in queries until + * the next index time. + * + * Possible errors: + * + * * Returns NOT_FOUND if the Product does not exist. + * * Returns INVALID_ARGUMENT if display_name is present in update_mask but is + * missing from the request or longer than 4096 characters. + * * Returns INVALID_ARGUMENT if description is present in update_mask but is + * longer than 4096 characters. + * * Returns INVALID_ARGUMENT if product_category is present in update_mask. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.vision.v1p4beta1.Product} request.product + * Required. The Product resource which replaces the one on the server. + * product.name is immutable. + * @param {google.protobuf.FieldMask} request.updateMask + * The [FieldMask][google.protobuf.FieldMask] that specifies which fields + * to update. + * If update_mask isn't specified, all mutable fields are to be updated. + * Valid mask paths include `product_labels`, `display_name`, and + * `description`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Product]{@link google.cloud.vision.v1p4beta1.Product}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + updateProduct( + request: protosTypes.google.cloud.vision.v1p4beta1.IUpdateProductRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1p4beta1.IProduct, + | protosTypes.google.cloud.vision.v1p4beta1.IUpdateProductRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1p4beta1.IProduct, + | protosTypes.google.cloud.vision.v1p4beta1.IUpdateProductRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1p4beta1.IProduct, + ( + | protosTypes.google.cloud.vision.v1p4beta1.IUpdateProductRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'product.name': request.product!.name || '', + }); + return this._innerApiCalls.updateProduct(request, options, callback); + } + deleteProduct( + request: protosTypes.google.cloud.vision.v1p4beta1.IDeleteProductRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.vision.v1p4beta1.IDeleteProductRequest + | undefined + ), + {} | undefined + ] + >; + deleteProduct( + request: protosTypes.google.cloud.vision.v1p4beta1.IDeleteProductRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1p4beta1.IDeleteProductRequest + | undefined, + {} | undefined + > + ): void; + /** + * Permanently deletes a product and its reference images. + * + * Metadata of the product and all its images will be deleted right away, but + * search queries against ProductSets containing the product may still work + * until all related caches are refreshed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource name of product to delete. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + deleteProduct( + request: protosTypes.google.cloud.vision.v1p4beta1.IDeleteProductRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1p4beta1.IDeleteProductRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1p4beta1.IDeleteProductRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.vision.v1p4beta1.IDeleteProductRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.deleteProduct(request, options, callback); + } + createReferenceImage( + request: protosTypes.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1p4beta1.IReferenceImage, + ( + | protosTypes.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest + | undefined + ), + {} | undefined + ] + >; + createReferenceImage( + request: protosTypes.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1p4beta1.IReferenceImage, + | protosTypes.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest + | undefined, + {} | undefined + > + ): void; + /** + * Creates and returns a new ReferenceImage resource. + * + * The `bounding_poly` field is optional. If `bounding_poly` is not specified, + * the system will try to detect regions of interest in the image that are + * compatible with the product_category on the parent product. If it is + * specified, detection is ALWAYS skipped. The system converts polygons into + * non-rotated rectangles. + * + * Note that the pipeline will resize the image if the image resolution is too + * large to process (above 50MP). + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 + * characters. + * * Returns INVALID_ARGUMENT if the product does not exist. + * * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing + * compatible with the parent product's product_category is detected. + * * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the product in which to create the reference + * image. + * + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * @param {google.cloud.vision.v1p4beta1.ReferenceImage} request.referenceImage + * Required. The reference image to create. + * If an image ID is specified, it is ignored. + * @param {string} request.referenceImageId + * A user-supplied resource id for the ReferenceImage to be added. If set, + * the server will attempt to use this value as the resource id. If it is + * already in use, an error is returned with code ALREADY_EXISTS. Must be at + * most 128 characters long. It cannot contain the character `/`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ReferenceImage]{@link google.cloud.vision.v1p4beta1.ReferenceImage}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + createReferenceImage( + request: protosTypes.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1p4beta1.IReferenceImage, + | protosTypes.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1p4beta1.IReferenceImage, + | protosTypes.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1p4beta1.IReferenceImage, + ( + | protosTypes.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.createReferenceImage(request, options, callback); + } + deleteReferenceImage( + request: protosTypes.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest + | undefined + ), + {} | undefined + ] + >; + deleteReferenceImage( + request: protosTypes.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest + | undefined, + {} | undefined + > + ): void; + /** + * Permanently deletes a reference image. + * + * The image metadata will be deleted right away, but search queries + * against ProductSets containing the image may still work until all related + * caches are refreshed. + * + * The actual image files are not deleted from Google Cloud Storage. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the reference image to delete. + * + * Format is: + * + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + deleteReferenceImage( + request: protosTypes.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.deleteReferenceImage(request, options, callback); + } + getReferenceImage( + request: protosTypes.google.cloud.vision.v1p4beta1.IGetReferenceImageRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1p4beta1.IReferenceImage, + ( + | protosTypes.google.cloud.vision.v1p4beta1.IGetReferenceImageRequest + | undefined + ), + {} | undefined + ] + >; + getReferenceImage( + request: protosTypes.google.cloud.vision.v1p4beta1.IGetReferenceImageRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1p4beta1.IReferenceImage, + | protosTypes.google.cloud.vision.v1p4beta1.IGetReferenceImageRequest + | undefined, + {} | undefined + > + ): void; + /** + * Gets information associated with a ReferenceImage. + * + * Possible errors: + * + * * Returns NOT_FOUND if the specified image does not exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the ReferenceImage to get. + * + * Format is: + * + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ReferenceImage]{@link google.cloud.vision.v1p4beta1.ReferenceImage}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getReferenceImage( + request: protosTypes.google.cloud.vision.v1p4beta1.IGetReferenceImageRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1p4beta1.IReferenceImage, + | protosTypes.google.cloud.vision.v1p4beta1.IGetReferenceImageRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1p4beta1.IReferenceImage, + | protosTypes.google.cloud.vision.v1p4beta1.IGetReferenceImageRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1p4beta1.IReferenceImage, + ( + | protosTypes.google.cloud.vision.v1p4beta1.IGetReferenceImageRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.getReferenceImage(request, options, callback); + } + addProductToProductSet( + request: protosTypes.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest + | undefined + ), + {} | undefined + ] + >; + addProductToProductSet( + request: protosTypes.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest + | undefined, + {} | undefined + > + ): void; + /** + * Adds a Product to the specified ProductSet. If the Product is already + * present, no change is made. + * + * One Product can be added to at most 100 ProductSets. + * + * Possible errors: + * + * * Returns NOT_FOUND if the Product or the ProductSet doesn't exist. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name for the ProductSet to modify. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param {string} request.product + * Required. The resource name for the Product to be added to this ProductSet. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + addProductToProductSet( + request: protosTypes.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.addProductToProductSet( + request, + options, + callback + ); + } + removeProductFromProductSet( + request: protosTypes.google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest + | undefined + ), + {} | undefined + ] + >; + removeProductFromProductSet( + request: protosTypes.google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest + | undefined, + {} | undefined + > + ): void; + /** + * Removes a Product from the specified ProductSet. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name for the ProductSet to modify. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param {string} request.product + * Required. The resource name for the Product to be removed from this + * ProductSet. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + removeProductFromProductSet( + request: protosTypes.google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest + | undefined, + {} | undefined + >, + callback?: Callback< + protosTypes.google.protobuf.IEmpty, + | protosTypes.google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest + | undefined, + {} | undefined + > + ): Promise< + [ + protosTypes.google.protobuf.IEmpty, + ( + | protosTypes.google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest + | undefined + ), + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.removeProductFromProductSet( + request, + options, + callback + ); + } + + importProductSets( + request: protosTypes.google.cloud.vision.v1p4beta1.IImportProductSetsRequest, + options?: gax.CallOptions + ): Promise< + [ + LROperation< + protosTypes.google.cloud.vision.v1p4beta1.IImportProductSetsResponse, + protosTypes.google.cloud.vision.v1p4beta1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + importProductSets( + request: protosTypes.google.cloud.vision.v1p4beta1.IImportProductSetsRequest, + options: gax.CallOptions, + callback: Callback< + LROperation< + protosTypes.google.cloud.vision.v1p4beta1.IImportProductSetsResponse, + protosTypes.google.cloud.vision.v1p4beta1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + > + ): void; + /** + * Asynchronous API that imports a list of reference images to specified + * product sets based on a list of image information. + * + * The [google.longrunning.Operation][google.longrunning.Operation] API can be + * used to keep track of the progress and results of the request. + * `Operation.metadata` contains `BatchOperationMetadata`. (progress) + * `Operation.response` contains `ImportProductSetsResponse`. (results) + * + * The input source of this method is a csv file on Google Cloud Storage. + * For the format of the csv file please see + * [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource.csv_file_uri]. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project in which the ProductSets should be imported. + * + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @param {google.cloud.vision.v1p4beta1.ImportProductSetsInputConfig} request.inputConfig + * Required. The input content for the list of requests. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + importProductSets( + request: protosTypes.google.cloud.vision.v1p4beta1.IImportProductSetsRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + LROperation< + protosTypes.google.cloud.vision.v1p4beta1.IImportProductSetsResponse, + protosTypes.google.cloud.vision.v1p4beta1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + >, + callback?: Callback< + LROperation< + protosTypes.google.cloud.vision.v1p4beta1.IImportProductSetsResponse, + protosTypes.google.cloud.vision.v1p4beta1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + > + ): Promise< + [ + LROperation< + protosTypes.google.cloud.vision.v1p4beta1.IImportProductSetsResponse, + protosTypes.google.cloud.vision.v1p4beta1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.importProductSets(request, options, callback); + } + purgeProducts( + request: protosTypes.google.cloud.vision.v1p4beta1.IPurgeProductsRequest, + options?: gax.CallOptions + ): Promise< + [ + LROperation< + protosTypes.google.protobuf.IEmpty, + protosTypes.google.cloud.vision.v1p4beta1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + purgeProducts( + request: protosTypes.google.cloud.vision.v1p4beta1.IPurgeProductsRequest, + options: gax.CallOptions, + callback: Callback< + LROperation< + protosTypes.google.protobuf.IEmpty, + protosTypes.google.cloud.vision.v1p4beta1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + > + ): void; + /** + * Asynchronous API to delete all Products in a ProductSet or all Products + * that are in no ProductSet. + * + * If a Product is a member of the specified ProductSet in addition to other + * ProductSets, the Product will still be deleted. + * + * It is recommended to not delete the specified ProductSet until after this + * operation has completed. It is also recommended to not add any of the + * Products involved in the batch delete to a new ProductSet while this + * operation is running because those Products may still end up deleted. + * + * It's not possible to undo the PurgeProducts operation. Therefore, it is + * recommended to keep the csv files used in ImportProductSets (if that was + * how you originally built the Product Set) before starting PurgeProducts, in + * case you need to re-import the data after deletion. + * + * If the plan is to purge all of the Products from a ProductSet and then + * re-use the empty ProductSet to re-import new Products into the empty + * ProductSet, you must wait until the PurgeProducts operation has finished + * for that ProductSet. + * + * The [google.longrunning.Operation][google.longrunning.Operation] API can be + * used to keep track of the progress and results of the request. + * `Operation.metadata` contains `BatchOperationMetadata`. (progress) + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.vision.v1p4beta1.ProductSetPurgeConfig} request.productSetPurgeConfig + * Specify which ProductSet contains the Products to be deleted. + * @param {boolean} request.deleteOrphanProducts + * If delete_orphan_products is true, all Products that are not in any + * ProductSet will be deleted. + * @param {string} request.parent + * Required. The project and location in which the Products should be deleted. + * + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @param {boolean} request.force + * The default value is false. Override this value to true to actually perform + * the purge. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Operation]{@link google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + purgeProducts( + request: protosTypes.google.cloud.vision.v1p4beta1.IPurgeProductsRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + LROperation< + protosTypes.google.protobuf.IEmpty, + protosTypes.google.cloud.vision.v1p4beta1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + >, + callback?: Callback< + LROperation< + protosTypes.google.protobuf.IEmpty, + protosTypes.google.cloud.vision.v1p4beta1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + > + ): Promise< + [ + LROperation< + protosTypes.google.protobuf.IEmpty, + protosTypes.google.cloud.vision.v1p4beta1.IBatchOperationMetadata + >, + protosTypes.google.longrunning.IOperation | undefined, + {} | undefined + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.purgeProducts(request, options, callback); + } + listProductSets( + request: protosTypes.google.cloud.vision.v1p4beta1.IListProductSetsRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1p4beta1.IProductSet[], + protosTypes.google.cloud.vision.v1p4beta1.IListProductSetsRequest | null, + protosTypes.google.cloud.vision.v1p4beta1.IListProductSetsResponse + ] + >; + listProductSets( + request: protosTypes.google.cloud.vision.v1p4beta1.IListProductSetsRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1p4beta1.IProductSet[], + protosTypes.google.cloud.vision.v1p4beta1.IListProductSetsRequest | null, + protosTypes.google.cloud.vision.v1p4beta1.IListProductSetsResponse + > + ): void; + /** + * Lists ProductSets in an unspecified order. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if page_size is greater than 100, or less + * than 1. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project from which ProductSets should be listed. + * + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @param {number} request.pageSize + * The maximum number of items to return. Default 10, maximum 100. + * @param {string} request.pageToken + * The next_page_token returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [ProductSet]{@link google.cloud.vision.v1p4beta1.ProductSet}. + * The client library support auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [ProductSet]{@link google.cloud.vision.v1p4beta1.ProductSet} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListProductSetsRequest]{@link google.cloud.vision.v1p4beta1.ListProductSetsRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListProductSetsResponse]{@link google.cloud.vision.v1p4beta1.ListProductSetsResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + listProductSets( + request: protosTypes.google.cloud.vision.v1p4beta1.IListProductSetsRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1p4beta1.IProductSet[], + protosTypes.google.cloud.vision.v1p4beta1.IListProductSetsRequest | null, + protosTypes.google.cloud.vision.v1p4beta1.IListProductSetsResponse + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1p4beta1.IProductSet[], + protosTypes.google.cloud.vision.v1p4beta1.IListProductSetsRequest | null, + protosTypes.google.cloud.vision.v1p4beta1.IListProductSetsResponse + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1p4beta1.IProductSet[], + protosTypes.google.cloud.vision.v1p4beta1.IListProductSetsRequest | null, + protosTypes.google.cloud.vision.v1p4beta1.IListProductSetsResponse + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.listProductSets(request, options, callback); + } + + /** + * Equivalent to {@link listProductSets}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listProductSets} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project from which ProductSets should be listed. + * + * Format is `projects/PROJECT_ID/locations/LOC_ID`. + * @param {number} request.pageSize + * The maximum number of items to return. Default 10, maximum 100. + * @param {string} request.pageToken + * The next_page_token returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [ProductSet]{@link google.cloud.vision.v1p4beta1.ProductSet} on 'data' event. + */ + listProductSetsStream( + request?: protosTypes.google.cloud.vision.v1p4beta1.IListProductSetsRequest, + options?: gax.CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + return this._descriptors.page.listProductSets.createStream( + this._innerApiCalls.listProductSets as gax.GaxCall, + request, + callSettings + ); + } + listProducts( + request: protosTypes.google.cloud.vision.v1p4beta1.IListProductsRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1p4beta1.IProduct[], + protosTypes.google.cloud.vision.v1p4beta1.IListProductsRequest | null, + protosTypes.google.cloud.vision.v1p4beta1.IListProductsResponse + ] + >; + listProducts( + request: protosTypes.google.cloud.vision.v1p4beta1.IListProductsRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1p4beta1.IProduct[], + protosTypes.google.cloud.vision.v1p4beta1.IListProductsRequest | null, + protosTypes.google.cloud.vision.v1p4beta1.IListProductsResponse + > + ): void; + /** + * Lists products in an unspecified order. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project OR ProductSet from which Products should be listed. + * + * Format: + * `projects/PROJECT_ID/locations/LOC_ID` + * @param {number} request.pageSize + * The maximum number of items to return. Default 10, maximum 100. + * @param {string} request.pageToken + * The next_page_token returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Product]{@link google.cloud.vision.v1p4beta1.Product}. + * The client library support auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [Product]{@link google.cloud.vision.v1p4beta1.Product} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListProductsRequest]{@link google.cloud.vision.v1p4beta1.ListProductsRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListProductsResponse]{@link google.cloud.vision.v1p4beta1.ListProductsResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + listProducts( + request: protosTypes.google.cloud.vision.v1p4beta1.IListProductsRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1p4beta1.IProduct[], + protosTypes.google.cloud.vision.v1p4beta1.IListProductsRequest | null, + protosTypes.google.cloud.vision.v1p4beta1.IListProductsResponse + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1p4beta1.IProduct[], + protosTypes.google.cloud.vision.v1p4beta1.IListProductsRequest | null, + protosTypes.google.cloud.vision.v1p4beta1.IListProductsResponse + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1p4beta1.IProduct[], + protosTypes.google.cloud.vision.v1p4beta1.IListProductsRequest | null, + protosTypes.google.cloud.vision.v1p4beta1.IListProductsResponse + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.listProducts(request, options, callback); + } + + /** + * Equivalent to {@link listProducts}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listProducts} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project OR ProductSet from which Products should be listed. + * + * Format: + * `projects/PROJECT_ID/locations/LOC_ID` + * @param {number} request.pageSize + * The maximum number of items to return. Default 10, maximum 100. + * @param {string} request.pageToken + * The next_page_token returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Product]{@link google.cloud.vision.v1p4beta1.Product} on 'data' event. + */ + listProductsStream( + request?: protosTypes.google.cloud.vision.v1p4beta1.IListProductsRequest, + options?: gax.CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + return this._descriptors.page.listProducts.createStream( + this._innerApiCalls.listProducts as gax.GaxCall, + request, + callSettings + ); + } + listReferenceImages( + request: protosTypes.google.cloud.vision.v1p4beta1.IListReferenceImagesRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1p4beta1.IReferenceImage[], + protosTypes.google.cloud.vision.v1p4beta1.IListReferenceImagesRequest | null, + protosTypes.google.cloud.vision.v1p4beta1.IListReferenceImagesResponse + ] + >; + listReferenceImages( + request: protosTypes.google.cloud.vision.v1p4beta1.IListReferenceImagesRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1p4beta1.IReferenceImage[], + protosTypes.google.cloud.vision.v1p4beta1.IListReferenceImagesRequest | null, + protosTypes.google.cloud.vision.v1p4beta1.IListReferenceImagesResponse + > + ): void; + /** + * Lists reference images. + * + * Possible errors: + * + * * Returns NOT_FOUND if the parent product does not exist. + * * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less + * than 1. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the product containing the reference images. + * + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * @param {number} request.pageSize + * The maximum number of items to return. Default 10, maximum 100. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This is the value + * of `nextPageToken` returned in a previous reference image list request. + * + * Defaults to the first page if not specified. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [ReferenceImage]{@link google.cloud.vision.v1p4beta1.ReferenceImage}. + * The client library support auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [ReferenceImage]{@link google.cloud.vision.v1p4beta1.ReferenceImage} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListReferenceImagesRequest]{@link google.cloud.vision.v1p4beta1.ListReferenceImagesRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListReferenceImagesResponse]{@link google.cloud.vision.v1p4beta1.ListReferenceImagesResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + listReferenceImages( + request: protosTypes.google.cloud.vision.v1p4beta1.IListReferenceImagesRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1p4beta1.IReferenceImage[], + protosTypes.google.cloud.vision.v1p4beta1.IListReferenceImagesRequest | null, + protosTypes.google.cloud.vision.v1p4beta1.IListReferenceImagesResponse + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1p4beta1.IReferenceImage[], + protosTypes.google.cloud.vision.v1p4beta1.IListReferenceImagesRequest | null, + protosTypes.google.cloud.vision.v1p4beta1.IListReferenceImagesResponse + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1p4beta1.IReferenceImage[], + protosTypes.google.cloud.vision.v1p4beta1.IListReferenceImagesRequest | null, + protosTypes.google.cloud.vision.v1p4beta1.IListReferenceImagesResponse + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + return this._innerApiCalls.listReferenceImages(request, options, callback); + } + + /** + * Equivalent to {@link listReferenceImages}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listReferenceImages} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource name of the product containing the reference images. + * + * Format is + * `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`. + * @param {number} request.pageSize + * The maximum number of items to return. Default 10, maximum 100. + * @param {string} request.pageToken + * A token identifying a page of results to be returned. This is the value + * of `nextPageToken` returned in a previous reference image list request. + * + * Defaults to the first page if not specified. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [ReferenceImage]{@link google.cloud.vision.v1p4beta1.ReferenceImage} on 'data' event. + */ + listReferenceImagesStream( + request?: protosTypes.google.cloud.vision.v1p4beta1.IListReferenceImagesRequest, + options?: gax.CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + parent: request.parent || '', + }); + const callSettings = new gax.CallSettings(options); + return this._descriptors.page.listReferenceImages.createStream( + this._innerApiCalls.listReferenceImages as gax.GaxCall, + request, + callSettings + ); + } + listProductsInProductSet( + request: protosTypes.google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest, + options?: gax.CallOptions + ): Promise< + [ + protosTypes.google.cloud.vision.v1p4beta1.IProduct[], + protosTypes.google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest | null, + protosTypes.google.cloud.vision.v1p4beta1.IListProductsInProductSetResponse + ] + >; + listProductsInProductSet( + request: protosTypes.google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest, + options: gax.CallOptions, + callback: Callback< + protosTypes.google.cloud.vision.v1p4beta1.IProduct[], + protosTypes.google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest | null, + protosTypes.google.cloud.vision.v1p4beta1.IListProductsInProductSetResponse + > + ): void; + /** + * Lists the Products in a ProductSet, in an unspecified order. If the + * ProductSet does not exist, the products field of the response will be + * empty. + * + * Possible errors: + * + * * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The ProductSet resource for which to retrieve Products. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param {number} request.pageSize + * The maximum number of items to return. Default 10, maximum 100. + * @param {string} request.pageToken + * The next_page_token returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Product]{@link google.cloud.vision.v1p4beta1.Product}. + * The client library support auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [Product]{@link google.cloud.vision.v1p4beta1.Product} that corresponds to + * the one page received from the API server. + * If the second element is not null it contains the request object of type [ListProductsInProductSetRequest]{@link google.cloud.vision.v1p4beta1.ListProductsInProductSetRequest} + * that can be used to obtain the next page of the results. + * If it is null, the next page does not exist. + * The third element contains the raw response received from the API server. Its type is + * [ListProductsInProductSetResponse]{@link google.cloud.vision.v1p4beta1.ListProductsInProductSetResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + listProductsInProductSet( + request: protosTypes.google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest, + optionsOrCallback?: + | gax.CallOptions + | Callback< + protosTypes.google.cloud.vision.v1p4beta1.IProduct[], + protosTypes.google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest | null, + protosTypes.google.cloud.vision.v1p4beta1.IListProductsInProductSetResponse + >, + callback?: Callback< + protosTypes.google.cloud.vision.v1p4beta1.IProduct[], + protosTypes.google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest | null, + protosTypes.google.cloud.vision.v1p4beta1.IListProductsInProductSetResponse + > + ): Promise< + [ + protosTypes.google.cloud.vision.v1p4beta1.IProduct[], + protosTypes.google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest | null, + protosTypes.google.cloud.vision.v1p4beta1.IListProductsInProductSetResponse + ] + > | void { + request = request || {}; + let options: gax.CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as gax.CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + return this._innerApiCalls.listProductsInProductSet( + request, + options, + callback + ); + } + + /** + * Equivalent to {@link listProductsInProductSet}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listProductsInProductSet} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The ProductSet resource for which to retrieve Products. + * + * Format is: + * `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` + * @param {number} request.pageSize + * The maximum number of items to return. Default 10, maximum 100. + * @param {string} request.pageToken + * The next_page_token returned from a previous List request, if any. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing [Product]{@link google.cloud.vision.v1p4beta1.Product} on 'data' event. + */ + listProductsInProductSetStream( + request?: protosTypes.google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest, + options?: gax.CallOptions + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + name: request.name || '', + }); + const callSettings = new gax.CallSettings(options); + return this._descriptors.page.listProductsInProductSet.createStream( + this._innerApiCalls.listProductsInProductSet as gax.GaxCall, + request, + callSettings + ); + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project: string, location: string) { + return this._pathTemplates.locationPathTemplate.render({ + project, + location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this._pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this._pathTemplates.locationPathTemplate.match(locationName) + .location; + } + + /** + * Return a fully-qualified product resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} product + * @returns {string} Resource name string. + */ + productPath(project: string, location: string, product: string) { + return this._pathTemplates.productPathTemplate.render({ + project, + location, + product, + }); + } + + /** + * Parse the project from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductName(productName: string) { + return this._pathTemplates.productPathTemplate.match(productName).project; + } + + /** + * Parse the location from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductName(productName: string) { + return this._pathTemplates.productPathTemplate.match(productName).location; + } + + /** + * Parse the product from Product resource. + * + * @param {string} productName + * A fully-qualified path representing Product resource. + * @returns {string} A string representing the product. + */ + matchProductFromProductName(productName: string) { + return this._pathTemplates.productPathTemplate.match(productName).product; + } + + /** + * Return a fully-qualified productSet resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} product_set + * @returns {string} Resource name string. + */ + productSetPath(project: string, location: string, productSet: string) { + return this._pathTemplates.productSetPathTemplate.render({ + project, + location, + product_set: productSet, + }); + } + + /** + * Parse the project from ProductSet resource. + * + * @param {string} productSetName + * A fully-qualified path representing ProductSet resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProductSetName(productSetName: string) { + return this._pathTemplates.productSetPathTemplate.match(productSetName) + .project; + } + + /** + * Parse the location from ProductSet resource. + * + * @param {string} productSetName + * A fully-qualified path representing ProductSet resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProductSetName(productSetName: string) { + return this._pathTemplates.productSetPathTemplate.match(productSetName) + .location; + } + + /** + * Parse the product_set from ProductSet resource. + * + * @param {string} productSetName + * A fully-qualified path representing ProductSet resource. + * @returns {string} A string representing the product_set. + */ + matchProductSetFromProductSetName(productSetName: string) { + return this._pathTemplates.productSetPathTemplate.match(productSetName) + .product_set; + } + + /** + * Return a fully-qualified referenceImage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} product + * @param {string} reference_image + * @returns {string} Resource name string. + */ + referenceImagePath( + project: string, + location: string, + product: string, + referenceImage: string + ) { + return this._pathTemplates.referenceImagePathTemplate.render({ + project, + location, + product, + reference_image: referenceImage, + }); + } + + /** + * Parse the project from ReferenceImage resource. + * + * @param {string} referenceImageName + * A fully-qualified path representing ReferenceImage resource. + * @returns {string} A string representing the project. + */ + matchProjectFromReferenceImageName(referenceImageName: string) { + return this._pathTemplates.referenceImagePathTemplate.match( + referenceImageName + ).project; + } + + /** + * Parse the location from ReferenceImage resource. + * + * @param {string} referenceImageName + * A fully-qualified path representing ReferenceImage resource. + * @returns {string} A string representing the location. + */ + matchLocationFromReferenceImageName(referenceImageName: string) { + return this._pathTemplates.referenceImagePathTemplate.match( + referenceImageName + ).location; + } + + /** + * Parse the product from ReferenceImage resource. + * + * @param {string} referenceImageName + * A fully-qualified path representing ReferenceImage resource. + * @returns {string} A string representing the product. + */ + matchProductFromReferenceImageName(referenceImageName: string) { + return this._pathTemplates.referenceImagePathTemplate.match( + referenceImageName + ).product; + } + + /** + * Parse the reference_image from ReferenceImage resource. + * + * @param {string} referenceImageName + * A fully-qualified path representing ReferenceImage resource. + * @returns {string} A string representing the reference_image. + */ + matchReferenceImageFromReferenceImageName(referenceImageName: string) { + return this._pathTemplates.referenceImagePathTemplate.match( + referenceImageName + ).reference_image; + } + + /** + * Terminate the GRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + */ + close(): Promise { + if (!this._terminated) { + return this.productSearchStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-vision/src/v1p4beta1/product_search_client_config.json b/packages/google-cloud-vision/src/v1p4beta1/product_search_client_config.json index 2c4fc8c0828..518529b78b7 100644 --- a/packages/google-cloud-vision/src/v1p4beta1/product_search_client_config.json +++ b/packages/google-cloud-vision/src/v1p4beta1/product_search_client_config.json @@ -2,116 +2,115 @@ "interfaces": { "google.cloud.vision.v1p4beta1.ProductSearch": { "retry_codes": { + "non_idempotent": [], "idempotent": [ "DEADLINE_EXCEEDED", "UNAVAILABLE" - ], - "non_idempotent": [] + ] }, "retry_params": { "default": { "initial_retry_delay_millis": 100, "retry_delay_multiplier": 1.3, "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 20000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 20000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, "total_timeout_millis": 600000 } }, "methods": { "CreateProductSet": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "ListProductSets": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "GetProductSet": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "UpdateProductSet": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "DeleteProductSet": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "CreateProduct": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "ListProducts": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "GetProduct": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "UpdateProduct": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "DeleteProduct": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "CreateReferenceImage": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "DeleteReferenceImage": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "ListReferenceImages": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "GetReferenceImage": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "AddProductToProductSet": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "RemoveProductFromProductSet": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "ListProductsInProductSet": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "idempotent", "retry_params_name": "default" }, "ImportProductSets": { - "timeout_millis": 60000, + "timeout_millis": 600000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, "PurgeProducts": { - "timeout_millis": 60000, "retry_codes_name": "non_idempotent", "retry_params_name": "default" } diff --git a/packages/google-cloud-vision/src/v1p4beta1/product_search_proto_list.json b/packages/google-cloud-vision/src/v1p4beta1/product_search_proto_list.json index f4abec5004a..04693e0484d 100644 --- a/packages/google-cloud-vision/src/v1p4beta1/product_search_proto_list.json +++ b/packages/google-cloud-vision/src/v1p4beta1/product_search_proto_list.json @@ -1,3 +1,9 @@ [ - "../../protos/google/cloud/vision/v1p4beta1/product_search_service.proto" + "../../protos/google/cloud/vision/v1p4beta1/face.proto", + "../../protos/google/cloud/vision/v1p4beta1/geometry.proto", + "../../protos/google/cloud/vision/v1p4beta1/image_annotator.proto", + "../../protos/google/cloud/vision/v1p4beta1/product_search.proto", + "../../protos/google/cloud/vision/v1p4beta1/product_search_service.proto", + "../../protos/google/cloud/vision/v1p4beta1/text_annotation.proto", + "../../protos/google/cloud/vision/v1p4beta1/web_detection.proto" ] diff --git a/packages/google-cloud-vision/synth.metadata b/packages/google-cloud-vision/synth.metadata index cc4795b68f3..5afc6626e39 100644 --- a/packages/google-cloud-vision/synth.metadata +++ b/packages/google-cloud-vision/synth.metadata @@ -1,19 +1,12 @@ { - "updateTime": "2020-02-07T20:29:26.289603Z", + "updateTime": "2020-03-02T23:51:22.269713Z", "sources": [ - { - "generator": { - "name": "artman", - "version": "0.44.4", - "dockerImage": "googleapis/artman@sha256:19e945954fc960a4bdfee6cb34695898ab21a8cf0bac063ee39b91f00a1faec8" - } - }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "e46f761cd6ec15a9e3d5ed4ff321a4bcba8e8585", - "internalRef": "293710856" + "sha": "244ab2b83a82076a1fa7be63b7e0671af73f5c02", + "internalRef": "298455048" } }, { @@ -30,9 +23,8 @@ "source": "googleapis", "apiName": "vision", "apiVersion": "v1", - "language": "nodejs", - "generator": "gapic", - "config": "google/cloud/vision/artman_vision_v1.yaml" + "language": "typescript", + "generator": "gapic-generator-typescript" } }, { @@ -40,9 +32,8 @@ "source": "googleapis", "apiName": "vision", "apiVersion": "v1p1beta1", - "language": "nodejs", - "generator": "gapic", - "config": "google/cloud/vision/artman_vision_v1p1beta1.yaml" + "language": "typescript", + "generator": "gapic-generator-typescript" } }, { @@ -50,9 +41,8 @@ "source": "googleapis", "apiName": "vision", "apiVersion": "v1p2beta1", - "language": "nodejs", - "generator": "gapic", - "config": "google/cloud/vision/artman_vision_v1p2beta1.yaml" + "language": "typescript", + "generator": "gapic-generator-typescript" } }, { @@ -60,9 +50,8 @@ "source": "googleapis", "apiName": "vision", "apiVersion": "v1p3beta1", - "language": "nodejs", - "generator": "gapic", - "config": "google/cloud/vision/artman_vision_v1p3beta1.yaml" + "language": "typescript", + "generator": "gapic-generator-typescript" } }, { @@ -70,9 +59,8 @@ "source": "googleapis", "apiName": "vision", "apiVersion": "v1p4beta1", - "language": "nodejs", - "generator": "gapic", - "config": "google/cloud/vision/artman_vision_v1p4beta1.yaml" + "language": "typescript", + "generator": "gapic-generator-typescript" } } ] diff --git a/packages/google-cloud-vision/synth.py b/packages/google-cloud-vision/synth.py index 3e38d7185a8..8eeb83fb94e 100644 --- a/packages/google-cloud-vision/synth.py +++ b/packages/google-cloud-vision/synth.py @@ -22,27 +22,31 @@ logging.basicConfig(level=logging.DEBUG) # Run the gapic generator -gapic = gcp.GAPICGenerator() +gapic = gcp.GAPICMicrogenerator() versions = ['v1', 'v1p1beta1', 'v1p2beta1', 'v1p3beta1', 'v1p4beta1'] for version in versions: - library = gapic.node_library('vision', version) - s.copy(library, excludes=['src/index.js', 'README.md', 'package.json']) - + library = gapic.typescript_library( + 'vision', version, + generator_args={ + "grpc-service-config": f"google/cloud/vision/{version}/vision_grpc_service_config.json", + "package-name": f"@google-cloud/vision", + "main-service": f"vision" + }, + proto_path=f'/google/cloud/vision/{version}', + extra_proto_files=['google/cloud/common_resources.proto'], + ) + s.copy(library, excludes=['src/index.ts', 'package.json']) +# extends interface for client.ts +for version in versions: + client_file = f"src/{version}/image_annotator_client.ts" + s.replace(client_file, '\Z', + 'import {FeaturesMethod} from \'../helpers\'; \n export interface ImageAnnotatorClient extends FeaturesMethod {}' + ) # Copy common templates common_templates = gcp.CommonTemplates() templates = common_templates.node_library() s.copy(templates) -# [START fix-dead-link] -s.replace('**/doc/google/protobuf/doc_timestamp.js', - 'https:\/\/cloud\.google\.com[\s\*]*http:\/\/(.*)[\s\*]*\)', - r"https://\1)") - -s.replace('**/doc/google/protobuf/doc_timestamp.js', - 'toISOString\]', - 'toISOString)') -# [END fix-dead-link] - # Node.js specific cleanup subprocess.run(['npm', 'install']) subprocess.run(['npm', 'run', 'fix']) diff --git a/packages/google-cloud-vision/src/v1p3beta1/index.js b/packages/google-cloud-vision/system-test/fixtures/sample/src/index.js similarity index 53% rename from packages/google-cloud-vision/src/v1p3beta1/index.js rename to packages/google-cloud-vision/system-test/fixtures/sample/src/index.js index d35c3834272..a9ca48b4cd9 100644 --- a/packages/google-cloud-vision/src/v1p3beta1/index.js +++ b/packages/google-cloud-vision/system-test/fixtures/sample/src/index.js @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -11,11 +11,18 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + -'use strict'; +/* eslint-disable node/no-missing-require, no-unused-vars */ +const vision = require('@google-cloud/vision'); -const ProductSearchClient = require('./product_search_client'); -const ImageAnnotatorClient = require('./image_annotator_client'); +function main() { + const imageAnnotatorClient = new vision.ImageAnnotatorClient(); + const productSearchClient = new vision.ProductSearchClient(); +} -module.exports.ProductSearchClient = ProductSearchClient; -module.exports.ImageAnnotatorClient = ImageAnnotatorClient; +main(); diff --git a/packages/google-cloud-vision/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-vision/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..67a0346c400 --- /dev/null +++ b/packages/google-cloud-vision/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,26 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {ImageAnnotatorClient, ProductSearchClient} from '@google-cloud/vision'; + +function main() { + const imageAnnotatorClient = new ImageAnnotatorClient(); + const productSearchClient = new ProductSearchClient(); +} + +main(); diff --git a/packages/google-cloud-vision/system-test/image_annotator_smoke_test.js b/packages/google-cloud-vision/system-test/image_annotator_smoke_test.ts similarity index 83% rename from packages/google-cloud-vision/system-test/image_annotator_smoke_test.js rename to packages/google-cloud-vision/system-test/image_annotator_smoke_test.ts index 7907d507a61..e0f5c1f2c13 100644 --- a/packages/google-cloud-vision/system-test/image_annotator_smoke_test.js +++ b/packages/google-cloud-vision/system-test/image_annotator_smoke_test.ts @@ -12,9 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -'use strict'; - -const {describe, it} = require('mocha'); +import {describe, it} from 'mocha'; describe('ImageAnnotatorSmokeTest', () => { it('successfully makes a call to the service', done => { @@ -26,24 +24,24 @@ describe('ImageAnnotatorSmokeTest', () => { const gcsImageUri = 'gs://gapic-toolkit/President_Barack_Obama.jpg'; const source = { - gcsImageUri: gcsImageUri, + gcsImageUri, }; const image = { - source: source, + source, }; const type = 'FACE_DETECTION'; const featuresElement = { - type: type, + type, }; const features = [featuresElement]; const requestsElement = { - image: image, - features: features, + image, + features, }; const requests = [requestsElement]; client - .batchAnnotateImages({requests: requests}) - .then(responses => { + .batchAnnotateImages({requests}) + .then((responses: {[index: number]: string}) => { const response = responses[0]; console.log(response); }) diff --git a/packages/google-cloud-vision/system-test/install.ts b/packages/google-cloud-vision/system-test/install.ts new file mode 100644 index 00000000000..c9aa74ec221 --- /dev/null +++ b/packages/google-cloud-vision/system-test/install.ts @@ -0,0 +1,51 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {packNTest} from 'pack-n-play'; +import {readFileSync} from 'fs'; +import {describe, it} from 'mocha'; + +describe('typescript consumer tests', () => { + it('should have correct type signature for typescript users', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), // path to your module. + sample: { + description: 'typescript based user can use the type definitions', + ts: readFileSync( + './system-test/fixtures/sample/src/index.ts' + ).toString(), + }, + }; + await packNTest(options); // will throw upon error. + }); + + it('should have correct type signature for javascript users', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), // path to your module. + sample: { + description: 'typescript based user can use the type definitions', + ts: readFileSync( + './system-test/fixtures/sample/src/index.js' + ).toString(), + }, + }; + await packNTest(options); // will throw upon error. + }); +}); diff --git a/packages/google-cloud-vision/system-test/vision-v1p2beta1.js b/packages/google-cloud-vision/system-test/vision-v1p2beta1.ts similarity index 83% rename from packages/google-cloud-vision/system-test/vision-v1p2beta1.js rename to packages/google-cloud-vision/system-test/vision-v1p2beta1.ts index 8c2ce8a591b..5b98620e090 100644 --- a/packages/google-cloud-vision/system-test/vision-v1p2beta1.js +++ b/packages/google-cloud-vision/system-test/vision-v1p2beta1.ts @@ -12,9 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -'use strict'; - -const {describe, it} = require('mocha'); +import {describe, it} from 'mocha'; describe('ImageAnnotatorSmokeTest', () => { it('successfully makes a call to the service', done => { @@ -26,24 +24,24 @@ describe('ImageAnnotatorSmokeTest', () => { const gcsImageUri = 'gs://gapic-toolkit/President_Barack_Obama.jpg'; const source = { - gcsImageUri: gcsImageUri, + gcsImageUri, }; const image = { - source: source, + source, }; const type = 'FACE_DETECTION'; const featuresElement = { - type: type, + type, }; const features = [featuresElement]; const requestsElement = { - image: image, - features: features, + image, + features, }; const requests = [requestsElement]; client - .batchAnnotateImages({requests: requests}) - .then(responses => { + .batchAnnotateImages({requests}) + .then((responses: {[index: number]: string}) => { const response = responses[0]; console.log(response); }) diff --git a/packages/google-cloud-vision/system-test/vision.js b/packages/google-cloud-vision/system-test/vision.js deleted file mode 100644 index 2479af73422..00000000000 --- a/packages/google-cloud-vision/system-test/vision.js +++ /dev/null @@ -1,115 +0,0 @@ -/*! - * Copyright 2015 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -const assert = require('assert'); -const {describe, it, before, after} = require('mocha'); -const fs = require('fs'); -const path = require('path'); -const {Storage} = require('@google-cloud/storage'); -const uuid = require('uuid'); - -const vision = require('../'); - -describe('Vision', function() { - const IMAGES = Object.freeze({ - document: path.join(__dirname, 'data/document.jpg'), - logo: path.join(__dirname, 'data/logo.jpg'), - rushmore: path.join(__dirname, 'data/rushmore.jpg'), - text: path.join(__dirname, 'data/text.png'), - malformed: __filename, - }); - - const TESTS_PREFIX = 'gcloud-vision-test'; - - const storage = new Storage(); - const client = new vision.v1.ImageAnnotatorClient(); - - const bucket = storage.bucket(generateName()); - - before(function(done) { - bucket.create(function(err) { - if (err) { - done(err); - return; - } - - bucket.upload(IMAGES.logo, done); - }); - }); - - after(async () => { - const [buckets] = await storage.getBuckets({prefix: TESTS_PREFIX}); - await Promise.all( - buckets.map(async bucket => { - await bucket.deleteFiles(); - await bucket.delete(); - }) - ); - }); - - it('should detect from a URL', () => { - const url = - 'https://upload.wikimedia.org/wikipedia/commons/5/51/Google.png'; - return client.logoDetection(url).then(responses => { - const response = responses[0]; - assert.strictEqual( - response.logoAnnotations[0].description.toLowerCase(), - 'google' - ); - }); - }); - - it('should detect from a filename', () => { - return client.logoDetection(IMAGES.logo).then(responses => { - const response = responses[0]; - assert.ok( - /google/.test(response.logoAnnotations[0].description.toLowerCase()) - ); - }); - }); - - it('should detect from a Buffer', () => { - const buffer = fs.readFileSync(IMAGES.logo); - return client.logoDetection(buffer).then(responses => { - const response = responses[0]; - assert.ok( - /google/.test(response.logoAnnotations[0].description.toLowerCase()) - ); - }); - }); - - describe('single image', () => { - const TYPES = [{type: 'LABEL_DETECTION'}, {type: 'SAFE_SEARCH_DETECTION'}]; - it('should perform multiple detections', () => { - return client - .annotateImage({ - features: TYPES, - image: {source: {filename: IMAGES.rushmore}}, - }) - .then(responses => { - const response = responses[0]; - assert(response.labelAnnotations.length >= 1); - assert(response.safeSearchAnnotation !== null); - }); - }); - }); - - function generateName() { - return TESTS_PREFIX + uuid.v1(); - } -}); diff --git a/packages/google-cloud-vision/system-test/vision.ts b/packages/google-cloud-vision/system-test/vision.ts new file mode 100644 index 00000000000..19aaa37557a --- /dev/null +++ b/packages/google-cloud-vision/system-test/vision.ts @@ -0,0 +1,154 @@ +// Copyright 2015 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import * as assert from 'assert'; +import {describe, it, before, after} from 'mocha'; +import * as fs from 'fs'; +import * as path from 'path'; +import {Storage} from '@google-cloud/storage'; +import * as uuid from 'uuid'; +import * as prototypes from '../protos/protos'; +import * as vision from '../src'; +// const vision = require('../src'); +describe('Vision', () => { + const IMAGES = Object.freeze({ + document: path.join( + __dirname, + '..', + '..', + 'system-test', + 'data/document.jpg' + ), + logo: path.join(__dirname, '..', '..', 'system-test', 'data/logo.jpg'), + rushmore: path.join( + __dirname, + '..', + '..', + 'system-test', + 'data/rushmore.jpg' + ), + text: path.join(__dirname, '..', '..', 'system-test', 'data/text.png'), + malformed: __filename, + }); + + const TESTS_PREFIX = 'gcloud-vision-test'; + + const storage = new Storage(); + const client = new vision.v1.ImageAnnotatorClient(); + const bucket = storage.bucket(generateName()); + + before(done => { + bucket.create((err: {}) => { + if (err) { + done(err); + return; + } + + bucket.upload(IMAGES.logo, done); + }); + }); + + after(async () => { + const [buckets] = await storage.getBuckets({prefix: TESTS_PREFIX}); + await Promise.all( + buckets.map(async bucket => { + await bucket.deleteFiles(); + await bucket.delete(); + }) + ); + }); + + it('should detect from a URL', () => { + const url = + 'https://upload.wikimedia.org/wikipedia/commons/5/51/Google.png'; + return client + .logoDetection(url) + .then( + ( + responses: [prototypes.google.cloud.vision.v1.IAnnotateImageResponse] + ) => { + const response = responses[0]; + assert.strictEqual( + response.logoAnnotations![0].description!.toLowerCase(), + 'google' + ); + } + ); + }); + + it('should detect from a filename', () => { + return client + .logoDetection(IMAGES.logo) + .then( + ( + responses: [prototypes.google.cloud.vision.v1.IAnnotateImageResponse] + ) => { + const response = responses[0]; + assert.ok( + /google/.test( + response.logoAnnotations![0].description!.toLowerCase() + ) + ); + } + ); + }); + + it('should detect from a Buffer', () => { + const buffer = fs.readFileSync(IMAGES.logo); + return client + .logoDetection(buffer) + .then( + ( + responses: [prototypes.google.cloud.vision.v1.IAnnotateImageResponse] + ) => { + const response = responses[0]; + assert.ok( + /google/.test( + response.logoAnnotations![0].description!.toLowerCase() + ) + ); + } + ); + }); + + describe('single image', () => { + const TYPES = [ + {type: 'FACE_DETECTION'}, + {type: 'LABEL_DETECTION'}, + {type: 'SAFE_SEARCH_DETECTION'}, + ]; + it('should perform multiple detections', () => { + return client + .annotateImage({ + features: TYPES, + image: {source: {filename: IMAGES.rushmore}}, + }) + .then( + ( + responses: [ + prototypes.google.cloud.vision.v1.IAnnotateImageResponse + ] + ) => { + const response = responses[0]; + assert(response.labelAnnotations!.length >= 1); + assert(response.safeSearchAnnotation !== null); + } + ); + }); + }); + + function generateName() { + return TESTS_PREFIX + uuid.v1(); + } +}); diff --git a/packages/google-cloud-vision/test/fixtures/image.jpg b/packages/google-cloud-vision/test/fixtures/image.jpg new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/google-cloud-vision/test/gapic-image_annotator-v1.ts b/packages/google-cloud-vision/test/gapic-image_annotator-v1.ts new file mode 100644 index 00000000000..c5589dad4b0 --- /dev/null +++ b/packages/google-cloud-vision/test/gapic-image_annotator-v1.ts @@ -0,0 +1,329 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protosTypes from '../protos/protos'; +import * as assert from 'assert'; +import {describe, it} from 'mocha'; +const imageannotatorModule = require('../src'); + +const FAKE_STATUS_CODE = 1; +class FakeError { + name: string; + message: string; + code: number; + constructor(n: number) { + this.name = 'fakeName'; + this.message = 'fake message'; + this.code = n; + } +} +const error = new FakeError(FAKE_STATUS_CODE); +export interface Callback { + (err: FakeError | null, response?: {} | null): void; +} + +export class Operation { + constructor() {} + promise() {} +} +function mockSimpleGrpcMethod( + expectedRequest: {}, + response: {} | null, + error: FakeError | null +) { + return (actualRequest: {}, options: {}, callback: Callback) => { + assert.deepStrictEqual(actualRequest, expectedRequest); + if (error) { + callback(error); + } else if (response) { + callback(null, response); + } else { + callback(null); + } + }; +} +function mockLongRunningGrpcMethod( + expectedRequest: {}, + response: {} | null, + error?: {} | null +) { + return (request: {}) => { + assert.deepStrictEqual(request, expectedRequest); + const mockOperation = { + promise() { + return new Promise((resolve, reject) => { + if (error) { + reject(error); + } else { + resolve([response]); + } + }); + }, + }; + return Promise.resolve([mockOperation]); + }; +} +describe('v1.ImageAnnotatorClient', () => { + it('has servicePath', () => { + const servicePath = + imageannotatorModule.v1.ImageAnnotatorClient.servicePath; + assert(servicePath); + }); + it('has apiEndpoint', () => { + const apiEndpoint = + imageannotatorModule.v1.ImageAnnotatorClient.apiEndpoint; + assert(apiEndpoint); + }); + it('has port', () => { + const port = imageannotatorModule.v1.ImageAnnotatorClient.port; + assert(port); + assert(typeof port === 'number'); + }); + it('should create a client with no option', () => { + const client = new imageannotatorModule.v1.ImageAnnotatorClient(); + assert(client); + }); + it('should create a client with gRPC fallback', () => { + const client = new imageannotatorModule.v1.ImageAnnotatorClient({ + fallback: true, + }); + assert(client); + }); + describe('batchAnnotateImages', () => { + it('invokes batchAnnotateImages without error', done => { + const client = new imageannotatorModule.v1.ImageAnnotatorClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IBatchAnnotateImagesRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.batchAnnotateImages = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.batchAnnotateImages(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes batchAnnotateImages with error', done => { + const client = new imageannotatorModule.v1.ImageAnnotatorClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IBatchAnnotateImagesRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.batchAnnotateImages = mockSimpleGrpcMethod( + request, + null, + error + ); + client.batchAnnotateImages(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('batchAnnotateFiles', () => { + it('invokes batchAnnotateFiles without error', done => { + const client = new imageannotatorModule.v1.ImageAnnotatorClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IBatchAnnotateFilesRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.batchAnnotateFiles = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.batchAnnotateFiles(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes batchAnnotateFiles with error', done => { + const client = new imageannotatorModule.v1.ImageAnnotatorClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IBatchAnnotateFilesRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.batchAnnotateFiles = mockSimpleGrpcMethod( + request, + null, + error + ); + client.batchAnnotateFiles(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('asyncBatchAnnotateImages', () => { + it('invokes asyncBatchAnnotateImages without error', done => { + const client = new imageannotatorModule.v1.ImageAnnotatorClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IAsyncBatchAnnotateImagesRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.asyncBatchAnnotateImages = mockLongRunningGrpcMethod( + request, + expectedResponse + ); + client + .asyncBatchAnnotateImages(request) + .then((responses: [Operation]) => { + const operation = responses[0]; + return operation ? operation.promise() : {}; + }) + .then((responses: [Operation]) => { + assert.deepStrictEqual(responses[0], expectedResponse); + done(); + }) + .catch((err: {}) => { + done(err); + }); + }); + + it('invokes asyncBatchAnnotateImages with error', done => { + const client = new imageannotatorModule.v1.ImageAnnotatorClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IAsyncBatchAnnotateImagesRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.asyncBatchAnnotateImages = mockLongRunningGrpcMethod( + request, + null, + error + ); + client + .asyncBatchAnnotateImages(request) + .then((responses: [Operation]) => { + const operation = responses[0]; + return operation ? operation.promise() : {}; + }) + .then(() => { + assert.fail(); + }) + .catch((err: FakeError) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + done(); + }); + }); + }); + describe('asyncBatchAnnotateFiles', () => { + it('invokes asyncBatchAnnotateFiles without error', done => { + const client = new imageannotatorModule.v1.ImageAnnotatorClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IAsyncBatchAnnotateFilesRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.asyncBatchAnnotateFiles = mockLongRunningGrpcMethod( + request, + expectedResponse + ); + client + .asyncBatchAnnotateFiles(request) + .then((responses: [Operation]) => { + const operation = responses[0]; + return operation ? operation.promise() : {}; + }) + .then((responses: [Operation]) => { + assert.deepStrictEqual(responses[0], expectedResponse); + done(); + }) + .catch((err: {}) => { + done(err); + }); + }); + + it('invokes asyncBatchAnnotateFiles with error', done => { + const client = new imageannotatorModule.v1.ImageAnnotatorClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IAsyncBatchAnnotateFilesRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.asyncBatchAnnotateFiles = mockLongRunningGrpcMethod( + request, + null, + error + ); + client + .asyncBatchAnnotateFiles(request) + .then((responses: [Operation]) => { + const operation = responses[0]; + return operation ? operation.promise() : {}; + }) + .then(() => { + assert.fail(); + }) + .catch((err: FakeError) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + done(); + }); + }); + }); +}); diff --git a/packages/google-cloud-vision/test/gapic-image_annotator-v1p1beta1.ts b/packages/google-cloud-vision/test/gapic-image_annotator-v1p1beta1.ts new file mode 100644 index 00000000000..5d183675a96 --- /dev/null +++ b/packages/google-cloud-vision/test/gapic-image_annotator-v1p1beta1.ts @@ -0,0 +1,132 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protosTypes from '../protos/protos'; +import * as assert from 'assert'; +import {describe, it} from 'mocha'; +const imageannotatorModule = require('../src'); + +const FAKE_STATUS_CODE = 1; +class FakeError { + name: string; + message: string; + code: number; + constructor(n: number) { + this.name = 'fakeName'; + this.message = 'fake message'; + this.code = n; + } +} +const error = new FakeError(FAKE_STATUS_CODE); +export interface Callback { + (err: FakeError | null, response?: {} | null): void; +} + +export class Operation { + constructor() {} + promise() {} +} +function mockSimpleGrpcMethod( + expectedRequest: {}, + response: {} | null, + error: FakeError | null +) { + return (actualRequest: {}, options: {}, callback: Callback) => { + assert.deepStrictEqual(actualRequest, expectedRequest); + if (error) { + callback(error); + } else if (response) { + callback(null, response); + } else { + callback(null); + } + }; +} +describe('v1p1beta1.ImageAnnotatorClient', () => { + it('has servicePath', () => { + const servicePath = + imageannotatorModule.v1p1beta1.ImageAnnotatorClient.servicePath; + assert(servicePath); + }); + it('has apiEndpoint', () => { + const apiEndpoint = + imageannotatorModule.v1p1beta1.ImageAnnotatorClient.apiEndpoint; + assert(apiEndpoint); + }); + it('has port', () => { + const port = imageannotatorModule.v1p1beta1.ImageAnnotatorClient.port; + assert(port); + assert(typeof port === 'number'); + }); + it('should create a client with no option', () => { + const client = new imageannotatorModule.v1p1beta1.ImageAnnotatorClient(); + assert(client); + }); + it('should create a client with gRPC fallback', () => { + const client = new imageannotatorModule.v1p1beta1.ImageAnnotatorClient({ + fallback: true, + }); + assert(client); + }); + describe('batchAnnotateImages', () => { + it('invokes batchAnnotateImages without error', done => { + const client = new imageannotatorModule.v1p1beta1.ImageAnnotatorClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest = {}; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.batchAnnotateImages = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.batchAnnotateImages(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes batchAnnotateImages with error', done => { + const client = new imageannotatorModule.v1p1beta1.ImageAnnotatorClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p1beta1.IBatchAnnotateImagesRequest = {}; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.batchAnnotateImages = mockSimpleGrpcMethod( + request, + null, + error + ); + client.batchAnnotateImages(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); +}); diff --git a/packages/google-cloud-vision/test/gapic-v1p2beta1.js b/packages/google-cloud-vision/test/gapic-image_annotator-v1p2beta1.ts similarity index 53% rename from packages/google-cloud-vision/test/gapic-v1p2beta1.js rename to packages/google-cloud-vision/test/gapic-image_annotator-v1p2beta1.ts index 3dafe924715..00d9a51e68d 100644 --- a/packages/google-cloud-vision/test/gapic-v1p2beta1.js +++ b/packages/google-cloud-vision/test/gapic-image_annotator-v1p2beta1.ts @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -11,70 +11,116 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** -'use strict'; - -const assert = require('assert'); -const {describe, it} = require('mocha'); - -const visionModule = require('../src'); +import * as protosTypes from '../protos/protos'; +import * as assert from 'assert'; +import {describe, it} from 'mocha'; +const imageannotatorModule = require('../src'); const FAKE_STATUS_CODE = 1; -const error = new Error(); -error.code = FAKE_STATUS_CODE; +class FakeError { + name: string; + message: string; + code: number; + constructor(n: number) { + this.name = 'fakeName'; + this.message = 'fake message'; + this.code = n; + } +} +const error = new FakeError(FAKE_STATUS_CODE); +export interface Callback { + (err: FakeError | null, response?: {} | null): void; +} -describe('ImageAnnotatorClient', () => { +export class Operation { + constructor() {} + promise() {} +} +function mockSimpleGrpcMethod( + expectedRequest: {}, + response: {} | null, + error: FakeError | null +) { + return (actualRequest: {}, options: {}, callback: Callback) => { + assert.deepStrictEqual(actualRequest, expectedRequest); + if (error) { + callback(error); + } else if (response) { + callback(null, response); + } else { + callback(null); + } + }; +} +function mockLongRunningGrpcMethod( + expectedRequest: {}, + response: {} | null, + error?: {} | null +) { + return (request: {}) => { + assert.deepStrictEqual(request, expectedRequest); + const mockOperation = { + promise() { + return new Promise((resolve, reject) => { + if (error) { + reject(error); + } else { + resolve([response]); + } + }); + }, + }; + return Promise.resolve([mockOperation]); + }; +} +describe('v1p2beta1.ImageAnnotatorClient', () => { it('has servicePath', () => { - const servicePath = visionModule.v1p2beta1.ImageAnnotatorClient.servicePath; + const servicePath = + imageannotatorModule.v1p2beta1.ImageAnnotatorClient.servicePath; assert(servicePath); }); - it('has apiEndpoint', () => { - const apiEndpoint = visionModule.v1p2beta1.ImageAnnotatorClient.apiEndpoint; + const apiEndpoint = + imageannotatorModule.v1p2beta1.ImageAnnotatorClient.apiEndpoint; assert(apiEndpoint); }); - it('has port', () => { - const port = visionModule.v1p2beta1.ImageAnnotatorClient.port; + const port = imageannotatorModule.v1p2beta1.ImageAnnotatorClient.port; assert(port); assert(typeof port === 'number'); }); - - it('should create a client with no options', () => { - const client = new visionModule.v1p2beta1.ImageAnnotatorClient(); + it('should create a client with no option', () => { + const client = new imageannotatorModule.v1p2beta1.ImageAnnotatorClient(); assert(client); }); - it('should create a client with gRPC fallback', () => { - const client = new visionModule.v1p2beta1.ImageAnnotatorClient({ + const client = new imageannotatorModule.v1p2beta1.ImageAnnotatorClient({ fallback: true, }); assert(client); }); - describe('batchAnnotateImages', () => { it('invokes batchAnnotateImages without error', done => { - const client = new visionModule.v1p2beta1.ImageAnnotatorClient({ + const client = new imageannotatorModule.v1p2beta1.ImageAnnotatorClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - // Mock request - const requests = []; - const request = { - requests: requests, - }; - + const request: protosTypes.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest = {}; // Mock response const expectedResponse = {}; - - // Mock Grpc layer + // Mock gRPC layer client._innerApiCalls.batchAnnotateImages = mockSimpleGrpcMethod( request, - expectedResponse + expectedResponse, + null ); - - client.batchAnnotateImages(request, (err, response) => { + client.batchAnnotateImages(request, (err: {}, response: {}) => { assert.ifError(err); assert.deepStrictEqual(response, expectedResponse); done(); @@ -82,149 +128,87 @@ describe('ImageAnnotatorClient', () => { }); it('invokes batchAnnotateImages with error', done => { - const client = new visionModule.v1p2beta1.ImageAnnotatorClient({ + const client = new imageannotatorModule.v1p2beta1.ImageAnnotatorClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - // Mock request - const requests = []; - const request = { - requests: requests, - }; - - // Mock Grpc layer + const request: protosTypes.google.cloud.vision.v1p2beta1.IBatchAnnotateImagesRequest = {}; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer client._innerApiCalls.batchAnnotateImages = mockSimpleGrpcMethod( request, null, error ); - - client.batchAnnotateImages(request, (err, response) => { - assert(err instanceof Error); + client.batchAnnotateImages(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); assert.strictEqual(err.code, FAKE_STATUS_CODE); assert(typeof response === 'undefined'); done(); }); }); }); - - describe('asyncBatchAnnotateFiles', function() { + describe('asyncBatchAnnotateFiles', () => { it('invokes asyncBatchAnnotateFiles without error', done => { - const client = new visionModule.v1p2beta1.ImageAnnotatorClient({ + const client = new imageannotatorModule.v1p2beta1.ImageAnnotatorClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - // Mock request - const requests = []; - const request = { - requests: requests, - }; - + const request: protosTypes.google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesRequest = {}; // Mock response const expectedResponse = {}; - - // Mock Grpc layer + // Mock gRPC layer client._innerApiCalls.asyncBatchAnnotateFiles = mockLongRunningGrpcMethod( request, expectedResponse ); - client .asyncBatchAnnotateFiles(request) - .then(responses => { + .then((responses: [Operation]) => { const operation = responses[0]; - return operation.promise(); + return operation ? operation.promise() : {}; }) - .then(responses => { + .then((responses: [Operation]) => { assert.deepStrictEqual(responses[0], expectedResponse); done(); }) - .catch(err => { + .catch((err: {}) => { done(err); }); }); it('invokes asyncBatchAnnotateFiles with error', done => { - const client = new visionModule.v1p2beta1.ImageAnnotatorClient({ + const client = new imageannotatorModule.v1p2beta1.ImageAnnotatorClient({ credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', }); - // Mock request - const requests = []; - const request = { - requests: requests, - }; - - // Mock Grpc layer + const request: protosTypes.google.cloud.vision.v1p2beta1.IAsyncBatchAnnotateFilesRequest = {}; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer client._innerApiCalls.asyncBatchAnnotateFiles = mockLongRunningGrpcMethod( request, null, error ); - client .asyncBatchAnnotateFiles(request) - .then(responses => { + .then((responses: [Operation]) => { const operation = responses[0]; - return operation.promise(); + return operation ? operation.promise() : {}; }) .then(() => { assert.fail(); }) - .catch(err => { - assert(err instanceof Error); + .catch((err: FakeError) => { + assert(err instanceof FakeError); assert.strictEqual(err.code, FAKE_STATUS_CODE); done(); }); }); - - it('has longrunning decoder functions', () => { - const client = new visionModule.v1p2beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert( - client._descriptors.longrunning.asyncBatchAnnotateFiles - .responseDecoder instanceof Function - ); - assert( - client._descriptors.longrunning.asyncBatchAnnotateFiles - .metadataDecoder instanceof Function - ); - }); }); }); - -function mockSimpleGrpcMethod(expectedRequest, response, error) { - return function(actualRequest, options, callback) { - assert.deepStrictEqual(actualRequest, expectedRequest); - if (error) { - callback(error); - } else if (response) { - callback(null, response); - } else { - callback(null); - } - }; -} - -function mockLongRunningGrpcMethod(expectedRequest, response, error) { - return request => { - assert.deepStrictEqual(request, expectedRequest); - const mockOperation = { - promise: function() { - return new Promise((resolve, reject) => { - if (error) { - reject(error); - } else { - resolve([response]); - } - }); - }, - }; - return Promise.resolve([mockOperation]); - }; -} diff --git a/packages/google-cloud-vision/test/gapic-image_annotator-v1p3beta1.ts b/packages/google-cloud-vision/test/gapic-image_annotator-v1p3beta1.ts new file mode 100644 index 00000000000..420248bda0e --- /dev/null +++ b/packages/google-cloud-vision/test/gapic-image_annotator-v1p3beta1.ts @@ -0,0 +1,214 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protosTypes from '../protos/protos'; +import * as assert from 'assert'; +import {describe, it} from 'mocha'; +const imageannotatorModule = require('../src'); + +const FAKE_STATUS_CODE = 1; +class FakeError { + name: string; + message: string; + code: number; + constructor(n: number) { + this.name = 'fakeName'; + this.message = 'fake message'; + this.code = n; + } +} +const error = new FakeError(FAKE_STATUS_CODE); +export interface Callback { + (err: FakeError | null, response?: {} | null): void; +} + +export class Operation { + constructor() {} + promise() {} +} +function mockSimpleGrpcMethod( + expectedRequest: {}, + response: {} | null, + error: FakeError | null +) { + return (actualRequest: {}, options: {}, callback: Callback) => { + assert.deepStrictEqual(actualRequest, expectedRequest); + if (error) { + callback(error); + } else if (response) { + callback(null, response); + } else { + callback(null); + } + }; +} +function mockLongRunningGrpcMethod( + expectedRequest: {}, + response: {} | null, + error?: {} | null +) { + return (request: {}) => { + assert.deepStrictEqual(request, expectedRequest); + const mockOperation = { + promise() { + return new Promise((resolve, reject) => { + if (error) { + reject(error); + } else { + resolve([response]); + } + }); + }, + }; + return Promise.resolve([mockOperation]); + }; +} +describe('v1p3beta1.ImageAnnotatorClient', () => { + it('has servicePath', () => { + const servicePath = + imageannotatorModule.v1p3beta1.ImageAnnotatorClient.servicePath; + assert(servicePath); + }); + it('has apiEndpoint', () => { + const apiEndpoint = + imageannotatorModule.v1p3beta1.ImageAnnotatorClient.apiEndpoint; + assert(apiEndpoint); + }); + it('has port', () => { + const port = imageannotatorModule.v1p3beta1.ImageAnnotatorClient.port; + assert(port); + assert(typeof port === 'number'); + }); + it('should create a client with no option', () => { + const client = new imageannotatorModule.v1p3beta1.ImageAnnotatorClient(); + assert(client); + }); + it('should create a client with gRPC fallback', () => { + const client = new imageannotatorModule.v1p3beta1.ImageAnnotatorClient({ + fallback: true, + }); + assert(client); + }); + describe('batchAnnotateImages', () => { + it('invokes batchAnnotateImages without error', done => { + const client = new imageannotatorModule.v1p3beta1.ImageAnnotatorClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest = {}; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.batchAnnotateImages = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.batchAnnotateImages(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes batchAnnotateImages with error', done => { + const client = new imageannotatorModule.v1p3beta1.ImageAnnotatorClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IBatchAnnotateImagesRequest = {}; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.batchAnnotateImages = mockSimpleGrpcMethod( + request, + null, + error + ); + client.batchAnnotateImages(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('asyncBatchAnnotateFiles', () => { + it('invokes asyncBatchAnnotateFiles without error', done => { + const client = new imageannotatorModule.v1p3beta1.ImageAnnotatorClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesRequest = {}; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.asyncBatchAnnotateFiles = mockLongRunningGrpcMethod( + request, + expectedResponse + ); + client + .asyncBatchAnnotateFiles(request) + .then((responses: [Operation]) => { + const operation = responses[0]; + return operation ? operation.promise() : {}; + }) + .then((responses: [Operation]) => { + assert.deepStrictEqual(responses[0], expectedResponse); + done(); + }) + .catch((err: {}) => { + done(err); + }); + }); + + it('invokes asyncBatchAnnotateFiles with error', done => { + const client = new imageannotatorModule.v1p3beta1.ImageAnnotatorClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IAsyncBatchAnnotateFilesRequest = {}; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.asyncBatchAnnotateFiles = mockLongRunningGrpcMethod( + request, + null, + error + ); + client + .asyncBatchAnnotateFiles(request) + .then((responses: [Operation]) => { + const operation = responses[0]; + return operation ? operation.promise() : {}; + }) + .then(() => { + assert.fail(); + }) + .catch((err: FakeError) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + done(); + }); + }); + }); +}); diff --git a/packages/google-cloud-vision/test/gapic-image_annotator-v1p4beta1.ts b/packages/google-cloud-vision/test/gapic-image_annotator-v1p4beta1.ts new file mode 100644 index 00000000000..84a2f0cf3db --- /dev/null +++ b/packages/google-cloud-vision/test/gapic-image_annotator-v1p4beta1.ts @@ -0,0 +1,321 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protosTypes from '../protos/protos'; +import * as assert from 'assert'; +import {describe, it} from 'mocha'; +const imageannotatorModule = require('../src'); + +const FAKE_STATUS_CODE = 1; +class FakeError { + name: string; + message: string; + code: number; + constructor(n: number) { + this.name = 'fakeName'; + this.message = 'fake message'; + this.code = n; + } +} +const error = new FakeError(FAKE_STATUS_CODE); +export interface Callback { + (err: FakeError | null, response?: {} | null): void; +} + +export class Operation { + constructor() {} + promise() {} +} +function mockSimpleGrpcMethod( + expectedRequest: {}, + response: {} | null, + error: FakeError | null +) { + return (actualRequest: {}, options: {}, callback: Callback) => { + assert.deepStrictEqual(actualRequest, expectedRequest); + if (error) { + callback(error); + } else if (response) { + callback(null, response); + } else { + callback(null); + } + }; +} +function mockLongRunningGrpcMethod( + expectedRequest: {}, + response: {} | null, + error?: {} | null +) { + return (request: {}) => { + assert.deepStrictEqual(request, expectedRequest); + const mockOperation = { + promise() { + return new Promise((resolve, reject) => { + if (error) { + reject(error); + } else { + resolve([response]); + } + }); + }, + }; + return Promise.resolve([mockOperation]); + }; +} +describe('v1p4beta1.ImageAnnotatorClient', () => { + it('has servicePath', () => { + const servicePath = + imageannotatorModule.v1p4beta1.ImageAnnotatorClient.servicePath; + assert(servicePath); + }); + it('has apiEndpoint', () => { + const apiEndpoint = + imageannotatorModule.v1p4beta1.ImageAnnotatorClient.apiEndpoint; + assert(apiEndpoint); + }); + it('has port', () => { + const port = imageannotatorModule.v1p4beta1.ImageAnnotatorClient.port; + assert(port); + assert(typeof port === 'number'); + }); + it('should create a client with no option', () => { + const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient(); + assert(client); + }); + it('should create a client with gRPC fallback', () => { + const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ + fallback: true, + }); + assert(client); + }); + describe('batchAnnotateImages', () => { + it('invokes batchAnnotateImages without error', done => { + const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest = {}; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.batchAnnotateImages = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.batchAnnotateImages(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes batchAnnotateImages with error', done => { + const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IBatchAnnotateImagesRequest = {}; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.batchAnnotateImages = mockSimpleGrpcMethod( + request, + null, + error + ); + client.batchAnnotateImages(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('batchAnnotateFiles', () => { + it('invokes batchAnnotateFiles without error', done => { + const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest = {}; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.batchAnnotateFiles = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.batchAnnotateFiles(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes batchAnnotateFiles with error', done => { + const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IBatchAnnotateFilesRequest = {}; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.batchAnnotateFiles = mockSimpleGrpcMethod( + request, + null, + error + ); + client.batchAnnotateFiles(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('asyncBatchAnnotateImages', () => { + it('invokes asyncBatchAnnotateImages without error', done => { + const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest = {}; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.asyncBatchAnnotateImages = mockLongRunningGrpcMethod( + request, + expectedResponse + ); + client + .asyncBatchAnnotateImages(request) + .then((responses: [Operation]) => { + const operation = responses[0]; + return operation ? operation.promise() : {}; + }) + .then((responses: [Operation]) => { + assert.deepStrictEqual(responses[0], expectedResponse); + done(); + }) + .catch((err: {}) => { + done(err); + }); + }); + + it('invokes asyncBatchAnnotateImages with error', done => { + const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateImagesRequest = {}; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.asyncBatchAnnotateImages = mockLongRunningGrpcMethod( + request, + null, + error + ); + client + .asyncBatchAnnotateImages(request) + .then((responses: [Operation]) => { + const operation = responses[0]; + return operation ? operation.promise() : {}; + }) + .then(() => { + assert.fail(); + }) + .catch((err: FakeError) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + done(); + }); + }); + }); + describe('asyncBatchAnnotateFiles', () => { + it('invokes asyncBatchAnnotateFiles without error', done => { + const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest = {}; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.asyncBatchAnnotateFiles = mockLongRunningGrpcMethod( + request, + expectedResponse + ); + client + .asyncBatchAnnotateFiles(request) + .then((responses: [Operation]) => { + const operation = responses[0]; + return operation ? operation.promise() : {}; + }) + .then((responses: [Operation]) => { + assert.deepStrictEqual(responses[0], expectedResponse); + done(); + }) + .catch((err: {}) => { + done(err); + }); + }); + + it('invokes asyncBatchAnnotateFiles with error', done => { + const client = new imageannotatorModule.v1p4beta1.ImageAnnotatorClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IAsyncBatchAnnotateFilesRequest = {}; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.asyncBatchAnnotateFiles = mockLongRunningGrpcMethod( + request, + null, + error + ); + client + .asyncBatchAnnotateFiles(request) + .then((responses: [Operation]) => { + const operation = responses[0]; + return operation ? operation.promise() : {}; + }) + .then(() => { + assert.fail(); + }) + .catch((err: FakeError) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + done(); + }); + }); + }); +}); diff --git a/packages/google-cloud-vision/test/gapic-product_search-v1.ts b/packages/google-cloud-vision/test/gapic-product_search-v1.ts new file mode 100644 index 00000000000..ab940b73084 --- /dev/null +++ b/packages/google-cloud-vision/test/gapic-product_search-v1.ts @@ -0,0 +1,1101 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protosTypes from '../protos/protos'; +import * as assert from 'assert'; +import {describe, it} from 'mocha'; +const productsearchModule = require('../src'); + +const FAKE_STATUS_CODE = 1; +class FakeError { + name: string; + message: string; + code: number; + constructor(n: number) { + this.name = 'fakeName'; + this.message = 'fake message'; + this.code = n; + } +} +const error = new FakeError(FAKE_STATUS_CODE); +export interface Callback { + (err: FakeError | null, response?: {} | null): void; +} + +export class Operation { + constructor() {} + promise() {} +} +function mockSimpleGrpcMethod( + expectedRequest: {}, + response: {} | null, + error: FakeError | null +) { + return (actualRequest: {}, options: {}, callback: Callback) => { + assert.deepStrictEqual(actualRequest, expectedRequest); + if (error) { + callback(error); + } else if (response) { + callback(null, response); + } else { + callback(null); + } + }; +} +function mockLongRunningGrpcMethod( + expectedRequest: {}, + response: {} | null, + error?: {} | null +) { + return (request: {}) => { + assert.deepStrictEqual(request, expectedRequest); + const mockOperation = { + promise() { + return new Promise((resolve, reject) => { + if (error) { + reject(error); + } else { + resolve([response]); + } + }); + }, + }; + return Promise.resolve([mockOperation]); + }; +} +describe('v1.ProductSearchClient', () => { + it('has servicePath', () => { + const servicePath = productsearchModule.v1.ProductSearchClient.servicePath; + assert(servicePath); + }); + it('has apiEndpoint', () => { + const apiEndpoint = productsearchModule.v1.ProductSearchClient.apiEndpoint; + assert(apiEndpoint); + }); + it('has port', () => { + const port = productsearchModule.v1.ProductSearchClient.port; + assert(port); + assert(typeof port === 'number'); + }); + it('should create a client with no option', () => { + const client = new productsearchModule.v1.ProductSearchClient(); + assert(client); + }); + it('should create a client with gRPC fallback', () => { + const client = new productsearchModule.v1.ProductSearchClient({ + fallback: true, + }); + assert(client); + }); + describe('createProductSet', () => { + it('invokes createProductSet without error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.ICreateProductSetRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.createProductSet = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.createProductSet(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes createProductSet with error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.ICreateProductSetRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.createProductSet = mockSimpleGrpcMethod( + request, + null, + error + ); + client.createProductSet(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('getProductSet', () => { + it('invokes getProductSet without error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IGetProductSetRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.getProductSet = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.getProductSet(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes getProductSet with error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IGetProductSetRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.getProductSet = mockSimpleGrpcMethod( + request, + null, + error + ); + client.getProductSet(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('updateProductSet', () => { + it('invokes updateProductSet without error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IUpdateProductSetRequest = {}; + request.productSet = {}; + request.productSet.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.updateProductSet = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.updateProductSet(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes updateProductSet with error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IUpdateProductSetRequest = {}; + request.productSet = {}; + request.productSet.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.updateProductSet = mockSimpleGrpcMethod( + request, + null, + error + ); + client.updateProductSet(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('deleteProductSet', () => { + it('invokes deleteProductSet without error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IDeleteProductSetRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.deleteProductSet = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.deleteProductSet(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes deleteProductSet with error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IDeleteProductSetRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.deleteProductSet = mockSimpleGrpcMethod( + request, + null, + error + ); + client.deleteProductSet(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('createProduct', () => { + it('invokes createProduct without error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.ICreateProductRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.createProduct = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.createProduct(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes createProduct with error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.ICreateProductRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.createProduct = mockSimpleGrpcMethod( + request, + null, + error + ); + client.createProduct(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('getProduct', () => { + it('invokes getProduct without error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IGetProductRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.getProduct = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.getProduct(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes getProduct with error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IGetProductRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.getProduct = mockSimpleGrpcMethod( + request, + null, + error + ); + client.getProduct(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('updateProduct', () => { + it('invokes updateProduct without error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IUpdateProductRequest = {}; + request.product = {}; + request.product.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.updateProduct = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.updateProduct(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes updateProduct with error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IUpdateProductRequest = {}; + request.product = {}; + request.product.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.updateProduct = mockSimpleGrpcMethod( + request, + null, + error + ); + client.updateProduct(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('deleteProduct', () => { + it('invokes deleteProduct without error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IDeleteProductRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.deleteProduct = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.deleteProduct(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes deleteProduct with error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IDeleteProductRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.deleteProduct = mockSimpleGrpcMethod( + request, + null, + error + ); + client.deleteProduct(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('createReferenceImage', () => { + it('invokes createReferenceImage without error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.ICreateReferenceImageRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.createReferenceImage = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.createReferenceImage(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes createReferenceImage with error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.ICreateReferenceImageRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.createReferenceImage = mockSimpleGrpcMethod( + request, + null, + error + ); + client.createReferenceImage(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('deleteReferenceImage', () => { + it('invokes deleteReferenceImage without error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IDeleteReferenceImageRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.deleteReferenceImage = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.deleteReferenceImage(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes deleteReferenceImage with error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IDeleteReferenceImageRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.deleteReferenceImage = mockSimpleGrpcMethod( + request, + null, + error + ); + client.deleteReferenceImage(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('getReferenceImage', () => { + it('invokes getReferenceImage without error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IGetReferenceImageRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.getReferenceImage = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.getReferenceImage(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes getReferenceImage with error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IGetReferenceImageRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.getReferenceImage = mockSimpleGrpcMethod( + request, + null, + error + ); + client.getReferenceImage(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('addProductToProductSet', () => { + it('invokes addProductToProductSet without error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IAddProductToProductSetRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.addProductToProductSet = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.addProductToProductSet(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes addProductToProductSet with error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IAddProductToProductSetRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.addProductToProductSet = mockSimpleGrpcMethod( + request, + null, + error + ); + client.addProductToProductSet(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('removeProductFromProductSet', () => { + it('invokes removeProductFromProductSet without error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IRemoveProductFromProductSetRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.removeProductFromProductSet = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.removeProductFromProductSet(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes removeProductFromProductSet with error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IRemoveProductFromProductSetRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.removeProductFromProductSet = mockSimpleGrpcMethod( + request, + null, + error + ); + client.removeProductFromProductSet( + request, + (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + } + ); + }); + }); + describe('importProductSets', () => { + it('invokes importProductSets without error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IImportProductSetsRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.importProductSets = mockLongRunningGrpcMethod( + request, + expectedResponse + ); + client + .importProductSets(request) + .then((responses: [Operation]) => { + const operation = responses[0]; + return operation ? operation.promise() : {}; + }) + .then((responses: [Operation]) => { + assert.deepStrictEqual(responses[0], expectedResponse); + done(); + }) + .catch((err: {}) => { + done(err); + }); + }); + + it('invokes importProductSets with error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IImportProductSetsRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.importProductSets = mockLongRunningGrpcMethod( + request, + null, + error + ); + client + .importProductSets(request) + .then((responses: [Operation]) => { + const operation = responses[0]; + return operation ? operation.promise() : {}; + }) + .then(() => { + assert.fail(); + }) + .catch((err: FakeError) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + done(); + }); + }); + }); + describe('purgeProducts', () => { + it('invokes purgeProducts without error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IPurgeProductsRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.purgeProducts = mockLongRunningGrpcMethod( + request, + expectedResponse + ); + client + .purgeProducts(request) + .then((responses: [Operation]) => { + const operation = responses[0]; + return operation ? operation.promise() : {}; + }) + .then((responses: [Operation]) => { + assert.deepStrictEqual(responses[0], expectedResponse); + done(); + }) + .catch((err: {}) => { + done(err); + }); + }); + + it('invokes purgeProducts with error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IPurgeProductsRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.purgeProducts = mockLongRunningGrpcMethod( + request, + null, + error + ); + client + .purgeProducts(request) + .then((responses: [Operation]) => { + const operation = responses[0]; + return operation ? operation.promise() : {}; + }) + .then(() => { + assert.fail(); + }) + .catch((err: FakeError) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + done(); + }); + }); + }); + describe('listProductSets', () => { + it('invokes listProductSets without error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IListProductSetsRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock Grpc layer + client._innerApiCalls.listProductSets = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + client.listProductSets(request, (err: FakeError, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + }); + describe('listProductSetsStream', () => { + it('invokes listProductSetsStream without error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IListProductSetsRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {response: 'data'}; + // Mock Grpc layer + client._innerApiCalls.listProductSets = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + const stream = client + .listProductSetsStream(request, {}) + .on('data', (response: {}) => { + assert.deepStrictEqual(response, expectedResponse); + done(); + }) + .on('error', (err: FakeError) => { + done(err); + }); + stream.write(expectedResponse); + }); + }); + describe('listProducts', () => { + it('invokes listProducts without error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IListProductsRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock Grpc layer + client._innerApiCalls.listProducts = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + client.listProducts(request, (err: FakeError, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + }); + describe('listProductsStream', () => { + it('invokes listProductsStream without error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IListProductsRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {response: 'data'}; + // Mock Grpc layer + client._innerApiCalls.listProducts = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + const stream = client + .listProductsStream(request, {}) + .on('data', (response: {}) => { + assert.deepStrictEqual(response, expectedResponse); + done(); + }) + .on('error', (err: FakeError) => { + done(err); + }); + stream.write(expectedResponse); + }); + }); + describe('listReferenceImages', () => { + it('invokes listReferenceImages without error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IListReferenceImagesRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock Grpc layer + client._innerApiCalls.listReferenceImages = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + client.listReferenceImages(request, (err: FakeError, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + }); + describe('listReferenceImagesStream', () => { + it('invokes listReferenceImagesStream without error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IListReferenceImagesRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {response: 'data'}; + // Mock Grpc layer + client._innerApiCalls.listReferenceImages = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + const stream = client + .listReferenceImagesStream(request, {}) + .on('data', (response: {}) => { + assert.deepStrictEqual(response, expectedResponse); + done(); + }) + .on('error', (err: FakeError) => { + done(err); + }); + stream.write(expectedResponse); + }); + }); + describe('listProductsInProductSet', () => { + it('invokes listProductsInProductSet without error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IListProductsInProductSetRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock Grpc layer + client._innerApiCalls.listProductsInProductSet = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + client.listProductsInProductSet( + request, + (err: FakeError, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + } + ); + }); + }); + describe('listProductsInProductSetStream', () => { + it('invokes listProductsInProductSetStream without error', done => { + const client = new productsearchModule.v1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1.IListProductsInProductSetRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {response: 'data'}; + // Mock Grpc layer + client._innerApiCalls.listProductsInProductSet = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + const stream = client + .listProductsInProductSetStream(request, {}) + .on('data', (response: {}) => { + assert.deepStrictEqual(response, expectedResponse); + done(); + }) + .on('error', (err: FakeError) => { + done(err); + }); + stream.write(expectedResponse); + }); + }); +}); diff --git a/packages/google-cloud-vision/test/gapic-product_search-v1p3beta1.ts b/packages/google-cloud-vision/test/gapic-product_search-v1p3beta1.ts new file mode 100644 index 00000000000..5eab211dc4a --- /dev/null +++ b/packages/google-cloud-vision/test/gapic-product_search-v1p3beta1.ts @@ -0,0 +1,1040 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protosTypes from '../protos/protos'; +import * as assert from 'assert'; +import {describe, it} from 'mocha'; +const productsearchModule = require('../src'); + +const FAKE_STATUS_CODE = 1; +class FakeError { + name: string; + message: string; + code: number; + constructor(n: number) { + this.name = 'fakeName'; + this.message = 'fake message'; + this.code = n; + } +} +const error = new FakeError(FAKE_STATUS_CODE); +export interface Callback { + (err: FakeError | null, response?: {} | null): void; +} + +export class Operation { + constructor() {} + promise() {} +} +function mockSimpleGrpcMethod( + expectedRequest: {}, + response: {} | null, + error: FakeError | null +) { + return (actualRequest: {}, options: {}, callback: Callback) => { + assert.deepStrictEqual(actualRequest, expectedRequest); + if (error) { + callback(error); + } else if (response) { + callback(null, response); + } else { + callback(null); + } + }; +} +function mockLongRunningGrpcMethod( + expectedRequest: {}, + response: {} | null, + error?: {} | null +) { + return (request: {}) => { + assert.deepStrictEqual(request, expectedRequest); + const mockOperation = { + promise() { + return new Promise((resolve, reject) => { + if (error) { + reject(error); + } else { + resolve([response]); + } + }); + }, + }; + return Promise.resolve([mockOperation]); + }; +} +describe('v1p3beta1.ProductSearchClient', () => { + it('has servicePath', () => { + const servicePath = + productsearchModule.v1p3beta1.ProductSearchClient.servicePath; + assert(servicePath); + }); + it('has apiEndpoint', () => { + const apiEndpoint = + productsearchModule.v1p3beta1.ProductSearchClient.apiEndpoint; + assert(apiEndpoint); + }); + it('has port', () => { + const port = productsearchModule.v1p3beta1.ProductSearchClient.port; + assert(port); + assert(typeof port === 'number'); + }); + it('should create a client with no option', () => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient(); + assert(client); + }); + it('should create a client with gRPC fallback', () => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + fallback: true, + }); + assert(client); + }); + describe('createProductSet', () => { + it('invokes createProductSet without error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.ICreateProductSetRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.createProductSet = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.createProductSet(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes createProductSet with error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.ICreateProductSetRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.createProductSet = mockSimpleGrpcMethod( + request, + null, + error + ); + client.createProductSet(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('getProductSet', () => { + it('invokes getProductSet without error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IGetProductSetRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.getProductSet = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.getProductSet(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes getProductSet with error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IGetProductSetRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.getProductSet = mockSimpleGrpcMethod( + request, + null, + error + ); + client.getProductSet(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('updateProductSet', () => { + it('invokes updateProductSet without error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IUpdateProductSetRequest = {}; + request.productSet = {}; + request.productSet.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.updateProductSet = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.updateProductSet(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes updateProductSet with error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IUpdateProductSetRequest = {}; + request.productSet = {}; + request.productSet.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.updateProductSet = mockSimpleGrpcMethod( + request, + null, + error + ); + client.updateProductSet(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('deleteProductSet', () => { + it('invokes deleteProductSet without error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IDeleteProductSetRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.deleteProductSet = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.deleteProductSet(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes deleteProductSet with error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IDeleteProductSetRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.deleteProductSet = mockSimpleGrpcMethod( + request, + null, + error + ); + client.deleteProductSet(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('createProduct', () => { + it('invokes createProduct without error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.ICreateProductRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.createProduct = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.createProduct(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes createProduct with error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.ICreateProductRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.createProduct = mockSimpleGrpcMethod( + request, + null, + error + ); + client.createProduct(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('getProduct', () => { + it('invokes getProduct without error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IGetProductRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.getProduct = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.getProduct(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes getProduct with error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IGetProductRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.getProduct = mockSimpleGrpcMethod( + request, + null, + error + ); + client.getProduct(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('updateProduct', () => { + it('invokes updateProduct without error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IUpdateProductRequest = {}; + request.product = {}; + request.product.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.updateProduct = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.updateProduct(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes updateProduct with error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IUpdateProductRequest = {}; + request.product = {}; + request.product.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.updateProduct = mockSimpleGrpcMethod( + request, + null, + error + ); + client.updateProduct(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('deleteProduct', () => { + it('invokes deleteProduct without error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IDeleteProductRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.deleteProduct = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.deleteProduct(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes deleteProduct with error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IDeleteProductRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.deleteProduct = mockSimpleGrpcMethod( + request, + null, + error + ); + client.deleteProduct(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('createReferenceImage', () => { + it('invokes createReferenceImage without error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.createReferenceImage = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.createReferenceImage(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes createReferenceImage with error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.ICreateReferenceImageRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.createReferenceImage = mockSimpleGrpcMethod( + request, + null, + error + ); + client.createReferenceImage(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('deleteReferenceImage', () => { + it('invokes deleteReferenceImage without error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.deleteReferenceImage = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.deleteReferenceImage(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes deleteReferenceImage with error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IDeleteReferenceImageRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.deleteReferenceImage = mockSimpleGrpcMethod( + request, + null, + error + ); + client.deleteReferenceImage(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('getReferenceImage', () => { + it('invokes getReferenceImage without error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IGetReferenceImageRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.getReferenceImage = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.getReferenceImage(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes getReferenceImage with error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IGetReferenceImageRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.getReferenceImage = mockSimpleGrpcMethod( + request, + null, + error + ); + client.getReferenceImage(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('addProductToProductSet', () => { + it('invokes addProductToProductSet without error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.addProductToProductSet = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.addProductToProductSet(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes addProductToProductSet with error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IAddProductToProductSetRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.addProductToProductSet = mockSimpleGrpcMethod( + request, + null, + error + ); + client.addProductToProductSet(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('removeProductFromProductSet', () => { + it('invokes removeProductFromProductSet without error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.removeProductFromProductSet = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.removeProductFromProductSet(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes removeProductFromProductSet with error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IRemoveProductFromProductSetRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.removeProductFromProductSet = mockSimpleGrpcMethod( + request, + null, + error + ); + client.removeProductFromProductSet( + request, + (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + } + ); + }); + }); + describe('importProductSets', () => { + it('invokes importProductSets without error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IImportProductSetsRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.importProductSets = mockLongRunningGrpcMethod( + request, + expectedResponse + ); + client + .importProductSets(request) + .then((responses: [Operation]) => { + const operation = responses[0]; + return operation ? operation.promise() : {}; + }) + .then((responses: [Operation]) => { + assert.deepStrictEqual(responses[0], expectedResponse); + done(); + }) + .catch((err: {}) => { + done(err); + }); + }); + + it('invokes importProductSets with error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IImportProductSetsRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.importProductSets = mockLongRunningGrpcMethod( + request, + null, + error + ); + client + .importProductSets(request) + .then((responses: [Operation]) => { + const operation = responses[0]; + return operation ? operation.promise() : {}; + }) + .then(() => { + assert.fail(); + }) + .catch((err: FakeError) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + done(); + }); + }); + }); + describe('listProductSets', () => { + it('invokes listProductSets without error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IListProductSetsRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock Grpc layer + client._innerApiCalls.listProductSets = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + client.listProductSets(request, (err: FakeError, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + }); + describe('listProductSetsStream', () => { + it('invokes listProductSetsStream without error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IListProductSetsRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {response: 'data'}; + // Mock Grpc layer + client._innerApiCalls.listProductSets = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + const stream = client + .listProductSetsStream(request, {}) + .on('data', (response: {}) => { + assert.deepStrictEqual(response, expectedResponse); + done(); + }) + .on('error', (err: FakeError) => { + done(err); + }); + stream.write(expectedResponse); + }); + }); + describe('listProducts', () => { + it('invokes listProducts without error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IListProductsRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock Grpc layer + client._innerApiCalls.listProducts = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + client.listProducts(request, (err: FakeError, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + }); + describe('listProductsStream', () => { + it('invokes listProductsStream without error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IListProductsRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {response: 'data'}; + // Mock Grpc layer + client._innerApiCalls.listProducts = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + const stream = client + .listProductsStream(request, {}) + .on('data', (response: {}) => { + assert.deepStrictEqual(response, expectedResponse); + done(); + }) + .on('error', (err: FakeError) => { + done(err); + }); + stream.write(expectedResponse); + }); + }); + describe('listReferenceImages', () => { + it('invokes listReferenceImages without error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IListReferenceImagesRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock Grpc layer + client._innerApiCalls.listReferenceImages = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + client.listReferenceImages(request, (err: FakeError, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + }); + describe('listReferenceImagesStream', () => { + it('invokes listReferenceImagesStream without error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IListReferenceImagesRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {response: 'data'}; + // Mock Grpc layer + client._innerApiCalls.listReferenceImages = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + const stream = client + .listReferenceImagesStream(request, {}) + .on('data', (response: {}) => { + assert.deepStrictEqual(response, expectedResponse); + done(); + }) + .on('error', (err: FakeError) => { + done(err); + }); + stream.write(expectedResponse); + }); + }); + describe('listProductsInProductSet', () => { + it('invokes listProductsInProductSet without error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock Grpc layer + client._innerApiCalls.listProductsInProductSet = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + client.listProductsInProductSet( + request, + (err: FakeError, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + } + ); + }); + }); + describe('listProductsInProductSetStream', () => { + it('invokes listProductsInProductSetStream without error', done => { + const client = new productsearchModule.v1p3beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p3beta1.IListProductsInProductSetRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {response: 'data'}; + // Mock Grpc layer + client._innerApiCalls.listProductsInProductSet = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + const stream = client + .listProductsInProductSetStream(request, {}) + .on('data', (response: {}) => { + assert.deepStrictEqual(response, expectedResponse); + done(); + }) + .on('error', (err: FakeError) => { + done(err); + }); + stream.write(expectedResponse); + }); + }); +}); diff --git a/packages/google-cloud-vision/test/gapic-product_search-v1p4beta1.ts b/packages/google-cloud-vision/test/gapic-product_search-v1p4beta1.ts new file mode 100644 index 00000000000..b83a0d25054 --- /dev/null +++ b/packages/google-cloud-vision/test/gapic-product_search-v1p4beta1.ts @@ -0,0 +1,1103 @@ +// Copyright 2019 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protosTypes from '../protos/protos'; +import * as assert from 'assert'; +import {describe, it} from 'mocha'; +const productsearchModule = require('../src'); + +const FAKE_STATUS_CODE = 1; +class FakeError { + name: string; + message: string; + code: number; + constructor(n: number) { + this.name = 'fakeName'; + this.message = 'fake message'; + this.code = n; + } +} +const error = new FakeError(FAKE_STATUS_CODE); +export interface Callback { + (err: FakeError | null, response?: {} | null): void; +} + +export class Operation { + constructor() {} + promise() {} +} +function mockSimpleGrpcMethod( + expectedRequest: {}, + response: {} | null, + error: FakeError | null +) { + return (actualRequest: {}, options: {}, callback: Callback) => { + assert.deepStrictEqual(actualRequest, expectedRequest); + if (error) { + callback(error); + } else if (response) { + callback(null, response); + } else { + callback(null); + } + }; +} +function mockLongRunningGrpcMethod( + expectedRequest: {}, + response: {} | null, + error?: {} | null +) { + return (request: {}) => { + assert.deepStrictEqual(request, expectedRequest); + const mockOperation = { + promise() { + return new Promise((resolve, reject) => { + if (error) { + reject(error); + } else { + resolve([response]); + } + }); + }, + }; + return Promise.resolve([mockOperation]); + }; +} +describe('v1p4beta1.ProductSearchClient', () => { + it('has servicePath', () => { + const servicePath = + productsearchModule.v1p4beta1.ProductSearchClient.servicePath; + assert(servicePath); + }); + it('has apiEndpoint', () => { + const apiEndpoint = + productsearchModule.v1p4beta1.ProductSearchClient.apiEndpoint; + assert(apiEndpoint); + }); + it('has port', () => { + const port = productsearchModule.v1p4beta1.ProductSearchClient.port; + assert(port); + assert(typeof port === 'number'); + }); + it('should create a client with no option', () => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient(); + assert(client); + }); + it('should create a client with gRPC fallback', () => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + fallback: true, + }); + assert(client); + }); + describe('createProductSet', () => { + it('invokes createProductSet without error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.ICreateProductSetRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.createProductSet = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.createProductSet(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes createProductSet with error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.ICreateProductSetRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.createProductSet = mockSimpleGrpcMethod( + request, + null, + error + ); + client.createProductSet(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('getProductSet', () => { + it('invokes getProductSet without error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IGetProductSetRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.getProductSet = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.getProductSet(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes getProductSet with error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IGetProductSetRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.getProductSet = mockSimpleGrpcMethod( + request, + null, + error + ); + client.getProductSet(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('updateProductSet', () => { + it('invokes updateProductSet without error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IUpdateProductSetRequest = {}; + request.productSet = {}; + request.productSet.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.updateProductSet = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.updateProductSet(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes updateProductSet with error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IUpdateProductSetRequest = {}; + request.productSet = {}; + request.productSet.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.updateProductSet = mockSimpleGrpcMethod( + request, + null, + error + ); + client.updateProductSet(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('deleteProductSet', () => { + it('invokes deleteProductSet without error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.deleteProductSet = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.deleteProductSet(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes deleteProductSet with error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IDeleteProductSetRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.deleteProductSet = mockSimpleGrpcMethod( + request, + null, + error + ); + client.deleteProductSet(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('createProduct', () => { + it('invokes createProduct without error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.ICreateProductRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.createProduct = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.createProduct(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes createProduct with error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.ICreateProductRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.createProduct = mockSimpleGrpcMethod( + request, + null, + error + ); + client.createProduct(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('getProduct', () => { + it('invokes getProduct without error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IGetProductRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.getProduct = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.getProduct(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes getProduct with error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IGetProductRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.getProduct = mockSimpleGrpcMethod( + request, + null, + error + ); + client.getProduct(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('updateProduct', () => { + it('invokes updateProduct without error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IUpdateProductRequest = {}; + request.product = {}; + request.product.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.updateProduct = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.updateProduct(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes updateProduct with error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IUpdateProductRequest = {}; + request.product = {}; + request.product.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.updateProduct = mockSimpleGrpcMethod( + request, + null, + error + ); + client.updateProduct(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('deleteProduct', () => { + it('invokes deleteProduct without error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IDeleteProductRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.deleteProduct = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.deleteProduct(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes deleteProduct with error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IDeleteProductRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.deleteProduct = mockSimpleGrpcMethod( + request, + null, + error + ); + client.deleteProduct(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('createReferenceImage', () => { + it('invokes createReferenceImage without error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.createReferenceImage = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.createReferenceImage(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes createReferenceImage with error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.ICreateReferenceImageRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.createReferenceImage = mockSimpleGrpcMethod( + request, + null, + error + ); + client.createReferenceImage(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('deleteReferenceImage', () => { + it('invokes deleteReferenceImage without error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.deleteReferenceImage = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.deleteReferenceImage(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes deleteReferenceImage with error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IDeleteReferenceImageRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.deleteReferenceImage = mockSimpleGrpcMethod( + request, + null, + error + ); + client.deleteReferenceImage(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('getReferenceImage', () => { + it('invokes getReferenceImage without error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IGetReferenceImageRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.getReferenceImage = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.getReferenceImage(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes getReferenceImage with error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IGetReferenceImageRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.getReferenceImage = mockSimpleGrpcMethod( + request, + null, + error + ); + client.getReferenceImage(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('addProductToProductSet', () => { + it('invokes addProductToProductSet without error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.addProductToProductSet = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.addProductToProductSet(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes addProductToProductSet with error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IAddProductToProductSetRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.addProductToProductSet = mockSimpleGrpcMethod( + request, + null, + error + ); + client.addProductToProductSet(request, (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + describe('removeProductFromProductSet', () => { + it('invokes removeProductFromProductSet without error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.removeProductFromProductSet = mockSimpleGrpcMethod( + request, + expectedResponse, + null + ); + client.removeProductFromProductSet(request, (err: {}, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes removeProductFromProductSet with error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IRemoveProductFromProductSetRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.removeProductFromProductSet = mockSimpleGrpcMethod( + request, + null, + error + ); + client.removeProductFromProductSet( + request, + (err: FakeError, response: {}) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + } + ); + }); + }); + describe('importProductSets', () => { + it('invokes importProductSets without error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IImportProductSetsRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.importProductSets = mockLongRunningGrpcMethod( + request, + expectedResponse + ); + client + .importProductSets(request) + .then((responses: [Operation]) => { + const operation = responses[0]; + return operation ? operation.promise() : {}; + }) + .then((responses: [Operation]) => { + assert.deepStrictEqual(responses[0], expectedResponse); + done(); + }) + .catch((err: {}) => { + done(err); + }); + }); + + it('invokes importProductSets with error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IImportProductSetsRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.importProductSets = mockLongRunningGrpcMethod( + request, + null, + error + ); + client + .importProductSets(request) + .then((responses: [Operation]) => { + const operation = responses[0]; + return operation ? operation.promise() : {}; + }) + .then(() => { + assert.fail(); + }) + .catch((err: FakeError) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + done(); + }); + }); + }); + describe('purgeProducts', () => { + it('invokes purgeProducts without error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IPurgeProductsRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.purgeProducts = mockLongRunningGrpcMethod( + request, + expectedResponse + ); + client + .purgeProducts(request) + .then((responses: [Operation]) => { + const operation = responses[0]; + return operation ? operation.promise() : {}; + }) + .then((responses: [Operation]) => { + assert.deepStrictEqual(responses[0], expectedResponse); + done(); + }) + .catch((err: {}) => { + done(err); + }); + }); + + it('invokes purgeProducts with error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IPurgeProductsRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock gRPC layer + client._innerApiCalls.purgeProducts = mockLongRunningGrpcMethod( + request, + null, + error + ); + client + .purgeProducts(request) + .then((responses: [Operation]) => { + const operation = responses[0]; + return operation ? operation.promise() : {}; + }) + .then(() => { + assert.fail(); + }) + .catch((err: FakeError) => { + assert(err instanceof FakeError); + assert.strictEqual(err.code, FAKE_STATUS_CODE); + done(); + }); + }); + }); + describe('listProductSets', () => { + it('invokes listProductSets without error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IListProductSetsRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock Grpc layer + client._innerApiCalls.listProductSets = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + client.listProductSets(request, (err: FakeError, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + }); + describe('listProductSetsStream', () => { + it('invokes listProductSetsStream without error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IListProductSetsRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {response: 'data'}; + // Mock Grpc layer + client._innerApiCalls.listProductSets = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + const stream = client + .listProductSetsStream(request, {}) + .on('data', (response: {}) => { + assert.deepStrictEqual(response, expectedResponse); + done(); + }) + .on('error', (err: FakeError) => { + done(err); + }); + stream.write(expectedResponse); + }); + }); + describe('listProducts', () => { + it('invokes listProducts without error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IListProductsRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock Grpc layer + client._innerApiCalls.listProducts = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + client.listProducts(request, (err: FakeError, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + }); + describe('listProductsStream', () => { + it('invokes listProductsStream without error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IListProductsRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {response: 'data'}; + // Mock Grpc layer + client._innerApiCalls.listProducts = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + const stream = client + .listProductsStream(request, {}) + .on('data', (response: {}) => { + assert.deepStrictEqual(response, expectedResponse); + done(); + }) + .on('error', (err: FakeError) => { + done(err); + }); + stream.write(expectedResponse); + }); + }); + describe('listReferenceImages', () => { + it('invokes listReferenceImages without error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IListReferenceImagesRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {}; + // Mock Grpc layer + client._innerApiCalls.listReferenceImages = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + client.listReferenceImages(request, (err: FakeError, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + }); + describe('listReferenceImagesStream', () => { + it('invokes listReferenceImagesStream without error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IListReferenceImagesRequest = {}; + request.parent = ''; + // Mock response + const expectedResponse = {response: 'data'}; + // Mock Grpc layer + client._innerApiCalls.listReferenceImages = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + const stream = client + .listReferenceImagesStream(request, {}) + .on('data', (response: {}) => { + assert.deepStrictEqual(response, expectedResponse); + done(); + }) + .on('error', (err: FakeError) => { + done(err); + }); + stream.write(expectedResponse); + }); + }); + describe('listProductsInProductSet', () => { + it('invokes listProductsInProductSet without error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {}; + // Mock Grpc layer + client._innerApiCalls.listProductsInProductSet = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + client.listProductsInProductSet( + request, + (err: FakeError, response: {}) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + } + ); + }); + }); + describe('listProductsInProductSetStream', () => { + it('invokes listProductsInProductSetStream without error', done => { + const client = new productsearchModule.v1p4beta1.ProductSearchClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + // Mock request + const request: protosTypes.google.cloud.vision.v1p4beta1.IListProductsInProductSetRequest = {}; + request.name = ''; + // Mock response + const expectedResponse = {response: 'data'}; + // Mock Grpc layer + client._innerApiCalls.listProductsInProductSet = ( + actualRequest: {}, + options: {}, + callback: Callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse); + }; + const stream = client + .listProductsInProductSetStream(request, {}) + .on('data', (response: {}) => { + assert.deepStrictEqual(response, expectedResponse); + done(); + }) + .on('error', (err: FakeError) => { + done(err); + }); + stream.write(expectedResponse); + }); + }); +}); diff --git a/packages/google-cloud-vision/test/gapic-v1.js b/packages/google-cloud-vision/test/gapic-v1.js deleted file mode 100644 index fde10ef1d15..00000000000 --- a/packages/google-cloud-vision/test/gapic-v1.js +++ /dev/null @@ -1,1741 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -'use strict'; - -const assert = require('assert'); -const {describe, it} = require('mocha'); - -const visionModule = require('../src'); - -const FAKE_STATUS_CODE = 1; -const error = new Error(); -error.code = FAKE_STATUS_CODE; - -describe('ImageAnnotatorClient', () => { - it('has servicePath', () => { - const servicePath = visionModule.v1.ImageAnnotatorClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = visionModule.v1.ImageAnnotatorClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = visionModule.v1.ImageAnnotatorClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no options', () => { - const client = new visionModule.v1.ImageAnnotatorClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new visionModule.v1.ImageAnnotatorClient({fallback: true}); - assert(client); - }); - - describe('batchAnnotateImages', () => { - it('invokes batchAnnotateImages without error', done => { - const client = new visionModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const requests = []; - const request = { - requests: requests, - }; - - // Mock response - const expectedResponse = {}; - - // Mock Grpc layer - client._innerApiCalls.batchAnnotateImages = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.batchAnnotateImages(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes batchAnnotateImages with error', done => { - const client = new visionModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const requests = []; - const request = { - requests: requests, - }; - - // Mock Grpc layer - client._innerApiCalls.batchAnnotateImages = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.batchAnnotateImages(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('batchAnnotateFiles', () => { - it('invokes batchAnnotateFiles without error', done => { - const client = new visionModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const requests = []; - const request = { - requests: requests, - }; - - // Mock response - const expectedResponse = {}; - - // Mock Grpc layer - client._innerApiCalls.batchAnnotateFiles = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.batchAnnotateFiles(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes batchAnnotateFiles with error', done => { - const client = new visionModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const requests = []; - const request = { - requests: requests, - }; - - // Mock Grpc layer - client._innerApiCalls.batchAnnotateFiles = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.batchAnnotateFiles(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('asyncBatchAnnotateImages', function() { - it('invokes asyncBatchAnnotateImages without error', done => { - const client = new visionModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const requests = []; - const outputConfig = {}; - const request = { - requests: requests, - outputConfig: outputConfig, - }; - - // Mock response - const expectedResponse = {}; - - // Mock Grpc layer - client._innerApiCalls.asyncBatchAnnotateImages = mockLongRunningGrpcMethod( - request, - expectedResponse - ); - - client - .asyncBatchAnnotateImages(request) - .then(responses => { - const operation = responses[0]; - return operation.promise(); - }) - .then(responses => { - assert.deepStrictEqual(responses[0], expectedResponse); - done(); - }) - .catch(err => { - done(err); - }); - }); - - it('invokes asyncBatchAnnotateImages with error', done => { - const client = new visionModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const requests = []; - const outputConfig = {}; - const request = { - requests: requests, - outputConfig: outputConfig, - }; - - // Mock Grpc layer - client._innerApiCalls.asyncBatchAnnotateImages = mockLongRunningGrpcMethod( - request, - null, - error - ); - - client - .asyncBatchAnnotateImages(request) - .then(responses => { - const operation = responses[0]; - return operation.promise(); - }) - .then(() => { - assert.fail(); - }) - .catch(err => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - done(); - }); - }); - - it('has longrunning decoder functions', () => { - const client = new visionModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert( - client._descriptors.longrunning.asyncBatchAnnotateImages - .responseDecoder instanceof Function - ); - assert( - client._descriptors.longrunning.asyncBatchAnnotateImages - .metadataDecoder instanceof Function - ); - }); - }); - - describe('asyncBatchAnnotateFiles', function() { - it('invokes asyncBatchAnnotateFiles without error', done => { - const client = new visionModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const requests = []; - const request = { - requests: requests, - }; - - // Mock response - const expectedResponse = {}; - - // Mock Grpc layer - client._innerApiCalls.asyncBatchAnnotateFiles = mockLongRunningGrpcMethod( - request, - expectedResponse - ); - - client - .asyncBatchAnnotateFiles(request) - .then(responses => { - const operation = responses[0]; - return operation.promise(); - }) - .then(responses => { - assert.deepStrictEqual(responses[0], expectedResponse); - done(); - }) - .catch(err => { - done(err); - }); - }); - - it('invokes asyncBatchAnnotateFiles with error', done => { - const client = new visionModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const requests = []; - const request = { - requests: requests, - }; - - // Mock Grpc layer - client._innerApiCalls.asyncBatchAnnotateFiles = mockLongRunningGrpcMethod( - request, - null, - error - ); - - client - .asyncBatchAnnotateFiles(request) - .then(responses => { - const operation = responses[0]; - return operation.promise(); - }) - .then(() => { - assert.fail(); - }) - .catch(err => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - done(); - }); - }); - - it('has longrunning decoder functions', () => { - const client = new visionModule.v1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert( - client._descriptors.longrunning.asyncBatchAnnotateFiles - .responseDecoder instanceof Function - ); - assert( - client._descriptors.longrunning.asyncBatchAnnotateFiles - .metadataDecoder instanceof Function - ); - }); - }); -}); -describe('ProductSearchClient', () => { - it('has servicePath', () => { - const servicePath = visionModule.v1.ProductSearchClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = visionModule.v1.ProductSearchClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = visionModule.v1.ProductSearchClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no options', () => { - const client = new visionModule.v1.ProductSearchClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new visionModule.v1.ProductSearchClient({fallback: true}); - assert(client); - }); - - describe('createProductSet', () => { - it('invokes createProductSet without error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const productSet = {}; - const request = { - parent: formattedParent, - productSet: productSet, - }; - - // Mock response - const name = 'name3373707'; - const displayName = 'displayName1615086568'; - const expectedResponse = { - name: name, - displayName: displayName, - }; - - // Mock Grpc layer - client._innerApiCalls.createProductSet = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.createProductSet(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes createProductSet with error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const productSet = {}; - const request = { - parent: formattedParent, - productSet: productSet, - }; - - // Mock Grpc layer - client._innerApiCalls.createProductSet = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.createProductSet(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('listProductSets', () => { - it('invokes listProductSets without error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const request = { - parent: formattedParent, - }; - - // Mock response - const nextPageToken = ''; - const productSetsElement = {}; - const productSets = [productSetsElement]; - const expectedResponse = { - nextPageToken: nextPageToken, - productSets: productSets, - }; - - // Mock Grpc layer - client._innerApiCalls.listProductSets = ( - actualRequest, - options, - callback - ) => { - assert.deepStrictEqual(actualRequest, request); - callback(null, expectedResponse.productSets); - }; - - client.listProductSets(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse.productSets); - done(); - }); - }); - - it('invokes listProductSets with error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const request = { - parent: formattedParent, - }; - - // Mock Grpc layer - client._innerApiCalls.listProductSets = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.listProductSets(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('getProductSet', () => { - it('invokes getProductSet without error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productSetPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT_SET]' - ); - const request = { - name: formattedName, - }; - - // Mock response - const name2 = 'name2-1052831874'; - const displayName = 'displayName1615086568'; - const expectedResponse = { - name: name2, - displayName: displayName, - }; - - // Mock Grpc layer - client._innerApiCalls.getProductSet = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.getProductSet(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes getProductSet with error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productSetPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT_SET]' - ); - const request = { - name: formattedName, - }; - - // Mock Grpc layer - client._innerApiCalls.getProductSet = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.getProductSet(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('updateProductSet', () => { - it('invokes updateProductSet without error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const productSet = {}; - const request = { - productSet: productSet, - }; - - // Mock response - const name = 'name3373707'; - const displayName = 'displayName1615086568'; - const expectedResponse = { - name: name, - displayName: displayName, - }; - - // Mock Grpc layer - client._innerApiCalls.updateProductSet = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.updateProductSet(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes updateProductSet with error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const productSet = {}; - const request = { - productSet: productSet, - }; - - // Mock Grpc layer - client._innerApiCalls.updateProductSet = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.updateProductSet(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('deleteProductSet', () => { - it('invokes deleteProductSet without error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productSetPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT_SET]' - ); - const request = { - name: formattedName, - }; - - // Mock Grpc layer - client._innerApiCalls.deleteProductSet = mockSimpleGrpcMethod(request); - - client.deleteProductSet(request, err => { - assert.ifError(err); - done(); - }); - }); - - it('invokes deleteProductSet with error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productSetPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT_SET]' - ); - const request = { - name: formattedName, - }; - - // Mock Grpc layer - client._innerApiCalls.deleteProductSet = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.deleteProductSet(request, err => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - done(); - }); - }); - }); - - describe('createProduct', () => { - it('invokes createProduct without error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const product = {}; - const request = { - parent: formattedParent, - product: product, - }; - - // Mock response - const name = 'name3373707'; - const displayName = 'displayName1615086568'; - const description = 'description-1724546052'; - const productCategory = 'productCategory-1607451058'; - const expectedResponse = { - name: name, - displayName: displayName, - description: description, - productCategory: productCategory, - }; - - // Mock Grpc layer - client._innerApiCalls.createProduct = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.createProduct(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes createProduct with error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const product = {}; - const request = { - parent: formattedParent, - product: product, - }; - - // Mock Grpc layer - client._innerApiCalls.createProduct = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.createProduct(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('listProducts', () => { - it('invokes listProducts without error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const request = { - parent: formattedParent, - }; - - // Mock response - const nextPageToken = ''; - const productsElement = {}; - const products = [productsElement]; - const expectedResponse = { - nextPageToken: nextPageToken, - products: products, - }; - - // Mock Grpc layer - client._innerApiCalls.listProducts = ( - actualRequest, - options, - callback - ) => { - assert.deepStrictEqual(actualRequest, request); - callback(null, expectedResponse.products); - }; - - client.listProducts(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse.products); - done(); - }); - }); - - it('invokes listProducts with error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const request = { - parent: formattedParent, - }; - - // Mock Grpc layer - client._innerApiCalls.listProducts = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.listProducts(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('getProduct', () => { - it('invokes getProduct without error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]' - ); - const request = { - name: formattedName, - }; - - // Mock response - const name2 = 'name2-1052831874'; - const displayName = 'displayName1615086568'; - const description = 'description-1724546052'; - const productCategory = 'productCategory-1607451058'; - const expectedResponse = { - name: name2, - displayName: displayName, - description: description, - productCategory: productCategory, - }; - - // Mock Grpc layer - client._innerApiCalls.getProduct = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.getProduct(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes getProduct with error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]' - ); - const request = { - name: formattedName, - }; - - // Mock Grpc layer - client._innerApiCalls.getProduct = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.getProduct(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('updateProduct', () => { - it('invokes updateProduct without error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const product = {}; - const request = { - product: product, - }; - - // Mock response - const name = 'name3373707'; - const displayName = 'displayName1615086568'; - const description = 'description-1724546052'; - const productCategory = 'productCategory-1607451058'; - const expectedResponse = { - name: name, - displayName: displayName, - description: description, - productCategory: productCategory, - }; - - // Mock Grpc layer - client._innerApiCalls.updateProduct = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.updateProduct(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes updateProduct with error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const product = {}; - const request = { - product: product, - }; - - // Mock Grpc layer - client._innerApiCalls.updateProduct = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.updateProduct(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('deleteProduct', () => { - it('invokes deleteProduct without error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]' - ); - const request = { - name: formattedName, - }; - - // Mock Grpc layer - client._innerApiCalls.deleteProduct = mockSimpleGrpcMethod(request); - - client.deleteProduct(request, err => { - assert.ifError(err); - done(); - }); - }); - - it('invokes deleteProduct with error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]' - ); - const request = { - name: formattedName, - }; - - // Mock Grpc layer - client._innerApiCalls.deleteProduct = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.deleteProduct(request, err => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - done(); - }); - }); - }); - - describe('createReferenceImage', () => { - it('invokes createReferenceImage without error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.productPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]' - ); - const referenceImage = {}; - const request = { - parent: formattedParent, - referenceImage: referenceImage, - }; - - // Mock response - const name = 'name3373707'; - const uri = 'uri116076'; - const expectedResponse = { - name: name, - uri: uri, - }; - - // Mock Grpc layer - client._innerApiCalls.createReferenceImage = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.createReferenceImage(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes createReferenceImage with error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.productPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]' - ); - const referenceImage = {}; - const request = { - parent: formattedParent, - referenceImage: referenceImage, - }; - - // Mock Grpc layer - client._innerApiCalls.createReferenceImage = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.createReferenceImage(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('deleteReferenceImage', () => { - it('invokes deleteReferenceImage without error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.referenceImagePath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]', - '[REFERENCE_IMAGE]' - ); - const request = { - name: formattedName, - }; - - // Mock Grpc layer - client._innerApiCalls.deleteReferenceImage = mockSimpleGrpcMethod( - request - ); - - client.deleteReferenceImage(request, err => { - assert.ifError(err); - done(); - }); - }); - - it('invokes deleteReferenceImage with error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.referenceImagePath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]', - '[REFERENCE_IMAGE]' - ); - const request = { - name: formattedName, - }; - - // Mock Grpc layer - client._innerApiCalls.deleteReferenceImage = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.deleteReferenceImage(request, err => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - done(); - }); - }); - }); - - describe('listReferenceImages', () => { - it('invokes listReferenceImages without error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.productPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]' - ); - const request = { - parent: formattedParent, - }; - - // Mock response - const pageSize = 883849137; - const nextPageToken = ''; - const referenceImagesElement = {}; - const referenceImages = [referenceImagesElement]; - const expectedResponse = { - pageSize: pageSize, - nextPageToken: nextPageToken, - referenceImages: referenceImages, - }; - - // Mock Grpc layer - client._innerApiCalls.listReferenceImages = ( - actualRequest, - options, - callback - ) => { - assert.deepStrictEqual(actualRequest, request); - callback(null, expectedResponse.referenceImages); - }; - - client.listReferenceImages(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse.referenceImages); - done(); - }); - }); - - it('invokes listReferenceImages with error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.productPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]' - ); - const request = { - parent: formattedParent, - }; - - // Mock Grpc layer - client._innerApiCalls.listReferenceImages = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.listReferenceImages(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('getReferenceImage', () => { - it('invokes getReferenceImage without error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.referenceImagePath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]', - '[REFERENCE_IMAGE]' - ); - const request = { - name: formattedName, - }; - - // Mock response - const name2 = 'name2-1052831874'; - const uri = 'uri116076'; - const expectedResponse = { - name: name2, - uri: uri, - }; - - // Mock Grpc layer - client._innerApiCalls.getReferenceImage = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.getReferenceImage(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes getReferenceImage with error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.referenceImagePath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]', - '[REFERENCE_IMAGE]' - ); - const request = { - name: formattedName, - }; - - // Mock Grpc layer - client._innerApiCalls.getReferenceImage = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.getReferenceImage(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('addProductToProductSet', () => { - it('invokes addProductToProductSet without error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productSetPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT_SET]' - ); - const formattedProduct = client.productPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]' - ); - const request = { - name: formattedName, - product: formattedProduct, - }; - - // Mock Grpc layer - client._innerApiCalls.addProductToProductSet = mockSimpleGrpcMethod( - request - ); - - client.addProductToProductSet(request, err => { - assert.ifError(err); - done(); - }); - }); - - it('invokes addProductToProductSet with error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productSetPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT_SET]' - ); - const formattedProduct = client.productPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]' - ); - const request = { - name: formattedName, - product: formattedProduct, - }; - - // Mock Grpc layer - client._innerApiCalls.addProductToProductSet = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.addProductToProductSet(request, err => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - done(); - }); - }); - }); - - describe('removeProductFromProductSet', () => { - it('invokes removeProductFromProductSet without error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productSetPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT_SET]' - ); - const formattedProduct = client.productPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]' - ); - const request = { - name: formattedName, - product: formattedProduct, - }; - - // Mock Grpc layer - client._innerApiCalls.removeProductFromProductSet = mockSimpleGrpcMethod( - request - ); - - client.removeProductFromProductSet(request, err => { - assert.ifError(err); - done(); - }); - }); - - it('invokes removeProductFromProductSet with error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productSetPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT_SET]' - ); - const formattedProduct = client.productPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]' - ); - const request = { - name: formattedName, - product: formattedProduct, - }; - - // Mock Grpc layer - client._innerApiCalls.removeProductFromProductSet = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.removeProductFromProductSet(request, err => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - done(); - }); - }); - }); - - describe('listProductsInProductSet', () => { - it('invokes listProductsInProductSet without error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productSetPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT_SET]' - ); - const request = { - name: formattedName, - }; - - // Mock response - const nextPageToken = ''; - const productsElement = {}; - const products = [productsElement]; - const expectedResponse = { - nextPageToken: nextPageToken, - products: products, - }; - - // Mock Grpc layer - client._innerApiCalls.listProductsInProductSet = ( - actualRequest, - options, - callback - ) => { - assert.deepStrictEqual(actualRequest, request); - callback(null, expectedResponse.products); - }; - - client.listProductsInProductSet(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse.products); - done(); - }); - }); - - it('invokes listProductsInProductSet with error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productSetPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT_SET]' - ); - const request = { - name: formattedName, - }; - - // Mock Grpc layer - client._innerApiCalls.listProductsInProductSet = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.listProductsInProductSet(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('importProductSets', function() { - it('invokes importProductSets without error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const inputConfig = {}; - const request = { - parent: formattedParent, - inputConfig: inputConfig, - }; - - // Mock response - const expectedResponse = {}; - - // Mock Grpc layer - client._innerApiCalls.importProductSets = mockLongRunningGrpcMethod( - request, - expectedResponse - ); - - client - .importProductSets(request) - .then(responses => { - const operation = responses[0]; - return operation.promise(); - }) - .then(responses => { - assert.deepStrictEqual(responses[0], expectedResponse); - done(); - }) - .catch(err => { - done(err); - }); - }); - - it('invokes importProductSets with error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const inputConfig = {}; - const request = { - parent: formattedParent, - inputConfig: inputConfig, - }; - - // Mock Grpc layer - client._innerApiCalls.importProductSets = mockLongRunningGrpcMethod( - request, - null, - error - ); - - client - .importProductSets(request) - .then(responses => { - const operation = responses[0]; - return operation.promise(); - }) - .then(() => { - assert.fail(); - }) - .catch(err => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - done(); - }); - }); - - it('has longrunning decoder functions', () => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert( - client._descriptors.longrunning.importProductSets - .responseDecoder instanceof Function - ); - assert( - client._descriptors.longrunning.importProductSets - .metadataDecoder instanceof Function - ); - }); - }); - - describe('purgeProducts', function() { - it('invokes purgeProducts without error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const request = { - parent: formattedParent, - }; - - // Mock response - const expectedResponse = {}; - - // Mock Grpc layer - client._innerApiCalls.purgeProducts = mockLongRunningGrpcMethod( - request, - expectedResponse - ); - - client - .purgeProducts(request) - .then(responses => { - const operation = responses[0]; - return operation.promise(); - }) - .then(responses => { - assert.deepStrictEqual(responses[0], expectedResponse); - done(); - }) - .catch(err => { - done(err); - }); - }); - - it('invokes purgeProducts with error', done => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const request = { - parent: formattedParent, - }; - - // Mock Grpc layer - client._innerApiCalls.purgeProducts = mockLongRunningGrpcMethod( - request, - null, - error - ); - - client - .purgeProducts(request) - .then(responses => { - const operation = responses[0]; - return operation.promise(); - }) - .then(() => { - assert.fail(); - }) - .catch(err => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - done(); - }); - }); - - it('has longrunning decoder functions', () => { - const client = new visionModule.v1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert( - client._descriptors.longrunning.purgeProducts.responseDecoder instanceof - Function - ); - assert( - client._descriptors.longrunning.purgeProducts.metadataDecoder instanceof - Function - ); - }); - }); -}); - -function mockSimpleGrpcMethod(expectedRequest, response, error) { - return function(actualRequest, options, callback) { - assert.deepStrictEqual(actualRequest, expectedRequest); - if (error) { - callback(error); - } else if (response) { - callback(null, response); - } else { - callback(null); - } - }; -} - -function mockLongRunningGrpcMethod(expectedRequest, response, error) { - return request => { - assert.deepStrictEqual(request, expectedRequest); - const mockOperation = { - promise: function() { - return new Promise((resolve, reject) => { - if (error) { - reject(error); - } else { - resolve([response]); - } - }); - }, - }; - return Promise.resolve([mockOperation]); - }; -} diff --git a/packages/google-cloud-vision/test/gapic-v1p1beta1.js b/packages/google-cloud-vision/test/gapic-v1p1beta1.js deleted file mode 100644 index 2f9d4ab4840..00000000000 --- a/packages/google-cloud-vision/test/gapic-v1p1beta1.js +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -'use strict'; - -const assert = require('assert'); -const {describe, it} = require('mocha'); - -const visionModule = require('../src'); - -const FAKE_STATUS_CODE = 1; -const error = new Error(); -error.code = FAKE_STATUS_CODE; - -describe('ImageAnnotatorClient', () => { - it('has servicePath', () => { - const servicePath = visionModule.v1p1beta1.ImageAnnotatorClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = visionModule.v1p1beta1.ImageAnnotatorClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = visionModule.v1p1beta1.ImageAnnotatorClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no options', () => { - const client = new visionModule.v1p1beta1.ImageAnnotatorClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new visionModule.v1p1beta1.ImageAnnotatorClient({ - fallback: true, - }); - assert(client); - }); - - describe('batchAnnotateImages', () => { - it('invokes batchAnnotateImages without error', done => { - const client = new visionModule.v1p1beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const requests = []; - const request = { - requests: requests, - }; - - // Mock response - const expectedResponse = {}; - - // Mock Grpc layer - client._innerApiCalls.batchAnnotateImages = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.batchAnnotateImages(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes batchAnnotateImages with error', done => { - const client = new visionModule.v1p1beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const requests = []; - const request = { - requests: requests, - }; - - // Mock Grpc layer - client._innerApiCalls.batchAnnotateImages = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.batchAnnotateImages(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); -}); - -function mockSimpleGrpcMethod(expectedRequest, response, error) { - return function(actualRequest, options, callback) { - assert.deepStrictEqual(actualRequest, expectedRequest); - if (error) { - callback(error); - } else if (response) { - callback(null, response); - } else { - callback(null); - } - }; -} diff --git a/packages/google-cloud-vision/test/gapic-v1p3beta1.js b/packages/google-cloud-vision/test/gapic-v1p3beta1.js deleted file mode 100644 index 928a4f23ef6..00000000000 --- a/packages/google-cloud-vision/test/gapic-v1p3beta1.js +++ /dev/null @@ -1,1512 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -'use strict'; - -const assert = require('assert'); -const {describe, it} = require('mocha'); - -const visionModule = require('../src'); - -const FAKE_STATUS_CODE = 1; -const error = new Error(); -error.code = FAKE_STATUS_CODE; - -describe('ProductSearchClient', () => { - it('has servicePath', () => { - const servicePath = visionModule.v1p3beta1.ProductSearchClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = visionModule.v1p3beta1.ProductSearchClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = visionModule.v1p3beta1.ProductSearchClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no options', () => { - const client = new visionModule.v1p3beta1.ProductSearchClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - fallback: true, - }); - assert(client); - }); - - describe('createProductSet', () => { - it('invokes createProductSet without error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const productSet = {}; - const productSetId = 'productSetId4216680'; - const request = { - parent: formattedParent, - productSet: productSet, - productSetId: productSetId, - }; - - // Mock response - const name = 'name3373707'; - const displayName = 'displayName1615086568'; - const expectedResponse = { - name: name, - displayName: displayName, - }; - - // Mock Grpc layer - client._innerApiCalls.createProductSet = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.createProductSet(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes createProductSet with error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const productSet = {}; - const productSetId = 'productSetId4216680'; - const request = { - parent: formattedParent, - productSet: productSet, - productSetId: productSetId, - }; - - // Mock Grpc layer - client._innerApiCalls.createProductSet = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.createProductSet(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('listProductSets', () => { - it('invokes listProductSets without error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const request = { - parent: formattedParent, - }; - - // Mock response - const nextPageToken = ''; - const productSetsElement = {}; - const productSets = [productSetsElement]; - const expectedResponse = { - nextPageToken: nextPageToken, - productSets: productSets, - }; - - // Mock Grpc layer - client._innerApiCalls.listProductSets = ( - actualRequest, - options, - callback - ) => { - assert.deepStrictEqual(actualRequest, request); - callback(null, expectedResponse.productSets); - }; - - client.listProductSets(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse.productSets); - done(); - }); - }); - - it('invokes listProductSets with error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const request = { - parent: formattedParent, - }; - - // Mock Grpc layer - client._innerApiCalls.listProductSets = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.listProductSets(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('getProductSet', () => { - it('invokes getProductSet without error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productSetPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT_SET]' - ); - const request = { - name: formattedName, - }; - - // Mock response - const name2 = 'name2-1052831874'; - const displayName = 'displayName1615086568'; - const expectedResponse = { - name: name2, - displayName: displayName, - }; - - // Mock Grpc layer - client._innerApiCalls.getProductSet = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.getProductSet(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes getProductSet with error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productSetPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT_SET]' - ); - const request = { - name: formattedName, - }; - - // Mock Grpc layer - client._innerApiCalls.getProductSet = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.getProductSet(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('updateProductSet', () => { - it('invokes updateProductSet without error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const productSet = {}; - const updateMask = {}; - const request = { - productSet: productSet, - updateMask: updateMask, - }; - - // Mock response - const name = 'name3373707'; - const displayName = 'displayName1615086568'; - const expectedResponse = { - name: name, - displayName: displayName, - }; - - // Mock Grpc layer - client._innerApiCalls.updateProductSet = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.updateProductSet(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes updateProductSet with error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const productSet = {}; - const updateMask = {}; - const request = { - productSet: productSet, - updateMask: updateMask, - }; - - // Mock Grpc layer - client._innerApiCalls.updateProductSet = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.updateProductSet(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('deleteProductSet', () => { - it('invokes deleteProductSet without error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productSetPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT_SET]' - ); - const request = { - name: formattedName, - }; - - // Mock Grpc layer - client._innerApiCalls.deleteProductSet = mockSimpleGrpcMethod(request); - - client.deleteProductSet(request, err => { - assert.ifError(err); - done(); - }); - }); - - it('invokes deleteProductSet with error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productSetPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT_SET]' - ); - const request = { - name: formattedName, - }; - - // Mock Grpc layer - client._innerApiCalls.deleteProductSet = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.deleteProductSet(request, err => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - done(); - }); - }); - }); - - describe('createProduct', () => { - it('invokes createProduct without error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const product = {}; - const productId = 'productId1753008747'; - const request = { - parent: formattedParent, - product: product, - productId: productId, - }; - - // Mock response - const name = 'name3373707'; - const displayName = 'displayName1615086568'; - const description = 'description-1724546052'; - const productCategory = 'productCategory-1607451058'; - const expectedResponse = { - name: name, - displayName: displayName, - description: description, - productCategory: productCategory, - }; - - // Mock Grpc layer - client._innerApiCalls.createProduct = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.createProduct(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes createProduct with error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const product = {}; - const productId = 'productId1753008747'; - const request = { - parent: formattedParent, - product: product, - productId: productId, - }; - - // Mock Grpc layer - client._innerApiCalls.createProduct = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.createProduct(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('listProducts', () => { - it('invokes listProducts without error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const request = { - parent: formattedParent, - }; - - // Mock response - const nextPageToken = ''; - const productsElement = {}; - const products = [productsElement]; - const expectedResponse = { - nextPageToken: nextPageToken, - products: products, - }; - - // Mock Grpc layer - client._innerApiCalls.listProducts = ( - actualRequest, - options, - callback - ) => { - assert.deepStrictEqual(actualRequest, request); - callback(null, expectedResponse.products); - }; - - client.listProducts(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse.products); - done(); - }); - }); - - it('invokes listProducts with error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const request = { - parent: formattedParent, - }; - - // Mock Grpc layer - client._innerApiCalls.listProducts = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.listProducts(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('getProduct', () => { - it('invokes getProduct without error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]' - ); - const request = { - name: formattedName, - }; - - // Mock response - const name2 = 'name2-1052831874'; - const displayName = 'displayName1615086568'; - const description = 'description-1724546052'; - const productCategory = 'productCategory-1607451058'; - const expectedResponse = { - name: name2, - displayName: displayName, - description: description, - productCategory: productCategory, - }; - - // Mock Grpc layer - client._innerApiCalls.getProduct = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.getProduct(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes getProduct with error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]' - ); - const request = { - name: formattedName, - }; - - // Mock Grpc layer - client._innerApiCalls.getProduct = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.getProduct(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('updateProduct', () => { - it('invokes updateProduct without error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const product = {}; - const updateMask = {}; - const request = { - product: product, - updateMask: updateMask, - }; - - // Mock response - const name = 'name3373707'; - const displayName = 'displayName1615086568'; - const description = 'description-1724546052'; - const productCategory = 'productCategory-1607451058'; - const expectedResponse = { - name: name, - displayName: displayName, - description: description, - productCategory: productCategory, - }; - - // Mock Grpc layer - client._innerApiCalls.updateProduct = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.updateProduct(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes updateProduct with error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const product = {}; - const updateMask = {}; - const request = { - product: product, - updateMask: updateMask, - }; - - // Mock Grpc layer - client._innerApiCalls.updateProduct = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.updateProduct(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('deleteProduct', () => { - it('invokes deleteProduct without error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]' - ); - const request = { - name: formattedName, - }; - - // Mock Grpc layer - client._innerApiCalls.deleteProduct = mockSimpleGrpcMethod(request); - - client.deleteProduct(request, err => { - assert.ifError(err); - done(); - }); - }); - - it('invokes deleteProduct with error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]' - ); - const request = { - name: formattedName, - }; - - // Mock Grpc layer - client._innerApiCalls.deleteProduct = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.deleteProduct(request, err => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - done(); - }); - }); - }); - - describe('createReferenceImage', () => { - it('invokes createReferenceImage without error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.productPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]' - ); - const referenceImage = {}; - const referenceImageId = 'referenceImageId1946713331'; - const request = { - parent: formattedParent, - referenceImage: referenceImage, - referenceImageId: referenceImageId, - }; - - // Mock response - const name = 'name3373707'; - const uri = 'uri116076'; - const expectedResponse = { - name: name, - uri: uri, - }; - - // Mock Grpc layer - client._innerApiCalls.createReferenceImage = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.createReferenceImage(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes createReferenceImage with error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.productPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]' - ); - const referenceImage = {}; - const referenceImageId = 'referenceImageId1946713331'; - const request = { - parent: formattedParent, - referenceImage: referenceImage, - referenceImageId: referenceImageId, - }; - - // Mock Grpc layer - client._innerApiCalls.createReferenceImage = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.createReferenceImage(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('deleteReferenceImage', () => { - it('invokes deleteReferenceImage without error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.referenceImagePath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]', - '[REFERENCE_IMAGE]' - ); - const request = { - name: formattedName, - }; - - // Mock Grpc layer - client._innerApiCalls.deleteReferenceImage = mockSimpleGrpcMethod( - request - ); - - client.deleteReferenceImage(request, err => { - assert.ifError(err); - done(); - }); - }); - - it('invokes deleteReferenceImage with error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.referenceImagePath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]', - '[REFERENCE_IMAGE]' - ); - const request = { - name: formattedName, - }; - - // Mock Grpc layer - client._innerApiCalls.deleteReferenceImage = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.deleteReferenceImage(request, err => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - done(); - }); - }); - }); - - describe('listReferenceImages', () => { - it('invokes listReferenceImages without error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.productPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]' - ); - const request = { - parent: formattedParent, - }; - - // Mock response - const pageSize = 883849137; - const nextPageToken = ''; - const referenceImagesElement = {}; - const referenceImages = [referenceImagesElement]; - const expectedResponse = { - pageSize: pageSize, - nextPageToken: nextPageToken, - referenceImages: referenceImages, - }; - - // Mock Grpc layer - client._innerApiCalls.listReferenceImages = ( - actualRequest, - options, - callback - ) => { - assert.deepStrictEqual(actualRequest, request); - callback(null, expectedResponse.referenceImages); - }; - - client.listReferenceImages(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse.referenceImages); - done(); - }); - }); - - it('invokes listReferenceImages with error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.productPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]' - ); - const request = { - parent: formattedParent, - }; - - // Mock Grpc layer - client._innerApiCalls.listReferenceImages = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.listReferenceImages(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('getReferenceImage', () => { - it('invokes getReferenceImage without error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.referenceImagePath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]', - '[REFERENCE_IMAGE]' - ); - const request = { - name: formattedName, - }; - - // Mock response - const name2 = 'name2-1052831874'; - const uri = 'uri116076'; - const expectedResponse = { - name: name2, - uri: uri, - }; - - // Mock Grpc layer - client._innerApiCalls.getReferenceImage = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.getReferenceImage(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes getReferenceImage with error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.referenceImagePath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]', - '[REFERENCE_IMAGE]' - ); - const request = { - name: formattedName, - }; - - // Mock Grpc layer - client._innerApiCalls.getReferenceImage = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.getReferenceImage(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('addProductToProductSet', () => { - it('invokes addProductToProductSet without error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productSetPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT_SET]' - ); - const product = 'product-309474065'; - const request = { - name: formattedName, - product: product, - }; - - // Mock Grpc layer - client._innerApiCalls.addProductToProductSet = mockSimpleGrpcMethod( - request - ); - - client.addProductToProductSet(request, err => { - assert.ifError(err); - done(); - }); - }); - - it('invokes addProductToProductSet with error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productSetPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT_SET]' - ); - const product = 'product-309474065'; - const request = { - name: formattedName, - product: product, - }; - - // Mock Grpc layer - client._innerApiCalls.addProductToProductSet = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.addProductToProductSet(request, err => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - done(); - }); - }); - }); - - describe('removeProductFromProductSet', () => { - it('invokes removeProductFromProductSet without error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productSetPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT_SET]' - ); - const product = 'product-309474065'; - const request = { - name: formattedName, - product: product, - }; - - // Mock Grpc layer - client._innerApiCalls.removeProductFromProductSet = mockSimpleGrpcMethod( - request - ); - - client.removeProductFromProductSet(request, err => { - assert.ifError(err); - done(); - }); - }); - - it('invokes removeProductFromProductSet with error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productSetPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT_SET]' - ); - const product = 'product-309474065'; - const request = { - name: formattedName, - product: product, - }; - - // Mock Grpc layer - client._innerApiCalls.removeProductFromProductSet = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.removeProductFromProductSet(request, err => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - done(); - }); - }); - }); - - describe('listProductsInProductSet', () => { - it('invokes listProductsInProductSet without error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productSetPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT_SET]' - ); - const request = { - name: formattedName, - }; - - // Mock response - const nextPageToken = ''; - const productsElement = {}; - const products = [productsElement]; - const expectedResponse = { - nextPageToken: nextPageToken, - products: products, - }; - - // Mock Grpc layer - client._innerApiCalls.listProductsInProductSet = ( - actualRequest, - options, - callback - ) => { - assert.deepStrictEqual(actualRequest, request); - callback(null, expectedResponse.products); - }; - - client.listProductsInProductSet(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse.products); - done(); - }); - }); - - it('invokes listProductsInProductSet with error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productSetPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT_SET]' - ); - const request = { - name: formattedName, - }; - - // Mock Grpc layer - client._innerApiCalls.listProductsInProductSet = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.listProductsInProductSet(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('importProductSets', function() { - it('invokes importProductSets without error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const inputConfig = {}; - const request = { - parent: formattedParent, - inputConfig: inputConfig, - }; - - // Mock response - const expectedResponse = {}; - - // Mock Grpc layer - client._innerApiCalls.importProductSets = mockLongRunningGrpcMethod( - request, - expectedResponse - ); - - client - .importProductSets(request) - .then(responses => { - const operation = responses[0]; - return operation.promise(); - }) - .then(responses => { - assert.deepStrictEqual(responses[0], expectedResponse); - done(); - }) - .catch(err => { - done(err); - }); - }); - - it('invokes importProductSets with error', done => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const inputConfig = {}; - const request = { - parent: formattedParent, - inputConfig: inputConfig, - }; - - // Mock Grpc layer - client._innerApiCalls.importProductSets = mockLongRunningGrpcMethod( - request, - null, - error - ); - - client - .importProductSets(request) - .then(responses => { - const operation = responses[0]; - return operation.promise(); - }) - .then(() => { - assert.fail(); - }) - .catch(err => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - done(); - }); - }); - - it('has longrunning decoder functions', () => { - const client = new visionModule.v1p3beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert( - client._descriptors.longrunning.importProductSets - .responseDecoder instanceof Function - ); - assert( - client._descriptors.longrunning.importProductSets - .metadataDecoder instanceof Function - ); - }); - }); -}); -describe('ImageAnnotatorClient', () => { - it('has servicePath', () => { - const servicePath = visionModule.v1p3beta1.ImageAnnotatorClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = visionModule.v1p3beta1.ImageAnnotatorClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = visionModule.v1p3beta1.ImageAnnotatorClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no options', () => { - const client = new visionModule.v1p3beta1.ImageAnnotatorClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new visionModule.v1p3beta1.ImageAnnotatorClient({ - fallback: true, - }); - assert(client); - }); - - describe('batchAnnotateImages', () => { - it('invokes batchAnnotateImages without error', done => { - const client = new visionModule.v1p3beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const requests = []; - const request = { - requests: requests, - }; - - // Mock response - const expectedResponse = {}; - - // Mock Grpc layer - client._innerApiCalls.batchAnnotateImages = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.batchAnnotateImages(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes batchAnnotateImages with error', done => { - const client = new visionModule.v1p3beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const requests = []; - const request = { - requests: requests, - }; - - // Mock Grpc layer - client._innerApiCalls.batchAnnotateImages = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.batchAnnotateImages(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('asyncBatchAnnotateFiles', function() { - it('invokes asyncBatchAnnotateFiles without error', done => { - const client = new visionModule.v1p3beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const requests = []; - const request = { - requests: requests, - }; - - // Mock response - const expectedResponse = {}; - - // Mock Grpc layer - client._innerApiCalls.asyncBatchAnnotateFiles = mockLongRunningGrpcMethod( - request, - expectedResponse - ); - - client - .asyncBatchAnnotateFiles(request) - .then(responses => { - const operation = responses[0]; - return operation.promise(); - }) - .then(responses => { - assert.deepStrictEqual(responses[0], expectedResponse); - done(); - }) - .catch(err => { - done(err); - }); - }); - - it('invokes asyncBatchAnnotateFiles with error', done => { - const client = new visionModule.v1p3beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const requests = []; - const request = { - requests: requests, - }; - - // Mock Grpc layer - client._innerApiCalls.asyncBatchAnnotateFiles = mockLongRunningGrpcMethod( - request, - null, - error - ); - - client - .asyncBatchAnnotateFiles(request) - .then(responses => { - const operation = responses[0]; - return operation.promise(); - }) - .then(() => { - assert.fail(); - }) - .catch(err => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - done(); - }); - }); - - it('has longrunning decoder functions', () => { - const client = new visionModule.v1p3beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert( - client._descriptors.longrunning.asyncBatchAnnotateFiles - .responseDecoder instanceof Function - ); - assert( - client._descriptors.longrunning.asyncBatchAnnotateFiles - .metadataDecoder instanceof Function - ); - }); - }); -}); - -function mockSimpleGrpcMethod(expectedRequest, response, error) { - return function(actualRequest, options, callback) { - assert.deepStrictEqual(actualRequest, expectedRequest); - if (error) { - callback(error); - } else if (response) { - callback(null, response); - } else { - callback(null); - } - }; -} - -function mockLongRunningGrpcMethod(expectedRequest, response, error) { - return request => { - assert.deepStrictEqual(request, expectedRequest); - const mockOperation = { - promise: function() { - return new Promise((resolve, reject) => { - if (error) { - reject(error); - } else { - resolve([response]); - } - }); - }, - }; - return Promise.resolve([mockOperation]); - }; -} diff --git a/packages/google-cloud-vision/test/gapic-v1p4beta1.js b/packages/google-cloud-vision/test/gapic-v1p4beta1.js deleted file mode 100644 index f8de1d2cec2..00000000000 --- a/packages/google-cloud-vision/test/gapic-v1p4beta1.js +++ /dev/null @@ -1,1717 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -'use strict'; - -const assert = require('assert'); -const {describe, it} = require('mocha'); - -const visionModule = require('../src'); - -const FAKE_STATUS_CODE = 1; -const error = new Error(); -error.code = FAKE_STATUS_CODE; - -describe('ProductSearchClient', () => { - it('has servicePath', () => { - const servicePath = visionModule.v1p4beta1.ProductSearchClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = visionModule.v1p4beta1.ProductSearchClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = visionModule.v1p4beta1.ProductSearchClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no options', () => { - const client = new visionModule.v1p4beta1.ProductSearchClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - fallback: true, - }); - assert(client); - }); - - describe('createProductSet', () => { - it('invokes createProductSet without error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const productSet = {}; - const productSetId = 'productSetId4216680'; - const request = { - parent: formattedParent, - productSet: productSet, - productSetId: productSetId, - }; - - // Mock response - const name = 'name3373707'; - const displayName = 'displayName1615086568'; - const expectedResponse = { - name: name, - displayName: displayName, - }; - - // Mock Grpc layer - client._innerApiCalls.createProductSet = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.createProductSet(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes createProductSet with error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const productSet = {}; - const productSetId = 'productSetId4216680'; - const request = { - parent: formattedParent, - productSet: productSet, - productSetId: productSetId, - }; - - // Mock Grpc layer - client._innerApiCalls.createProductSet = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.createProductSet(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('listProductSets', () => { - it('invokes listProductSets without error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const request = { - parent: formattedParent, - }; - - // Mock response - const nextPageToken = ''; - const productSetsElement = {}; - const productSets = [productSetsElement]; - const expectedResponse = { - nextPageToken: nextPageToken, - productSets: productSets, - }; - - // Mock Grpc layer - client._innerApiCalls.listProductSets = ( - actualRequest, - options, - callback - ) => { - assert.deepStrictEqual(actualRequest, request); - callback(null, expectedResponse.productSets); - }; - - client.listProductSets(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse.productSets); - done(); - }); - }); - - it('invokes listProductSets with error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const request = { - parent: formattedParent, - }; - - // Mock Grpc layer - client._innerApiCalls.listProductSets = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.listProductSets(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('getProductSet', () => { - it('invokes getProductSet without error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productSetPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT_SET]' - ); - const request = { - name: formattedName, - }; - - // Mock response - const name2 = 'name2-1052831874'; - const displayName = 'displayName1615086568'; - const expectedResponse = { - name: name2, - displayName: displayName, - }; - - // Mock Grpc layer - client._innerApiCalls.getProductSet = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.getProductSet(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes getProductSet with error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productSetPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT_SET]' - ); - const request = { - name: formattedName, - }; - - // Mock Grpc layer - client._innerApiCalls.getProductSet = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.getProductSet(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('updateProductSet', () => { - it('invokes updateProductSet without error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const productSet = {}; - const updateMask = {}; - const request = { - productSet: productSet, - updateMask: updateMask, - }; - - // Mock response - const name = 'name3373707'; - const displayName = 'displayName1615086568'; - const expectedResponse = { - name: name, - displayName: displayName, - }; - - // Mock Grpc layer - client._innerApiCalls.updateProductSet = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.updateProductSet(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes updateProductSet with error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const productSet = {}; - const updateMask = {}; - const request = { - productSet: productSet, - updateMask: updateMask, - }; - - // Mock Grpc layer - client._innerApiCalls.updateProductSet = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.updateProductSet(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('deleteProductSet', () => { - it('invokes deleteProductSet without error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productSetPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT_SET]' - ); - const request = { - name: formattedName, - }; - - // Mock Grpc layer - client._innerApiCalls.deleteProductSet = mockSimpleGrpcMethod(request); - - client.deleteProductSet(request, err => { - assert.ifError(err); - done(); - }); - }); - - it('invokes deleteProductSet with error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productSetPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT_SET]' - ); - const request = { - name: formattedName, - }; - - // Mock Grpc layer - client._innerApiCalls.deleteProductSet = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.deleteProductSet(request, err => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - done(); - }); - }); - }); - - describe('createProduct', () => { - it('invokes createProduct without error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const product = {}; - const productId = 'productId1753008747'; - const request = { - parent: formattedParent, - product: product, - productId: productId, - }; - - // Mock response - const name = 'name3373707'; - const displayName = 'displayName1615086568'; - const description = 'description-1724546052'; - const productCategory = 'productCategory-1607451058'; - const expectedResponse = { - name: name, - displayName: displayName, - description: description, - productCategory: productCategory, - }; - - // Mock Grpc layer - client._innerApiCalls.createProduct = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.createProduct(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes createProduct with error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const product = {}; - const productId = 'productId1753008747'; - const request = { - parent: formattedParent, - product: product, - productId: productId, - }; - - // Mock Grpc layer - client._innerApiCalls.createProduct = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.createProduct(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('listProducts', () => { - it('invokes listProducts without error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const request = { - parent: formattedParent, - }; - - // Mock response - const nextPageToken = ''; - const productsElement = {}; - const products = [productsElement]; - const expectedResponse = { - nextPageToken: nextPageToken, - products: products, - }; - - // Mock Grpc layer - client._innerApiCalls.listProducts = ( - actualRequest, - options, - callback - ) => { - assert.deepStrictEqual(actualRequest, request); - callback(null, expectedResponse.products); - }; - - client.listProducts(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse.products); - done(); - }); - }); - - it('invokes listProducts with error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const request = { - parent: formattedParent, - }; - - // Mock Grpc layer - client._innerApiCalls.listProducts = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.listProducts(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('getProduct', () => { - it('invokes getProduct without error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]' - ); - const request = { - name: formattedName, - }; - - // Mock response - const name2 = 'name2-1052831874'; - const displayName = 'displayName1615086568'; - const description = 'description-1724546052'; - const productCategory = 'productCategory-1607451058'; - const expectedResponse = { - name: name2, - displayName: displayName, - description: description, - productCategory: productCategory, - }; - - // Mock Grpc layer - client._innerApiCalls.getProduct = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.getProduct(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes getProduct with error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]' - ); - const request = { - name: formattedName, - }; - - // Mock Grpc layer - client._innerApiCalls.getProduct = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.getProduct(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('updateProduct', () => { - it('invokes updateProduct without error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const product = {}; - const updateMask = {}; - const request = { - product: product, - updateMask: updateMask, - }; - - // Mock response - const name = 'name3373707'; - const displayName = 'displayName1615086568'; - const description = 'description-1724546052'; - const productCategory = 'productCategory-1607451058'; - const expectedResponse = { - name: name, - displayName: displayName, - description: description, - productCategory: productCategory, - }; - - // Mock Grpc layer - client._innerApiCalls.updateProduct = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.updateProduct(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes updateProduct with error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const product = {}; - const updateMask = {}; - const request = { - product: product, - updateMask: updateMask, - }; - - // Mock Grpc layer - client._innerApiCalls.updateProduct = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.updateProduct(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('deleteProduct', () => { - it('invokes deleteProduct without error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]' - ); - const request = { - name: formattedName, - }; - - // Mock Grpc layer - client._innerApiCalls.deleteProduct = mockSimpleGrpcMethod(request); - - client.deleteProduct(request, err => { - assert.ifError(err); - done(); - }); - }); - - it('invokes deleteProduct with error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]' - ); - const request = { - name: formattedName, - }; - - // Mock Grpc layer - client._innerApiCalls.deleteProduct = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.deleteProduct(request, err => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - done(); - }); - }); - }); - - describe('createReferenceImage', () => { - it('invokes createReferenceImage without error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.productPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]' - ); - const referenceImage = {}; - const referenceImageId = 'referenceImageId1946713331'; - const request = { - parent: formattedParent, - referenceImage: referenceImage, - referenceImageId: referenceImageId, - }; - - // Mock response - const name = 'name3373707'; - const uri = 'uri116076'; - const expectedResponse = { - name: name, - uri: uri, - }; - - // Mock Grpc layer - client._innerApiCalls.createReferenceImage = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.createReferenceImage(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes createReferenceImage with error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.productPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]' - ); - const referenceImage = {}; - const referenceImageId = 'referenceImageId1946713331'; - const request = { - parent: formattedParent, - referenceImage: referenceImage, - referenceImageId: referenceImageId, - }; - - // Mock Grpc layer - client._innerApiCalls.createReferenceImage = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.createReferenceImage(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('deleteReferenceImage', () => { - it('invokes deleteReferenceImage without error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.referenceImagePath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]', - '[REFERENCE_IMAGE]' - ); - const request = { - name: formattedName, - }; - - // Mock Grpc layer - client._innerApiCalls.deleteReferenceImage = mockSimpleGrpcMethod( - request - ); - - client.deleteReferenceImage(request, err => { - assert.ifError(err); - done(); - }); - }); - - it('invokes deleteReferenceImage with error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.referenceImagePath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]', - '[REFERENCE_IMAGE]' - ); - const request = { - name: formattedName, - }; - - // Mock Grpc layer - client._innerApiCalls.deleteReferenceImage = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.deleteReferenceImage(request, err => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - done(); - }); - }); - }); - - describe('listReferenceImages', () => { - it('invokes listReferenceImages without error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.productPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]' - ); - const request = { - parent: formattedParent, - }; - - // Mock response - const pageSize = 883849137; - const nextPageToken = ''; - const referenceImagesElement = {}; - const referenceImages = [referenceImagesElement]; - const expectedResponse = { - pageSize: pageSize, - nextPageToken: nextPageToken, - referenceImages: referenceImages, - }; - - // Mock Grpc layer - client._innerApiCalls.listReferenceImages = ( - actualRequest, - options, - callback - ) => { - assert.deepStrictEqual(actualRequest, request); - callback(null, expectedResponse.referenceImages); - }; - - client.listReferenceImages(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse.referenceImages); - done(); - }); - }); - - it('invokes listReferenceImages with error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.productPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]' - ); - const request = { - parent: formattedParent, - }; - - // Mock Grpc layer - client._innerApiCalls.listReferenceImages = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.listReferenceImages(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('getReferenceImage', () => { - it('invokes getReferenceImage without error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.referenceImagePath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]', - '[REFERENCE_IMAGE]' - ); - const request = { - name: formattedName, - }; - - // Mock response - const name2 = 'name2-1052831874'; - const uri = 'uri116076'; - const expectedResponse = { - name: name2, - uri: uri, - }; - - // Mock Grpc layer - client._innerApiCalls.getReferenceImage = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.getReferenceImage(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes getReferenceImage with error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.referenceImagePath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT]', - '[REFERENCE_IMAGE]' - ); - const request = { - name: formattedName, - }; - - // Mock Grpc layer - client._innerApiCalls.getReferenceImage = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.getReferenceImage(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('addProductToProductSet', () => { - it('invokes addProductToProductSet without error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productSetPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT_SET]' - ); - const product = 'product-309474065'; - const request = { - name: formattedName, - product: product, - }; - - // Mock Grpc layer - client._innerApiCalls.addProductToProductSet = mockSimpleGrpcMethod( - request - ); - - client.addProductToProductSet(request, err => { - assert.ifError(err); - done(); - }); - }); - - it('invokes addProductToProductSet with error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productSetPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT_SET]' - ); - const product = 'product-309474065'; - const request = { - name: formattedName, - product: product, - }; - - // Mock Grpc layer - client._innerApiCalls.addProductToProductSet = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.addProductToProductSet(request, err => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - done(); - }); - }); - }); - - describe('removeProductFromProductSet', () => { - it('invokes removeProductFromProductSet without error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productSetPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT_SET]' - ); - const product = 'product-309474065'; - const request = { - name: formattedName, - product: product, - }; - - // Mock Grpc layer - client._innerApiCalls.removeProductFromProductSet = mockSimpleGrpcMethod( - request - ); - - client.removeProductFromProductSet(request, err => { - assert.ifError(err); - done(); - }); - }); - - it('invokes removeProductFromProductSet with error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productSetPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT_SET]' - ); - const product = 'product-309474065'; - const request = { - name: formattedName, - product: product, - }; - - // Mock Grpc layer - client._innerApiCalls.removeProductFromProductSet = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.removeProductFromProductSet(request, err => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - done(); - }); - }); - }); - - describe('listProductsInProductSet', () => { - it('invokes listProductsInProductSet without error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productSetPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT_SET]' - ); - const request = { - name: formattedName, - }; - - // Mock response - const nextPageToken = ''; - const productsElement = {}; - const products = [productsElement]; - const expectedResponse = { - nextPageToken: nextPageToken, - products: products, - }; - - // Mock Grpc layer - client._innerApiCalls.listProductsInProductSet = ( - actualRequest, - options, - callback - ) => { - assert.deepStrictEqual(actualRequest, request); - callback(null, expectedResponse.products); - }; - - client.listProductsInProductSet(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse.products); - done(); - }); - }); - - it('invokes listProductsInProductSet with error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedName = client.productSetPath( - '[PROJECT]', - '[LOCATION]', - '[PRODUCT_SET]' - ); - const request = { - name: formattedName, - }; - - // Mock Grpc layer - client._innerApiCalls.listProductsInProductSet = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.listProductsInProductSet(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('importProductSets', function() { - it('invokes importProductSets without error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const inputConfig = {}; - const request = { - parent: formattedParent, - inputConfig: inputConfig, - }; - - // Mock response - const expectedResponse = {}; - - // Mock Grpc layer - client._innerApiCalls.importProductSets = mockLongRunningGrpcMethod( - request, - expectedResponse - ); - - client - .importProductSets(request) - .then(responses => { - const operation = responses[0]; - return operation.promise(); - }) - .then(responses => { - assert.deepStrictEqual(responses[0], expectedResponse); - done(); - }) - .catch(err => { - done(err); - }); - }); - - it('invokes importProductSets with error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const formattedParent = client.locationPath('[PROJECT]', '[LOCATION]'); - const inputConfig = {}; - const request = { - parent: formattedParent, - inputConfig: inputConfig, - }; - - // Mock Grpc layer - client._innerApiCalls.importProductSets = mockLongRunningGrpcMethod( - request, - null, - error - ); - - client - .importProductSets(request) - .then(responses => { - const operation = responses[0]; - return operation.promise(); - }) - .then(() => { - assert.fail(); - }) - .catch(err => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - done(); - }); - }); - - it('has longrunning decoder functions', () => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert( - client._descriptors.longrunning.importProductSets - .responseDecoder instanceof Function - ); - assert( - client._descriptors.longrunning.importProductSets - .metadataDecoder instanceof Function - ); - }); - }); - - describe('purgeProducts', () => { - it('invokes purgeProducts without error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const request = {}; - - // Mock response - const name = 'name3373707'; - const done_ = true; - const expectedResponse = { - name: name, - done: done_, - }; - - // Mock Grpc layer - client._innerApiCalls.purgeProducts = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.purgeProducts(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes purgeProducts with error', done => { - const client = new visionModule.v1p4beta1.ProductSearchClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const request = {}; - - // Mock Grpc layer - client._innerApiCalls.purgeProducts = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.purgeProducts(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); -}); -describe('ImageAnnotatorClient', () => { - it('has servicePath', () => { - const servicePath = visionModule.v1p4beta1.ImageAnnotatorClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = visionModule.v1p4beta1.ImageAnnotatorClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = visionModule.v1p4beta1.ImageAnnotatorClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no options', () => { - const client = new visionModule.v1p4beta1.ImageAnnotatorClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new visionModule.v1p4beta1.ImageAnnotatorClient({ - fallback: true, - }); - assert(client); - }); - - describe('batchAnnotateImages', () => { - it('invokes batchAnnotateImages without error', done => { - const client = new visionModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const requests = []; - const request = { - requests: requests, - }; - - // Mock response - const expectedResponse = {}; - - // Mock Grpc layer - client._innerApiCalls.batchAnnotateImages = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.batchAnnotateImages(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes batchAnnotateImages with error', done => { - const client = new visionModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const requests = []; - const request = { - requests: requests, - }; - - // Mock Grpc layer - client._innerApiCalls.batchAnnotateImages = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.batchAnnotateImages(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('batchAnnotateFiles', () => { - it('invokes batchAnnotateFiles without error', done => { - const client = new visionModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const requests = []; - const request = { - requests: requests, - }; - - // Mock response - const expectedResponse = {}; - - // Mock Grpc layer - client._innerApiCalls.batchAnnotateFiles = mockSimpleGrpcMethod( - request, - expectedResponse - ); - - client.batchAnnotateFiles(request, (err, response) => { - assert.ifError(err); - assert.deepStrictEqual(response, expectedResponse); - done(); - }); - }); - - it('invokes batchAnnotateFiles with error', done => { - const client = new visionModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const requests = []; - const request = { - requests: requests, - }; - - // Mock Grpc layer - client._innerApiCalls.batchAnnotateFiles = mockSimpleGrpcMethod( - request, - null, - error - ); - - client.batchAnnotateFiles(request, (err, response) => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - assert(typeof response === 'undefined'); - done(); - }); - }); - }); - - describe('asyncBatchAnnotateImages', function() { - it('invokes asyncBatchAnnotateImages without error', done => { - const client = new visionModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const requests = []; - const outputConfig = {}; - const request = { - requests: requests, - outputConfig: outputConfig, - }; - - // Mock response - const expectedResponse = {}; - - // Mock Grpc layer - client._innerApiCalls.asyncBatchAnnotateImages = mockLongRunningGrpcMethod( - request, - expectedResponse - ); - - client - .asyncBatchAnnotateImages(request) - .then(responses => { - const operation = responses[0]; - return operation.promise(); - }) - .then(responses => { - assert.deepStrictEqual(responses[0], expectedResponse); - done(); - }) - .catch(err => { - done(err); - }); - }); - - it('invokes asyncBatchAnnotateImages with error', done => { - const client = new visionModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const requests = []; - const outputConfig = {}; - const request = { - requests: requests, - outputConfig: outputConfig, - }; - - // Mock Grpc layer - client._innerApiCalls.asyncBatchAnnotateImages = mockLongRunningGrpcMethod( - request, - null, - error - ); - - client - .asyncBatchAnnotateImages(request) - .then(responses => { - const operation = responses[0]; - return operation.promise(); - }) - .then(() => { - assert.fail(); - }) - .catch(err => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - done(); - }); - }); - - it('has longrunning decoder functions', () => { - const client = new visionModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert( - client._descriptors.longrunning.asyncBatchAnnotateImages - .responseDecoder instanceof Function - ); - assert( - client._descriptors.longrunning.asyncBatchAnnotateImages - .metadataDecoder instanceof Function - ); - }); - }); - - describe('asyncBatchAnnotateFiles', function() { - it('invokes asyncBatchAnnotateFiles without error', done => { - const client = new visionModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const requests = []; - const request = { - requests: requests, - }; - - // Mock response - const expectedResponse = {}; - - // Mock Grpc layer - client._innerApiCalls.asyncBatchAnnotateFiles = mockLongRunningGrpcMethod( - request, - expectedResponse - ); - - client - .asyncBatchAnnotateFiles(request) - .then(responses => { - const operation = responses[0]; - return operation.promise(); - }) - .then(responses => { - assert.deepStrictEqual(responses[0], expectedResponse); - done(); - }) - .catch(err => { - done(err); - }); - }); - - it('invokes asyncBatchAnnotateFiles with error', done => { - const client = new visionModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - - // Mock request - const requests = []; - const request = { - requests: requests, - }; - - // Mock Grpc layer - client._innerApiCalls.asyncBatchAnnotateFiles = mockLongRunningGrpcMethod( - request, - null, - error - ); - - client - .asyncBatchAnnotateFiles(request) - .then(responses => { - const operation = responses[0]; - return operation.promise(); - }) - .then(() => { - assert.fail(); - }) - .catch(err => { - assert(err instanceof Error); - assert.strictEqual(err.code, FAKE_STATUS_CODE); - done(); - }); - }); - - it('has longrunning decoder functions', () => { - const client = new visionModule.v1p4beta1.ImageAnnotatorClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert( - client._descriptors.longrunning.asyncBatchAnnotateFiles - .responseDecoder instanceof Function - ); - assert( - client._descriptors.longrunning.asyncBatchAnnotateFiles - .metadataDecoder instanceof Function - ); - }); - }); -}); - -function mockSimpleGrpcMethod(expectedRequest, response, error) { - return function(actualRequest, options, callback) { - assert.deepStrictEqual(actualRequest, expectedRequest); - if (error) { - callback(error); - } else if (response) { - callback(null, response); - } else { - callback(null); - } - }; -} - -function mockLongRunningGrpcMethod(expectedRequest, response, error) { - return request => { - assert.deepStrictEqual(request, expectedRequest); - const mockOperation = { - promise: function() { - return new Promise((resolve, reject) => { - if (error) { - reject(error); - } else { - resolve([response]); - } - }); - }, - }; - return Promise.resolve([mockOperation]); - }; -} diff --git a/packages/google-cloud-vision/test/helpers.test.js b/packages/google-cloud-vision/test/helpers.test.ts similarity index 57% rename from packages/google-cloud-vision/test/helpers.test.js rename to packages/google-cloud-vision/test/helpers.test.ts index 2d5cfdb9d00..ef806b5239e 100644 --- a/packages/google-cloud-vision/test/helpers.test.js +++ b/packages/google-cloud-vision/test/helpers.test.ts @@ -14,21 +14,19 @@ * limitations under the License. */ -'use strict'; - -const assert = require('assert'); -const {describe, it, afterEach} = require('mocha'); -const fs = require('fs'); -const is = require('is'); -const sinon = require('sinon'); - -const vision = require('../'); +import {describe, it, afterEach} from 'mocha'; +import * as path from 'path'; +import * as is from 'is'; +import * as sinon from 'sinon'; +import * as prototypes from '../protos/protos'; +import * as assert from 'assert'; +const vision = require('../src'); describe('Vision helper methods', () => { - const CREDENTIALS = Object.freeze({ + const CREDENTIALS = { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - }); + }; const sandbox = sinon.createSandbox(); @@ -54,19 +52,23 @@ describe('Vision helper methods', () => { image: {content: Buffer.from('bogus==')}, features: {type: ['LOGO_DETECTION']}, }; - return client.annotateImage(request).then(r => { - const response = r[0]; - - // Ensure that we got the slice of the response that we expected. - assert.deepStrictEqual(response, { - logoAnnotations: [{description: 'Google'}], - }); - // Inspect the calls to batchAnnotateImages and ensure they matched - // the expected signature. - assert(batchAnnotate.callCount === 1); - assert(batchAnnotate.calledWith({requests: [request]})); - }); + return client + .annotateImage(request) + .then( + (r: [prototypes.google.cloud.vision.v1.IAnnotateImageResponse]) => { + const response = r[0]; + // Ensure that we got the slice of the response that we expected. + assert.deepStrictEqual(response, { + logoAnnotations: [{description: 'Google'}], + }); + + // Inspect the calls to batchAnnotateImages and ensure they matched + // the expected signature. + assert(batchAnnotate.callCount === 1); + assert(batchAnnotate.calledWith({requests: [request]})); + } + ); }); it('understands buffers in a request object', () => { @@ -88,36 +90,32 @@ describe('Vision helper methods', () => { image: Buffer.from('fakeImage'), features: {type: ['LOGO_DETECTION']}, }; - return client.annotateImage(request).then(r => { - const response = r[0]; - - // Ensure that we got the slice of the response that we expected. - assert.deepStrictEqual(response, { - logoAnnotations: [{description: 'Google'}], - }); - - // Inspect the calls to batchAnnotateImages and ensure they matched - // the expected signature. - assert(batchAnnotate.callCount === 1); - assert.deepStrictEqual(request, { - image: {content: 'ZmFrZUltYWdl'}, - features: {type: ['LOGO_DETECTION']}, - }); - assert(batchAnnotate.calledWith({requests: [request]})); - }); + return client + .annotateImage(request) + .then( + (r: [prototypes.google.cloud.vision.v1.IAnnotateImageResponse]) => { + const response = r[0]; + + // Ensure that we got the slice of the response that we expected. + assert.deepStrictEqual(response, { + logoAnnotations: [{description: 'Google'}], + }); + + // Inspect the calls to batchAnnotateImages and ensure they matched + // the expected signature. + assert(batchAnnotate.callCount === 1); + assert.deepStrictEqual(request, { + image: {content: 'ZmFrZUltYWdl'}, + features: {type: ['LOGO_DETECTION']}, + }); + assert(batchAnnotate.calledWith({requests: [request]})); + } + ); }); it('understands filenames', () => { const client = new vision.v1.ImageAnnotatorClient(CREDENTIALS); - // Stub out `fs.readFile` and return a bogus image object. - // This allows us to test filename detection. - const readFile = sandbox.stub(fs, 'readFile'); - readFile - .withArgs('image.jpg') - .callsArgWith(1, null, Buffer.from('fakeImage')); - readFile.callThrough(); - // Stub out the batch annotation method as before. const batchAnnotate = sandbox.stub(client, 'batchAnnotateImages'); batchAnnotate.callsArgWith(2, undefined, { @@ -130,55 +128,54 @@ describe('Vision helper methods', () => { // Ensure that the annotateImage method arrifies the request and // passes it through to the batch annotation method. + const imagePath = path.join( + __dirname, + '..', + '..', + 'test', + 'fixtures', + 'image.jpg' + ); const request = { - image: {source: {filename: 'image.jpg'}}, + image: {source: {filename: imagePath}}, features: {type: ['LOGO_DETECTION']}, }; - return client.annotateImage(request).then(r => { - const response = r[0]; - - // Ensure that we got the slice of the response that we expected. - assert.deepStrictEqual(response, { - logoAnnotations: [{description: 'Google'}], - }); - - // Inspect the calls to `readFile` to ensure that they matched - // the expected signature. - assert(readFile.callCount === 1); - assert(readFile.calledWith('image.jpg')); - - // Inspect the calls to batchAnnotateImages and ensure they matched - // the expected signature. - assert(batchAnnotate.callCount === 1); - assert.deepStrictEqual(request, { - image: {content: 'ZmFrZUltYWdl'}, - features: {type: ['LOGO_DETECTION']}, - }); - assert(batchAnnotate.calledWith({requests: [request]})); - }); + return client + .annotateImage(request) + .then( + (r: [prototypes.google.cloud.vision.v1.IAnnotateImageResponse]) => { + const response = r[0]; + + // Ensure that we got the slice of the response that we expected. + assert.deepStrictEqual(response, { + logoAnnotations: [{description: 'Google'}], + }); + + // Inspect the calls to batchAnnotateImages and ensure they matched + // the expected signature. + assert(batchAnnotate.callCount === 1); + assert.deepStrictEqual(request, { + image: {content: ''}, + features: {type: ['LOGO_DETECTION']}, + }); + assert(batchAnnotate.calledWith({requests: [request]})); + } + ); }); it('propagates the error if a file is not found', () => { const client = new vision.v1.ImageAnnotatorClient(CREDENTIALS); - - // Stub out `fs.readFile` and return a bogus image object. - // This allows us to test filename detection. - const readFile = sandbox.stub(fs, 'readFile'); - readFile.withArgs('image.jpg').callsArgWith(1, {error: 404}); - readFile.callThrough(); - // Ensure that the annotateImage method arrifies the request and // passes it through to the batch annotation method. const request = { image: {source: {filename: 'image.jpg'}}, features: {type: ['LOGO_DETECTION']}, }; - return client - .annotateImage(request) - .then(assert.fail) - .catch(err => { - assert.deepStrictEqual(err, {error: 404}); - }); + return client.annotateImage(request).catch((err: string) => { + assert( + err.toString().match(/Error: ENOENT: no such file or directory/) + ); + }); }); it('retains call options sent', () => { @@ -198,19 +195,25 @@ describe('Vision helper methods', () => { image: {content: Buffer.from('bogus==')}, features: {type: ['LOGO_DETECTION']}, }; - return client.annotateImage(request, {foo: 'bar'}).then(r => { - const response = r[0]; - - // Ensure that we got the slice of the response that we expected. - assert.deepStrictEqual(response, { - logoAnnotations: [{description: 'Google'}], - }); - - // Inspect the calls to batchAnnotateImages and ensure they matched - // the expected signature. - assert(batchAnnotate.callCount === 1); - assert(batchAnnotate.calledWith({requests: [request]}, {foo: 'bar'})); - }); + return client + .annotateImage(request, {foo: 'bar'}) + .then( + (r: [prototypes.google.cloud.vision.v1.IAnnotateImageResponse]) => { + const response = r[0]; + + // Ensure that we got the slice of the response that we expected. + assert.deepStrictEqual(response, { + logoAnnotations: [{description: 'Google'}], + }); + + // Inspect the calls to batchAnnotateImages and ensure they matched + // the expected signature. + assert(batchAnnotate.callCount === 1); + assert( + batchAnnotate.calledWith({requests: [request]}, {foo: 'bar'}) + ); + } + ); }); it('fires a callback if provided', done => { @@ -230,7 +233,7 @@ describe('Vision helper methods', () => { image: {content: Buffer.from('bogus==')}, features: {type: ['LOGO_DETECTION']}, }; - client.annotateImage(request, function(err, response) { + client.annotateImage(request, (err: {}, response: {}) => { // Establish that we got the expected response. assert(is.undefined(err)); assert.deepStrictEqual(response, { @@ -256,7 +259,7 @@ describe('Vision helper methods', () => { image: {content: Buffer.from('bogus==')}, features: {type: ['LOGO_DETECTION']}, }; - return client.annotateImage(request).catch(err => { + return client.annotateImage(request).catch((err: {}) => { // Establish that we got the expected response. assert.deepStrictEqual(err, {message: 'Bad things!'}); @@ -270,12 +273,9 @@ describe('Vision helper methods', () => { it('requires an image and throws without one', () => { const client = new vision.v1.ImageAnnotatorClient(CREDENTIALS); const request = {}; - return client - .annotateImage(request) - .then(assert.fail) - .catch(err => { - assert(err.message === 'No image present.'); - }); + return client.annotateImage(request).catch((err: string) => { + assert(err.toString().match(/Error: No image present./)); + }); }); }); @@ -295,30 +295,34 @@ describe('Vision helper methods', () => { // Ensure that the annotateImage method does *not* pass the callback // on to batchAnnotateImages, but rather handles it itself. const imageRequest = {image: {content: Buffer.from('bogus==')}}; - return client.logoDetection(Object.assign({}, imageRequest)).then(r => { - const response = r[0]; - - // Ensure that we got the slice of the response that we expected. - assert.deepStrictEqual(response, { - logoAnnotations: [{description: 'Google'}], - }); - - // Inspect the calls to annotateImage and batchAnnotateImages and - // ensure they matched the expected signature. - assert(annotate.callCount === 1); - assert( - annotate.calledWith({ - features: [{type: 3}], - image: imageRequest.image, - }) - ); - assert(batchAnnotate.callCount === 1); - assert( - batchAnnotate.calledWith({ - requests: [{image: imageRequest.image, features: [{type: 3}]}], - }) + return client + .logoDetection(Object.assign({}, imageRequest)) + .then( + (r: [prototypes.google.cloud.vision.v1.IAnnotateImageResponse]) => { + const response = r[0]; + + // Ensure that we got the slice of the response that we expected. + assert.deepStrictEqual(response, { + logoAnnotations: [{description: 'Google'}], + }); + + // Inspect the calls to annotateImage and batchAnnotateImages and + // ensure they matched the expected signature. + assert(annotate.callCount === 1); + assert( + annotate.calledWith({ + features: [{type: 3}], + image: imageRequest.image, + }) + ); + assert(batchAnnotate.callCount === 1); + assert( + batchAnnotate.calledWith({ + requests: [{image: imageRequest.image, features: [{type: 3}]}], + }) + ); + } ); - }); }); it('accept a URL as a string', () => { @@ -335,28 +339,32 @@ describe('Vision helper methods', () => { }); // Call a request to a single-feature method using a URL. - return client.logoDetection('https://goo.gl/logo.png').then(r => { - const response = r[0]; - - // Ensure we got the slice of the response that we expected. - assert.deepStrictEqual(response, { - logoAnnotations: [{description: 'Google'}], - }); - - // Inspect the calls to batchAnnotateImages and ensure they matched - // the expected signature. - assert(batchAnnotate.callCount === 1); - assert( - batchAnnotate.calledWith({ - requests: [ - { - image: {source: {imageUri: 'https://goo.gl/logo.png'}}, - features: [{type: 3}], - }, - ], - }) + return client + .logoDetection('https://goo.gl/logo.png') + .then( + (r: [prototypes.google.cloud.vision.v1.IAnnotateImageResponse]) => { + const response = r[0]; + + // Ensure we got the slice of the response that we expected. + assert.deepStrictEqual(response, { + logoAnnotations: [{description: 'Google'}], + }); + + // Inspect the calls to batchAnnotateImages and ensure they matched + // the expected signature. + assert(batchAnnotate.callCount === 1); + assert( + batchAnnotate.calledWith({ + requests: [ + { + image: {source: {imageUri: 'https://goo.gl/logo.png'}}, + features: [{type: 3}], + }, + ], + }) + ); + } ); - }); }); it('accept a filename as a string', () => { @@ -369,7 +377,7 @@ describe('Vision helper methods', () => { }); // Call a request to a single-feature method using a URL. - return client.logoDetection('/path/to/logo.png').then(response => { + return client.logoDetection('/path/to/logo.png').then((response: {}) => { // Ensure we got the slice of the response that we expected. assert.deepStrictEqual(response, [ { @@ -404,28 +412,32 @@ describe('Vision helper methods', () => { // Ensure that the annotateImage method arrifies the request and // passes it through to the batch annotation method. - return client.logoDetection(Buffer.from('fakeImage')).then(r => { - const response = r[0]; - - // Ensure that we got the slice of the response that we expected. - assert.deepStrictEqual(response, { - logoAnnotations: [{description: 'Google'}], - }); - - // Inspect the calls to batchAnnotateImages and ensure they matched - // the expected signature. - assert(batchAnnotate.callCount === 1); - assert( - batchAnnotate.calledWith({ - requests: [ - { - image: {content: 'ZmFrZUltYWdl'}, - features: [{type: 3}], - }, - ], - }) + return client + .logoDetection(Buffer.from('fakeImage')) + .then( + (r: [prototypes.google.cloud.vision.v1.IAnnotateImageResponse]) => { + const response = r[0]; + + // Ensure that we got the slice of the response that we expected. + assert.deepStrictEqual(response, { + logoAnnotations: [{description: 'Google'}], + }); + + // Inspect the calls to batchAnnotateImages and ensure they matched + // the expected signature. + assert(batchAnnotate.callCount === 1); + assert( + batchAnnotate.calledWith({ + requests: [ + { + image: {content: 'ZmFrZUltYWdl'}, + features: [{type: 3}], + }, + ], + }) + ); + } ); - }); }); it('handle being sent call options', () => { @@ -444,26 +456,30 @@ describe('Vision helper methods', () => { // Perform the request. Send `opts` as an explicit second argument // to ensure that sending call options works appropriately. - return client.logoDetection(Buffer.from('fakeImage'), opts).then(r => { - const response = r[0]; - assert.deepStrictEqual(response, { - logoAnnotations: [{description: 'Google'}], - }); - - // Inspect the calls to batchAnnotateImages and ensure they matched - // the expected signature. - assert(batchAnnotate.callCount === 1); - assert( - batchAnnotate.calledWith({ - requests: [ - { - image: {content: 'ZmFrZUltYWdl'}, - features: [{type: 3}], - }, - ], - }) + return client + .logoDetection(Buffer.from('fakeImage'), opts) + .then( + (r: [prototypes.google.cloud.vision.v1.IAnnotateImageResponse]) => { + const response = r[0]; + assert.deepStrictEqual(response, { + logoAnnotations: [{description: 'Google'}], + }); + + // Inspect the calls to batchAnnotateImages and ensure they matched + // the expected signature. + assert(batchAnnotate.callCount === 1); + assert( + batchAnnotate.calledWith({ + requests: [ + { + image: {content: 'ZmFrZUltYWdl'}, + features: [{type: 3}], + }, + ], + }) + ); + } ); - }); }); it('throw an exception if conflicting features are given', () => { @@ -472,12 +488,9 @@ describe('Vision helper methods', () => { image: {content: Buffer.from('bogus==')}, features: [{type: 0}], }; - client - .logoDetection(imageRequest) - .then(assert.fail) - .catch(ex => { - assert(ex.message.indexOf('Setting explicit') > -1); - }); + client.logoDetection(imageRequest).catch((err: string) => { + assert(err.toString().match(/Setting explicit/)); + }); }); it('creates and promisify methods that are available in certain versions', () => { @@ -500,27 +513,26 @@ describe('Vision helper methods', () => { client .productSearch(request) - .then(r => { - const response = r[0]; - - assert.deepStrictEqual(response, { - localizedObjectAnnotations: [{dummy: 'response'}], - }); - - assert(batchAnnotate.callCount === 1); - assert(batchAnnotate.calledWith({requests: [request]})); - }) + .then( + (r: [prototypes.google.cloud.vision.v1.IAnnotateImageResponse]) => { + const response = r[0]; + + assert.deepStrictEqual(response, { + localizedObjectAnnotations: [{dummy: 'response'}], + }); + + assert(batchAnnotate.callCount === 1); + assert(batchAnnotate.calledWith({requests: [request]})); + } + ) .catch(assert.ifError); }); - it('throws an error if trying to invoke a method not available in current version', () => { // Use v1p1beta1 version of client. const client = new vision.v1p1beta1.ImageAnnotatorClient(CREDENTIALS); - - assert.throws(() => { - // Object localization is only available for v1p3beta1. - client.objectLocalization({}); - }, 'TypeError: client.objectLocalization is not a function'); + if (typeof client['objectLocalization'] === 'function') { + assert.fail('objectLocalization does not exist in v1p1beta1'); + } }); }); }); diff --git a/packages/google-cloud-vision/test/index.test.js b/packages/google-cloud-vision/test/index.test.ts similarity index 91% rename from packages/google-cloud-vision/test/index.test.js rename to packages/google-cloud-vision/test/index.test.ts index 7b3a1513d41..cedd41e4f6b 100644 --- a/packages/google-cloud-vision/test/index.test.js +++ b/packages/google-cloud-vision/test/index.test.ts @@ -12,18 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -'use strict'; +import * as assert from 'assert'; +import {describe, it} from 'mocha'; -const assert = require('assert'); -const {describe, it} = require('mocha'); - -const vision = require('../'); +const vision = require('../src'); describe('Vision', () => { - const CREDENTIALS = Object.freeze({ + const CREDENTIALS = { credentials: {client_email: 'bogus', private_key: 'bogus'}, projectId: 'bogus', - }); + }; describe('v1', () => { it('returns a v1 GAPIC augmented with helpers', () => { diff --git a/packages/google-cloud-vision/tsconfig.json b/packages/google-cloud-vision/tsconfig.json new file mode 100644 index 00000000000..613d35597b5 --- /dev/null +++ b/packages/google-cloud-vision/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2016", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/packages/google-cloud-vision/tslint.json b/packages/google-cloud-vision/tslint.json new file mode 100644 index 00000000000..617dc975bae --- /dev/null +++ b/packages/google-cloud-vision/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "gts/tslint.json" +} diff --git a/packages/google-cloud-vision/webpack.config.js b/packages/google-cloud-vision/webpack.config.js index ba61eb01d6e..f89f8bf4d21 100644 --- a/packages/google-cloud-vision/webpack.config.js +++ b/packages/google-cloud-vision/webpack.config.js @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +const path = require('path'); + module.exports = { - entry: './src/browser.js', + entry: './src/index.ts', output: { library: 'vision', filename: './vision.js', @@ -24,21 +26,37 @@ module.exports = { crypto: 'empty', }, resolve: { - extensions: ['.js', '.json'], + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], }, module: { rules: [ { - test: /node_modules[\\/]retry-request[\\/]/, - use: 'null-loader', + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' }, { - test: /node_modules[\\/]https-proxy-agent[\\/]/, - use: 'null-loader', + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' }, { - test: /node_modules[\\/]gtoken[\\/]/, - use: 'null-loader', + test: /node_modules[\\/]gtoken/, + use: 'null-loader' }, ], },